3 * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
4 * Copyright (C) 2005-2007 Imendio AB
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
23 #include <Carbon/Carbon.h>
26 #include "gdkwindowimpl.h"
27 #include "gdkprivate-quartz.h"
29 static gpointer parent_class;
31 static GSList *update_nswindows;
32 static gboolean in_process_all_updates = FALSE;
34 static GSList *main_window_stack;
36 #define FULLSCREEN_DATA "fullscreen-data"
42 GdkWMDecoration decor;
43 } FullscreenSavedGeometry;
46 static void update_toplevel_order (void);
47 static void clear_toplevel_order (void);
49 static FullscreenSavedGeometry *get_fullscreen_geometry (GdkWindow *window);
51 #define WINDOW_IS_TOPLEVEL(window) \
52 (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD && \
53 GDK_WINDOW_TYPE (window) != GDK_WINDOW_FOREIGN && \
54 GDK_WINDOW_TYPE (window) != GDK_WINDOW_OFFSCREEN)
56 static void gdk_window_impl_iface_init (GdkWindowImplIface *iface);
59 gdk_quartz_window_get_nsview (GdkWindow *window)
61 GdkWindowObject *private = (GdkWindowObject *)window;
63 if (GDK_WINDOW_DESTROYED (window))
66 return ((GdkWindowImplQuartz *)private->impl)->view;
70 gdk_quartz_window_get_nswindow (GdkWindow *window)
72 GdkWindowObject *private = (GdkWindowObject *)window;
74 if (GDK_WINDOW_DESTROYED (window))
77 return ((GdkWindowImplQuartz *)private->impl)->toplevel;
81 gdk_window_impl_quartz_get_context (GdkDrawable *drawable,
84 GdkDrawableImplQuartz *drawable_impl = GDK_DRAWABLE_IMPL_QUARTZ (drawable);
85 GdkWindowImplQuartz *window_impl = GDK_WINDOW_IMPL_QUARTZ (drawable);
86 CGContextRef cg_context;
88 if (GDK_WINDOW_DESTROYED (drawable_impl->wrapper))
91 /* Lock focus when not called as part of a drawRect call. This
92 * is needed when called from outside "real" expose events, for
93 * example for synthesized expose events when realizing windows
94 * and for widgets that send fake expose events like the arrow
95 * buttons in spinbuttons or the position marker in rulers.
97 if (window_impl->in_paint_rect_count == 0)
99 if (![window_impl->view lockFocusIfCanDraw])
103 cg_context = [[NSGraphicsContext currentContext] graphicsPort];
104 CGContextSaveGState (cg_context);
105 CGContextSetAllowsAntialiasing (cg_context, antialias);
107 /* We'll emulate the clipping caused by double buffering here */
108 if (window_impl->begin_paint_count != 0)
115 gdk_region_get_rectangles (window_impl->paint_clip_region,
121 cg_rects = g_new (CGRect, n_rects);
123 for (i = 0; i < n_rects; i++)
125 cg_rects[i].origin.x = rects[i].x;
126 cg_rects[i].origin.y = rects[i].y;
127 cg_rects[i].size.width = rects[i].width;
128 cg_rects[i].size.height = rects[i].height;
131 CGContextClipToRects (cg_context, cg_rects, n_rects);
134 if (cg_rects != &rect)
142 check_grab_unmap (GdkWindow *window)
144 GdkDisplay *display = gdk_drawable_get_display (window);
146 _gdk_display_end_pointer_grab (display, 0, window, TRUE);
148 if (display->keyboard_grab.window)
150 GdkWindowObject *private = GDK_WINDOW_OBJECT (window);
151 GdkWindowObject *tmp = GDK_WINDOW_OBJECT (display->keyboard_grab.window);
153 while (tmp && tmp != private)
157 _gdk_display_unset_has_keyboard_grab (display, TRUE);
162 check_grab_destroy (GdkWindow *window)
164 GdkDisplay *display = gdk_drawable_get_display (window);
165 GdkPointerGrabInfo *grab;
167 /* Make sure there is no lasting grab in this native window */
168 grab = _gdk_display_get_last_pointer_grab (display);
169 if (grab && grab->native_window == window)
171 /* Serials are always 0 in quartz, but for clarity: */
172 grab->serial_end = grab->serial_start;
173 grab->implicit_ungrab = TRUE;
176 if (window == display->keyboard_grab.native_window &&
177 display->keyboard_grab.window != NULL)
178 _gdk_display_unset_has_keyboard_grab (display, TRUE);
182 gdk_window_impl_quartz_finalize (GObject *object)
184 GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (object);
186 check_grab_destroy (GDK_DRAWABLE_IMPL_QUARTZ (object)->wrapper);
188 if (impl->paint_clip_region)
189 gdk_region_destroy (impl->paint_clip_region);
191 if (impl->transient_for)
192 g_object_unref (impl->transient_for);
194 G_OBJECT_CLASS (parent_class)->finalize (object);
198 gdk_window_impl_quartz_class_init (GdkWindowImplQuartzClass *klass)
200 GObjectClass *object_class = G_OBJECT_CLASS (klass);
201 GdkDrawableImplQuartzClass *drawable_quartz_class = GDK_DRAWABLE_IMPL_QUARTZ_CLASS (klass);
203 parent_class = g_type_class_peek_parent (klass);
205 object_class->finalize = gdk_window_impl_quartz_finalize;
207 drawable_quartz_class->get_context = gdk_window_impl_quartz_get_context;
211 gdk_window_impl_quartz_init (GdkWindowImplQuartz *impl)
213 impl->type_hint = GDK_WINDOW_TYPE_HINT_NORMAL;
217 gdk_window_impl_quartz_begin_paint_region (GdkPaintable *paintable,
219 const GdkRegion *region)
221 GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (paintable);
222 GdkWindowObject *private = (GdkWindowObject*)window;
224 GdkRectangle *rects = NULL;
225 GdkPixmap *bg_pixmap;
226 GdkRegion *clipped_and_offset_region;
227 gboolean free_clipped_and_offset_region = TRUE;
229 bg_pixmap = private->bg_pixmap;
231 clipped_and_offset_region = gdk_region_copy (region);
233 gdk_region_intersect (clipped_and_offset_region,
234 private->clip_region_with_children);
235 gdk_region_offset (clipped_and_offset_region,
236 private->abs_x, private->abs_y);
238 if (impl->begin_paint_count == 0)
240 impl->paint_clip_region = clipped_and_offset_region;
241 free_clipped_and_offset_region = FALSE;
244 gdk_region_union (impl->paint_clip_region, clipped_and_offset_region);
246 impl->begin_paint_count++;
248 if (bg_pixmap == GDK_NO_BG)
251 gdk_region_get_rectangles (clipped_and_offset_region, &rects, &n_rects);
253 if (bg_pixmap == NULL)
255 CGContextRef cg_context;
259 cg_context = gdk_quartz_drawable_get_context (GDK_DRAWABLE (impl), FALSE);
260 _gdk_quartz_colormap_get_rgba_from_pixel (gdk_drawable_get_colormap (window),
261 private->bg_color.pixel,
263 CGContextSetRGBFillColor (cg_context, r, g, b, a);
265 for (i = 0; i < n_rects; i++)
267 CGContextFillRect (cg_context,
268 CGRectMake (rects[i].x, rects[i].y,
269 rects[i].width, rects[i].height));
272 gdk_quartz_drawable_release_context (GDK_DRAWABLE (impl), cg_context);
277 int x_offset, y_offset;
281 x_offset = y_offset = 0;
283 while (window && bg_pixmap == GDK_PARENT_RELATIVE_BG)
285 /* If this window should have the same background as the parent,
286 * fetch the parent. (And if the same goes for the parent, fetch
287 * the grandparent, etc.)
289 x_offset += ((GdkWindowObject *) window)->x;
290 y_offset += ((GdkWindowObject *) window)->y;
291 window = GDK_WINDOW (((GdkWindowObject *) window)->parent);
292 bg_pixmap = ((GdkWindowObject *) window)->bg_pixmap;
295 if (bg_pixmap == NULL || bg_pixmap == GDK_NO_BG || bg_pixmap == GDK_PARENT_RELATIVE_BG)
297 /* Parent relative background but the parent doesn't have a
303 /* Note: There should be a CG API to draw tiled images, we might
304 * want to look into that for this.
306 gc = gdk_gc_new (GDK_DRAWABLE (impl));
308 gdk_drawable_get_size (GDK_DRAWABLE (bg_pixmap), &width, &height);
311 while (x < (rects[0].x + rects[0].width))
313 if (x + width >= rects[0].x)
316 while (y < (rects[0].y + rects[0].height))
318 if (y + height >= rects[0].y)
319 gdk_draw_drawable (GDK_DRAWABLE (impl), gc, bg_pixmap, 0, 0, x, y, width, height);
331 if (free_clipped_and_offset_region)
332 gdk_region_destroy (clipped_and_offset_region);
337 gdk_window_impl_quartz_end_paint (GdkPaintable *paintable)
339 GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (paintable);
341 impl->begin_paint_count--;
343 if (impl->begin_paint_count == 0)
345 gdk_region_destroy (impl->paint_clip_region);
346 impl->paint_clip_region = NULL;
351 _gdk_windowing_window_process_updates_recurse (GdkWindow *window,
354 GdkWindowObject *private = (GdkWindowObject *)window;
355 GdkWindowImplQuartz *impl = (GdkWindowImplQuartz *)private->impl;
359 /* Make sure to only flush each toplevel at most once if we're called
360 * from process_all_updates.
362 if (in_process_all_updates)
366 toplevel = gdk_window_get_toplevel (window);
369 GdkWindowObject *toplevel_private;
370 GdkWindowImplQuartz *toplevel_impl;
373 toplevel_private = (GdkWindowObject *)toplevel;
374 toplevel_impl = (GdkWindowImplQuartz *)toplevel_private->impl;
375 nswindow = toplevel_impl->toplevel;
377 /* In theory, we could skip the flush disabling, since we only
380 if (nswindow && ![nswindow isFlushWindowDisabled])
383 [nswindow disableFlushWindow];
384 update_nswindows = g_slist_prepend (update_nswindows, nswindow);
389 gdk_region_get_rectangles (region, &rects, &n_rects);
391 for (i = 0; i < n_rects; i++)
393 [impl->view setNeedsDisplayInRect:NSMakeRect (rects[i].x, rects[i].y,
394 rects[i].width, rects[i].height)];
399 /* NOTE: I'm not sure if we should displayIfNeeded here. It slows down a
400 * lot (since it triggers the beam syncing) and things seem to work
406 _gdk_windowing_before_process_all_updates (void)
408 in_process_all_updates = TRUE;
410 NSDisableScreenUpdates ();
414 _gdk_windowing_after_process_all_updates (void)
416 GSList *old_update_nswindows = update_nswindows;
417 GSList *tmp_list = update_nswindows;
419 update_nswindows = NULL;
423 NSWindow *nswindow = tmp_list->data;
425 [[nswindow contentView] displayIfNeeded];
427 _gdk_quartz_drawable_flush (NULL);
429 [nswindow enableFlushWindow];
430 [nswindow flushWindow];
433 tmp_list = tmp_list->next;
436 g_slist_free (old_update_nswindows);
438 in_process_all_updates = FALSE;
440 NSEnableScreenUpdates ();
444 gdk_window_impl_quartz_paintable_init (GdkPaintableIface *iface)
446 iface->begin_paint_region = gdk_window_impl_quartz_begin_paint_region;
447 iface->end_paint = gdk_window_impl_quartz_end_paint;
451 _gdk_window_impl_quartz_get_type (void)
453 static GType object_type = 0;
457 const GTypeInfo object_info =
459 sizeof (GdkWindowImplQuartzClass),
460 (GBaseInitFunc) NULL,
461 (GBaseFinalizeFunc) NULL,
462 (GClassInitFunc) gdk_window_impl_quartz_class_init,
463 NULL, /* class_finalize */
464 NULL, /* class_data */
465 sizeof (GdkWindowImplQuartz),
467 (GInstanceInitFunc) gdk_window_impl_quartz_init,
470 const GInterfaceInfo paintable_info =
472 (GInterfaceInitFunc) gdk_window_impl_quartz_paintable_init,
477 const GInterfaceInfo window_impl_info =
479 (GInterfaceInitFunc) gdk_window_impl_iface_init,
484 object_type = g_type_register_static (GDK_TYPE_DRAWABLE_IMPL_QUARTZ,
485 "GdkWindowImplQuartz",
487 g_type_add_interface_static (object_type,
490 g_type_add_interface_static (object_type,
491 GDK_TYPE_WINDOW_IMPL,
499 _gdk_window_impl_get_type (void)
501 return _gdk_window_impl_quartz_get_type ();
505 get_default_title (void)
509 title = g_get_application_name ();
511 title = g_get_prgname ();
517 get_ancestor_coordinates_from_child (GdkWindow *child_window,
520 GdkWindow *ancestor_window,
524 GdkWindowObject *child_private = GDK_WINDOW_OBJECT (child_window);
525 GdkWindowObject *ancestor_private = GDK_WINDOW_OBJECT (ancestor_window);
527 while (child_private != ancestor_private)
529 child_x += child_private->x;
530 child_y += child_private->y;
532 child_private = child_private->parent;
535 *ancestor_x = child_x;
536 *ancestor_y = child_y;
540 _gdk_quartz_window_debug_highlight (GdkWindow *window, gint number)
542 GdkWindowObject *private = GDK_WINDOW_OBJECT (window);
546 static NSWindow *debug_window[10];
547 static NSRect old_rect[10];
551 g_return_if_fail (number >= 0 && number <= 9);
553 if (window == _gdk_root)
558 if (debug_window[number])
559 [debug_window[number] close];
560 debug_window[number] = NULL;
565 toplevel = gdk_window_get_toplevel (window);
566 get_ancestor_coordinates_from_child (window, 0, 0, toplevel, &x, &y);
568 gdk_window_get_origin (toplevel, &tx, &ty);
572 rect = NSMakeRect (x,
573 _gdk_quartz_window_get_inverted_screen_y (y + private->height),
574 private->width, private->height);
576 if (debug_window[number] && NSEqualRects (rect, old_rect[number]))
579 old_rect[number] = rect;
581 if (debug_window[number])
582 [debug_window[number] close];
584 debug_window[number] = [[NSWindow alloc] initWithContentRect:rect
585 styleMask:NSBorderlessWindowMask
586 backing:NSBackingStoreBuffered
592 color = [NSColor redColor];
595 color = [NSColor blueColor];
598 color = [NSColor greenColor];
601 color = [NSColor yellowColor];
604 color = [NSColor brownColor];
607 color = [NSColor purpleColor];
610 color = [NSColor blackColor];
614 [debug_window[number] setBackgroundColor:color];
615 [debug_window[number] setAlphaValue:0.4];
616 [debug_window[number] setOpaque:NO];
617 [debug_window[number] setReleasedWhenClosed:YES];
618 [debug_window[number] setIgnoresMouseEvents:YES];
619 [debug_window[number] setLevel:NSFloatingWindowLevel];
621 [debug_window[number] orderFront:nil];
625 _gdk_quartz_window_is_ancestor (GdkWindow *ancestor,
628 if (ancestor == NULL || window == NULL)
631 return (gdk_window_get_parent (window) == ancestor ||
632 _gdk_quartz_window_is_ancestor (ancestor,
633 gdk_window_get_parent (window)));
636 /* FIXME: It would be nice to have one function that takes an NSPoint
637 * and flips the coords for any window.
640 _gdk_quartz_window_get_inverted_screen_y (gint y)
642 NSRect rect = [[NSScreen mainScreen] frame];
644 return rect.size.height - y;
648 find_child_window_helper (GdkWindow *window,
654 GdkWindowImplQuartz *impl;
657 impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (window)->impl);
659 if (window == _gdk_root)
660 update_toplevel_order ();
662 for (l = impl->sorted_children; l; l = l->next)
664 GdkWindowObject *child_private = l->data;
665 GdkWindowImplQuartz *child_impl = GDK_WINDOW_IMPL_QUARTZ (child_private->impl);
668 if (!GDK_WINDOW_IS_MAPPED (child_private))
671 temp_x = x_offset + child_private->x;
672 temp_y = y_offset + child_private->y;
674 /* Special-case the root window. We have to include the title
675 * bar in the checks, otherwise the window below the title bar
676 * will be found i.e. events punch through. (If we can find a
677 * better way to deal with the events in gdkevents-quartz, this
678 * might not be needed.)
680 if (window == _gdk_root)
682 NSRect frame = NSMakeRect (0, 0, 100, 100);
687 mask = [child_impl->toplevel styleMask];
689 /* Get the title bar height. */
690 content = [NSWindow contentRectForFrameRect:frame
692 titlebar_height = frame.size.height - content.size.height;
694 if (titlebar_height > 0 &&
695 x >= temp_x && y >= temp_y - titlebar_height &&
696 x < temp_x + child_private->width && y < temp_y)
698 /* The root means "unknown" i.e. a window not managed by
701 return (GdkWindow *)_gdk_root;
705 if (x >= temp_x && y >= temp_y &&
706 x < temp_x + child_private->width && y < temp_y + child_private->height)
708 /* Look for child windows. */
709 return find_child_window_helper (l->data,
718 /* Given a GdkWindow and coordinates relative to it, returns the
719 * innermost subwindow that contains the point. If the coordinates are
720 * outside the passed in window, NULL is returned.
723 _gdk_quartz_window_find_child (GdkWindow *window,
727 GdkWindowObject *private = GDK_WINDOW_OBJECT (window);
729 if (x >= 0 && y >= 0 && x < private->width && y < private->height)
730 return find_child_window_helper (window, x, y, 0, 0);
736 _gdk_quartz_window_did_become_main (GdkWindow *window)
738 main_window_stack = g_slist_remove (main_window_stack, window);
740 if (GDK_WINDOW_OBJECT (window)->window_type != GDK_WINDOW_TEMP)
741 main_window_stack = g_slist_prepend (main_window_stack, window);
743 clear_toplevel_order ();
747 _gdk_quartz_window_did_resign_main (GdkWindow *window)
749 GdkWindow *new_window = NULL;
751 if (main_window_stack)
752 new_window = main_window_stack->data;
757 toplevels = gdk_window_get_toplevels ();
759 new_window = toplevels->data;
760 g_list_free (toplevels);
764 new_window != window &&
765 GDK_WINDOW_IS_MAPPED (new_window) &&
766 GDK_WINDOW_OBJECT (new_window)->window_type != GDK_WINDOW_TEMP)
768 GdkWindowObject *private = (GdkWindowObject *) new_window;
769 GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
771 [impl->toplevel makeKeyAndOrderFront:impl->toplevel];
774 clear_toplevel_order ();
778 _gdk_window_impl_new (GdkWindow *window,
779 GdkWindow *real_parent,
782 GdkEventMask event_mask,
783 GdkWindowAttr *attributes,
784 gint attributes_mask)
786 GdkWindowObject *private;
787 GdkWindowImplQuartz *impl;
788 GdkDrawableImplQuartz *draw_impl;
789 GdkWindowImplQuartz *parent_impl;
791 GDK_QUARTZ_ALLOC_POOL;
793 private = (GdkWindowObject *)window;
795 impl = g_object_new (_gdk_window_impl_get_type (), NULL);
796 private->impl = (GdkDrawable *)impl;
797 draw_impl = GDK_DRAWABLE_IMPL_QUARTZ (impl);
798 draw_impl->wrapper = GDK_DRAWABLE (window);
800 parent_impl = GDK_WINDOW_IMPL_QUARTZ (private->parent->impl);
802 switch (private->window_type)
804 case GDK_WINDOW_TOPLEVEL:
805 case GDK_WINDOW_DIALOG:
806 case GDK_WINDOW_TEMP:
807 if (GDK_WINDOW_TYPE (private->parent) != GDK_WINDOW_ROOT)
809 /* The common code warns for this case */
810 parent_impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (_gdk_root)->impl);
814 if (!private->input_only)
816 if (attributes_mask & GDK_WA_COLORMAP)
818 draw_impl->colormap = attributes->colormap;
819 g_object_ref (attributes->colormap);
823 if (visual == gdk_screen_get_system_visual (_gdk_screen))
825 draw_impl->colormap = gdk_screen_get_system_colormap (_gdk_screen);
826 g_object_ref (draw_impl->colormap);
828 else if (visual == gdk_screen_get_rgba_visual (_gdk_screen))
830 draw_impl->colormap = gdk_screen_get_rgba_colormap (_gdk_screen);
831 g_object_ref (draw_impl->colormap);
835 draw_impl->colormap = gdk_colormap_new (visual, FALSE);
841 draw_impl->colormap = gdk_screen_get_system_colormap (_gdk_screen);
842 g_object_ref (draw_impl->colormap);
845 /* Maintain the z-ordered list of children. */
846 if (private->parent != (GdkWindowObject *)_gdk_root)
847 parent_impl->sorted_children = g_list_prepend (parent_impl->sorted_children, window);
849 clear_toplevel_order ();
851 gdk_window_set_cursor (window, ((attributes_mask & GDK_WA_CURSOR) ?
852 (attributes->cursor) :
855 switch (attributes->window_type)
857 case GDK_WINDOW_TOPLEVEL:
858 case GDK_WINDOW_DIALOG:
859 case GDK_WINDOW_TEMP:
865 content_rect = NSMakeRect (private->x,
866 _gdk_quartz_window_get_inverted_screen_y (private->y) - private->height,
870 if (attributes->window_type == GDK_WINDOW_TEMP ||
871 attributes->type_hint == GDK_WINDOW_TYPE_HINT_SPLASHSCREEN)
873 style_mask = NSBorderlessWindowMask;
877 style_mask = (NSTitledWindowMask |
878 NSClosableWindowMask |
879 NSMiniaturizableWindowMask |
880 NSResizableWindowMask);
883 impl->toplevel = [[GdkQuartzWindow alloc] initWithContentRect:content_rect
885 backing:NSBackingStoreBuffered
888 if (attributes_mask & GDK_WA_TITLE)
889 title = attributes->title;
891 title = get_default_title ();
893 gdk_window_set_title (window, title);
895 if (draw_impl->colormap == gdk_screen_get_rgba_colormap (_gdk_screen))
897 [impl->toplevel setOpaque:NO];
898 [impl->toplevel setBackgroundColor:[NSColor clearColor]];
901 content_rect.origin.x = 0;
902 content_rect.origin.y = 0;
904 impl->view = [[GdkQuartzView alloc] initWithFrame:content_rect];
905 [impl->view setGdkWindow:window];
906 [impl->toplevel setContentView:impl->view];
910 case GDK_WINDOW_CHILD:
912 GdkWindowImplQuartz *parent_impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (private->parent)->impl);
914 if (!private->input_only)
916 NSRect frame_rect = NSMakeRect (private->x + private->parent->abs_x,
917 private->y + private->parent->abs_y,
921 impl->view = [[GdkQuartzView alloc] initWithFrame:frame_rect];
923 [impl->view setGdkWindow:window];
925 /* GdkWindows should be hidden by default */
926 [impl->view setHidden:YES];
927 [parent_impl->view addSubview:impl->view];
933 g_assert_not_reached ();
936 GDK_QUARTZ_RELEASE_POOL;
938 if (attributes_mask & GDK_WA_TYPE_HINT)
939 gdk_window_set_type_hint (window, attributes->type_hint);
943 _gdk_windowing_window_init (void)
945 GdkWindowObject *private;
946 GdkWindowImplQuartz *impl;
947 GdkDrawableImplQuartz *drawable_impl;
950 g_assert (_gdk_root == NULL);
952 _gdk_root = g_object_new (GDK_TYPE_WINDOW, NULL);
954 private = (GdkWindowObject *)_gdk_root;
955 private->impl = g_object_new (_gdk_window_impl_get_type (), NULL);
956 private->impl_window = private;
958 /* Note: This needs to be reworked for multi-screen support. */
959 impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (_gdk_root)->impl);
960 rect = [[NSScreen mainScreen] frame];
966 private->width = rect.size.width;
967 private->height = rect.size.height;
969 private->state = 0; /* We don't want GDK_WINDOW_STATE_WITHDRAWN here */
970 private->window_type = GDK_WINDOW_ROOT;
972 private->viewable = TRUE;
974 drawable_impl = GDK_DRAWABLE_IMPL_QUARTZ (private->impl);
976 drawable_impl->wrapper = GDK_DRAWABLE (private);
977 drawable_impl->colormap = gdk_screen_get_system_colormap (_gdk_screen);
978 g_object_ref (drawable_impl->colormap);
982 _gdk_quartz_window_destroy (GdkWindow *window,
984 gboolean foreign_destroy)
986 GdkWindowObject *private;
987 GdkWindowImplQuartz *impl;
988 GdkWindowObject *parent;
990 private = GDK_WINDOW_OBJECT (window);
991 impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
993 main_window_stack = g_slist_remove (main_window_stack, window);
995 g_list_free (impl->sorted_children);
996 impl->sorted_children = NULL;
998 parent = private->parent;
1001 GdkWindowImplQuartz *parent_impl = GDK_WINDOW_IMPL_QUARTZ (parent->impl);
1003 parent_impl->sorted_children = g_list_remove (parent_impl->sorted_children, window);
1006 _gdk_quartz_drawable_finish (GDK_DRAWABLE (impl));
1008 if (!recursing && !foreign_destroy)
1010 GDK_QUARTZ_ALLOC_POOL;
1013 [impl->toplevel close];
1014 else if (impl->view)
1015 [impl->view removeFromSuperview];
1017 GDK_QUARTZ_RELEASE_POOL;
1022 _gdk_windowing_window_destroy_foreign (GdkWindow *window)
1024 /* Foreign windows aren't supported in OSX. */
1027 /* FIXME: This might be possible to simplify with client-side windows. Also
1028 * note that already_mapped is not used yet, see the x11 backend.
1031 gdk_window_quartz_show (GdkWindow *window, gboolean already_mapped)
1033 GdkWindowObject *private = (GdkWindowObject *)window;
1034 GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
1035 gboolean focus_on_map;
1037 GDK_QUARTZ_ALLOC_POOL;
1039 if (!GDK_WINDOW_IS_MAPPED (window))
1040 focus_on_map = private->focus_on_map;
1042 focus_on_map = TRUE;
1048 make_key = (private->accept_focus && focus_on_map &&
1049 private->window_type != GDK_WINDOW_TEMP);
1051 [(GdkQuartzWindow*)impl->toplevel showAndMakeKey:make_key];
1052 clear_toplevel_order ();
1054 _gdk_quartz_events_send_map_event (window);
1058 [impl->view setHidden:NO];
1061 [impl->view setNeedsDisplay:YES];
1063 gdk_synthesize_window_state (window, GDK_WINDOW_STATE_WITHDRAWN, 0);
1065 if (private->state & GDK_WINDOW_STATE_MAXIMIZED)
1066 gdk_window_maximize (window);
1068 if (private->state & GDK_WINDOW_STATE_ICONIFIED)
1069 gdk_window_iconify (window);
1071 if (impl->transient_for && !GDK_WINDOW_DESTROYED (impl->transient_for))
1072 _gdk_quartz_window_attach_to_parent (window);
1074 GDK_QUARTZ_RELEASE_POOL;
1077 /* Temporarily unsets the parent window, if the window is a
1081 _gdk_quartz_window_detach_from_parent (GdkWindow *window)
1083 GdkWindowImplQuartz *impl;
1085 g_return_if_fail (GDK_IS_WINDOW (window));
1087 impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (window)->impl);
1089 g_return_if_fail (impl->toplevel != NULL);
1091 if (impl->transient_for && !GDK_WINDOW_DESTROYED (impl->transient_for))
1093 GdkWindowImplQuartz *parent_impl;
1095 parent_impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (impl->transient_for)->impl);
1096 [parent_impl->toplevel removeChildWindow:impl->toplevel];
1097 clear_toplevel_order ();
1101 /* Re-sets the parent window, if the window is a transient. */
1103 _gdk_quartz_window_attach_to_parent (GdkWindow *window)
1105 GdkWindowImplQuartz *impl;
1107 g_return_if_fail (GDK_IS_WINDOW (window));
1109 impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (window)->impl);
1111 g_return_if_fail (impl->toplevel != NULL);
1113 if (impl->transient_for && !GDK_WINDOW_DESTROYED (impl->transient_for))
1115 GdkWindowImplQuartz *parent_impl;
1117 parent_impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (impl->transient_for)->impl);
1118 [parent_impl->toplevel addChildWindow:impl->toplevel ordered:NSWindowAbove];
1119 clear_toplevel_order ();
1124 gdk_window_quartz_hide (GdkWindow *window)
1126 GdkWindowObject *private = (GdkWindowObject *)window;
1127 GdkWindowImplQuartz *impl;
1129 /* Make sure we're not stuck in fullscreen mode. */
1130 if (get_fullscreen_geometry (window))
1131 SetSystemUIMode (kUIModeNormal, 0);
1133 check_grab_unmap (window);
1135 _gdk_window_clear_update_area (window);
1137 impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
1141 /* Update main window. */
1142 main_window_stack = g_slist_remove (main_window_stack, window);
1143 if ([NSApp mainWindow] == impl->toplevel)
1144 _gdk_quartz_window_did_resign_main (window);
1146 if (impl->transient_for)
1147 _gdk_quartz_window_detach_from_parent (window);
1149 [(GdkQuartzWindow*)impl->toplevel hide];
1151 else if (impl->view)
1153 [impl->view setHidden:YES];
1158 gdk_window_quartz_withdraw (GdkWindow *window)
1160 gdk_window_hide (window);
1164 move_resize_window_internal (GdkWindow *window,
1170 GdkWindowObject *private = (GdkWindowObject *)window;
1171 GdkWindowImplQuartz *impl;
1172 GdkRectangle old_visible;
1173 GdkRectangle new_visible;
1174 GdkRectangle scroll_rect;
1175 GdkRegion *old_region;
1176 GdkRegion *expose_region;
1179 if (GDK_WINDOW_DESTROYED (window))
1182 impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
1184 if ((x == -1 || (x == private->x)) &&
1185 (y == -1 || (y == private->y)) &&
1186 (width == -1 || (width == private->width)) &&
1187 (height == -1 || (height == private->height)))
1192 if (!impl->toplevel)
1194 /* The previously visible area of this window in a coordinate
1195 * system rooted at the origin of this window.
1197 old_visible.x = -private->x;
1198 old_visible.y = -private->y;
1200 gdk_window_get_size (GDK_DRAWABLE (private->parent),
1202 &old_visible.height);
1207 delta.width = x - private->x;
1217 delta.height = y - private->y;
1226 private->width = width;
1229 private->height = height;
1231 GDK_QUARTZ_ALLOC_POOL;
1235 NSRect content_rect;
1238 content_rect = NSMakeRect (private->x,
1239 _gdk_quartz_window_get_inverted_screen_y (private->y + private->height),
1240 private->width, private->height);
1242 frame_rect = [impl->toplevel frameRectForContentRect:content_rect];
1243 [impl->toplevel setFrame:frame_rect display:YES];
1247 if (!private->input_only)
1251 nsrect = NSMakeRect (private->x, private->y, private->width, private->height);
1253 /* The newly visible area of this window in a coordinate
1254 * system rooted at the origin of this window.
1256 new_visible.x = -private->x;
1257 new_visible.y = -private->y;
1258 new_visible.width = old_visible.width; /* parent has not changed size */
1259 new_visible.height = old_visible.height; /* parent has not changed size */
1261 expose_region = gdk_region_rectangle (&new_visible);
1262 old_region = gdk_region_rectangle (&old_visible);
1263 gdk_region_subtract (expose_region, old_region);
1265 /* Determine what (if any) part of the previously visible
1266 * part of the window can be copied without a redraw
1268 scroll_rect = old_visible;
1269 scroll_rect.x -= delta.width;
1270 scroll_rect.y -= delta.height;
1271 gdk_rectangle_intersect (&scroll_rect, &old_visible, &scroll_rect);
1273 if (!gdk_region_empty (expose_region))
1275 GdkRectangle* rects;
1279 if (scroll_rect.width != 0 && scroll_rect.height != 0)
1281 [impl->view scrollRect:NSMakeRect (scroll_rect.x,
1288 [impl->view setFrame:nsrect];
1290 gdk_region_get_rectangles (expose_region, &rects, &n_rects);
1292 for (n = 0; n < n_rects; ++n)
1294 [impl->view setNeedsDisplayInRect:NSMakeRect (rects[n].x,
1304 [impl->view setFrame:nsrect];
1305 [impl->view setNeedsDisplay:YES];
1308 gdk_region_destroy (expose_region);
1309 gdk_region_destroy (old_region);
1313 GDK_QUARTZ_RELEASE_POOL;
1317 window_quartz_move (GdkWindow *window,
1321 g_return_if_fail (GDK_IS_WINDOW (window));
1323 if (((GdkWindowObject *)window)->state & GDK_WINDOW_STATE_FULLSCREEN)
1326 move_resize_window_internal (window, x, y, -1, -1);
1330 window_quartz_resize (GdkWindow *window,
1334 g_return_if_fail (GDK_IS_WINDOW (window));
1336 if (((GdkWindowObject *)window)->state & GDK_WINDOW_STATE_FULLSCREEN)
1344 move_resize_window_internal (window, -1, -1, width, height);
1348 window_quartz_move_resize (GdkWindow *window,
1359 move_resize_window_internal (window, x, y, width, height);
1363 gdk_window_quartz_move_resize (GdkWindow *window,
1370 if (with_move && (width < 0 && height < 0))
1371 window_quartz_move (window, x, y);
1375 window_quartz_move_resize (window, x, y, width, height);
1377 window_quartz_resize (window, width, height);
1381 /* FIXME: This might need fixing (reparenting didn't work before client-side
1385 gdk_window_quartz_reparent (GdkWindow *window,
1386 GdkWindow *new_parent,
1390 GdkWindowObject *private, *old_parent_private, *new_parent_private;
1391 GdkWindowImplQuartz *impl, *old_parent_impl, *new_parent_impl;
1392 NSView *view, *new_parent_view;
1394 if (new_parent == _gdk_root)
1396 /* Could be added, just needs implementing. */
1397 g_warning ("Reparenting to root window is not supported yet in the Mac OS X backend");
1401 private = GDK_WINDOW_OBJECT (window);
1402 impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
1405 new_parent_private = GDK_WINDOW_OBJECT (new_parent);
1406 new_parent_impl = GDK_WINDOW_IMPL_QUARTZ (new_parent_private->impl);
1407 new_parent_view = new_parent_impl->view;
1409 old_parent_private = GDK_WINDOW_OBJECT (private->parent);
1410 old_parent_impl = GDK_WINDOW_IMPL_QUARTZ (old_parent_private->impl);
1414 [view removeFromSuperview];
1415 [new_parent_view addSubview:view];
1419 private->parent = new_parent_private;
1421 if (old_parent_private)
1423 old_parent_impl->sorted_children = g_list_remove (old_parent_impl->sorted_children, window);
1426 new_parent_impl->sorted_children = g_list_prepend (new_parent_impl->sorted_children, window);
1431 /* Get the toplevel ordering from NSApp and update our own list. We do
1432 * this on demand since the NSApp's list is not up to date directly
1433 * after we get windowDidBecomeMain.
1436 update_toplevel_order (void)
1438 GdkWindowObject *root;
1439 GdkWindowImplQuartz *root_impl;
1440 NSEnumerator *enumerator;
1442 GList *toplevels = NULL;
1444 root = GDK_WINDOW_OBJECT (_gdk_root);
1445 root_impl = GDK_WINDOW_IMPL_QUARTZ (root->impl);
1447 if (root_impl->sorted_children)
1450 GDK_QUARTZ_ALLOC_POOL;
1452 enumerator = [[NSApp orderedWindows] objectEnumerator];
1453 while ((nswindow = [enumerator nextObject]))
1457 if (![[nswindow contentView] isKindOfClass:[GdkQuartzView class]])
1460 window = [(GdkQuartzView *)[nswindow contentView] gdkWindow];
1461 toplevels = g_list_prepend (toplevels, window);
1464 GDK_QUARTZ_RELEASE_POOL;
1466 root_impl->sorted_children = g_list_reverse (toplevels);
1470 clear_toplevel_order (void)
1472 GdkWindowObject *root;
1473 GdkWindowImplQuartz *root_impl;
1475 root = GDK_WINDOW_OBJECT (_gdk_root);
1476 root_impl = GDK_WINDOW_IMPL_QUARTZ (root->impl);
1478 g_list_free (root_impl->sorted_children);
1479 root_impl->sorted_children = NULL;
1483 gdk_window_quartz_raise (GdkWindow *window)
1485 if (GDK_WINDOW_DESTROYED (window))
1488 if (WINDOW_IS_TOPLEVEL (window))
1490 GdkWindowImplQuartz *impl;
1492 impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (window)->impl);
1493 [impl->toplevel orderFront:impl->toplevel];
1495 clear_toplevel_order ();
1499 GdkWindowObject *parent = GDK_WINDOW_OBJECT (window)->parent;
1503 GdkWindowImplQuartz *impl;
1505 impl = (GdkWindowImplQuartz *)parent->impl;
1507 impl->sorted_children = g_list_remove (impl->sorted_children, window);
1508 impl->sorted_children = g_list_prepend (impl->sorted_children, window);
1514 gdk_window_quartz_lower (GdkWindow *window)
1516 if (GDK_WINDOW_DESTROYED (window))
1519 if (WINDOW_IS_TOPLEVEL (window))
1521 GdkWindowImplQuartz *impl;
1523 impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (window)->impl);
1524 [impl->toplevel orderBack:impl->toplevel];
1526 clear_toplevel_order ();
1530 GdkWindowObject *parent = GDK_WINDOW_OBJECT (window)->parent;
1534 GdkWindowImplQuartz *impl;
1536 impl = (GdkWindowImplQuartz *)parent->impl;
1538 impl->sorted_children = g_list_remove (impl->sorted_children, window);
1539 impl->sorted_children = g_list_append (impl->sorted_children, window);
1545 gdk_window_quartz_set_background (GdkWindow *window,
1546 const GdkColor *color)
1548 /* FIXME: We could theoretically set the background color for toplevels
1549 * here. (Currently we draw the background before emitting expose events)
1554 gdk_window_quartz_set_back_pixmap (GdkWindow *window,
1557 /* FIXME: Could theoretically set some background image here. (Currently
1558 * the back pixmap is drawn before emitting expose events.
1563 gdk_window_quartz_set_cursor (GdkWindow *window,
1566 GdkCursorPrivate *cursor_private;
1569 cursor_private = (GdkCursorPrivate *)cursor;
1571 if (GDK_WINDOW_DESTROYED (window))
1575 nscursor = [NSCursor arrowCursor];
1577 nscursor = cursor_private->nscursor;
1583 gdk_window_quartz_get_geometry (GdkWindow *window,
1590 GdkWindowImplQuartz *impl;
1591 GdkWindowObject *private;
1594 if (GDK_WINDOW_DESTROYED (window))
1597 impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (window)->impl);
1598 private = GDK_WINDOW_OBJECT (window);
1599 if (window == _gdk_root)
1607 *width = private->width;
1609 *height = private->height;
1611 else if (WINDOW_IS_TOPLEVEL (window))
1613 ns_rect = [impl->toplevel contentRectForFrameRect:[impl->toplevel frame]];
1615 /* This doesn't work exactly as in X. There doesn't seem to be a
1616 * way to get the coords relative to the parent window (usually
1617 * the window frame), but that seems useless except for
1618 * borderless windows where it's relative to the root window. So
1619 * we return (0, 0) (should be something like (0, 22)) for
1620 * windows with borders and the root relative coordinates
1623 if ([impl->toplevel styleMask] == NSBorderlessWindowMask)
1626 *x = ns_rect.origin.x;
1628 *y = _gdk_quartz_window_get_inverted_screen_y (ns_rect.origin.y + ns_rect.size.height);
1639 *width = ns_rect.size.width;
1641 *height = ns_rect.size.height;
1645 ns_rect = [impl->view frame];
1648 *x = ns_rect.origin.x;
1650 *y = ns_rect.origin.y;
1652 *width = ns_rect.size.width;
1654 *height = ns_rect.size.height;
1658 *depth = gdk_drawable_get_depth (window);
1662 gdk_window_quartz_get_root_coords (GdkWindow *window,
1668 GdkWindowObject *private;
1669 int tmp_x = 0, tmp_y = 0;
1670 GdkWindow *toplevel;
1671 NSRect content_rect;
1672 GdkWindowImplQuartz *impl;
1674 if (GDK_WINDOW_DESTROYED (window))
1684 if (window == _gdk_root)
1694 private = GDK_WINDOW_OBJECT (window);
1696 toplevel = gdk_window_get_toplevel (window);
1697 impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (toplevel)->impl);
1699 content_rect = [impl->toplevel contentRectForFrameRect:[impl->toplevel frame]];
1701 tmp_x = x + content_rect.origin.x;
1702 tmp_y = y + _gdk_quartz_window_get_inverted_screen_y (content_rect.origin.y + content_rect.size.height);
1704 while (private != GDK_WINDOW_OBJECT (toplevel))
1706 if (_gdk_window_has_impl ((GdkWindow *)private))
1708 tmp_x += private->x;
1709 tmp_y += private->y;
1712 private = private->parent;
1724 gdk_window_quartz_get_deskrelative_origin (GdkWindow *window,
1728 return gdk_window_get_origin (window, x, y);
1732 gdk_window_get_root_origin (GdkWindow *window,
1741 gdk_window_get_frame_extents (window, &rect);
1750 /* Returns coordinates relative to the passed in window. */
1752 gdk_window_quartz_get_pointer_helper (GdkWindow *window,
1755 GdkModifierType *mask)
1757 GdkWindowObject *toplevel;
1758 GdkWindowObject *private;
1761 GdkWindow *found_window;
1763 g_return_val_if_fail (window == NULL || GDK_IS_WINDOW (window), NULL);
1765 if (GDK_WINDOW_DESTROYED (window))
1773 toplevel = GDK_WINDOW_OBJECT (gdk_window_get_toplevel (window));
1775 *mask = _gdk_quartz_events_get_current_event_mask ();
1777 /* Get the y coordinate, needs to be flipped. */
1778 if (window == _gdk_root)
1780 point = [NSEvent mouseLocation];
1782 y_tmp = _gdk_quartz_window_get_inverted_screen_y (point.y);
1786 GdkWindowImplQuartz *impl;
1789 impl = GDK_WINDOW_IMPL_QUARTZ (toplevel->impl);
1790 private = GDK_WINDOW_OBJECT (toplevel);
1791 nswindow = impl->toplevel;
1793 point = [nswindow mouseLocationOutsideOfEventStream];
1796 y_tmp = private->height - point.y;
1798 window = (GdkWindow *)toplevel;
1801 found_window = _gdk_quartz_window_find_child (window, x_tmp, y_tmp);
1803 /* We never return the root window. */
1804 if (found_window == _gdk_root)
1805 found_window = NULL;
1810 return found_window;
1814 gdk_window_quartz_get_pointer (GdkWindow *window,
1817 GdkModifierType *mask)
1819 return gdk_window_quartz_get_pointer_helper (window, x, y, mask) != NULL;
1822 /* Returns coordinates relative to the root. */
1824 _gdk_windowing_get_pointer (GdkDisplay *display,
1828 GdkModifierType *mask)
1830 g_return_if_fail (display == _gdk_display);
1832 *screen = _gdk_screen;
1833 gdk_window_quartz_get_pointer_helper (_gdk_root, x, y, mask);
1837 gdk_display_warp_pointer (GdkDisplay *display,
1842 CGDisplayMoveCursorToPoint (CGMainDisplayID (), CGPointMake (x, y));
1845 /* Returns coordinates relative to the found window. */
1847 _gdk_windowing_window_at_pointer (GdkDisplay *display,
1850 GdkModifierType *mask)
1852 GdkWindow *found_window;
1854 GdkModifierType tmp_mask = 0;
1856 found_window = gdk_window_quartz_get_pointer_helper (_gdk_root,
1861 GdkWindowObject *private;
1863 /* The coordinates returned above are relative the root, we want
1864 * coordinates relative the window here.
1866 private = GDK_WINDOW_OBJECT (found_window);
1867 while (private != GDK_WINDOW_OBJECT (_gdk_root))
1872 private = private->parent;
1880 /* Mimic the X backend here, -1,-1 for unknown windows. */
1888 return found_window;
1892 gdk_window_quartz_get_events (GdkWindow *window)
1894 if (GDK_WINDOW_DESTROYED (window))
1897 return GDK_WINDOW_OBJECT (window)->event_mask;
1901 gdk_window_quartz_set_events (GdkWindow *window,
1902 GdkEventMask event_mask)
1904 /* The mask is set in the common code. */
1908 gdk_window_set_urgency_hint (GdkWindow *window,
1911 if (GDK_WINDOW_DESTROYED (window) ||
1912 !WINDOW_IS_TOPLEVEL (window))
1915 /* FIXME: Implement */
1919 gdk_window_set_geometry_hints (GdkWindow *window,
1920 const GdkGeometry *geometry,
1921 GdkWindowHints geom_mask)
1923 GdkWindowImplQuartz *impl;
1925 g_return_if_fail (geometry != NULL);
1927 if (GDK_WINDOW_DESTROYED (window) ||
1928 !WINDOW_IS_TOPLEVEL (window))
1931 impl = GDK_WINDOW_IMPL_QUARTZ (((GdkWindowObject *) window)->impl);
1932 if (!impl->toplevel)
1935 if (geom_mask & GDK_HINT_POS)
1937 /* FIXME: Implement */
1940 if (geom_mask & GDK_HINT_USER_POS)
1942 /* FIXME: Implement */
1945 if (geom_mask & GDK_HINT_USER_SIZE)
1947 /* FIXME: Implement */
1950 if (geom_mask & GDK_HINT_MIN_SIZE)
1954 size.width = geometry->min_width;
1955 size.height = geometry->min_height;
1957 [impl->toplevel setContentMinSize:size];
1960 if (geom_mask & GDK_HINT_MAX_SIZE)
1964 size.width = geometry->max_width;
1965 size.height = geometry->max_height;
1967 [impl->toplevel setContentMaxSize:size];
1970 if (geom_mask & GDK_HINT_BASE_SIZE)
1972 /* FIXME: Implement */
1975 if (geom_mask & GDK_HINT_RESIZE_INC)
1979 size.width = geometry->width_inc;
1980 size.height = geometry->height_inc;
1982 [impl->toplevel setContentResizeIncrements:size];
1985 if (geom_mask & GDK_HINT_ASPECT)
1987 /* FIXME: Implement */
1990 if (geom_mask & GDK_HINT_WIN_GRAVITY)
1992 /* FIXME: Implement */
1997 gdk_window_set_title (GdkWindow *window,
2000 GdkWindowImplQuartz *impl;
2002 g_return_if_fail (title != NULL);
2004 if (GDK_WINDOW_DESTROYED (window) ||
2005 WINDOW_IS_TOPLEVEL (window))
2008 impl = GDK_WINDOW_IMPL_QUARTZ (((GdkWindowObject *)window)->impl);
2012 GDK_QUARTZ_ALLOC_POOL;
2013 [impl->toplevel setTitle:[NSString stringWithUTF8String:title]];
2014 GDK_QUARTZ_RELEASE_POOL;
2019 gdk_window_set_role (GdkWindow *window,
2022 if (GDK_WINDOW_DESTROYED (window) ||
2023 WINDOW_IS_TOPLEVEL (window))
2026 /* FIXME: Implement */
2030 gdk_window_set_transient_for (GdkWindow *window,
2033 GdkWindowImplQuartz *window_impl;
2034 GdkWindowImplQuartz *parent_impl;
2036 if (!GDK_WINDOW_DESTROYED (window) && !GDK_WINDOW_DESTROYED (parent) &&
2037 WINDOW_IS_TOPLEVEL (window))
2040 window_impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (window)->impl);
2041 if (!window_impl->toplevel)
2044 GDK_QUARTZ_ALLOC_POOL;
2046 if (window_impl->transient_for)
2048 _gdk_quartz_window_detach_from_parent (window);
2050 g_object_unref (window_impl->transient_for);
2051 window_impl->transient_for = NULL;
2054 parent_impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (parent)->impl);
2055 if (parent_impl->toplevel)
2057 /* We save the parent because it needs to be unset/reset when
2058 * hiding and showing the window.
2061 /* We don't set transients for tooltips, they are already
2062 * handled by the window level being the top one. If we do, then
2063 * the parent window will be brought to the top just because the
2064 * tooltip is, which is not what we want.
2066 if (gdk_window_get_type_hint (window) != GDK_WINDOW_TYPE_HINT_TOOLTIP)
2068 window_impl->transient_for = g_object_ref (parent);
2070 /* We only add the window if it is shown, otherwise it will
2071 * be shown unconditionally here. If it is not shown, the
2072 * window will be added in show() instead.
2074 if (!(GDK_WINDOW_OBJECT (window)->state & GDK_WINDOW_STATE_WITHDRAWN))
2075 _gdk_quartz_window_attach_to_parent (window);
2079 GDK_QUARTZ_RELEASE_POOL;
2083 gdk_window_quartz_shape_combine_region (GdkWindow *window,
2084 const GdkRegion *shape,
2088 /* FIXME: Implement */
2092 gdk_window_quartz_input_shape_combine_region (GdkWindow *window,
2093 const GdkRegion *shape_region,
2097 /* FIXME: Implement */
2101 gdk_window_set_override_redirect (GdkWindow *window,
2102 gboolean override_redirect)
2104 /* FIXME: Implement */
2108 gdk_window_set_accept_focus (GdkWindow *window,
2109 gboolean accept_focus)
2111 GdkWindowObject *private;
2113 private = (GdkWindowObject *)window;
2115 private->accept_focus = accept_focus != FALSE;
2119 gdk_window_quartz_set_static_gravities (GdkWindow *window,
2120 gboolean use_static)
2122 if (GDK_WINDOW_DESTROYED (window) ||
2123 !WINDOW_IS_TOPLEVEL (window))
2126 /* FIXME: Implement */
2131 gdk_window_set_focus_on_map (GdkWindow *window,
2132 gboolean focus_on_map)
2134 GdkWindowObject *private;
2136 private = (GdkWindowObject *)window;
2138 private->focus_on_map = focus_on_map != FALSE;
2142 gdk_window_set_icon (GdkWindow *window,
2143 GdkWindow *icon_window,
2147 /* FIXME: Implement */
2151 gdk_window_set_icon_name (GdkWindow *window,
2154 /* FIXME: Implement */
2158 gdk_window_focus (GdkWindow *window,
2161 GdkWindowObject *private;
2162 GdkWindowImplQuartz *impl;
2164 private = (GdkWindowObject*) window;
2165 impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
2167 if (GDK_WINDOW_DESTROYED (window) ||
2168 !WINDOW_IS_TOPLEVEL (window))
2171 if (private->accept_focus && private->window_type != GDK_WINDOW_TEMP)
2173 GDK_QUARTZ_ALLOC_POOL;
2174 [impl->toplevel makeKeyAndOrderFront:impl->toplevel];
2175 clear_toplevel_order ();
2176 GDK_QUARTZ_RELEASE_POOL;
2181 gdk_window_set_hints (GdkWindow *window,
2190 /* FIXME: Implement */
2194 gint window_type_hint_to_level (GdkWindowTypeHint hint)
2198 case GDK_WINDOW_TYPE_HINT_DOCK:
2199 case GDK_WINDOW_TYPE_HINT_UTILITY:
2200 return NSFloatingWindowLevel;
2202 case GDK_WINDOW_TYPE_HINT_MENU: /* Torn-off menu */
2203 case GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU: /* Menu from menubar */
2204 return NSTornOffMenuWindowLevel;
2206 case GDK_WINDOW_TYPE_HINT_NOTIFICATION:
2207 case GDK_WINDOW_TYPE_HINT_TOOLTIP:
2208 return NSStatusWindowLevel;
2210 case GDK_WINDOW_TYPE_HINT_SPLASHSCREEN:
2211 case GDK_WINDOW_TYPE_HINT_POPUP_MENU:
2212 case GDK_WINDOW_TYPE_HINT_COMBO:
2213 case GDK_WINDOW_TYPE_HINT_DND:
2214 return NSPopUpMenuWindowLevel;
2216 case GDK_WINDOW_TYPE_HINT_NORMAL: /* Normal toplevel window */
2217 case GDK_WINDOW_TYPE_HINT_DIALOG: /* Dialog window */
2218 case GDK_WINDOW_TYPE_HINT_TOOLBAR: /* Window used to implement toolbars */
2219 case GDK_WINDOW_TYPE_HINT_DESKTOP: /* N/A */
2226 return NSNormalWindowLevel;
2230 window_type_hint_to_shadow (GdkWindowTypeHint hint)
2234 case GDK_WINDOW_TYPE_HINT_NORMAL: /* Normal toplevel window */
2235 case GDK_WINDOW_TYPE_HINT_DIALOG: /* Dialog window */
2236 case GDK_WINDOW_TYPE_HINT_DOCK:
2237 case GDK_WINDOW_TYPE_HINT_UTILITY:
2238 case GDK_WINDOW_TYPE_HINT_MENU: /* Torn-off menu */
2239 case GDK_WINDOW_TYPE_HINT_DROPDOWN_MENU: /* Menu from menubar */
2240 case GDK_WINDOW_TYPE_HINT_SPLASHSCREEN:
2241 case GDK_WINDOW_TYPE_HINT_POPUP_MENU:
2242 case GDK_WINDOW_TYPE_HINT_COMBO:
2243 case GDK_WINDOW_TYPE_HINT_NOTIFICATION:
2244 case GDK_WINDOW_TYPE_HINT_TOOLTIP:
2247 case GDK_WINDOW_TYPE_HINT_TOOLBAR: /* Window used to implement toolbars */
2248 case GDK_WINDOW_TYPE_HINT_DESKTOP: /* N/A */
2249 case GDK_WINDOW_TYPE_HINT_DND:
2261 gdk_window_set_type_hint (GdkWindow *window,
2262 GdkWindowTypeHint hint)
2264 GdkWindowImplQuartz *impl;
2266 if (GDK_WINDOW_DESTROYED (window) ||
2267 !WINDOW_IS_TOPLEVEL (window))
2270 impl = GDK_WINDOW_IMPL_QUARTZ (((GdkWindowObject *) window)->impl);
2272 impl->type_hint = hint;
2274 /* Match the documentation, only do something if we're not mapped yet. */
2275 if (GDK_WINDOW_IS_MAPPED (window))
2278 [impl->toplevel setHasShadow: window_type_hint_to_shadow (hint)];
2279 [impl->toplevel setLevel: window_type_hint_to_level (hint)];
2283 gdk_window_get_type_hint (GdkWindow *window)
2285 if (GDK_WINDOW_DESTROYED (window) ||
2286 !WINDOW_IS_TOPLEVEL (window))
2287 return GDK_WINDOW_TYPE_HINT_NORMAL;
2289 return GDK_WINDOW_IMPL_QUARTZ (((GdkWindowObject *) window)->impl)->type_hint;
2293 gdk_window_set_modal_hint (GdkWindow *window,
2296 if (GDK_WINDOW_DESTROYED (window) ||
2297 !WINDOW_IS_TOPLEVEL (window))
2300 /* FIXME: Implement */
2304 gdk_window_set_skip_taskbar_hint (GdkWindow *window,
2305 gboolean skips_taskbar)
2307 if (GDK_WINDOW_DESTROYED (window) ||
2308 !WINDOW_IS_TOPLEVEL (window))
2311 /* FIXME: Implement */
2315 gdk_window_set_skip_pager_hint (GdkWindow *window,
2316 gboolean skips_pager)
2318 if (GDK_WINDOW_DESTROYED (window) ||
2319 !WINDOW_IS_TOPLEVEL (window))
2322 /* FIXME: Implement */
2326 gdk_window_begin_resize_drag (GdkWindow *window,
2333 GdkWindowObject *private;
2334 GdkWindowImplQuartz *impl;
2336 g_return_if_fail (GDK_IS_WINDOW (window));
2338 if (edge != GDK_WINDOW_EDGE_SOUTH_EAST)
2340 g_warning ("Resizing is only implemented for GDK_WINDOW_EDGE_SOUTH_EAST on Mac OS");
2344 if (GDK_WINDOW_DESTROYED (window))
2347 private = GDK_WINDOW_OBJECT (window);
2348 impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
2350 if (!impl->toplevel)
2352 g_warning ("Can't call gdk_window_begin_resize_drag on non-toplevel window");
2356 [(GdkQuartzWindow *)impl->toplevel beginManualResize];
2360 gdk_window_begin_move_drag (GdkWindow *window,
2366 GdkWindowObject *private;
2367 GdkWindowImplQuartz *impl;
2369 if (GDK_WINDOW_DESTROYED (window) ||
2370 !WINDOW_IS_TOPLEVEL (window))
2373 private = GDK_WINDOW_OBJECT (window);
2374 impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
2376 if (!impl->toplevel)
2378 g_warning ("Can't call gdk_window_begin_move_drag on non-toplevel window");
2382 [(GdkQuartzWindow *)impl->toplevel beginManualMove];
2386 gdk_window_set_icon_list (GdkWindow *window,
2389 /* FIXME: Implement */
2393 gdk_window_get_frame_extents (GdkWindow *window,
2396 GdkWindowObject *private;
2397 GdkWindow *toplevel;
2398 GdkWindowImplQuartz *impl;
2401 g_return_if_fail (rect != NULL);
2403 private = GDK_WINDOW_OBJECT (window);
2410 toplevel = gdk_window_get_toplevel (window);
2411 impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (toplevel)->impl);
2413 ns_rect = [impl->toplevel frame];
2415 rect->x = ns_rect.origin.x;
2416 rect->y = _gdk_quartz_window_get_inverted_screen_y (ns_rect.origin.y + ns_rect.size.height);
2417 rect->width = ns_rect.size.width;
2418 rect->height = ns_rect.size.height;
2422 gdk_window_set_decorations (GdkWindow *window,
2423 GdkWMDecoration decorations)
2425 GdkWindowImplQuartz *impl;
2426 int old_mask, new_mask;
2429 if (GDK_WINDOW_DESTROYED (window) ||
2430 !WINDOW_IS_TOPLEVEL (window))
2433 impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (window)->impl);
2435 if (decorations == 0 || GDK_WINDOW_TYPE (window) == GDK_WINDOW_TEMP ||
2436 impl->type_hint == GDK_WINDOW_TYPE_HINT_SPLASHSCREEN )
2438 new_mask = NSBorderlessWindowMask;
2442 /* FIXME: Honor other GDK_DECOR_* flags. */
2443 new_mask = (NSTitledWindowMask | NSClosableWindowMask |
2444 NSMiniaturizableWindowMask | NSResizableWindowMask);
2447 GDK_QUARTZ_ALLOC_POOL;
2449 old_mask = [impl->toplevel styleMask];
2451 /* Note, there doesn't seem to be a way to change this without
2452 * recreating the toplevel. There might be bad side-effects of doing
2453 * that, but it seems alright.
2455 if (old_mask != new_mask)
2459 old_view = [impl->toplevel contentView];
2461 rect = [impl->toplevel frame];
2463 /* Properly update the size of the window when the titlebar is
2466 if (old_mask == NSBorderlessWindowMask &&
2467 new_mask != NSBorderlessWindowMask)
2469 rect = [NSWindow frameRectForContentRect:rect styleMask:new_mask];
2472 else if (old_mask != NSBorderlessWindowMask &&
2473 new_mask == NSBorderlessWindowMask)
2475 rect = [NSWindow contentRectForFrameRect:rect styleMask:old_mask];
2478 impl->toplevel = [impl->toplevel initWithContentRect:rect
2480 backing:NSBackingStoreBuffered
2483 [impl->toplevel setHasShadow: window_type_hint_to_shadow (impl->type_hint)];
2484 [impl->toplevel setLevel: window_type_hint_to_level (impl->type_hint)];
2486 [impl->toplevel setContentView:old_view];
2487 [impl->toplevel setFrame:rect display:YES];
2489 /* Invalidate the window shadow for non-opaque views that have shadow
2490 * enabled, to get the shadow shape updated.
2492 if (![old_view isOpaque] && [impl->toplevel hasShadow])
2493 [(GdkQuartzView*)old_view setNeedsInvalidateShadow:YES];
2496 GDK_QUARTZ_RELEASE_POOL;
2500 gdk_window_get_decorations (GdkWindow *window,
2501 GdkWMDecoration *decorations)
2503 GdkWindowImplQuartz *impl;
2505 if (GDK_WINDOW_DESTROYED (window) ||
2506 !WINDOW_IS_TOPLEVEL (window))
2509 impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (window)->impl);
2513 /* Borderless is 0, so we can't check it as a bit being set. */
2514 if ([impl->toplevel styleMask] == NSBorderlessWindowMask)
2520 /* FIXME: Honor the other GDK_DECOR_* flags. */
2521 *decorations = GDK_DECOR_ALL;
2529 gdk_window_set_functions (GdkWindow *window,
2530 GdkWMFunction functions)
2532 g_return_if_fail (GDK_IS_WINDOW (window));
2534 /* FIXME: Implement */
2538 _gdk_windowing_window_queue_antiexpose (GdkWindow *window,
2545 gdk_window_stick (GdkWindow *window)
2547 if (GDK_WINDOW_DESTROYED (window) ||
2548 !WINDOW_IS_TOPLEVEL (window))
2553 gdk_window_unstick (GdkWindow *window)
2555 if (GDK_WINDOW_DESTROYED (window) ||
2556 !WINDOW_IS_TOPLEVEL (window))
2561 gdk_window_maximize (GdkWindow *window)
2563 GdkWindowImplQuartz *impl;
2565 if (GDK_WINDOW_DESTROYED (window) ||
2566 !WINDOW_IS_TOPLEVEL (window))
2569 impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (window)->impl);
2571 if (GDK_WINDOW_IS_MAPPED (window))
2573 GDK_QUARTZ_ALLOC_POOL;
2575 if (impl->toplevel && ![impl->toplevel isZoomed])
2576 [impl->toplevel zoom:nil];
2578 GDK_QUARTZ_RELEASE_POOL;
2582 gdk_synthesize_window_state (window,
2584 GDK_WINDOW_STATE_MAXIMIZED);
2589 gdk_window_unmaximize (GdkWindow *window)
2591 GdkWindowImplQuartz *impl;
2593 if (GDK_WINDOW_DESTROYED (window) ||
2594 !WINDOW_IS_TOPLEVEL (window))
2597 impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (window)->impl);
2599 if (GDK_WINDOW_IS_MAPPED (window))
2601 GDK_QUARTZ_ALLOC_POOL;
2603 if (impl->toplevel && [impl->toplevel isZoomed])
2604 [impl->toplevel zoom:nil];
2606 GDK_QUARTZ_RELEASE_POOL;
2610 gdk_synthesize_window_state (window,
2611 GDK_WINDOW_STATE_MAXIMIZED,
2617 gdk_window_iconify (GdkWindow *window)
2619 GdkWindowImplQuartz *impl;
2621 if (GDK_WINDOW_DESTROYED (window) ||
2622 !WINDOW_IS_TOPLEVEL (window))
2625 impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (window)->impl);
2627 if (GDK_WINDOW_IS_MAPPED (window))
2629 GDK_QUARTZ_ALLOC_POOL;
2632 [impl->toplevel miniaturize:nil];
2634 GDK_QUARTZ_RELEASE_POOL;
2638 gdk_synthesize_window_state (window,
2640 GDK_WINDOW_STATE_ICONIFIED);
2645 gdk_window_deiconify (GdkWindow *window)
2647 GdkWindowImplQuartz *impl;
2649 if (GDK_WINDOW_DESTROYED (window) ||
2650 !WINDOW_IS_TOPLEVEL (window))
2653 impl = GDK_WINDOW_IMPL_QUARTZ (GDK_WINDOW_OBJECT (window)->impl);
2655 if (GDK_WINDOW_IS_MAPPED (window))
2657 GDK_QUARTZ_ALLOC_POOL;
2660 [impl->toplevel deminiaturize:nil];
2662 GDK_QUARTZ_RELEASE_POOL;
2666 gdk_synthesize_window_state (window,
2667 GDK_WINDOW_STATE_ICONIFIED,
2672 static FullscreenSavedGeometry *
2673 get_fullscreen_geometry (GdkWindow *window)
2675 return g_object_get_data (G_OBJECT (window), FULLSCREEN_DATA);
2679 gdk_window_fullscreen (GdkWindow *window)
2681 FullscreenSavedGeometry *geometry;
2682 GdkWindowObject *private = (GdkWindowObject *) window;
2685 if (GDK_WINDOW_DESTROYED (window) ||
2686 !WINDOW_IS_TOPLEVEL (window))
2689 geometry = get_fullscreen_geometry (window);
2692 geometry = g_new (FullscreenSavedGeometry, 1);
2694 geometry->x = private->x;
2695 geometry->y = private->y;
2696 geometry->width = private->width;
2697 geometry->height = private->height;
2699 if (!gdk_window_get_decorations (window, &geometry->decor))
2700 geometry->decor = GDK_DECOR_ALL;
2702 g_object_set_data_full (G_OBJECT (window),
2703 FULLSCREEN_DATA, geometry,
2706 gdk_window_set_decorations (window, 0);
2708 frame = [[NSScreen mainScreen] frame];
2709 move_resize_window_internal (window,
2711 frame.size.width, frame.size.height);
2714 SetSystemUIMode (kUIModeAllHidden, kUIOptionAutoShowMenuBar);
2716 gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_FULLSCREEN);
2720 gdk_window_unfullscreen (GdkWindow *window)
2722 FullscreenSavedGeometry *geometry;
2724 if (GDK_WINDOW_DESTROYED (window) ||
2725 !WINDOW_IS_TOPLEVEL (window))
2728 geometry = get_fullscreen_geometry (window);
2731 SetSystemUIMode (kUIModeNormal, 0);
2733 move_resize_window_internal (window,
2739 gdk_window_set_decorations (window, geometry->decor);
2741 g_object_set_data (G_OBJECT (window), FULLSCREEN_DATA, NULL);
2743 gdk_synthesize_window_state (window, GDK_WINDOW_STATE_FULLSCREEN, 0);
2748 gdk_window_set_keep_above (GdkWindow *window, gboolean setting)
2750 GdkWindowObject *private = (GdkWindowObject *) window;
2751 GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
2754 g_return_if_fail (GDK_IS_WINDOW (window));
2756 if (GDK_WINDOW_DESTROYED (window) ||
2757 !WINDOW_IS_TOPLEVEL (window))
2760 level = window_type_hint_to_level (gdk_window_get_type_hint (window));
2762 /* Adjust normal window level by one if necessary. */
2763 [impl->toplevel setLevel: level + (setting ? 1 : 0)];
2767 gdk_window_set_keep_below (GdkWindow *window, gboolean setting)
2769 GdkWindowObject *private = (GdkWindowObject *) window;
2770 GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
2773 g_return_if_fail (GDK_IS_WINDOW (window));
2775 if (GDK_WINDOW_DESTROYED (window) ||
2776 !WINDOW_IS_TOPLEVEL (window))
2779 level = window_type_hint_to_level (gdk_window_get_type_hint (window));
2781 /* Adjust normal window level by one if necessary. */
2782 [impl->toplevel setLevel: level - (setting ? 1 : 0)];
2786 gdk_window_get_group (GdkWindow *window)
2788 g_return_val_if_fail (GDK_WINDOW_TYPE (window) != GDK_WINDOW_CHILD, NULL);
2790 if (GDK_WINDOW_DESTROYED (window) ||
2791 !WINDOW_IS_TOPLEVEL (window))
2794 /* FIXME: Implement */
2800 gdk_window_set_group (GdkWindow *window,
2803 /* FIXME: Implement */
2807 gdk_window_foreign_new_for_display (GdkDisplay *display,
2808 GdkNativeWindow anid)
2810 /* Foreign windows aren't supported in Mac OS X */
2815 gdk_window_lookup (GdkNativeWindow anid)
2817 /* Foreign windows aren't supported in Mac OS X */
2822 gdk_window_lookup_for_display (GdkDisplay *display, GdkNativeWindow anid)
2824 /* Foreign windows aren't supported in Mac OS X */
2829 gdk_window_enable_synchronized_configure (GdkWindow *window)
2834 gdk_window_configure_finished (GdkWindow *window)
2839 gdk_window_destroy_notify (GdkWindow *window)
2841 check_grab_destroy (window);
2845 _gdk_windowing_window_beep (GdkWindow *window)
2847 g_return_if_fail (GDK_IS_WINDOW (window));
2849 gdk_display_beep (_gdk_display);
2853 gdk_window_set_opacity (GdkWindow *window,
2856 GdkWindowObject *private = (GdkWindowObject *) window;
2857 GdkWindowImplQuartz *impl = GDK_WINDOW_IMPL_QUARTZ (private->impl);
2859 g_return_if_fail (GDK_IS_WINDOW (window));
2860 g_return_if_fail (WINDOW_IS_TOPLEVEL (window));
2862 if (GDK_WINDOW_DESTROYED (window) ||
2863 !WINDOW_IS_TOPLEVEL (window))
2868 else if (opacity > 1)
2871 [impl->toplevel setAlphaValue: opacity];
2875 _gdk_windowing_window_set_composited (GdkWindow *window, gboolean composited)
2880 _gdk_windowing_get_shape_for_mask (GdkBitmap *mask)
2882 /* FIXME: implement */
2887 _gdk_windowing_window_get_shape (GdkWindow *window)
2889 /* FIXME: implement */
2894 _gdk_windowing_window_get_input_shape (GdkWindow *window)
2896 /* FIXME: implement */
2901 gdk_window_impl_iface_init (GdkWindowImplIface *iface)
2903 iface->show = gdk_window_quartz_show;
2904 iface->hide = gdk_window_quartz_hide;
2905 iface->withdraw = gdk_window_quartz_withdraw;
2906 iface->set_events = gdk_window_quartz_set_events;
2907 iface->get_events = gdk_window_quartz_get_events;
2908 iface->raise = gdk_window_quartz_raise;
2909 iface->lower = gdk_window_quartz_lower;
2910 iface->move_resize = gdk_window_quartz_move_resize;
2911 iface->set_background = gdk_window_quartz_set_background;
2912 iface->set_back_pixmap = gdk_window_quartz_set_back_pixmap;
2913 iface->reparent = gdk_window_quartz_reparent;
2914 iface->set_cursor = gdk_window_quartz_set_cursor;
2915 iface->get_geometry = gdk_window_quartz_get_geometry;
2916 iface->get_root_coords = gdk_window_quartz_get_root_coords;
2917 iface->get_pointer = gdk_window_quartz_get_pointer;
2918 iface->get_deskrelative_origin = gdk_window_quartz_get_deskrelative_origin;
2919 iface->shape_combine_region = gdk_window_quartz_shape_combine_region;
2920 iface->input_shape_combine_region = gdk_window_quartz_input_shape_combine_region;
2921 iface->set_static_gravities = gdk_window_quartz_set_static_gravities;
2922 iface->queue_antiexpose = _gdk_quartz_window_queue_antiexpose;
2923 iface->queue_translation = _gdk_quartz_window_queue_translation;
2924 iface->destroy = _gdk_quartz_window_destroy;