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
This commit is contained in:
Richard Hult 2007-07-13 19:09:10 +00:00 committed by Richard Hult
parent 7f66d205e8
commit ed82448b9a
4 changed files with 52 additions and 21 deletions

View File

@ -1,3 +1,15 @@
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.
2007-07-13 Richard Hult <richard@imendio.com>
* gdk/quartz/gdkcolor-quartz.c: (gdk_colors_alloc),

View File

@ -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;

View File

@ -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);

View File

@ -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