quartz: convert GdkVisual

This commit is contained in:
Kristian Rietveld 2010-12-22 14:42:25 +01:00
parent d024153c96
commit 1b344ad8e4
2 changed files with 44 additions and 13 deletions

View File

@ -35,11 +35,6 @@
#include "config.h"
struct _GdkVisualClass
{
GObjectClass parent_class;
};
extern GdkDisplay *_gdk_display;
extern GdkScreen *_gdk_screen;
extern GdkWindow *_gdk_root;
@ -52,7 +47,6 @@ extern GdkDragContext *_gdk_quartz_drag_source_context;
void _gdk_windowing_update_window_sizes (GdkScreen *screen);
void _gdk_windowing_window_init (void);
void _gdk_quartz_events_init (void);
void _gdk_quartz_visual_init (GdkScreen *screen);
void _gdk_quartz_input_init (void);
void _gdk_quartz_event_loop_init (void);
@ -209,6 +203,7 @@ void _gdk_quartz_screen_query_depths (GdkScreen *scr
void _gdk_quartz_screen_query_visual_types (GdkScreen *screen,
GdkVisualType **visual_types,
gint *count);
void _gdk_quartz_screen_init_visuals (GdkScreen *screen);
GList * _gdk_quartz_screen_list_visuals (GdkScreen *screen);

View File

@ -23,6 +23,29 @@
#include "gdkvisualprivate.h"
#include "gdkprivate-quartz.h"
GType gdk_quartz_visual_get_type (void);
#define GDK_TYPE_QUARTZ_VISUAL (gdk_quartz_visual_get_type ())
#define GDK_QUARTZ_VISUAL(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_QUARTZ_VISUAL, GdkQuartzVisual))
#define GDK_QUARTZ_VISUAL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_QUARTZ_VISUAL, GdkQuartzVisualClass))
#define GDK_IS_QUARTZ_VISUAL(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_QUARTZ_VISUAL))
#define GDK_IS_QUARTZ_VISUAL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_QUARTZ_VISUAL))
#define GDK_QUARTZ_VISUAL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_QUARTZ_VISUAL, GdkQuartzVisualClass))
typedef struct _GdkQuartzVisual GdkQuartzVisual;
typedef struct _GdkQuartzVisualClass GdkQuartzVisualClass;
struct _GdkQuartzVisual
{
GdkVisual visual;
};
struct _GdkQuartzVisualClass
{
GdkVisualClass visual_class;
};
static GdkVisual *system_visual;
static GdkVisual *rgba_visual;
static GdkVisual *gray_visual;
@ -52,7 +75,7 @@ static GdkVisual *
create_standard_visual (GdkScreen *screen,
gint depth)
{
GdkVisual *visual = g_object_new (GDK_TYPE_VISUAL, NULL);
GdkVisual *visual = g_object_new (GDK_TYPE_QUARTZ_VISUAL, NULL);
visual->screen = screen;
@ -82,7 +105,7 @@ create_standard_visual (GdkScreen *screen,
static GdkVisual *
create_gray_visual (GdkScreen *screen)
{
GdkVisual *visual = g_object_new (GDK_TYPE_VISUAL, NULL);
GdkVisual *visual = g_object_new (GDK_TYPE_QUARTZ_VISUAL, NULL);
visual->screen = screen;
@ -95,12 +118,17 @@ create_gray_visual (GdkScreen *screen)
return visual;
}
void
_gdk_quartz_visual_init (GdkScreen *screen)
G_DEFINE_TYPE (GdkQuartzVisual, _gdk_quartz_visual, GDK_TYPE_VISUAL)
static void
_gdk_quartz_visual_init (GdkQuartzVisual *quartz_visual)
{
}
static void
_gdk_quartz_visual_class_init (GdkQuartzVisualClass *class)
{
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 ... */
@ -210,6 +238,14 @@ _gdk_quartz_screen_query_visual_types (GdkScreen *screen,
*visual_types = &system_visual->type;
}
void
_gdk_quartz_screen_init_visuals (GdkScreen *screen)
{
system_visual = create_standard_visual (screen, 24);
rgba_visual = create_standard_visual (screen, 32);
gray_visual = create_gray_visual (screen);
}
GList*
_gdk_quartz_screen_list_visuals (GdkScreen *screen)
{