Add experimental GTK support.
This commit is contained in:
@ -16,6 +16,9 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
# 02110-1301 USA
|
||||
|
||||
noinst_PROGRAMS = eek-clutter-xkb-test
|
||||
noinst_PROGRAMS = eek-clutter-xkb-test eek-gtk-xkb-test
|
||||
eek_clutter_xkb_test_CFLAGS = -I$(top_srcdir) $(GOBJECT2_CFLAGS) $(CLUTTER_CFLAGS) $(XKB_CFLAGS)
|
||||
eek_clutter_xkb_test_LDFLAGS = $(top_builddir)/eek/libeek.la $(top_builddir)/eek/libeek-xkb.la $(top_builddir)/eek/libeek-clutter.la $(GOBJECT2_LIBS) $(CLUTTER_LIBS) $(XKB_LIBS)
|
||||
|
||||
eek_gtk_xkb_test_CFLAGS = -I$(top_srcdir) $(GOBJECT2_CFLAGS) $(GTK2_CFLAGS) $(XKB_CFLAGS)
|
||||
eek_gtk_xkb_test_LDFLAGS = $(top_builddir)/eek/libeek.la $(top_builddir)/eek/libeek-xkb.la $(top_builddir)/eek/libeek-gtk.la $(GOBJECT2_LIBS) $(GTK2_LIBS) $(XKB_LIBS)
|
||||
|
||||
70
examples/eek-gtk-xkb-test.c
Normal file
70
examples/eek-gtk-xkb-test.c
Normal file
@ -0,0 +1,70 @@
|
||||
#include "eek/eek-gtk.h"
|
||||
#include "eek/eek-xkb.h"
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
static gchar *symbols = NULL;
|
||||
static gchar *keycodes = NULL;
|
||||
static gchar *geometry = NULL;
|
||||
|
||||
static const GOptionEntry options[] = {
|
||||
{"symbols", '\0', 0, G_OPTION_ARG_STRING, &symbols,
|
||||
"Symbols component of the keyboard. If you omit this option, it is "
|
||||
"obtained from the X server; that is, the keyboard that is currently "
|
||||
"configured is drawn. Examples: --symbols=us or "
|
||||
"--symbols=us(pc104)+iso9995-3+group(switch)+ctrl(nocaps)", NULL},
|
||||
{"keycodes", '\0', 0, G_OPTION_ARG_STRING, &keycodes,
|
||||
"Keycodes component of the keyboard. If you omit this option, it is "
|
||||
"obtained from the X server; that is, the keyboard that is currently"
|
||||
" configured is drawn. Examples: --keycodes=xfree86+aliases(qwerty)",
|
||||
NULL},
|
||||
{"geometry", '\0', 0, G_OPTION_ARG_STRING, &geometry,
|
||||
"Geometry xkb component. If you omit this option, it is obtained from the"
|
||||
" X server; that is, the keyboard that is currently configured is drawn. "
|
||||
"Example: --geometry=kinesis", NULL},
|
||||
{NULL},
|
||||
};
|
||||
|
||||
gfloat window_width, window_height;
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
EekKeyboard *keyboard;
|
||||
EekLayout *layout;
|
||||
GtkWidget *window;
|
||||
GOptionContext *context;
|
||||
|
||||
context = g_option_context_new ("test-xkb-gtk");
|
||||
g_option_context_add_main_entries (context, options, NULL);
|
||||
g_option_context_parse (context, &argc, &argv, NULL);
|
||||
g_option_context_free (context);
|
||||
|
||||
gtk_init (&argc, &argv);
|
||||
|
||||
layout = eek_xkb_layout_new (keycodes, geometry, symbols);
|
||||
if (layout == NULL) {
|
||||
fprintf (stderr, "Failed to create layout\n");
|
||||
exit(1);
|
||||
}
|
||||
g_object_ref_sink (layout);
|
||||
|
||||
keyboard = eek_gtk_keyboard_new ();
|
||||
if (keyboard == NULL) {
|
||||
g_object_unref (layout);
|
||||
fprintf (stderr, "Failed to create keyboard\n");
|
||||
exit(1);
|
||||
}
|
||||
g_object_ref_sink (keyboard);
|
||||
|
||||
eek_keyboard_set_layout (keyboard, layout);
|
||||
|
||||
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_container_add (GTK_CONTAINER(window), GTK_WIDGET(keyboard));
|
||||
|
||||
gtk_widget_show_all (window);
|
||||
gtk_main ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user