Hello,
I have an issue with old code that handles a mouse action where the user holds down the Shift and Mod1 (mapped to the Alt/Option key) modifiers. When the mouse button is pressed down I do
XButtonPressedEvent *evt;
XQueryPointer(disp, win, &root_rtn, &child_rtn, &root_x, &root_y, &curX, &curY, &mask_rtn_pressed); if( debugFlag && debugLevel==-2 ){ int bstate=evt->state, bbutton= evt->button; fprintf( StdErr, "HandleMouse event: %s == 0x%lx (%s)", event_name(((XEvent*)evt)->xany.type), mask_rtn_pressed, xtb_modifiers_string(mask_rtn_pressed) ); fprintf( StdErr, " state=0x%lx (%s) button=%d (%s)\n", bstate, xtb_modifiers_string(bstate), bbutton, (bbutton>=0 && bbutton< sizeof(bnames)/sizeof(char*))? bnames[bbutton] : "?!" ); }
and get the printout
HandleMouse event: ButtonPress == 0x100 (0x100=Button1Mask) state=0x9 (0x9=ShiftMask|Mod1Mask) button=1 (Button1)
Later on, when the mouse button is released:
XEvent theEvent;
case ButtonRelease:{ #pragma mark ***HMil ButtonRelease int bstate=theEvent.xbutton.state, bbutton= theEvent.xbutton.button; XQueryPointer(disp, win, &root_rtn, &child_rtn, &root_x, &root_y, &newX, &newY, &mask_rtn_released ); if( debugFlag && debugLevel==-2 ){ fprintf( StdErr, "ButtonRelease event: %s == 0x%lx (%s)", event_name(theEvent.xany.type), mask_rtn_released, xtb_modifiers_string(mask_rtn_released) ); fprintf( StdErr, " state=0x%lx (%s) button=%d (%s)\n", bstate, xtb_modifiers_string(bstate), bbutton, (bbutton>=0 && bbutton< sizeof(bnames)/sizeof(char*))? bnames[bbutton] : "?!" ); }
I get the printout
ButtonRelease event: ButtonRelease == 0x9 (0x9=ShiftMask|Mod1Mask) state=0x109 (0x109=Button1Mask|ShiftMask|Mod1Mask) button=1 (Button1)
In other words, the information contained in the event state variable and in the mask_return argument to XQueryPointer is not consistent among event types. I can accept that (to some extent) for the event state variable, but the mask_return argument is supposed to return "the current state of the modifier keys and pointer buttons".
This is in XQuartz 2.7.1 ( X.Org version 1.11.4) but I also observed it in a Debian 6 virtual machine running on the same MBP ( X.Org 1.7.7).
Is it possible that some Mac OS X feature is responsible for this (I've already triggered a "focus this application and hide the other(s)" action with a slightly different modifier/click combination ...
TIA, René
|