Skip to content

Commit

Permalink
Merge pull request #421 from pinaf/keyboardgrab
Browse files Browse the repository at this point in the history
Added mappings for XGrabKeyboard and XUngrabKeyboard
  • Loading branch information
twall committed Apr 14, 2015
2 parents 5a4d392 + ef56aa1 commit e3d534e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Features
* [#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).
* [#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).
* [#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).
* [#421](https://github.com/twall/jna/pull/421): Added `XGrabKeyboard` and `XUngrabKeyboard` to `X11` interface.

Bug Fixes
---------
Expand Down
21 changes: 21 additions & 0 deletions contrib/platform/src/com/sun/jna/platform/unix/X11.java
Original file line number Diff line number Diff line change
Expand Up @@ -1953,6 +1953,27 @@ public interface XErrorHandler extends Callback {
*/
int XUngrabKey(Display display, int keyCode, int modifiers, Window grab_window);

/**
* Actively grabs control of the keyboard and generates FocusIn and FocusOut events
*
* @param display Specifies the connection to the X server.
* @param grab_window Specifies the grab window.
* @param owner_events Specifies a Boolean value that indicates whether the keyboard events are to be reported as usual.
* @param pointer_mode Specifies further processing of pointer events. You can pass GrabModeSync or GrabModeAsync.
* @param keyboard_mode Specifies further processing of keyboard events. You can pass GrabModeSync or GrabModeAsync.
* @param time Specifies the time. You can pass either a timestamp or CurrentTime.
* @return nothing
*/
int XGrabKeyboard(Display display, Window grab_window, int owner_events, int pointer_mode, int keyboard_mode, NativeLong time);

/**
* Releases the keyboard and any queued events if this client has it actively grabbed from either XGrabKeyboard() or XGrabKey().
* @param display Specifies the connection to the X server.
* @param time Specifies the time. You can pass either a timestamp or CurrentTime.
* @return nothing
*/
int XUngrabKeyboard(Display display, NativeLong time);

//int XChangeKeyboardMapping(Display display, int first_keycode, int keysyms_per_keycode, KeySym *keysyms, int num_codes);
/** 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. */
int XChangeKeyboardMapping(Display display, int first_keycode, int keysyms_per_keycode, KeySym[] keysyms, int num_codes);
Expand Down

0 comments on commit e3d534e

Please sign in to comment.