Implement preliminary support for Display.isInsideWindow() on linux

This commit is contained in:
kappa1 2010-10-28 21:39:55 +00:00
parent 7f839f2fe7
commit 84f28884c5
3 changed files with 17 additions and 8 deletions

View File

@ -136,6 +136,7 @@ final class LinuxDisplay implements DisplayImplementation {
private long parent_window; private long parent_window;
private boolean xembedded; private boolean xembedded;
private boolean parent_focus; private boolean parent_focus;
private boolean mouseInside = true;
private LinuxKeyboard keyboard; private LinuxKeyboard keyboard;
private LinuxMouse mouse; private LinuxMouse mouse;
@ -777,6 +778,12 @@ final class LinuxDisplay implements DisplayImplementation {
case LinuxEvent.Expose: case LinuxEvent.Expose:
dirty = true; dirty = true;
break; break;
case LinuxEvent.EnterNotify:
mouseInside = true;
break;
case LinuxEvent.LeaveNotify:
mouseInside = false;
break;
default: default:
break; break;
} }
@ -1249,7 +1256,7 @@ final class LinuxDisplay implements DisplayImplementation {
} }
public boolean isInsideWindow() { public boolean isInsideWindow() {
return true; return mouseInside;
} }
/** /**

View File

@ -48,6 +48,8 @@ final class LinuxEvent {
public static final int ButtonPress = 4; public static final int ButtonPress = 4;
public static final int ButtonRelease = 5; public static final int ButtonRelease = 5;
public static final int MotionNotify = 6; 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 UnmapNotify = 18;
public static final int MapNotify = 19; public static final int MapNotify = 19;
public static final int Expose = 12; public static final int Expose = 12;

View File

@ -307,7 +307,7 @@ static Window createWindow(JNIEnv* env, Display *disp, int screen, jint window_m
cmap = XCreateColormap(disp, parent, vis_info->visual, AllocNone); cmap = XCreateColormap(disp, parent, vis_info->visual, AllocNone);
attribs.colormap = cmap; attribs.colormap = cmap;
attribs.border_pixel = 0; 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; attribmask = CWColormap | CWEventMask | CWBorderPixel;
if (isLegacyFullscreen(window_mode)) { if (isLegacyFullscreen(window_mode)) {
attribmask |= CWOverrideRedirect; attribmask |= CWOverrideRedirect;