diff options
author | Matthias Clasen <mclasen@redhat.com> | 2018-02-19 18:29:00 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2018-02-24 21:34:40 -0500 |
commit | 29bcc38ae62e73b76f0f663e2ecc5e85bfe4ca46 (patch) | |
tree | cff130d8b76d27418228ece1187d98d79133e7c6 /modules/input/gtkimcontextxim.c | |
parent | e6bf832514c04a224c799413bdac7489c7fe9186 (diff) | |
download | gtk+-29bcc38ae62e73b76f0f663e2ecc5e85bfe4ca46.tar.gz |
Convert immodules to use an extension point
Add an extension point called gtk-im-module, which requires
the type GtkIMContext. Simplify the loading by using GIO
infrastructure. Drop the locale filtering for now, I don't
think it is really necessary nowadays.
Convert existing platform modules to gio modules.
Sill to do: Drop the conditional build machinery.
Either always include them, or never.
Diffstat (limited to 'modules/input/gtkimcontextxim.c')
-rw-r--r-- | modules/input/gtkimcontextxim.c | 59 |
1 files changed, 34 insertions, 25 deletions
diff --git a/modules/input/gtkimcontextxim.c b/modules/input/gtkimcontextxim.c index 05e98f051a..03ce3e727c 100644 --- a/modules/input/gtkimcontextxim.c +++ b/modules/input/gtkimcontextxim.c @@ -20,6 +20,7 @@ #include <string.h> #include <stdlib.h> +#include "gtkimmodule.h" #include "gtkimcontextxim.h" #include "gtk/gtkintl.h" @@ -145,38 +146,43 @@ static void xim_info_display_closed (GdkDisplay *display, gboolean is_error, GtkXIMInfo *info); -static GObjectClass *parent_class; +G_DEFINE_DYNAMIC_TYPE (GtkIMContextXIM, gtk_im_context_xim, GTK_TYPE_IM_CONTEXT) -GType gtk_type_im_context_xim = 0; +void +g_io_module_load (GIOModule *module) +{ + g_type_module_use (G_TYPE_MODULE (module)); -static GSList *open_ims = NULL; + g_print ("load io module for x11\n"); + gtk_im_context_xim_register_type (G_TYPE_MODULE (module)); -/* List of status windows for different toplevels */ -static GSList *status_windows = NULL; + g_io_extension_point_implement (GTK_IM_MODULE_EXTENSION_POINT_NAME, + GTK_TYPE_IM_CONTEXT_XIM, + "xim", + 10); +} void -gtk_im_context_xim_register_type (GTypeModule *type_module) +g_io_module_unload (GIOModule *module) { - const GTypeInfo im_context_xim_info = - { - sizeof (GtkIMContextXIMClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) gtk_im_context_xim_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (GtkIMContextXIM), - 0, - (GInstanceInitFunc) gtk_im_context_xim_init, +} + +char ** +g_io_module_query (void) +{ + char *eps[] = { + GTK_IM_MODULE_EXTENSION_POINT_NAME, + NULL }; - gtk_type_im_context_xim = - g_type_module_register_type (type_module, - GTK_TYPE_IM_CONTEXT, - "GtkIMContextXIM", - &im_context_xim_info, 0); + return g_strdupv (eps); } +static GSList *open_ims = NULL; + +/* List of status windows for different toplevels */ +static GSList *status_windows = NULL; + #define PREEDIT_MASK (XIMPreeditCallbacks | XIMPreeditPosition | \ XIMPreeditArea | XIMPreeditNothing | XIMPreeditNone) #define STATUS_MASK (XIMStatusCallbacks | XIMStatusArea | \ @@ -475,8 +481,6 @@ gtk_im_context_xim_class_init (GtkIMContextXIMClass *class) GtkIMContextClass *im_context_class = GTK_IM_CONTEXT_CLASS (class); GObjectClass *gobject_class = G_OBJECT_CLASS (class); - parent_class = g_type_class_peek_parent (class); - im_context_class->set_client_widget = gtk_im_context_xim_set_client_widget; im_context_class->filter_keypress = gtk_im_context_xim_filter_keypress; im_context_class->reset = gtk_im_context_xim_reset; @@ -489,6 +493,11 @@ gtk_im_context_xim_class_init (GtkIMContextXIMClass *class) } static void +gtk_im_context_xim_class_finalize (GtkIMContextXIMClass *class) +{ +} + +static void gtk_im_context_xim_init (GtkIMContextXIM *im_context_xim) { im_context_xim->use_preedit = TRUE; @@ -534,7 +543,7 @@ gtk_im_context_xim_finalize (GObject *obj) g_free (context_xim->locale); g_free (context_xim->mb_charset); - G_OBJECT_CLASS (parent_class)->finalize (obj); + G_OBJECT_CLASS (gtk_im_context_xim_parent_class)->finalize (obj); } static void |