[gtk+/gdk-backend-quartz: 8/29] Adapt quartz visual code to new ways
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gdk-backend-quartz: 8/29] Adapt quartz visual code to new ways
- Date: Wed, 22 Dec 2010 02:31:41 +0000 (UTC)
commit 7d035928fd2eadff42779e7ca765c00057a4a9f7
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Dec 17 11:05:53 2010 -0500
Adapt quartz visual code to new ways
We may still need a subclass here later, not sure
gdk/quartz/gdkdisplay-quartz.c | 4 +-
gdk/quartz/gdkprivate-quartz.h | 2 +-
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 39e7bae..2883136 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 160b4db..0608d4e 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 4ac9ed7..24f24f6 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 ();
-}
-
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]