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,7 +136,8 @@ 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;
} }
@ -1248,9 +1255,9 @@ final class LinuxDisplay implements DisplayImplementation {
return Display.getDisplayMode().getHeight(); return Display.getDisplayMode().getHeight();
} }
public boolean isInsideWindow() { public boolean isInsideWindow() {
return true; return mouseInside;
} }
/** /**
* Helper class for managing Compiz's workarounds. We need this to enable Legacy * Helper class for managing Compiz's workarounds. We need this to enable Legacy

View File

@ -46,12 +46,14 @@ final class LinuxEvent {
public static final int KeyPress = 2; public static final int KeyPress = 2;
public static final int KeyRelease = 3; public static final int KeyRelease = 3;
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;
public static final int ClientMessage = 33; public static final int ClientMessage = 33;
private final ByteBuffer event_buffer; private final ByteBuffer event_buffer;

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;