eekboard: add --toolkit and --standalone.
This commit is contained in:
@ -226,6 +226,10 @@ static gboolean opt_list_models = FALSE;
|
|||||||
static gboolean opt_list_layouts = FALSE;
|
static gboolean opt_list_layouts = FALSE;
|
||||||
static gboolean opt_list_options = FALSE;
|
static gboolean opt_list_options = FALSE;
|
||||||
static gboolean opt_version = FALSE;
|
static gboolean opt_version = FALSE;
|
||||||
|
#if HAVE_CLUTTER_GTK
|
||||||
|
static gchar *opt_toolkit = NULL;
|
||||||
|
#endif
|
||||||
|
static gboolean opt_standalone = FALSE;
|
||||||
|
|
||||||
static const GOptionEntry options[] = {
|
static const GOptionEntry options[] = {
|
||||||
{"model", 'M', 0, G_OPTION_ARG_STRING, &opt_model,
|
{"model", 'M', 0, G_OPTION_ARG_STRING, &opt_model,
|
||||||
@ -240,6 +244,12 @@ static const GOptionEntry options[] = {
|
|||||||
N_("List all available keyboard layouts and variants")},
|
N_("List all available keyboard layouts and variants")},
|
||||||
{"list-options", 'O', 0, G_OPTION_ARG_NONE, &opt_list_options,
|
{"list-options", 'O', 0, G_OPTION_ARG_NONE, &opt_list_options,
|
||||||
N_("List all available keyboard layout options")},
|
N_("List all available keyboard layout options")},
|
||||||
|
#if HAVE_CLUTTER_GTK
|
||||||
|
{"toolkit", 't', 0, G_OPTION_ARG_STRING, &opt_toolkit,
|
||||||
|
N_("Toolkit (\"clutter\" or \"gtk\")")},
|
||||||
|
#endif
|
||||||
|
{"standalone", 's', 0, G_OPTION_ARG_NONE, &opt_standalone,
|
||||||
|
N_("Start as a standalone application")},
|
||||||
{"version", 'v', 0, G_OPTION_ARG_NONE, &opt_version,
|
{"version", 'v', 0, G_OPTION_ARG_NONE, &opt_version,
|
||||||
N_("Display version")},
|
N_("Display version")},
|
||||||
{NULL}
|
{NULL}
|
||||||
@ -344,7 +354,8 @@ a11y_keystroke_listener (const AccessibleKeystroke *stroke,
|
|||||||
//g_return_val_if_fail (stroke->modifiers == SPI_KEYMASK_UNMODIFIED, FALSE);
|
//g_return_val_if_fail (stroke->modifiers == SPI_KEYMASK_UNMODIFIED, FALSE);
|
||||||
key = eek_keyboard_find_key_by_keycode (eekboard->keyboard,
|
key = eek_keyboard_find_key_by_keycode (eekboard->keyboard,
|
||||||
stroke->keycode);
|
stroke->keycode);
|
||||||
g_return_val_if_fail (key, FALSE);
|
if (!key)
|
||||||
|
return FALSE;
|
||||||
if (stroke->type == SPI_KEY_PRESSED)
|
if (stroke->type == SPI_KEY_PRESSED)
|
||||||
g_signal_emit_by_name (key, "pressed");
|
g_signal_emit_by_name (key, "pressed");
|
||||||
else
|
else
|
||||||
@ -1265,6 +1276,17 @@ main (int argc, char *argv[])
|
|||||||
use_clutter = FALSE;
|
use_clutter = FALSE;
|
||||||
|
|
||||||
#if HAVE_CLUTTER_GTK
|
#if HAVE_CLUTTER_GTK
|
||||||
|
if (opt_toolkit) {
|
||||||
|
if (g_strcmp0 (opt_toolkit, "clutter") == 0)
|
||||||
|
use_clutter = TRUE;
|
||||||
|
else if (g_strcmp0 (opt_toolkit, "gtk") == 0)
|
||||||
|
use_clutter = FALSE;
|
||||||
|
else {
|
||||||
|
g_print ("Invalid toolkit \"%s\"\n", opt_toolkit);
|
||||||
|
exit (0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (use_clutter &&
|
if (use_clutter &&
|
||||||
gtk_clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) {
|
gtk_clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) {
|
||||||
g_warning ("Can't init Clutter-Gtk...fallback to GTK");
|
g_warning ("Can't init Clutter-Gtk...fallback to GTK");
|
||||||
@ -1309,7 +1331,9 @@ main (int argc, char *argv[])
|
|||||||
exit (0);
|
exit (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
window = gtk_window_new (opt_standalone ?
|
||||||
|
GTK_WINDOW_TOPLEVEL :
|
||||||
|
GTK_WINDOW_POPUP);
|
||||||
gtk_widget_set_can_focus (window, FALSE);
|
gtk_widget_set_can_focus (window, FALSE);
|
||||||
g_object_set (G_OBJECT(window), "accept_focus", FALSE, NULL);
|
g_object_set (G_OBJECT(window), "accept_focus", FALSE, NULL);
|
||||||
gtk_window_set_title (GTK_WINDOW(window), "Keyboard");
|
gtk_window_set_title (GTK_WINDOW(window), "Keyboard");
|
||||||
@ -1321,9 +1345,11 @@ main (int argc, char *argv[])
|
|||||||
g_object_set_data (G_OBJECT(window), "eekboard", eekboard);
|
g_object_set_data (G_OBJECT(window), "eekboard", eekboard);
|
||||||
widget = create_widget (eekboard, CSW, CSH);
|
widget = create_widget (eekboard, CSW, CSH);
|
||||||
|
|
||||||
create_menus (eekboard, window);
|
if (opt_standalone) {
|
||||||
menubar = gtk_ui_manager_get_widget (eekboard->ui_manager, "/MainMenu");
|
create_menus (eekboard, window);
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), menubar, FALSE, FALSE, 0);
|
menubar = gtk_ui_manager_get_widget (eekboard->ui_manager, "/MainMenu");
|
||||||
|
gtk_box_pack_start (GTK_BOX (vbox), menubar, FALSE, FALSE, 0);
|
||||||
|
}
|
||||||
|
|
||||||
gtk_container_add (GTK_CONTAINER(vbox), widget);
|
gtk_container_add (GTK_CONTAINER(vbox), widget);
|
||||||
gtk_container_add (GTK_CONTAINER(window), vbox);
|
gtk_container_add (GTK_CONTAINER(window), vbox);
|
||||||
@ -1335,7 +1361,7 @@ main (int argc, char *argv[])
|
|||||||
notify_init ("eekboard");
|
notify_init ("eekboard");
|
||||||
eekboard->window = window;
|
eekboard->window = window;
|
||||||
eekboard->gconfc = gconfc;
|
eekboard->gconfc = gconfc;
|
||||||
if (eekboard->accessibility_enabled) {
|
if (!opt_standalone && eekboard->accessibility_enabled) {
|
||||||
NotifyNotification *notification;
|
NotifyNotification *notification;
|
||||||
|
|
||||||
error = NULL;
|
error = NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user