diff options
author | Matthias Clasen <mclasen@redhat.com> | 2010-12-17 11:05:53 -0500 |
---|---|---|
committer | Kristian Rietveld <kris@gtk.org> | 2010-12-22 17:46:59 +0100 |
commit | e2fea748d663e0353475068ed2f94e6883760934 (patch) | |
tree | cadace40b12d6291660bf463dc64a0ffa20577f9 | |
parent | 46e8aadaf80345a8fd59b501f0f17483994916db (diff) | |
download | gtk+-e2fea748d663e0353475068ed2f94e6883760934.tar.gz |
Adapt quartz visual code to new ways
We may still need a subclass here later, not sure
-rw-r--r-- | gdk/quartz/gdkdisplay-quartz.c | 4 | ||||
-rw-r--r-- | gdk/quartz/gdkprivate-quartz.h | 2 | ||||
-rw-r--r-- | gdk/quartz/gdkvisual-quartz.c | 70 |
3 files changed, 16 insertions, 60 deletions
diff --git a/gdk/quartz/gdkdisplay-quartz.c b/gdk/quartz/gdkdisplay-quartz.c index 39e7bae9ae..2883136fe8 100644 --- a/gdk/quartz/gdkdisplay-quartz.c +++ b/gdk/quartz/gdkdisplay-quartz.c @@ -63,10 +63,10 @@ gdk_display_open (const gchar *display_name) _gdk_display = g_object_new (GDK_TYPE_DISPLAY, NULL); _gdk_display->device_manager = _gdk_device_manager_new (_gdk_display); - _gdk_visual_init (); - _gdk_screen = _gdk_screen_quartz_new (); + _gdk_quartz_visual_init (_gdk_screen); + _gdk_windowing_window_init (); _gdk_events_init (); diff --git a/gdk/quartz/gdkprivate-quartz.h b/gdk/quartz/gdkprivate-quartz.h index 160b4db54b..0608d4e76c 100644 --- a/gdk/quartz/gdkprivate-quartz.h +++ b/gdk/quartz/gdkprivate-quartz.h @@ -68,7 +68,7 @@ extern GdkDragContext *_gdk_quartz_drag_source_context; void _gdk_windowing_update_window_sizes (GdkScreen *screen); void _gdk_windowing_window_init (void); void _gdk_events_init (void); -void _gdk_visual_init (void); +void _gdk_quartz_visual_init (GdkScreen *screen); void _gdk_input_init (void); void _gdk_quartz_event_loop_init (void); diff --git a/gdk/quartz/gdkvisual-quartz.c b/gdk/quartz/gdkvisual-quartz.c index 4ac9ed7fe5..24f24f6ecc 100644 --- a/gdk/quartz/gdkvisual-quartz.c +++ b/gdk/quartz/gdkvisual-quartz.c @@ -20,7 +20,7 @@ #include "config.h" -#include "gdkvisual.h" +#include "gdkvisualprivate.h" #include "gdkprivate-quartz.h" static GdkVisual *system_visual; @@ -28,46 +28,6 @@ static GdkVisual *rgba_visual; static GdkVisual *gray_visual; static void -gdk_visual_finalize (GObject *object) -{ - g_error ("A GdkVisual object was finalized. This should not happen"); -} - -static void -gdk_visual_class_init (GObjectClass *class) -{ - class->finalize = gdk_visual_finalize; -} - -GType -gdk_visual_get_type (void) -{ - static GType object_type = 0; - - if (!object_type) - { - const GTypeInfo object_info = - { - sizeof (GdkVisualClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gdk_visual_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GdkVisual), - 0, /* n_preallocs */ - (GInstanceInitFunc) NULL, - }; - - object_type = g_type_register_static (G_TYPE_OBJECT, - "GdkVisual", - &object_info, 0); - } - - return object_type; -} - -static void gdk_visual_decompose_mask (gulong mask, gint *shift, gint *prec) @@ -89,14 +49,17 @@ gdk_visual_decompose_mask (gulong mask, } static GdkVisual * -create_standard_visual (gint depth) +create_standard_visual (GdkScreen *screen, + gint depth) { GdkVisual *visual = g_object_new (GDK_TYPE_VISUAL, NULL); + visual->screen = screen; + visual->depth = depth; visual->byte_order = GDK_MSB_FIRST; /* FIXME: Should this be different on intel macs? */ visual->colormap_size = 0; - + visual->type = GDK_VISUAL_TRUE_COLOR; visual->red_mask = 0xff0000; @@ -117,10 +80,12 @@ create_standard_visual (gint depth) } static GdkVisual * -create_gray_visual (void) +create_gray_visual (GdkScreen *screen) { GdkVisual *visual = g_object_new (GDK_TYPE_VISUAL, NULL); + visual->screen = screen; + visual->depth = 1; visual->byte_order = GDK_MSB_FIRST; visual->colormap_size = 0; @@ -131,11 +96,11 @@ create_gray_visual (void) } void -_gdk_visual_init (void) +_gdk_quartz_visual_init (GdkScreen *screen) { - system_visual = create_standard_visual (24); - rgba_visual = create_standard_visual (32); - gray_visual = create_gray_visual (); + system_visual = create_standard_visual (screen, 24); + rgba_visual = create_standard_visual (screen, 32); + gray_visual = create_gray_visual (screen); } /* We prefer the system visual for now ... */ @@ -256,12 +221,3 @@ _gdk_quartz_screen_list_visuals (GdkScreen *screen) return visuals; } - -GdkScreen * -gdk_visual_get_screen (GdkVisual *visual) -{ - g_return_val_if_fail (GDK_IS_VISUAL (visual), NULL); - - return gdk_screen_get_default (); -} - |