diff --git a/src/java/org/lwjgl/opengl/LinuxDisplay.java b/src/java/org/lwjgl/opengl/LinuxDisplay.java index 48a2798b..2795538b 100644 --- a/src/java/org/lwjgl/opengl/LinuxDisplay.java +++ b/src/java/org/lwjgl/opengl/LinuxDisplay.java @@ -136,7 +136,8 @@ final class LinuxDisplay implements DisplayImplementation { private long parent_window; private boolean xembedded; private boolean parent_focus; - + private boolean mouseInside = true; + private LinuxKeyboard keyboard; private LinuxMouse mouse; @@ -777,6 +778,12 @@ final class LinuxDisplay implements DisplayImplementation { case LinuxEvent.Expose: dirty = true; break; + case LinuxEvent.EnterNotify: + mouseInside = true; + break; + case LinuxEvent.LeaveNotify: + mouseInside = false; + break; default: break; } @@ -1248,9 +1255,9 @@ final class LinuxDisplay implements DisplayImplementation { return Display.getDisplayMode().getHeight(); } - public boolean isInsideWindow() { - return true; - } + public boolean isInsideWindow() { + return mouseInside; + } /** * Helper class for managing Compiz's workarounds. We need this to enable Legacy diff --git a/src/java/org/lwjgl/opengl/LinuxEvent.java b/src/java/org/lwjgl/opengl/LinuxEvent.java index 96fbc40e..fb8e9827 100644 --- a/src/java/org/lwjgl/opengl/LinuxEvent.java +++ b/src/java/org/lwjgl/opengl/LinuxEvent.java @@ -46,12 +46,14 @@ final class LinuxEvent { public static final int KeyPress = 2; public static final int KeyRelease = 3; public static final int ButtonPress = 4; - public static final int ButtonRelease = 5; - public static final int MotionNotify = 6; + public static final int ButtonRelease = 5; + public static final int MotionNotify = 6; + public static final int EnterNotify = 7; + public static final int LeaveNotify = 8; public static final int UnmapNotify = 18; public static final int MapNotify = 19; public static final int Expose = 12; - public static final int ClientMessage = 33; + public static final int ClientMessage = 33; private final ByteBuffer event_buffer; diff --git a/src/native/linux/org_lwjgl_opengl_Display.c b/src/native/linux/org_lwjgl_opengl_Display.c index 74fe4563..5a44fab6 100644 --- a/src/native/linux/org_lwjgl_opengl_Display.c +++ b/src/native/linux/org_lwjgl_opengl_Display.c @@ -307,7 +307,7 @@ static Window createWindow(JNIEnv* env, Display *disp, int screen, jint window_m cmap = XCreateColormap(disp, parent, vis_info->visual, AllocNone); attribs.colormap = cmap; attribs.border_pixel = 0; - attribs.event_mask = ExposureMask | FocusChangeMask | VisibilityChangeMask | StructureNotifyMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask; + attribs.event_mask = ExposureMask | FocusChangeMask | VisibilityChangeMask | StructureNotifyMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask| EnterWindowMask | LeaveWindowMask; attribmask = CWColormap | CWEventMask | CWBorderPixel; if (isLegacyFullscreen(window_mode)) { attribmask |= CWOverrideRedirect;