Applied [ 654253 ] wxGTK: fix to wxGetMousePosition()

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
This commit is contained in:
Julian Smart 2002-12-16 09:44:35 +00:00
parent d775acfa77
commit 37d81cc2e2
2 changed files with 2 additions and 6 deletions

View File

@ -4605,10 +4605,8 @@ wxPoint wxGetMousePosition()
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;

View File

@ -4605,10 +4605,8 @@ wxPoint wxGetMousePosition()
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;