From a1a0205dad4d98780fe9e7353f738aa8c9400eaf Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 17 Dec 2010 12:01:54 -0500 Subject: [PATCH] Implment process_updates_recurse vfunc for quartz --- gdk/quartz/gdkcursor-quartz.c | 58 ++++++++++++++-------------------- gdk/quartz/gdkdisplay-quartz.c | 9 +++++- gdk/quartz/gdkprivate-quartz.h | 20 ++++++++++++ gdk/quartz/gdkwindow-quartz.c | 9 +++--- 4 files changed, 57 insertions(+), 39 deletions(-) diff --git a/gdk/quartz/gdkcursor-quartz.c b/gdk/quartz/gdkcursor-quartz.c index 0e22fb7d24..62f19a6dc2 100644 --- a/gdk/quartz/gdkcursor-quartz.c +++ b/gdk/quartz/gdkcursor-quartz.c @@ -175,14 +175,14 @@ create_builtin_cursor (GdkCursorType cursor_type) } GdkCursor* -gdk_cursor_new_for_display (GdkDisplay *display, - GdkCursorType cursor_type) +_gdk_quartz_display_get_cursor_for_type (GdkDisplay *display, + GdkCursorType cursor_type) { NSCursor *nscursor; g_return_val_if_fail (display == gdk_display_get_default (), NULL); - switch (cursor_type) + switch (cursor_type) { case GDK_XTERM: nscursor = [NSCursor IBeamCursor]; @@ -303,21 +303,16 @@ _gdk_quartz_pixbuf_to_ns_image (GdkPixbuf *pixbuf) } GdkCursor * -gdk_cursor_new_from_pixbuf (GdkDisplay *display, - GdkPixbuf *pixbuf, - gint x, - gint y) +_gdk_quartz_display_get_cursor_for_pixbuf (GdkDisplay *display, + GdkPixbuf *pixbuf, + gint x, + gint y) { NSImage *image; NSCursor *nscursor; GdkCursor *cursor; gboolean has_alpha; - g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); - g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL); - g_return_val_if_fail (0 <= x && x < gdk_pixbuf_get_width (pixbuf), NULL); - g_return_val_if_fail (0 <= y && y < gdk_pixbuf_get_height (pixbuf), NULL); - GDK_QUARTZ_ALLOC_POOL; has_alpha = gdk_pixbuf_get_has_alpha (pixbuf); @@ -332,9 +327,9 @@ gdk_cursor_new_from_pixbuf (GdkDisplay *display, return cursor; } -GdkCursor* -gdk_cursor_new_from_name (GdkDisplay *display, - const gchar *name) +GdkCursor* +_gdk_quartz_display_get_cursor_for_name (GdkDisplay *display, + const gchar *name) { /* FIXME: Implement */ return NULL; @@ -354,38 +349,33 @@ _gdk_cursor_destroy (GdkCursor *cursor) g_free (private); } -gboolean -gdk_display_supports_cursor_alpha (GdkDisplay *display) +gboolean +_gdk_quartz_display_supports_cursor_alpha (GdkDisplay *display) { - g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE); - return TRUE; } -gboolean -gdk_display_supports_cursor_color (GdkDisplay *display) +gboolean +_gdk_quartz_display_supports_cursor_color (GdkDisplay *display) { - g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE); - return TRUE; } -guint -gdk_display_get_default_cursor_size (GdkDisplay *display) +void +_gdk_quartz_display_get_default_cursor_size (GdkDisplay *display, + guint *width, + guint *height) { - g_return_val_if_fail (GDK_IS_DISPLAY (display), 0); - /* Mac OS X doesn't have the notion of a default size */ - return 32; + *width = 32; + *height = 32; } -void -gdk_display_get_maximal_cursor_size (GdkDisplay *display, - guint *width, - guint *height) +void +_gdk_quartz_display_get_maximal_cursor_size (GdkDisplay *display, + guint *width, + guint *height) { - g_return_if_fail (GDK_IS_DISPLAY (display)); - /* Cursor sizes in Mac OS X can be arbitrarily large */ *width = 65536; *height = 65536; diff --git a/gdk/quartz/gdkdisplay-quartz.c b/gdk/quartz/gdkdisplay-quartz.c index f3a87a2ae3..ee37811588 100644 --- a/gdk/quartz/gdkdisplay-quartz.c +++ b/gdk/quartz/gdkdisplay-quartz.c @@ -193,7 +193,7 @@ G_DEFINE_TYPE (GdkDisplayQuartz, _gdk_display_quartz, GDK_TYPE_DISPLAY) static void _gdk_display_quartz_init (GdkDisplayQuartz *display) { - gdk_x11_display_manager_add_display (gdk_display_nmanager_get (), + gdk_quartz_display_manager_add_display (gdk_display_nmanager_get (), GDK_DISPLAY_OBJECT (display)); } @@ -241,4 +241,11 @@ _gdk_display_quartz_class_init (GdkDisplayQuartz *class) display_class->send_client_message = _gdk_quartz_display_send_client_message; display_class->add_client_message_filter = _gdk_quartz_display_add_client_message_filter; display_class->get_drag_protocol = _gdk_quartz_display_get_drag_protocol; + display_class->get_cursor_for_type = _gdk_quartz_display_get_cursor_for_type; + display_class->get_cursor_for_name = _gdk_quartz_display_get_cursor_for_name; + display_class->get_cursor_for_pixbuf = _gdk_quartz_display_get_cursor_for_pixbuf; + display_class->get_default_cursor_size = _gdk_quartz_display_get_default_cursor_size; + display_class->get_maximal_cursor_size = _gdk_quartz_display_get_maximal_cursor_size; + display_class->supports_cursor_alpha = _gdk_quartz_display_supports_cursor_alpha; + display_class->supports_cursor_color = _gdk_quartz_display_supports_cursor_color; } diff --git a/gdk/quartz/gdkprivate-quartz.h b/gdk/quartz/gdkprivate-quartz.h index 0cb56db27c..a742ffeaf9 100644 --- a/gdk/quartz/gdkprivate-quartz.h +++ b/gdk/quartz/gdkprivate-quartz.h @@ -155,6 +155,26 @@ GList * _gdk_quartz_display_list_devices (GdkDisplay *display); void _gdk_quartz_display_queue_events (GdkDisplay *display); gboolean _gdk_quartz_display_has_pending (GdkDisplay *display); +GdkCursor *_gdk_quartz_display_get_cursor_for_type (GdkDisplay *display, + GdkCursorType type); +GdkCursor *_gdk_quartz_display_get_cursor_for_name (GdkDisplay *display, + const gchar *name); +GdkCursor *_gdk_quartz_display_get_cursor_for_pixbuf (GdkDisplay *display, + GdkPixbuf *pixbuf, + gint x, + gint y); +gboolean _gdk_quartz_display_supports_cursor_alpha (GdkDisplay *display); +gboolean _gdk_quartz_display_supports_cursor_color (GdkDisplay *display); +void _gdk_quartz_display_get_default_cursor_size (GdkDisplay *display, + guint *width, + guint *height); +void _gdk_quartz_display_get_maximal_cursor_size (GdkDisplay *display, + guint *width, + guint *height); +void _gdk_quartz_display_before_process_all_updates (GdkDisplay *display); +void _gdk_quartz_display_after_process_all_updates (GdkDisplay *display); + + GdkDisplay * _gdk_quartz_display_open (const gchar *name); GdkNativeWinodw _gdk_quartz_display_get_drag_get_protocol (GdkDisplay *display, diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c index 37f07a4b21..4fbef442d2 100644 --- a/gdk/quartz/gdkwindow-quartz.c +++ b/gdk/quartz/gdkwindow-quartz.c @@ -424,8 +424,8 @@ _gdk_quartz_window_set_needs_display_in_region (GdkWindow *window, } void -_gdk_windowing_window_process_updates_recurse (GdkWindow *window, - cairo_region_t *region) +_gdk_quartz_window_process_updates_recurse (GdkWindow *window, + cairo_region_t *region) { /* Make sure to only flush each toplevel at most once if we're called * from process_all_updates. @@ -467,7 +467,7 @@ _gdk_windowing_window_process_updates_recurse (GdkWindow *window, } void -_gdk_windowing_before_process_all_updates (void) +_gdk_quartz_display_before_process_all_updates (GdkDisplay *display) { in_process_all_updates = TRUE; @@ -475,7 +475,7 @@ _gdk_windowing_before_process_all_updates (void) } void -_gdk_windowing_after_process_all_updates (void) +_gdk_quartz_display_after_process_all_updates (GdkDisplay *display) { GSList *old_update_nswindows = update_nswindows; GSList *tmp_list = update_nswindows; @@ -3122,6 +3122,7 @@ gdk_root_window_impl_quartz_class_init (GdkRootWindowImplQuartzClass *klass) impl_class->destroy_notify = gdk_quartz_window_destroy_notify; impl_class->register_dnd = _gdk_quartz_window_register_dnd; impl_class->drag_begin = _gdk_quartz_window_drag_begin; + impl_class->process_updates_recurse = gdk_x11_window_process_updates_recurse; } static void