wxGetMousePosition() returns -999, -999 when the mouse
pointer is not over a GTK window. This is apparently
because it uses the current window as a handle to get
to the X display. This is not necessary, however;
GDK_DISPLAY() can be used. With
this patch wxGetMousePosition() works regardless of
where on the screen the mouse is.
Jay Berkenbilt (jay_berkenbilt) modified by JACS
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18250
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
int x, y;
GdkWindow* windowAtPtr = gdk_window_at_pointer(& x, & y);
int x, y;
GdkWindow* windowAtPtr = gdk_window_at_pointer(& x, & y);
- if (!windowAtPtr)
- return wxPoint(-999, -999);
- Display *display = GDK_WINDOW_XDISPLAY(windowAtPtr);
+ Display *display = windowAtPtr ? GDK_WINDOW_XDISPLAY(windowAtPtr) : GDK_DISPLAY();
Window rootWindow = RootWindowOfScreen (DefaultScreenOfDisplay(display));
Window rootReturn, childReturn;
int rootX, rootY, winX, winY;
Window rootWindow = RootWindowOfScreen (DefaultScreenOfDisplay(display));
Window rootReturn, childReturn;
int rootX, rootY, winX, winY;
int x, y;
GdkWindow* windowAtPtr = gdk_window_at_pointer(& x, & y);
int x, y;
GdkWindow* windowAtPtr = gdk_window_at_pointer(& x, & y);
- if (!windowAtPtr)
- return wxPoint(-999, -999);
- Display *display = GDK_WINDOW_XDISPLAY(windowAtPtr);
+ Display *display = windowAtPtr ? GDK_WINDOW_XDISPLAY(windowAtPtr) : GDK_DISPLAY();
Window rootWindow = RootWindowOfScreen (DefaultScreenOfDisplay(display));
Window rootReturn, childReturn;
int rootX, rootY, winX, winY;
Window rootWindow = RootWindowOfScreen (DefaultScreenOfDisplay(display));
Window rootReturn, childReturn;
int rootX, rootY, winX, winY;