Fixed a negative focus feedback loop
This commit is contained in:
parent
35a1538f82
commit
a62ebc2c3b
|
@ -79,8 +79,6 @@ static unsigned char buttons[NUM_BUTTONS];
|
|||
static Cursor blank_cursor;
|
||||
static Cursor current_cursor;
|
||||
|
||||
static int grab_mask = FocusChangeMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask;
|
||||
|
||||
/*
|
||||
* Class: org_lwjgl_input_Mouse
|
||||
* Method: initIDs
|
||||
|
@ -131,6 +129,7 @@ static void grabPointer(void) {
|
|||
if (isFullscreen() || !native_cursor) {
|
||||
if (!pointer_grabbed) {
|
||||
int result;
|
||||
int grab_mask = PointerMotionMask | ButtonPressMask | ButtonReleaseMask;
|
||||
result = XGrabPointer(getCurrentDisplay(), getCurrentWindow(), False, grab_mask, GrabModeAsync,
|
||||
GrabModeAsync, getCurrentWindow(), current_cursor, CurrentTime);
|
||||
if (result == GrabSuccess) {
|
||||
|
|
|
@ -113,6 +113,8 @@ bool isFullscreen(void) {
|
|||
|
||||
static void handleMessages() {
|
||||
XEvent event;
|
||||
Window win;
|
||||
int revert_mode;
|
||||
while (XPending(current_disp) > 0) {
|
||||
XNextEvent(current_disp, &event);
|
||||
switch (event.type) {
|
||||
|
@ -121,12 +123,18 @@ static void handleMessages() {
|
|||
closerequested = true;
|
||||
break;
|
||||
case FocusOut:
|
||||
XGetInputFocus(current_disp, &win, &revert_mode);
|
||||
if (win != current_win) {
|
||||
releaseInput();
|
||||
focused = false;
|
||||
}
|
||||
break;
|
||||
case FocusIn:
|
||||
XGetInputFocus(current_disp, &win, &revert_mode);
|
||||
if (win == current_win) {
|
||||
acquireInput();
|
||||
focused = true;
|
||||
}
|
||||
break;
|
||||
case MapNotify:
|
||||
dirty = true;
|
||||
|
|
Loading…
Reference in New Issue