diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-05-25 16:34:01 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-05-28 14:49:03 +1000 |
commit | 4d962ed1841f35aa255bbec89e37f396612cfd96 (patch) | |
tree | 3d934defd377a7701a6fc0ac7dd03935e7c65f56 | |
parent | 7922430e0d063b0c3617050320d613d9dc7de7ba (diff) |
Add support for Enter/FocusIn passive grabs.
-rw-r--r-- | include/X11/extensions/XInput2.h | 41 | ||||
-rw-r--r-- | man/Makefile.am | 4 | ||||
-rw-r--r-- | man/XIGrabEnter.txt | 165 | ||||
-rw-r--r-- | src/XIPassiveGrab.c | 38 |
4 files changed, 248 insertions, 0 deletions
diff --git a/include/X11/extensions/XInput2.h b/include/X11/extensions/XInput2.h index 8b3741a..7425b44 100644 --- a/include/X11/extensions/XInput2.h +++ b/include/X11/extensions/XInput2.h @@ -433,6 +433,30 @@ extern int XIGrabKeysym( XIGrabModifiers *modifiers_inout ); +extern int XIGrabEnter( + Display* display, + int deviceid, + Window grab_window, + Cursor cursor, + int grab_mode, + int paired_device_mode, + int owner_events, + XIEventMask *mask, + int num_modifiers, + XIGrabModifiers *modifiers_inout +); + +extern int XIGrabFocusIn( + Display* display, + int deviceid, + Window grab_window, + int grab_mode, + int paired_device_mode, + int owner_events, + XIEventMask *mask, + int num_modifiers, + XIGrabModifiers *modifiers_inout +); extern Status XIUngrabButton( Display* display, int deviceid, @@ -451,6 +475,23 @@ extern Status XIUngrabKeysym( XIGrabModifiers *modifiers ); +extern Status XIUngrabEnter( + Display* display, + int deviceid, + Window grab_window, + int num_modifiers, + XIGrabModifiers *modifiers +); + +extern Status XIUngrabFocusIn( + Display* display, + int deviceid, + Window grab_window, + int num_modifiers, + XIGrabModifiers *modifiers +); + + extern Atom *XIListProperties( Display* display, int deviceid, diff --git a/man/Makefile.am b/man/Makefile.am index 304f993..81db8f8 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -33,6 +33,7 @@ XI2_manpages = \ XIDefineCursor.txt \ XIGrabButton.txt \ XIGrabDevice.txt \ + XIGrabEnter.txt \ XIQueryPointer.txt \ XIQueryVersion.txt \ XISelectEvents.txt \ @@ -77,6 +78,9 @@ XI2_refpages = \ XIGrabKeysym.man \ XIUngrabKeysym.man \ XIUngrabDevice.man \ + XIUngrabEnter.man \ + XIGrabFocusIn.man \ + XIUngrabFocusIn.man \ XIGetClientPointer.man \ XIGetFocus.man \ XIGetSelectedEvents.man diff --git a/man/XIGrabEnter.txt b/man/XIGrabEnter.txt new file mode 100644 index 0000000..e2ab42c --- /dev/null +++ b/man/XIGrabEnter.txt @@ -0,0 +1,165 @@ +XIGRABENTER(libmansuffix) +========================= + +NAME +---- + + XIGrabEnter, XIUngrabEnter, XIGrabFocusIn, XIUngrabFocusIn - + grab/ungrab enter or focus in events. + +SYNOPSIS +-------- + + #include <X11/extensions/XInput.h> + + int XIGrabEnter( Display *display, + int deviceid, + Window grab_window + Cursor cursor, + int grab_mode, + int paired_device_mode, + Bool owner_events, + XIEventMask *mask, + int num_modifiers, + XIGrabModifiers *modifiers_inout); + + int XIUngrabEnter( Display *display, + int deviceid, + Window grab_window + int num_modifiers, + XIGrabModifiers *modifiers); + + int XIGrabFocusIn ( Display *display, + int deviceid, + Window grab_window + int grab_mode, + int paired_device_mode, + Bool owner_events, + XIEventMask *mask, + int num_modifiers, + XIGrabModifiers *modifiers_inout); + + int XIUngrabFocusIn( Display *display, + int deviceid, + Window grab_window + int num_modifiers, + XIGrabModifiers *modifiers); + display + Specifies the connection to the X server. + + device + Specifies the device that is to be grabbed or released + + num_modifiers + Number of elements in modifiers or modifiers_return + + modifiers + Specifies the set of latched and base modifiers or + XIAnyModifier to ungrab. The data type is for + consistency with the respective grab request and the + status code of the XIGrabModifiers struct is ignored. + + modifiers_inout + Specifies the set of latched and base modifiers or + XIAnyModifier to grab. Returns the modifiers that could + not be grabbed and their status code. + + grab_window + Specifies the grab window. + + owner_events + Specifies a Boolean value that indicates whether the are + to be reported as usual or reported with respect to the + grab window. + + mask + Specifies the event mask. + + grab_mode + Specifies further processing of events from this device. + You can pass GrabModeSync or GrabModeAsync. + + paired_device_mode + Specifies further processing of events from the paired + master device. You can pass GrabModeSync or + GrabModeAsync. If deviceid specifies a floating slave + device, this parameter is ignored. + +DESCRIPTION +----------- + + XIGrabEnter and XIGrabFocusIn establish a passive grab. The modifier device + for a enter grab is the paired master device if deviceid specifies a master + pointer. Otherwise, the modifier device is the device specified with + deviceid. + + For XIGrabEnter and XIGrabFocusIn, in the future, the device is actively + grabbed (as for XIGrabDevice, the last-grab time is set to the time at + which the pointer/focus entered window) if the device is not grabbed and + the pointer has entered the grab_window or the focus has been set to the + grab_window when the specified modifier keys are logically down on the + modifier device and no other buttons or modifier keys are logically down. + + The interpretation of the remaining arguments is as for + XIGrabDevice. The active grab is terminated automatically when + the pointer leaves the window or the focus is set to a different window + (independent of the logical state of the modifier keys). + + Note that the logical state of a device (as seen by client + applications) may lag the physical state if device event + processing is frozen. + + This request overrides all previous grabs by the same client of the same + type and modifier combinations on the same window. A modifiers of + XIAnyModifier is equivalent to issuing the grab request for all possible + modifier combinations (including the combination of no modifiers). It is + not required that all modifiers specified have currently assigned KeyCodes. + + If some other client has already issued a XIGrabEnter or + XIGrabFocusIn on the same window, a BadAccess error results. When + using XIAnyModifier, the request fails completely, and a XIBadAccess error + results (no grabs are established) if there is a conflicting grab for any + combination. XIGrabEnter and XIGrabFocusin have no effect on an + active grab. + + XIGrabEnter and XIGrabFocusIn can generate BadDevice, + BadMatch, BadValue, and BadWindow errors. + + XIUngrabEnter and XIUngrabFocusIn releases the passive grab on the + specified window if it was grabbed by this client. A modifier + of XIAnyModifier is equivalent to issuing the ungrab request + for all possible modifier combinations, including the combination of no + modifiers. XIUngrabEnter and XIUngrabFocusIn have no effect on an active + grab. + + XIUngrabEnter and XIUngrabFocusIn can generate BadDevice, BadMatch, + BadValue and BadWindow errors. + +DIAGNOSTICS +----------- + + BadDevice + An invalid deviceid was specified. + + BadMatch + This error may occur if XIGrabEnter specified a device + that has no valuators, or XIGrabFocusIn specified a device + that has no keys. + + BadValue + Some numeric value falls outside the range of values + accepted by the request. Unless a specific range is + specified for an argument, the full range defined by the + argument's type is accepted. Any argument defined as a + set of alternatives can generate this error. + + BadWindow + A value for a Window argument does not name a defined + Window. + +SEE ALSO +-------- + + XIAllowEvents(libmansuffix) + + diff --git a/src/XIPassiveGrab.c b/src/XIPassiveGrab.c index 1e30606..ed79f1c 100644 --- a/src/XIPassiveGrab.c +++ b/src/XIPassiveGrab.c @@ -122,6 +122,29 @@ XIGrabKeysym(Display* dpy, int deviceid, int keysym, modifiers_inout); } +int +XIGrabEnter(Display *dpy, int deviceid, Window grab_window, Cursor cursor, + int grab_mode, int paired_device_mode, Bool owner_events, + XIEventMask *mask, int num_modifiers, + XIGrabModifiers *modifiers_inout) +{ + return _XIPassiveGrabDevice(dpy, deviceid, XIGrabtypeEnter, 0, + grab_window, cursor, grab_mode, paired_device_mode, + owner_events, mask, num_modifiers, + modifiers_inout); +} + +int +XIGrabFocusIn(Display *dpy, int deviceid, Window grab_window, int grab_mode, + int paired_device_mode, Bool owner_events, XIEventMask *mask, + int num_modifiers, XIGrabModifiers *modifiers_inout) +{ + return _XIPassiveGrabDevice(dpy, deviceid, XIGrabtypeFocusIn, 0, + grab_window, None, grab_mode, paired_device_mode, + owner_events, mask, num_modifiers, + modifiers_inout); +} + static int _XIPassiveUngrabDevice(Display* dpy, int deviceid, int grabtype, int detail, Window grab_window, int num_modifiers, XIGrabModifiers *modifiers) @@ -170,3 +193,18 @@ XIUngrabKeysym(Display* display, int deviceid, int keysym, Window grab_window, } +int +XIUngrabEnter(Display* display, int deviceid, Window grab_window, + int num_modifiers, XIGrabModifiers *modifiers) +{ + return _XIPassiveUngrabDevice(display, deviceid, XIGrabtypeEnter, 0, + grab_window, num_modifiers, modifiers); +} + +int +XIUngrabFocusIn(Display* display, int deviceid, Window grab_window, + int num_modifiers, XIGrabModifiers *modifiers) +{ + return _XIPassiveUngrabDevice(display, deviceid, XIGrabtypeFocusIn, 0, + grab_window, num_modifiers, modifiers); +} |