Extend _gdk_windowing_window_at_pointer to be able to get toplevels only
This has two advantages: 1) In many backends, this is faster as we can terminate the window hierarchy traversal earlier 2) When used in gdkdisplay.c::get_current_toplevel() to get the current toplevel that has the pointer we now correctly return a toplevel with the pointer in it where the pointer is inside some foreign subwindow of a toplevel window. The second advantage fixes some bugs in client side event generation when the pointer is inside such a foreign child window.
This commit is contained in:
@ -2261,7 +2261,8 @@ GdkWindow*
|
||||
_gdk_windowing_window_at_pointer (GdkDisplay *display,
|
||||
gint *win_x,
|
||||
gint *win_y,
|
||||
GdkModifierType *mask)
|
||||
GdkModifierType *mask,
|
||||
gboolean get_toplevel)
|
||||
{
|
||||
GdkWindow *window;
|
||||
POINT point, pointc;
|
||||
@ -2283,6 +2284,11 @@ _gdk_windowing_window_at_pointer (GdkDisplay *display,
|
||||
ScreenToClient (hwnd, &point);
|
||||
|
||||
do {
|
||||
if (get_toplevel &&
|
||||
(window = gdk_win32_handle_table_lookup ((GdkNativeWindow) hwnd)) != NULL &&
|
||||
GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN)
|
||||
break;
|
||||
|
||||
hwndc = ChildWindowFromPoint (hwnd, point);
|
||||
ClientToScreen (hwnd, &point);
|
||||
ScreenToClient (hwndc, &point);
|
||||
|
||||
Reference in New Issue
Block a user