[gtk+] Fix handling of window cursor wrt grabs
- From: Alexander Larsson <alexl src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gtk+] Fix handling of window cursor wrt grabs
- Date: Tue, 8 Sep 2009 09:49:17 +0000 (UTC)
commit 113d21801b4550058d10cd324da24f688c903793
Author: Alexander Larsson <alexl redhat com>
Date: Tue Sep 8 11:48:20 2009 +0200
Fix handling of window cursor wrt grabs
Even for grabs we need to recurse up to look for what cursor to use.
gdk/gdkwindow.c | 30 +++++++++++++++++++-----------
1 files changed, 19 insertions(+), 11 deletions(-)
---
diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c
index 40176b2..7820d46 100644
--- a/gdk/gdkwindow.c
+++ b/gdk/gdkwindow.c
@@ -8599,28 +8599,36 @@ _gdk_window_event_parent_of (GdkWindow *parent,
static void
update_cursor (GdkDisplay *display)
{
- GdkWindowObject *pointer_window, *cursor_window, *parent, *toplevel;
+ GdkWindowObject *cursor_window, *parent, *toplevel;
+ GdkWindow *pointer_window;
GdkWindowImplIface *impl_iface;
GdkPointerGrabInfo *grab;
- pointer_window = (GdkWindowObject *)display->pointer_info.window_under_pointer;
-
- cursor_window = pointer_window;
- while (cursor_window->cursor == NULL &&
- (parent = get_event_parent (cursor_window)) != NULL &&
- parent->window_type != GDK_WINDOW_ROOT)
- cursor_window = parent;
+ pointer_window = display->pointer_info.window_under_pointer;
/* We ignore the serials here and just pick the last grab
we've sent, as that would shortly be used anyway. */
grab = _gdk_display_get_last_pointer_grab (display);
- if (grab != NULL &&
- !_gdk_window_event_parent_of (grab->window, (GdkWindow *)cursor_window))
+ if (/* have grab */
+ grab != NULL &&
+ /* the pointer is not in a descendant of the grab window */
+ !_gdk_window_event_parent_of (grab->window, pointer_window))
+ /* use the cursor from the grab window */
cursor_window = (GdkWindowObject *)grab->window;
+ else
+ /* otherwise use the cursor from the pointer window */
+ cursor_window = (GdkWindowObject *)pointer_window;
+
+ /* Find the first window with the cursor actually set, as
+ the cursor is inherited from the parent */
+ while (cursor_window->cursor == NULL &&
+ (parent = get_event_parent (cursor_window)) != NULL &&
+ parent->window_type != GDK_WINDOW_ROOT)
+ cursor_window = parent;
/* Set all cursors on toplevel, otherwise its tricky to keep track of
* which native window has what cursor set. */
- toplevel = (GdkWindowObject *)get_event_toplevel ((GdkWindow *)pointer_window);
+ toplevel = (GdkWindowObject *)get_event_toplevel (pointer_window);
impl_iface = GDK_WINDOW_IMPL_GET_IFACE (toplevel->impl);
impl_iface->set_cursor ((GdkWindow *)toplevel, cursor_window->cursor);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]