mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-12 11:10:07 +00:00
devdraw: handle shift of real mouse buttons correctly
This commit is contained in:
parent
e9cbe46fe6
commit
a2567fcac9
2 changed files with 23 additions and 10 deletions
|
@ -639,9 +639,9 @@ rpc_resizewindow(Client *c, Rectangle r)
|
|||
x = 2;
|
||||
if(m & ~omod & NSEventModifierFlagCommand)
|
||||
x = 4;
|
||||
if(m & NSEventModifierFlagShift)
|
||||
x <<= 5;
|
||||
b |= x;
|
||||
if(m & NSEventModifierFlagShift)
|
||||
b <<= 5;
|
||||
[self sendmouse:b];
|
||||
}else if(m & ~omod & NSEventModifierFlagOption)
|
||||
gfx_keystroke(self.client, Kalt);
|
||||
|
@ -698,17 +698,17 @@ rpc_resizewindow(Client *c, Rectangle r)
|
|||
b = b&~6 | (b&4)>>1 | (b&2)<<1;
|
||||
b = mouseswap(b);
|
||||
|
||||
m = [e modifierFlags];
|
||||
if(b == 1){
|
||||
m = [e modifierFlags];
|
||||
if(m & NSEventModifierFlagOption){
|
||||
gfx_abortcompose(self.client);
|
||||
b = 2;
|
||||
}else
|
||||
if(m & NSEventModifierFlagCommand)
|
||||
b = 4;
|
||||
if(m & NSEventModifierFlagShift)
|
||||
b <<= 5;
|
||||
}
|
||||
if(m & NSEventModifierFlagShift)
|
||||
b <<= 5;
|
||||
[self sendmouse:b];
|
||||
}
|
||||
|
||||
|
|
|
@ -376,6 +376,7 @@ runxevent(XEvent *xev)
|
|||
if(w == nil)
|
||||
w = _x.windows;
|
||||
|
||||
int shift;
|
||||
switch(xev->type){
|
||||
case Expose:
|
||||
_xexpose(w, xev);
|
||||
|
@ -406,7 +407,10 @@ runxevent(XEvent *xev)
|
|||
case MotionNotify:
|
||||
if(_xtoplan9mouse(w, xev, &m) < 0)
|
||||
return;
|
||||
gfx_mousetrack(w->client, m.xy.x, m.xy.y, m.buttons|_x.kbuttons, m.msec);
|
||||
shift = 0;
|
||||
if(_x.kstate & ShiftMask)
|
||||
shift = 5;
|
||||
gfx_mousetrack(w->client, m.xy.x, m.xy.y, (m.buttons|_x.kbuttons)<<shift, m.msec);
|
||||
break;
|
||||
|
||||
case KeyRelease:
|
||||
|
@ -440,32 +444,41 @@ runxevent(XEvent *xev)
|
|||
case XK_Alt_L:
|
||||
case XK_Alt_R:
|
||||
kcodealt = ke->keycode;
|
||||
// fall through
|
||||
c |= Mod1Mask;
|
||||
modp = 1;
|
||||
break;
|
||||
case XK_Shift_L:
|
||||
case XK_Shift_R:
|
||||
kcodeshift = ke->keycode;
|
||||
c |= Mod1Mask;
|
||||
c |= ShiftMask;
|
||||
modp = 1;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
if(ke->keycode == kcodecontrol){
|
||||
c &= ~ControlMask;
|
||||
modp = 1;
|
||||
} else if(ke->keycode == kcodealt || ke->keycode == kcodeshift){
|
||||
} else if(ke->keycode == kcodealt){
|
||||
c &= ~Mod1Mask;
|
||||
modp = 1;
|
||||
} else if(ke->keycode == kcodeshift) {
|
||||
c &= ~ShiftMask;
|
||||
modp = 1;
|
||||
}
|
||||
}
|
||||
if(modp){
|
||||
_x.kstate = c;
|
||||
if(m.buttons || _x.kbuttons) {
|
||||
int shift = 0;
|
||||
_x.altdown = 0; // used alt
|
||||
_x.kbuttons = 0;
|
||||
if(c & ControlMask)
|
||||
_x.kbuttons |= 2;
|
||||
if(c & Mod1Mask)
|
||||
_x.kbuttons |= 4;
|
||||
gfx_mousetrack(w->client, m.xy.x, m.xy.y, m.buttons|_x.kbuttons, m.msec);
|
||||
if(c & ShiftMask)
|
||||
shift = 5;
|
||||
gfx_mousetrack(w->client, m.xy.x, m.xy.y, (m.buttons|_x.kbuttons)<<shift, m.msec);
|
||||
}
|
||||
modp = 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue