quartz: Port gdkkeys-quartz.c to new API

This commit is contained in:
Kristian Rietveld 2010-12-22 14:29:24 +01:00
parent 6fe3100f14
commit cde6dade8f

View File

@ -54,6 +54,7 @@
#include <Carbon/Carbon.h>
#include <AppKit/NSEvent.h>
#include "gdk.h"
#include "gdkkeysprivate.h"
#include "gdkkeysyms.h"
#define NUM_KEYCODES 128
@ -61,16 +62,34 @@
static GdkKeymap *default_keymap = NULL;
typedef struct _GdkKeymapQuartz GdkKeymapQuartz;
typedef struct _GdkKeymapQuartzClass GdkKeymapQuartzClass;
G_DEFINE_TYPE (GdkKeyMapQuartz, _gdk_keymap_quartz, GDK_TYPE_KEYMAP)
#define GDK_TYPE_QUARTZ_KEYMAP (gdk_quartz_keymap_get_type ())
#define GDK_QUARTZ_KEYMAP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_QUARTZ_KEYMAP, GdkQuartzKeymap))
#define GDK_QUARTZ_KEYMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_QUARTZ_KEYMAP, GdkQuartzKeymapClass))
#define GDK_IS_QUARTZ_KEYMAP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GDK_TYPE_QUARTZ_KEYMAP))
#define GDK_IS_QUARTZ_KEYMAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GDK_TYPE_QUARTZ_KEYMAP))
#define GDK_QUARTZ_KEYMAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GDK_TYPE_QUARTZ_KEYMAP, GdkQuartzKeymapClass))
typedef struct _GdkQuartzKeymap GdkQuartzKeymap;
typedef struct _GdkQuartzKeymapClass GdkQuartzKeymapClass;
struct _GdkQuartzKeymap
{
GdkKeymap keymap;
};
struct _GdkQuartzKeymapClass
{
GdkKeymapClass keymap_class;
};
G_DEFINE_TYPE (GdkQuartzKeymap, _gdk_quartz_keymap, GDK_TYPE_KEYMAP)
GdkKeymap *
_gdk_quartz_display_get_keymap (GdkDisplay *display)
{
if (default_keymap == NULL)
default_keymap = g_object_new (_gdk_keymap_quartz_get_type (), NULL);
default_keymap = g_object_new (_gdk_quartz_keymap_get_type (), NULL);
return default_keymap;
}
@ -734,23 +753,23 @@ _gdk_quartz_keys_is_modifier (guint keycode)
}
static void
_gdk_keymap_quartz_init (GdkKeymapQuartz *keymap)
_gdk_quartz_keymap_init (GdkQuartzKeymap *keymap)
{
}
static void
_gdk_keymap_quartz_finalize (GObject *object)
_gdk_quartz_keymap_finalize (GObject *object)
{
G_OBJECT_CLASS (_gdk_keymap_quartz_parent_class)->finalize (object);
G_OBJECT_CLASS (_gdk_quartz_keymap_parent_class)->finalize (object);
}
static void
_gdk_keymap_quartz_class_init (GdkKeymapQuartzClass *klass)
_gdk_quartz_keymap_class_init (GdkQuartzKeymapClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GdkKeymapClass *keymap_class = GDK_KEYMAP_CLASS (klass);
object_class->finalize = gdk_keymap_quartz_finalize;
object_class->finalize = _gdk_quartz_keymap_finalize;
keymap_class->get_direction = gdk_quartz_keymap_get_direction;
keymap_class->have_bidi_layouts = gdk_quartz_keymap_have_bidi_layouts;