• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
mask_return mystery in XQueryPointer()
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

mask_return mystery in XQueryPointer()


  • Subject: mask_return mystery in XQueryPointer()
  • From: RenĂ© J.V. Bertin <email@hidden>
  • Date: Tue, 08 May 2012 12:57:51 +0200

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é

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
X11-users mailing list      (email@hidden)

This email sent to email@hidden

  • Follow-Ups:
    • Re: mask_return mystery in XQueryPointer()
      • From: Jeremy Huddleston <email@hidden>
  • Prev by Date: Re: How can I start XQuartz at startup instead of X11.app?
  • Next by Date: Re: mask_return mystery in XQueryPointer()
  • Previous by thread: Re: How can I start XQuartz at startup instead of X11.app?
  • Next by thread: Re: mask_return mystery in XQueryPointer()
  • Index(es):
    • Date
    • Thread