Skip to content

Commit e3d534e

Browse files
committed
Merge pull request #421 from pinaf/keyboardgrab
Added mappings for XGrabKeyboard and XUngrabKeyboard
2 parents 5a4d392 + ef56aa1 commit e3d534e

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

CHANGES.md

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Features
3838
* [#400](https://github.com/twall/jna/pull/400): Added specific constants for request of icon settings in `com.sun.jna.platform.win32.WinUser` - [@PAX523](https://github.com/PAX523).
3939
* [#400](https://github.com/twall/jna/pull/400): Added constants for `GetClassLong`, `SendMessageTimeout` and `GetIconInfo` in `com.sun.jna.platform.win32.WinUser` - [@PAX523](https://github.com/PAX523).
4040
* [#419](https://github.com/twall/jna/pull/419): Added `SetupDiOpenDevRegKey` , `SetupDiEnumDeviceInfo` and related constants to `com.sun.jna.platform.win32.SetupApi` - [@ChristianSchwarz](https://github.com/ChristianSchwarz).
41+
* [#421](https://github.com/twall/jna/pull/421): Added `XGrabKeyboard` and `XUngrabKeyboard` to `X11` interface.
4142

4243
Bug Fixes
4344
---------

contrib/platform/src/com/sun/jna/platform/unix/X11.java

+21
Original file line numberDiff line numberDiff line change
@@ -1953,6 +1953,27 @@ public interface XErrorHandler extends Callback {
19531953
*/
19541954
int XUngrabKey(Display display, int keyCode, int modifiers, Window grab_window);
19551955

1956+
/**
1957+
* Actively grabs control of the keyboard and generates FocusIn and FocusOut events
1958+
*
1959+
* @param display Specifies the connection to the X server.
1960+
* @param grab_window Specifies the grab window.
1961+
* @param owner_events Specifies a Boolean value that indicates whether the keyboard events are to be reported as usual.
1962+
* @param pointer_mode Specifies further processing of pointer events. You can pass GrabModeSync or GrabModeAsync.
1963+
* @param keyboard_mode Specifies further processing of keyboard events. You can pass GrabModeSync or GrabModeAsync.
1964+
* @param time Specifies the time. You can pass either a timestamp or CurrentTime.
1965+
* @return nothing
1966+
*/
1967+
int XGrabKeyboard(Display display, Window grab_window, int owner_events, int pointer_mode, int keyboard_mode, NativeLong time);
1968+
1969+
/**
1970+
* Releases the keyboard and any queued events if this client has it actively grabbed from either XGrabKeyboard() or XGrabKey().
1971+
* @param display Specifies the connection to the X server.
1972+
* @param time Specifies the time. You can pass either a timestamp or CurrentTime.
1973+
* @return nothing
1974+
*/
1975+
int XUngrabKeyboard(Display display, NativeLong time);
1976+
19561977
//int XChangeKeyboardMapping(Display display, int first_keycode, int keysyms_per_keycode, KeySym *keysyms, int num_codes);
19571978
/** Defines the symbols for the specified number of KeyCodes starting with first_keycode. The symbols for KeyCodes outside this range remain unchanged. The number of elements in keysyms must be: num_codes * keysyms_per_keycode. The specified first_keycode must be greater than or equal to min_keycode returned by XDisplayKeycodes, or a BadValue error results. In addition, the following expression must be less than or equal to max_keycode as returned by XDisplayKeycodes, or a BadValue error results: first_keycode + num_codes - 1. */
19581979
int XChangeKeyboardMapping(Display display, int first_keycode, int keysyms_per_keycode, KeySym[] keysyms, int num_codes);

0 commit comments

Comments
 (0)