Simplify codebase.
* Drop clutter support. * Unify eek-xkb into eek-xkl. * Generate vapi from gir instead of gi.
This commit is contained in:
@ -25,28 +25,17 @@
|
||||
#include <X11/Xatom.h>
|
||||
#include <gdk/gdkx.h>
|
||||
|
||||
#if HAVE_CLUTTER_GTK
|
||||
#include <clutter-gtk/clutter-gtk.h>
|
||||
#include "eek/eek-clutter.h"
|
||||
#endif
|
||||
#include "eek/eek-gtk.h"
|
||||
|
||||
#include "server-context-service.h"
|
||||
|
||||
enum {
|
||||
PROP_0,
|
||||
PROP_UI_TOOLKIT,
|
||||
PROP_SIZE_CONSTRAINT_LANDSCAPE,
|
||||
PROP_SIZE_CONSTRAINT_PORTRAIT,
|
||||
PROP_LAST
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
UI_TOOLKIT_GTK,
|
||||
UI_TOOLKIT_CLUTTER,
|
||||
UI_TOOLKIT_DEFAULT = UI_TOOLKIT_GTK
|
||||
} UIToolkitType;
|
||||
|
||||
typedef struct _ServerContextServiceClass ServerContextServiceClass;
|
||||
|
||||
struct _ServerContextService {
|
||||
@ -60,7 +49,6 @@ struct _ServerContextService {
|
||||
gulong notify_visible_handler;
|
||||
|
||||
GSettings *settings;
|
||||
UIToolkitType ui_toolkit;
|
||||
gdouble size_constraint_landscape[2];
|
||||
gdouble size_constraint_portrait[2];
|
||||
};
|
||||
@ -85,23 +73,6 @@ on_monitors_changed (GdkScreen *screen,
|
||||
set_geometry (context);
|
||||
}
|
||||
|
||||
#if HAVE_CLUTTER_GTK
|
||||
static void
|
||||
on_allocation_changed (ClutterActor *stage,
|
||||
ClutterActorBox *box,
|
||||
ClutterAllocationFlags flags,
|
||||
gpointer user_data)
|
||||
{
|
||||
ClutterActor *actor =
|
||||
clutter_container_find_child_by_name (CLUTTER_CONTAINER(stage),
|
||||
"keyboard");
|
||||
|
||||
clutter_actor_set_size (actor,
|
||||
box->x2 - box->x1,
|
||||
box->y2 - box->y1);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
on_destroy (GtkWidget *widget, gpointer user_data)
|
||||
{
|
||||
@ -284,22 +255,6 @@ set_geometry (ServerContextService *context)
|
||||
G_CALLBACK(on_size_allocate_set_dock),
|
||||
context);
|
||||
} else {
|
||||
if (context->ui_toolkit == UI_TOOLKIT_CLUTTER) {
|
||||
#if HAVE_CLUTTER_GTK
|
||||
ClutterActor *stage =
|
||||
gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED(context->widget));
|
||||
clutter_stage_set_user_resizable (CLUTTER_STAGE(stage), TRUE);
|
||||
clutter_stage_set_minimum_size (CLUTTER_STAGE(stage),
|
||||
bounds.width / 3,
|
||||
bounds.height / 3);
|
||||
g_signal_connect (stage,
|
||||
"allocation-changed",
|
||||
G_CALLBACK(on_allocation_changed),
|
||||
NULL);
|
||||
#else
|
||||
g_return_if_reached ();
|
||||
#endif
|
||||
}
|
||||
gtk_widget_set_size_request (context->widget,
|
||||
bounds.width,
|
||||
bounds.height);
|
||||
@ -321,11 +276,6 @@ update_widget (ServerContextService *context)
|
||||
gchar *theme_name, *theme_path;
|
||||
EekTheme *theme;
|
||||
|
||||
#if HAVE_CLUTTER_GTK
|
||||
ClutterActor *stage, *actor;
|
||||
ClutterColor stage_color = { 0xff, 0xff, 0xff, 0xff };
|
||||
#endif
|
||||
|
||||
if (context->widget)
|
||||
gtk_widget_destroy (context->widget);
|
||||
|
||||
@ -338,25 +288,9 @@ update_widget (ServerContextService *context)
|
||||
|
||||
keyboard = eekboard_context_service_get_keyboard (EEKBOARD_CONTEXT_SERVICE(context));
|
||||
eek_element_get_bounds (EEK_ELEMENT(keyboard), &bounds);
|
||||
if (context->ui_toolkit == UI_TOOLKIT_CLUTTER) {
|
||||
#if HAVE_CLUTTER_GTK
|
||||
context->widget = gtk_clutter_embed_new ();
|
||||
stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED(context->widget));
|
||||
actor = eek_clutter_keyboard_new (keyboard);
|
||||
clutter_actor_set_name (actor, "keyboard");
|
||||
eek_clutter_keyboard_set_theme (EEK_CLUTTER_KEYBOARD(actor), theme);
|
||||
g_object_unref (theme);
|
||||
clutter_container_add_actor (CLUTTER_CONTAINER(stage), actor);
|
||||
|
||||
clutter_stage_set_color (CLUTTER_STAGE(stage), &stage_color);
|
||||
#else
|
||||
g_return_if_reached ();
|
||||
#endif
|
||||
} else {
|
||||
context->widget = eek_gtk_keyboard_new (keyboard);
|
||||
eek_gtk_keyboard_set_theme (EEK_GTK_KEYBOARD(context->widget), theme);
|
||||
g_object_unref (theme);
|
||||
}
|
||||
context->widget = eek_gtk_keyboard_new (keyboard);
|
||||
eek_gtk_keyboard_set_theme (EEK_GTK_KEYBOARD(context->widget), theme);
|
||||
g_object_unref (theme);
|
||||
|
||||
if (!context->window) {
|
||||
context->window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
@ -426,21 +360,9 @@ server_context_service_set_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
ServerContextService *context = SERVER_CONTEXT_SERVICE(object);
|
||||
const gchar *ui_toolkit;
|
||||
GVariant *variant;
|
||||
|
||||
switch (prop_id) {
|
||||
case PROP_UI_TOOLKIT:
|
||||
ui_toolkit = g_value_get_string (value);
|
||||
if (g_strcmp0 (ui_toolkit, "gtk") == 0)
|
||||
context->ui_toolkit = UI_TOOLKIT_GTK;
|
||||
#if HAVE_CLUTTER_GTK
|
||||
else if (g_strcmp0 (ui_toolkit, "clutter") == 0)
|
||||
context->ui_toolkit = UI_TOOLKIT_CLUTTER;
|
||||
#endif /* HAVE_CLUTTER_GTK */
|
||||
else
|
||||
g_warning ("unknown UI toolkit %s", ui_toolkit);
|
||||
break;
|
||||
case PROP_SIZE_CONSTRAINT_LANDSCAPE:
|
||||
variant = g_value_get_variant (value);
|
||||
g_variant_get (variant, "(dd)",
|
||||
@ -490,15 +412,6 @@ server_context_service_class_init (ServerContextServiceClass *klass)
|
||||
gobject_class->set_property = server_context_service_set_property;
|
||||
gobject_class->dispose = server_context_service_dispose;
|
||||
|
||||
pspec = g_param_spec_string ("ui-toolkit",
|
||||
"UI toolkit",
|
||||
"UI toolkit",
|
||||
NULL,
|
||||
G_PARAM_WRITABLE);
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_UI_TOOLKIT,
|
||||
pspec);
|
||||
|
||||
pspec = g_param_spec_variant ("size-constraint-landscape",
|
||||
"Size constraint landscape",
|
||||
"Size constraint landscape",
|
||||
@ -540,9 +453,6 @@ server_context_service_init (ServerContextService *context)
|
||||
context);
|
||||
|
||||
context->settings = g_settings_new ("org.fedorahosted.eekboard");
|
||||
g_settings_bind (context->settings, "ui-toolkit",
|
||||
context, "ui-toolkit",
|
||||
G_SETTINGS_BIND_GET);
|
||||
g_settings_bind_with_mapping (context->settings, "size-constraint-landscape",
|
||||
context, "size-constraint-landscape",
|
||||
G_SETTINGS_BIND_GET,
|
||||
|
||||
Reference in New Issue
Block a user