quartz: Misc. fixes for getting offscreen windows to work

Mainly fixes to properly differentiate between toplevel and offscreen
windows, since these sometimes need different treatment.  Furthermore,
usage of gdk_window_get_effective_foo() instead of gdk_window_get_foo()
where applicable.
This commit is contained in:
Kristian Rietveld 2010-08-08 18:22:51 +02:00 committed by Benjamin Otte
parent d819bc4814
commit bde0f9a8f6
3 changed files with 24 additions and 13 deletions

View File

@ -147,7 +147,7 @@ translate_coords_to_child_coords (GdkWindow *parent,
*x -= tmp_x;
*y -= tmp_y;
current = gdk_window_get_parent (current);
current = gdk_window_get_effective_parent (current);
}
}
@ -204,7 +204,7 @@ gdk_device_core_query_state_helper (GdkWindow *window,
return NULL;
}
toplevel = GDK_WINDOW_OBJECT (gdk_window_get_toplevel (window));
toplevel = GDK_WINDOW_OBJECT (gdk_window_get_effective_toplevel (window));
*mask = _gdk_quartz_events_get_current_event_mask ();

View File

@ -37,6 +37,11 @@
#define GRIP_WIDTH 15
#define GRIP_HEIGHT 15
#define WINDOW_IS_TOPLEVEL(window) \
(GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD && \
GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN && \
GDK_WINDOW_TYPE (window) != GDK_WINDOW_OFFSCREEN)
/* This is the window corresponding to the key window */
static GdkWindow *current_keyboard_window;
@ -505,7 +510,7 @@ find_toplevel_under_pointer (GdkDisplay *display,
info = _gdk_display_get_pointer_info (display, display->core_pointer);
toplevel = info->toplevel_under_pointer;
if (toplevel)
if (toplevel && WINDOW_IS_TOPLEVEL (toplevel))
{
GdkWindowObject *private;
NSWindow *nswindow;
@ -551,7 +556,7 @@ find_toplevel_for_keyboard_event (NSEvent *nsevent)
grab = _gdk_display_get_last_device_grab (display, device);
if (grab && grab->window && !grab->owner_events)
{
window = gdk_window_get_toplevel (grab->window);
window = gdk_window_get_effective_toplevel (grab->window);
break;
}
}
@ -596,7 +601,7 @@ find_toplevel_for_mouse_event (NSEvent *nsevent,
*/
grab = _gdk_display_get_last_device_grab (display,
display->core_pointer);
if (grab)
if (WINDOW_IS_TOPLEVEL (toplevel) && grab)
{
/* Implicit grabs do not go through XGrabPointer and thus the
* event mask should not be checked.
@ -634,7 +639,7 @@ find_toplevel_for_mouse_event (NSEvent *nsevent,
GdkWindowObject *grab_private;
NSWindow *grab_nswindow;
grab_toplevel = gdk_window_get_toplevel (grab->window);
grab_toplevel = gdk_window_get_effective_toplevel (grab->window);
grab_private = (GdkWindowObject *)grab_toplevel;
grab_nswindow = ((GdkWindowImplQuartz *)grab_private->impl)->toplevel;
@ -670,7 +675,8 @@ find_toplevel_for_mouse_event (NSEvent *nsevent,
toplevel_under_pointer = find_toplevel_under_pointer (display,
screen_point,
&x_tmp, &y_tmp);
if (toplevel_under_pointer)
if (toplevel_under_pointer
&& WINDOW_IS_TOPLEVEL (toplevel_under_pointer))
{
GdkWindowObject *toplevel_private;
GdkWindowImplQuartz *toplevel_impl;

View File

@ -355,8 +355,8 @@ _gdk_windowing_window_process_updates_recurse (GdkWindow *window,
{
GdkWindow *toplevel;
toplevel = gdk_window_get_toplevel (window);
if (toplevel)
toplevel = gdk_window_get_effective_toplevel (window);
if (toplevel && WINDOW_IS_TOPLEVEL (toplevel))
{
GdkWindowObject *toplevel_private;
GdkWindowImplQuartz *toplevel_impl;
@ -378,7 +378,10 @@ _gdk_windowing_window_process_updates_recurse (GdkWindow *window,
}
}
_gdk_quartz_window_set_needs_display_in_region (window, region);
if (WINDOW_IS_TOPLEVEL (window))
_gdk_quartz_window_set_needs_display_in_region (window, region);
else
_gdk_window_process_updates_recurse (window, region);
/* NOTE: I'm not sure if we should displayIfNeeded here. It slows down a
* lot (since it triggers the beam syncing) and things seem to work
@ -784,7 +787,7 @@ _gdk_quartz_window_did_resign_main (GdkWindow *window)
if (new_window &&
new_window != window &&
GDK_WINDOW_IS_MAPPED (new_window) &&
GDK_WINDOW_OBJECT (new_window)->window_type != GDK_WINDOW_TEMP)
WINDOW_IS_TOPLEVEL (new_window))
{
GdkWindowObject *private = (GdkWindowObject *) new_window;
GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
@ -901,6 +904,8 @@ _gdk_window_impl_new (GdkWindow *window,
(attributes->cursor) :
NULL));
impl->view = NULL;
switch (attributes->window_type)
{
case GDK_WINDOW_TOPLEVEL:
@ -1148,7 +1153,7 @@ gdk_window_quartz_show (GdkWindow *window, gboolean already_mapped)
else
focus_on_map = TRUE;
if (impl->toplevel)
if (WINDOW_IS_TOPLEVEL (window) && impl->toplevel)
{
gboolean make_key;
@ -1243,7 +1248,7 @@ gdk_window_quartz_hide (GdkWindow *window)
impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
if (impl->toplevel)
if (WINDOW_IS_TOPLEVEL (window))
{
/* Update main window. */
main_window_stack = g_slist_remove (main_window_stack, window);