summaryrefslogtreecommitdiff
path: root/gdk
diff options
context:
space:
mode:
authorRichard Hult <richard@imendio.com>2007-07-13 19:09:10 +0000
committerRichard Hult <rhult@src.gnome.org>2007-07-13 19:09:10 +0000
commited82448b9aef2ff77ed3884a0c6fe6b14d821bd7 (patch)
tree3fe99412ac66d43926aac7d001163b0bf8f0c88f /gdk
parent7f66d205e892e9e9be58e0f4e483833c8071c2d8 (diff)
downloadgtk+-ed82448b9aef2ff77ed3884a0c6fe6b14d821bd7.tar.gz
Move from here... ...to here. (_gdk_windowing_window_destroy): Update the
2007-07-13 Richard Hult <richard@imendio.com> * gdk/quartz/gdkprivate-quartz.h: * gdk/quartz/gdkevents-quartz.c: (gdk_window_is_ancestor): Move from here... * gdk/quartz/gdkwindow-quartz.c: (_gdk_quartz_window_is_ancestor): ...to here. (_gdk_windowing_window_destroy): Update the mouse window if the destroyed window is an ancestor of the current one, not only if they are the same. (gdk_window_hide): Update the mouse window here too. svn path=/trunk/; revision=18467
Diffstat (limited to 'gdk')
-rw-r--r--gdk/quartz/gdkevents-quartz.c22
-rw-r--r--gdk/quartz/gdkprivate-quartz.h8
-rw-r--r--gdk/quartz/gdkwindow-quartz.c31
3 files changed, 40 insertions, 21 deletions
diff --git a/gdk/quartz/gdkevents-quartz.c b/gdk/quartz/gdkevents-quartz.c
index 5bae459d7b..8d6b51373c 100644
--- a/gdk/quartz/gdkevents-quartz.c
+++ b/gdk/quartz/gdkevents-quartz.c
@@ -603,17 +603,6 @@ _gdk_quartz_events_update_focus_window (GdkWindow *window,
}
}
-static gboolean
-gdk_window_is_ancestor (GdkWindow *ancestor,
- GdkWindow *window)
-{
- if (ancestor == NULL || window == NULL)
- return FALSE;
-
- return (gdk_window_get_parent (window) == ancestor ||
- gdk_window_is_ancestor (ancestor, gdk_window_get_parent (window)));
-}
-
static void
convert_window_coordinates_to_root (GdkWindow *window,
gdouble x,
@@ -774,7 +763,7 @@ synthesize_crossing_events (GdkWindow *window,
if (window == current_mouse_window)
return;
- if (gdk_window_is_ancestor (current_mouse_window, window))
+ if (_gdk_quartz_window_is_ancestor (current_mouse_window, window))
{
/* Pointer has moved to an inferior window. */
synthesize_leave_event (current_mouse_window, nsevent, mode, GDK_NOTIFY_INFERIOR);
@@ -791,7 +780,7 @@ synthesize_crossing_events (GdkWindow *window,
synthesize_enter_event (window, nsevent, mode, GDK_NOTIFY_ANCESTOR);
}
- else if (gdk_window_is_ancestor (window, current_mouse_window))
+ else if (_gdk_quartz_window_is_ancestor (window, current_mouse_window))
{
/* Pointer has moved to an ancestor window. */
synthesize_leave_event (current_mouse_window, nsevent, mode, GDK_NOTIFY_ANCESTOR);
@@ -815,7 +804,7 @@ synthesize_crossing_events (GdkWindow *window,
common_ancestor = gdk_window_get_parent (tem);
tem = common_ancestor;
} while (common_ancestor &&
- !gdk_window_is_ancestor (common_ancestor, window));
+ !_gdk_quartz_window_is_ancestor (common_ancestor, window));
if (common_ancestor)
{
synthesize_leave_event (current_mouse_window, nsevent, mode, GDK_NOTIFY_NONLINEAR);
@@ -878,8 +867,11 @@ _gdk_quartz_events_send_map_events (GdkWindow *window)
/* Get current mouse window */
GdkWindow *
-_gdk_quartz_events_get_mouse_window (void)
+_gdk_quartz_events_get_mouse_window (gboolean consider_grabs)
{
+ if (!consider_grabs)
+ return current_mouse_window;
+
if (_gdk_quartz_pointer_grab_window && !pointer_grab_owner_events)
return _gdk_quartz_pointer_grab_window;
diff --git a/gdk/quartz/gdkprivate-quartz.h b/gdk/quartz/gdkprivate-quartz.h
index 875dadc8b4..c3b7b0bc63 100644
--- a/gdk/quartz/gdkprivate-quartz.h
+++ b/gdk/quartz/gdkprivate-quartz.h
@@ -134,6 +134,8 @@ void _gdk_quartz_colormap_get_rgba_from_pixel (GdkColormap *colormap,
gfloat *alpha);
/* Window */
+gboolean _gdk_quartz_window_is_ancestor (GdkWindow *ancestor,
+ GdkWindow *window);
gint _gdk_quartz_window_get_inverted_screen_y (gint y);
GdkWindow *_gdk_quartz_window_find_child (GdkWindow *window,
gint x,
@@ -144,9 +146,9 @@ void _gdk_quartz_window_did_become_main (GdkWindow *window);
void _gdk_quartz_window_did_resign_main (GdkWindow *window);
/* Events */
-void _gdk_quartz_events_update_focus_window (GdkWindow *new_window,
- gboolean got_focus);
-GdkWindow * _gdk_quartz_events_get_mouse_window (void);
+void _gdk_quartz_events_update_focus_window (GdkWindow *new_window,
+ gboolean got_focus);
+GdkWindow * _gdk_quartz_events_get_mouse_window (gboolean consider_grabs);
void _gdk_quartz_events_update_mouse_window (GdkWindow *window);
void _gdk_quartz_events_update_cursor (GdkWindow *window);
void _gdk_quartz_events_send_map_events (GdkWindow *window);
diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c
index b4a1997f57..d4fc015675 100644
--- a/gdk/quartz/gdkwindow-quartz.c
+++ b/gdk/quartz/gdkwindow-quartz.c
@@ -436,6 +436,18 @@ get_default_title (void)
return title;
}
+gboolean
+_gdk_quartz_window_is_ancestor (GdkWindow *ancestor,
+ GdkWindow *window)
+{
+ if (ancestor == NULL || window == NULL)
+ return FALSE;
+
+ return (gdk_window_get_parent (window) == ancestor ||
+ _gdk_quartz_window_is_ancestor (ancestor,
+ gdk_window_get_parent (window)));
+}
+
/* FIXME: It would be nice to have one function that takes an NSPoint
* and flips the coords for any window.
*/
@@ -789,9 +801,12 @@ _gdk_windowing_window_destroy (GdkWindow *window,
if (!recursing && !foreign_destroy)
{
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (window)->impl);
+ GdkWindow *mouse_window;
- if (window == _gdk_quartz_events_get_mouse_window ())
- _gdk_quartz_events_update_mouse_window (_gdk_root);
+ mouse_window = _gdk_quartz_events_get_mouse_window (FALSE);
+ if (window == mouse_window ||
+ _gdk_quartz_window_is_ancestor (window, mouse_window))
+ _gdk_quartz_events_update_mouse_window (_gdk_root);
GDK_QUARTZ_ALLOC_POOL;
@@ -966,12 +981,18 @@ gdk_window_hide (GdkWindow *window)
{
GdkWindowObject *private = (GdkWindowObject *)window;
GdkWindowImplQuartz *impl;
+ GdkWindow *mouse_window;
g_return_if_fail (GDK_IS_WINDOW (window));
if (GDK_WINDOW_DESTROYED (window))
return;
+ mouse_window = _gdk_quartz_events_get_mouse_window (FALSE);
+ if (window == mouse_window ||
+ _gdk_quartz_window_is_ancestor (window, mouse_window))
+ _gdk_quartz_events_update_mouse_window (_gdk_root);
+
if (GDK_WINDOW_IS_MAPPED (window))
gdk_synthesize_window_state (window,
0,
@@ -1264,6 +1285,8 @@ gdk_window_set_cursor (GdkWindow *window,
if (GDK_WINDOW_DESTROYED (window))
return;
+ GDK_QUARTZ_ALLOC_POOL;
+
if (!cursor)
nscursor = NULL;
else
@@ -1274,7 +1297,9 @@ gdk_window_set_cursor (GdkWindow *window,
impl->nscursor = nscursor;
- _gdk_quartz_events_update_cursor (_gdk_quartz_events_get_mouse_window ());
+ GDK_QUARTZ_RELEASE_POOL;
+
+ _gdk_quartz_events_update_cursor (_gdk_quartz_events_get_mouse_window (TRUE));
}
void