mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-17 07:30:09 +00:00
Always include platform immodules
No need to load these as gio modules, we just include them in libgtk.
This commit is contained in:
parent
29bcc38ae6
commit
15cc20e7b5
@ -21,7 +21,7 @@
|
||||
#include "config.h"
|
||||
#include <string.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtk/gtkimcontextbroadway.h"
|
||||
#include "gtk/gtkintl.h"
|
||||
#include "gtk/gtkimmodule.h"
|
||||
|
||||
@ -42,38 +42,11 @@ typedef struct _GtkIMContextBroadwayClass
|
||||
GtkIMContextSimpleClass parent_class;
|
||||
} GtkIMContextBroadwayClass;
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE (GtkIMContextBroadway, gtk_im_context_broadway, GTK_TYPE_IM_CONTEXT_SIMPLE)
|
||||
|
||||
void
|
||||
g_io_module_load (GIOModule *module)
|
||||
{
|
||||
g_type_module_use (G_TYPE_MODULE (module));
|
||||
|
||||
g_print ("load io module for broadway\n");
|
||||
gtk_im_context_broadway_register_type (G_TYPE_MODULE (module));
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkIMContextBroadway, gtk_im_context_broadway, GTK_TYPE_IM_CONTEXT_SIMPLE,
|
||||
g_io_extension_point_implement (GTK_IM_MODULE_EXTENSION_POINT_NAME,
|
||||
GTK_TYPE_IM_CONTEXT_BROADWAY,
|
||||
g_define_type_id,
|
||||
"broadway",
|
||||
10);
|
||||
}
|
||||
|
||||
void
|
||||
g_io_module_unload (GIOModule *module)
|
||||
{
|
||||
}
|
||||
|
||||
char **
|
||||
g_io_module_query (void)
|
||||
{
|
||||
char *eps[] = {
|
||||
GTK_IM_MODULE_EXTENSION_POINT_NAME,
|
||||
NULL
|
||||
};
|
||||
|
||||
return g_strdupv (eps);
|
||||
}
|
||||
|
||||
10))
|
||||
|
||||
static void
|
||||
broadway_set_client_widget (GtkIMContext *context, GtkWidget *widget)
|
||||
@ -119,11 +92,6 @@ gtk_im_context_broadway_class_init (GtkIMContextBroadwayClass *class)
|
||||
klass->set_client_widget = broadway_set_client_widget;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_im_context_broadway_class_finalize (GtkIMContextBroadwayClass *class)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_im_context_broadway_init (GtkIMContextBroadway *im_context)
|
||||
{
|
29
gtk/gtkimcontextbroadway.h
Normal file
29
gtk/gtkimcontextbroadway.h
Normal file
@ -0,0 +1,29 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 2000 Red Hat Software
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_IM_CONTEXT_BROADWAY_H__
|
||||
#define __GTK_IM_CONTEXT_BROADWAY_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GType gtk_im_context_broadway_get_type (void) G_GNUC_CONST;
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_IM_CONTEXT_BROADWAY_H__ */
|
@ -128,36 +128,11 @@ static void cb_client_widget_hierarchy_changed (GtkWidget *widget,
|
||||
#define GTK_TYPE_IM_CONTEXT_IME (gtk_im_context_ime_get_type ())
|
||||
#define GTK_IM_CONTEXT_IME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_IM_CONTEXT_IME, GtkIMContextIME))
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE (GtkIMContextIME, gtk_im_context_ime, GTK_TYPE_IM_CONTEXT)
|
||||
|
||||
void
|
||||
g_io_module_load (GIOModule *module)
|
||||
{
|
||||
g_type_module_use (G_TYPE_MODULE (module));
|
||||
|
||||
gtk_im_context_ime_register_type (G_TYPE_MODULE (module));
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkIMContextIME, gtk_im_context_ime, GTK_TYPE_IM_CONTEXT,
|
||||
g_io_extension_point_implement (GTK_IM_MODULE_EXTENSION_POINT_NAME,
|
||||
GTK_TYPE_IM_CONTEXT_IME,
|
||||
g_define_type_id,
|
||||
"ime",
|
||||
10);
|
||||
}
|
||||
|
||||
void
|
||||
g_io_module_unload (GIOModule *module)
|
||||
{
|
||||
}
|
||||
|
||||
char **
|
||||
g_io_module_query (void)
|
||||
{
|
||||
char *eps[] = {
|
||||
GTK_IM_MODULE_EXTENSION_POINT_NAME,
|
||||
NULL
|
||||
};
|
||||
|
||||
return g_strdupv (eps);
|
||||
}
|
||||
10))
|
||||
|
||||
static void
|
||||
gtk_im_context_ime_class_init (GtkIMContextIMEClass *class)
|
||||
@ -180,11 +155,6 @@ gtk_im_context_ime_class_init (GtkIMContextIMEClass *class)
|
||||
im_context_class->set_use_preedit = gtk_im_context_ime_set_use_preedit;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_im_context_ime_class_finalize (GtkIMContextIMEClass *class)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_im_context_ime_init (GtkIMContextIME *context_ime)
|
||||
{
|
@ -21,7 +21,7 @@
|
||||
#include "config.h"
|
||||
#include <string.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtk/gtkimcontextquartz.h"
|
||||
#include "gtk/gtkintl.h"
|
||||
#include "gtk/gtkimmodule.h"
|
||||
|
||||
@ -50,41 +50,11 @@ typedef struct _GtkIMContextQuartzClass
|
||||
GtkIMContextClass parent_class;
|
||||
} GtkIMContextQuartzClass;
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE (GtkIMContextQuartz, gtk_im_context_quartz, GTK_TYPE_IM_CONTEXT)
|
||||
|
||||
void
|
||||
g_io_module_load (GIOModule *module)
|
||||
{
|
||||
g_type_module_use (G_TYPE_MODULE (module));
|
||||
|
||||
g_print ("load io module for quartz\n");
|
||||
gtk_im_context_quartz_register_type (G_TYPE_MODULE (module));
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkIMContextQuartz, gtk_im_context_quartz, GTK_TYPE_IM_CONTEXT,
|
||||
g_io_extension_point_implement (GTK_IM_MODULE_EXTENSION_POINT_NAME,
|
||||
GTK_TYPE_IM_CONTEXT_BROADWAY,
|
||||
g_define_type_id,
|
||||
"quartz",
|
||||
10);
|
||||
}
|
||||
|
||||
void
|
||||
g_io_module_unload (GIOModule *module)
|
||||
{
|
||||
}
|
||||
|
||||
char **
|
||||
g_io_module_query (void)
|
||||
{
|
||||
char *eps[] = {
|
||||
GTK_IM_MODULE_EXTENSION_POINT_NAME,
|
||||
NULL
|
||||
};
|
||||
|
||||
return g_strdupv (eps);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
10))
|
||||
|
||||
static void
|
||||
quartz_get_preedit_string (GtkIMContext *context,
|
||||
@ -396,11 +366,6 @@ gtk_im_context_quartz_class_init (GtkIMContextQuartzClass *class)
|
||||
object_class->finalize = imquartz_finalize;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_im_context_quartz_class_finalize (GtkIMContextQuartzClass *class)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_im_context_quartz_init (GtkIMContextQuartz *qc)
|
||||
{
|
29
gtk/gtkimcontextquartz.h
Normal file
29
gtk/gtkimcontextquartz.h
Normal file
@ -0,0 +1,29 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 2018 Red Hat Software
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_IM_CONTEXT_QUARTZ_H__
|
||||
#define __GTK_IM_CONTEXT_QUARTZ_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GType gtk_im_context_quartz_get_type (void) G_GNUC_CONST;
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_IM_CONTEXT_QUARTZ_H__ */
|
@ -20,7 +20,7 @@
|
||||
#include <string.h>
|
||||
#include <wayland-client-protocol.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include "gtk/gtkimcontextwayland.h"
|
||||
#include "gtk/gtkintl.h"
|
||||
#include "gtk/gtkimmodule.h"
|
||||
|
||||
@ -70,47 +70,15 @@ struct _GtkIMContextWayland
|
||||
guint use_preedit : 1;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkIMContextWayland, gtk_im_context_wayland, GTK_TYPE_IM_CONTEXT,
|
||||
g_io_extension_point_implement (GTK_IM_MODULE_EXTENSION_POINT_NAME,
|
||||
g_define_type_id,
|
||||
"wayland",
|
||||
10));
|
||||
|
||||
static GtkIMContextWaylandGlobal *global = NULL;
|
||||
|
||||
static void gtk_im_context_wayland_global_init (GdkDisplay *display);
|
||||
|
||||
#define GTK_TYPE_IM_CONTEXT_WAYLAND (gtk_im_context_wayland_get_type ())
|
||||
#define GTK_IM_CONTEXT_WAYLAND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_IM_CONTEXT_WAYLAND, GtkIMContextWayland))
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE (GtkIMContextWayland, gtk_im_context_wayland, GTK_TYPE_IM_CONTEXT_SIMPLE)
|
||||
|
||||
void
|
||||
g_io_module_load (GIOModule *module)
|
||||
{
|
||||
g_type_module_use (G_TYPE_MODULE (module));
|
||||
|
||||
g_print ("load io module for wayland\n");
|
||||
gtk_im_context_wayland_register_type (G_TYPE_MODULE (module));
|
||||
gtk_im_context_wayland_global_init (gdk_display_get_default ());
|
||||
|
||||
g_io_extension_point_implement (GTK_IM_MODULE_EXTENSION_POINT_NAME,
|
||||
GTK_TYPE_IM_CONTEXT_WAYLAND,
|
||||
"wayland",
|
||||
10);
|
||||
}
|
||||
|
||||
void
|
||||
g_io_module_unload (GIOModule *module)
|
||||
{
|
||||
}
|
||||
|
||||
char **
|
||||
g_io_module_query (void)
|
||||
{
|
||||
char *eps[] = {
|
||||
GTK_IM_MODULE_EXTENSION_POINT_NAME,
|
||||
NULL
|
||||
};
|
||||
|
||||
return g_strdupv (eps);
|
||||
}
|
||||
|
||||
|
||||
#define GTK_IM_CONTEXT_WAYLAND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), gtk_im_context_wayland__get_type (), GtkIMContextWayland))
|
||||
|
||||
static void
|
||||
reset_preedit (GtkIMContextWayland *context)
|
||||
@ -253,7 +221,7 @@ static const struct wl_registry_listener registry_listener = {
|
||||
static void
|
||||
gtk_im_context_wayland_global_init (GdkDisplay *display)
|
||||
{
|
||||
if (global)
|
||||
if (global != NULL)
|
||||
return;
|
||||
|
||||
global = g_new0 (GtkIMContextWaylandGlobal, 1);
|
||||
@ -356,6 +324,8 @@ translate_purpose (GtkInputPurpose purpose)
|
||||
return GTK_TEXT_INPUT_CONTENT_PURPOSE_PASSWORD;
|
||||
case GTK_INPUT_PURPOSE_PIN:
|
||||
return GTK_TEXT_INPUT_CONTENT_PURPOSE_PIN;
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
return GTK_TEXT_INPUT_CONTENT_PURPOSE_NORMAL;
|
||||
@ -487,7 +457,7 @@ gtk_im_context_wayland_get_preedit_string (GtkIMContext *context,
|
||||
gint *cursor_pos)
|
||||
{
|
||||
GtkIMContextWayland *context_wayland = GTK_IM_CONTEXT_WAYLAND (context);
|
||||
gchar *preedit_str;
|
||||
const char *preedit_str;
|
||||
|
||||
GTK_IM_CONTEXT_CLASS (gtk_im_context_wayland_parent_class)->get_preedit_string (context, str, attrs, cursor_pos);
|
||||
|
||||
@ -632,11 +602,6 @@ gtk_im_context_wayland_class_init (GtkIMContextWaylandClass *klass)
|
||||
im_context_class->get_surrounding = gtk_im_context_wayland_get_surrounding;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_im_context_wayland_class_finalize (GtkIMContextWaylandClass *class)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
on_content_type_changed (GtkIMContextWayland *context)
|
||||
{
|
||||
@ -647,6 +612,8 @@ on_content_type_changed (GtkIMContextWayland *context)
|
||||
static void
|
||||
gtk_im_context_wayland_init (GtkIMContextWayland *context)
|
||||
{
|
||||
gtk_im_context_wayland_global_init (gdk_display_get_default ());
|
||||
|
||||
context->use_preedit = TRUE;
|
||||
g_signal_connect_swapped (context, "notify::input-purpose",
|
||||
G_CALLBACK (on_content_type_changed), context);
|
29
gtk/gtkimcontextwayland.h
Normal file
29
gtk/gtkimcontextwayland.h
Normal file
@ -0,0 +1,29 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 2018 Red Hat Software
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_IM_CONTEXT_WAYLAND_H__
|
||||
#define __GTK_IM_CONTEXT_WAYLAND_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GType gtk_im_context_wayland_get_type (void) G_GNUC_CONST;
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_IM_CONTEXT_WAYLAND_H__ */
|
@ -20,8 +20,8 @@
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "gtkimmodule.h"
|
||||
#include "gtkimcontextxim.h"
|
||||
#include "gtkimmodule.h"
|
||||
|
||||
#include "gtk/gtkintl.h"
|
||||
|
||||
@ -104,8 +104,6 @@ struct _StatusWindow
|
||||
GtkIMContextXIM *context;
|
||||
};
|
||||
|
||||
static void gtk_im_context_xim_class_init (GtkIMContextXIMClass *class);
|
||||
static void gtk_im_context_xim_init (GtkIMContextXIM *im_context_xim);
|
||||
static void gtk_im_context_xim_finalize (GObject *obj);
|
||||
static void gtk_im_context_xim_set_client_widget (GtkIMContext *context,
|
||||
GtkWidget *widget);
|
||||
@ -146,37 +144,11 @@ static void xim_info_display_closed (GdkDisplay *display,
|
||||
gboolean is_error,
|
||||
GtkXIMInfo *info);
|
||||
|
||||
G_DEFINE_DYNAMIC_TYPE (GtkIMContextXIM, gtk_im_context_xim, GTK_TYPE_IM_CONTEXT)
|
||||
|
||||
void
|
||||
g_io_module_load (GIOModule *module)
|
||||
{
|
||||
g_type_module_use (G_TYPE_MODULE (module));
|
||||
|
||||
g_print ("load io module for x11\n");
|
||||
gtk_im_context_xim_register_type (G_TYPE_MODULE (module));
|
||||
|
||||
G_DEFINE_TYPE_WITH_CODE (GtkIMContextXIM, gtk_im_context_xim, GTK_TYPE_IM_CONTEXT,
|
||||
g_io_extension_point_implement (GTK_IM_MODULE_EXTENSION_POINT_NAME,
|
||||
GTK_TYPE_IM_CONTEXT_XIM,
|
||||
g_define_type_id,
|
||||
"xim",
|
||||
10);
|
||||
}
|
||||
|
||||
void
|
||||
g_io_module_unload (GIOModule *module)
|
||||
{
|
||||
}
|
||||
|
||||
char **
|
||||
g_io_module_query (void)
|
||||
{
|
||||
char *eps[] = {
|
||||
GTK_IM_MODULE_EXTENSION_POINT_NAME,
|
||||
NULL
|
||||
};
|
||||
|
||||
return g_strdupv (eps);
|
||||
}
|
||||
10))
|
||||
|
||||
static GSList *open_ims = NULL;
|
||||
|
||||
@ -492,11 +464,6 @@ gtk_im_context_xim_class_init (GtkIMContextXIMClass *class)
|
||||
gobject_class->finalize = gtk_im_context_xim_finalize;
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_im_context_xim_class_finalize (GtkIMContextXIMClass *class)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_im_context_xim_init (GtkIMContextXIM *im_context_xim)
|
||||
{
|
@ -39,8 +39,8 @@ struct _GtkIMContextXIMClass
|
||||
GtkIMContextClass parent_class;
|
||||
};
|
||||
|
||||
GType gtk_im_context_xim_get_type (void) G_GNUC_CONST;
|
||||
GtkIMContext *gtk_im_context_xim_new (void);
|
||||
|
||||
void gtk_im_context_xim_shutdown (void);
|
||||
|
||||
G_END_DECLS
|
@ -42,18 +42,27 @@
|
||||
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
#include "x11/gdkx.h"
|
||||
#include "gtkimcontextxim.h"
|
||||
#endif
|
||||
|
||||
#ifdef GDK_WINDOWING_WAYLAND
|
||||
#include "wayland/gdkwayland.h"
|
||||
#include "gtkimcontextwayland.h"
|
||||
#endif
|
||||
|
||||
#ifdef GDK_WINDOWING_BROADWAY
|
||||
#include "broadway/gdkbroadway.h"
|
||||
#include "gtkimcontextbroadway.h"
|
||||
#endif
|
||||
|
||||
#ifdef GDK_WINDOWING_WIN32
|
||||
#include "win32/gdkwin32.h"
|
||||
#include "gtkimcontextime.h"
|
||||
#endif
|
||||
|
||||
#ifdef GDK_WINDOWING_QUARTZ
|
||||
#include "quartz/gdkquartz.h"
|
||||
#include "gtkimcontextquartz.h"
|
||||
#endif
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
@ -101,6 +110,7 @@ is_platform (const char *context_id)
|
||||
return g_strcmp0 (context_id, "wayland") == 0 ||
|
||||
g_strcmp0 (context_id, "broadway") == 0 ||
|
||||
g_strcmp0 (context_id, "xim") == 0 ||
|
||||
g_strcmp0 (context_id, "quartz") == 0 ||
|
||||
g_strcmp0 (context_id, "ime") == 0;
|
||||
}
|
||||
|
||||
@ -127,6 +137,11 @@ match_backend (const char *context_id)
|
||||
return GDK_IS_WIN32_DISPLAY (gdk_display_get_default ());
|
||||
#endif
|
||||
|
||||
#ifdef GDK_WINDOWING_QUARTZ
|
||||
if (g_strcmp0 (context_id, "quartz") == 0)
|
||||
return GDK_IS_QUARTZ_DISPLAY (gdk_display_get_default ());
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -236,7 +251,21 @@ gtk_im_modules_init (void)
|
||||
g_io_extension_point_set_required_type (ep, GTK_TYPE_IM_CONTEXT);
|
||||
|
||||
g_type_ensure (gtk_im_context_simple_get_type ());
|
||||
// other builtin im context types go here
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
g_type_ensure (gtk_im_context_xim_get_type ());
|
||||
#endif
|
||||
#ifdef GDK_WINDOWING_WAYLAND
|
||||
g_type_ensure (gtk_im_context_wayland_get_type ());
|
||||
#endif
|
||||
#ifdef GDK_WINDOWING_BROADWAY
|
||||
g_type_ensure (gtk_im_context_broadway_get_type ());
|
||||
#endif
|
||||
#ifdef GDK_WINDOWING_WIN32
|
||||
g_type_ensure (gtk_im_context_ime_get_type ());
|
||||
#endif
|
||||
#ifdef GDK_WINDOWING_QUARTZ
|
||||
g_type_ensure (gtk_im_context_quartz_get_type ());
|
||||
#endif
|
||||
|
||||
scope = g_io_module_scope_new (G_IO_MODULE_SCOPE_BLOCK_DUPLICATES);
|
||||
|
||||
@ -251,6 +280,7 @@ gtk_im_modules_init (void)
|
||||
|
||||
g_io_module_scope_free (scope);
|
||||
|
||||
if (GTK_DEBUG_CHECK (MODULES))
|
||||
{
|
||||
GList *list, *l;
|
||||
|
||||
|
@ -578,6 +578,48 @@ install_headers(gtk_public_headers, subdir: 'gtk-4.0/gtk/')
|
||||
|
||||
gtk_sources = gtk_public_sources + gtk_private_sources
|
||||
|
||||
proto_sources = [
|
||||
['gtk-text-input', 'stable', ],
|
||||
]
|
||||
|
||||
im_wayland_sources = files('gtkimcontextwayland.c')
|
||||
wayland_scanner = find_program('wayland-scanner')
|
||||
genprotocols = find_program('../gdk/wayland/genprotocolfiles.py')
|
||||
|
||||
foreach p: proto_sources
|
||||
proto_name = p.get(0)
|
||||
proto_stability = p.get(1)
|
||||
|
||||
if proto_stability == 'stable'
|
||||
output_base = proto_name
|
||||
input = '@0@.xml'.format(proto_name)
|
||||
else
|
||||
proto_version = p.get(2)
|
||||
output_base = '@0@-@1@-@2@'.format(proto_name, proto_stability, proto_version)
|
||||
input = join_paths(proto_dir, '@0@/@1@/@2@.xml'.format(proto_stability, proto_name, output_base))
|
||||
endif
|
||||
|
||||
im_wayland_sources += custom_target('@0@ client header'.format(output_base),
|
||||
input: input,
|
||||
output: '@0@-client-protocol.h'.format(output_base),
|
||||
command: [
|
||||
genprotocols,
|
||||
wayland_scanner,
|
||||
'@INPUT@', '@OUTPUT@',
|
||||
'client-header',
|
||||
])
|
||||
|
||||
im_wayland_sources += custom_target('@0@ source'.format(output_base),
|
||||
input: input,
|
||||
output: '@0@-protocol.c'.format(output_base),
|
||||
command: [
|
||||
genprotocols,
|
||||
wayland_scanner,
|
||||
'@INPUT@', '@OUTPUT@',
|
||||
'code',
|
||||
])
|
||||
endforeach
|
||||
|
||||
if os_unix
|
||||
gtk_unix_print_headers = [
|
||||
'gtkpagesetupunixdialog.h',
|
||||
@ -616,6 +658,7 @@ if os_win32
|
||||
])
|
||||
|
||||
gtk_sources += gtk_win32_print_sources
|
||||
gtk_sources += ['gtkimcontextime.c']
|
||||
|
||||
if cc.has_header_symbol('windows.h', 'IPrintDialogCallback')
|
||||
cdata.set('HAVE_IPRINTDIALOGCALLBACK', 1)
|
||||
@ -624,10 +667,12 @@ endif
|
||||
|
||||
if x11_enabled
|
||||
gtk_sources += ['gtkapplication-x11.c', 'gtkmountoperation-x11.c']
|
||||
gtk_sources += ['gtkimcontextxim.c']
|
||||
endif
|
||||
|
||||
if wayland_enabled
|
||||
gtk_sources += ['gtkapplication-wayland.c']
|
||||
gtk_sources += im_wayland_sources
|
||||
endif
|
||||
|
||||
if x11_enabled or wayland_enabled
|
||||
@ -647,6 +692,8 @@ if quartz_enabled
|
||||
'gtkfilechoosernativequartz.c',
|
||||
'gtkquartz.c',
|
||||
])
|
||||
gtk_sources += ['gtkimcontextquartz.c']
|
||||
|
||||
gtk_cargs += ['-xobjective-c'] # FIXME? maybe add_languages() instead?
|
||||
endif
|
||||
|
||||
@ -824,6 +871,10 @@ if wayland_enabled
|
||||
gtk_sources += gtk_wayland_sources
|
||||
endif
|
||||
|
||||
if broadway_enabled
|
||||
gtk_sources += ['gtkimcontextbroadway.c']
|
||||
endif
|
||||
|
||||
if win32_enabled
|
||||
gtk_cargs += ['-DGTK_PRINT_BACKENDS="file,lpr"']
|
||||
gtk_deps += [ giowin32_dep ]
|
||||
@ -868,39 +919,6 @@ if cc.has_header('langinfo.h')
|
||||
endforeach
|
||||
endif
|
||||
|
||||
# Input methods
|
||||
|
||||
gen_headers = [ gtk_gen_headers, gsk_gen_headers, gdk_gen_headers, ]
|
||||
|
||||
included_input_modules = []
|
||||
foreach m: inc_im_method_defs # populated in modules/input/meson.build
|
||||
im_name = m[0]
|
||||
im_srcs = m[1]
|
||||
im_args = m[2]
|
||||
im_libs = m[3]
|
||||
|
||||
included_input_modules += static_library('im-@0@'.format(im_name),
|
||||
im_srcs, gen_headers,
|
||||
c_args: im_args,
|
||||
include_directories: [confinc, gdkinc, gtkinc],
|
||||
dependencies: gtk_deps + im_libs)
|
||||
endforeach
|
||||
|
||||
foreach m: dyn_im_method_defs # populated in modules/input/meson.build
|
||||
im_name = m[0]
|
||||
im_srcs = m[1]
|
||||
im_args = m[2]
|
||||
im_libs = m[3]
|
||||
|
||||
shared_module('libim-@0@'.format(im_name), im_srcs, gen_headers,
|
||||
c_args: im_args,
|
||||
include_directories: [confinc, gdkinc, gtkinc],
|
||||
dependencies: gtk_deps + im_libs,
|
||||
name_prefix: '', # we want im-foo.so not libim-foo.so
|
||||
install_dir: immodules_install_dir,
|
||||
install: true)
|
||||
endforeach
|
||||
|
||||
# Library
|
||||
libgtk = shared_library('gtk-4',
|
||||
soversion: gtk_soversion,
|
||||
@ -909,7 +927,6 @@ libgtk = shared_library('gtk-4',
|
||||
include_directories: [confinc, gdkinc, gskinc, gtkinc],
|
||||
dependencies: gtk_deps + [libgdk_dep, libgsk_dep],
|
||||
link_with: [libgdk, libgsk, ],
|
||||
link_whole: included_input_modules,
|
||||
link_args: common_ldflags,
|
||||
install: true)
|
||||
|
||||
|
@ -589,7 +589,6 @@ if cloudproviders_enabled
|
||||
endif
|
||||
endif
|
||||
|
||||
subdir('modules/input')
|
||||
subdir('gdk')
|
||||
subdir('gsk')
|
||||
subdir('gtk')
|
||||
|
@ -24,12 +24,6 @@ option('print-backends', type : 'string', value : 'cups,file',
|
||||
option('colord', type: 'combo', choices : ['yes', 'no', 'auto'], value : 'auto',
|
||||
description : 'Build colord support for the CUPS printing backend')
|
||||
|
||||
# Modules
|
||||
option('dynamic-modules', type: 'boolean', value : true,
|
||||
description : 'Allow dynamic module loading')
|
||||
option('included-immodules', type: 'string', value : 'none',
|
||||
description : 'Build the specified input methods (comma-separated list, "all", or "none")')
|
||||
|
||||
# Documentation and introspection
|
||||
option('documentation', type: 'boolean', value: 'false',
|
||||
description : 'Build API reference and tools documentation')
|
||||
|
@ -1,118 +0,0 @@
|
||||
# Note: this file is included from the top-level before gtk/meson.build.
|
||||
# The actual input modules are then built in gtk/meson.build based on the
|
||||
# defs we provide here. It has to be that way because included input methods
|
||||
# need to be built before libgtk-4.so is built, so before gtk/meson.build, but
|
||||
# all input methods also rely on gtk generated headers to be created first, so
|
||||
# there is a bit of an ordering problem which we solve by collecting all the
|
||||
# information here but moving the actual build definitions to gtk/meson.build.
|
||||
build_dynamic_modules = false
|
||||
dynamic_modules = get_option('dynamic-modules')
|
||||
if dynamic_modules
|
||||
gmodule_supported = dependency('gmodule-no-export-2.0').get_pkgconfig_variable('gmodule_supported')
|
||||
if gmodule_supported == 'true'
|
||||
build_dynamic_modules = true
|
||||
else
|
||||
message('Modules are not supported according to gmodule-no-export-2.0.pc')
|
||||
endif
|
||||
endif
|
||||
|
||||
all_immodules = backend_immodules
|
||||
|
||||
# Allow building some or all immodules included
|
||||
included_immodules = get_option('included-immodules').split(',')
|
||||
if included_immodules.contains('none')
|
||||
included_immodules = []
|
||||
elif included_immodules.contains('all')
|
||||
included_immodules = all_immodules
|
||||
endif
|
||||
|
||||
have_included_immodules = included_immodules.length() > 0
|
||||
|
||||
foreach im: included_immodules
|
||||
if not all_immodules.contains(im)
|
||||
error('The specified input method "@0@" is not available (available methods: @1@)'.format(im, ', '.join(all_immodules)))
|
||||
endif
|
||||
endforeach
|
||||
|
||||
immodules_subdir = 'gtk-4.0/@0@/immodules'.format(gtk_binary_version)
|
||||
immodules_install_dir = join_paths(gtk_libdir, immodules_subdir)
|
||||
|
||||
# Format:
|
||||
# - protocol name
|
||||
# - protocol stability ('stable' or 'unstable')
|
||||
# - protocol version (if stability is 'unstable')
|
||||
proto_sources = [
|
||||
['gtk-text-input', 'stable', ],
|
||||
]
|
||||
|
||||
im_wayland_gen_headers = []
|
||||
im_wayland_sources = files('imwayland.c')
|
||||
wayland_scanner = find_program('wayland-scanner')
|
||||
genprotocols = find_program('../../gdk/wayland/genprotocolfiles.py')
|
||||
|
||||
foreach p: proto_sources
|
||||
proto_name = p.get(0)
|
||||
proto_stability = p.get(1)
|
||||
|
||||
if proto_stability == 'stable'
|
||||
output_base = proto_name
|
||||
input = '@0@.xml'.format(proto_name)
|
||||
else
|
||||
proto_version = p.get(2)
|
||||
output_base = '@0@-@1@-@2@'.format(proto_name, proto_stability, proto_version)
|
||||
input = join_paths(proto_dir, '@0@/@1@/@2@.xml'.format(proto_stability, proto_name, output_base))
|
||||
endif
|
||||
|
||||
im_wayland_sources += custom_target('@0@ client header'.format(output_base),
|
||||
input: input,
|
||||
output: '@0@-client-protocol.h'.format(output_base),
|
||||
command: [
|
||||
genprotocols,
|
||||
wayland_scanner,
|
||||
'@INPUT@', '@OUTPUT@',
|
||||
'client-header',
|
||||
])
|
||||
|
||||
im_wayland_sources += custom_target('@0@ source'.format(output_base),
|
||||
input: input,
|
||||
output: '@0@-protocol.c'.format(output_base),
|
||||
command: [
|
||||
genprotocols,
|
||||
wayland_scanner,
|
||||
'@INPUT@', '@OUTPUT@',
|
||||
'code',
|
||||
])
|
||||
endforeach
|
||||
|
||||
method_defs = [
|
||||
['broadway', files('imbroadway.c')],
|
||||
['quartz', ('imquartz.c'), [], ('-xobjective-c')],
|
||||
['xim', files('gtkimcontextxim.c')],
|
||||
['ime', files('gtkimcontextime.c'), ['imm32']],
|
||||
['wayland', im_wayland_sources],
|
||||
]
|
||||
|
||||
inc_im_method_defs = []
|
||||
dyn_im_method_defs = []
|
||||
|
||||
foreach m: method_defs
|
||||
im = m.get(0)
|
||||
srcs = m.get(1)
|
||||
cargs = m.get(3, [])
|
||||
libs = []
|
||||
|
||||
# only use backend-specific input methods for backends that are enabled
|
||||
if all_immodules.contains(im)
|
||||
# check for extra libs lazily
|
||||
foreach libname: m.get(2, [])
|
||||
libs += [cc.find_library(libname)]
|
||||
endforeach
|
||||
|
||||
if included_immodules.contains(im)
|
||||
cdata.set('INCLUDE_IM_@0@'.format(im.underscorify()), true)
|
||||
inc_im_method_defs += [[im, srcs, cargs, libs]]
|
||||
elif build_dynamic_modules
|
||||
dyn_im_method_defs += [[im, srcs, cargs, libs]]
|
||||
endif
|
||||
endif
|
||||
endforeach
|
@ -1,5 +1,3 @@
|
||||
# Note: 'input' subdir has already been included from top-level.
|
||||
|
||||
if os_unix
|
||||
subdir('printbackends')
|
||||
endif
|
||||
|
Loading…
Reference in New Issue
Block a user