Workaround for old clutter-gtk.

This commit is contained in:
Daiki Ueno
2010-06-12 07:29:25 +09:00
parent 89cfaef48c
commit e08fb8935f

View File

@ -1,3 +1,23 @@
/*
* Copyright (C) 2010 Daiki Ueno <ueno@unixuser.org>
* Copyright (C) 2010 Red Hat, Inc.
*
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA
*/
#include <clutter-gtk/clutter-gtk.h> #include <clutter-gtk/clutter-gtk.h>
#include <fakekey/fakekey.h> #include <fakekey/fakekey.h>
#include <glib/gi18n.h> #include <glib/gi18n.h>
@ -28,7 +48,7 @@ Window target;
EekLayout *layout; EekLayout *layout;
EekKeyboard *eek_keyboard; EekKeyboard *eek_keyboard;
static void on_capture_key_event_toggled (GtkToggleAction *action, static void on_monitor_key_event_toggled (GtkToggleAction *action,
GtkWidget *window); GtkWidget *window);
static const GOptionEntry options[] = { static const GOptionEntry options[] = {
@ -47,12 +67,12 @@ static const GtkActionEntry action_entry[] = {
}; };
static const GtkToggleActionEntry toggle_action_entry[] = { static const GtkToggleActionEntry toggle_action_entry[] = {
{"CaptureKeyEvent", NULL, N_("Capture Key Event"), NULL, NULL, {"MonitorKeyEvent", NULL, N_("Monitor Key Typing"), NULL, NULL,
G_CALLBACK(on_capture_key_event_toggled), FALSE} G_CALLBACK(on_monitor_key_event_toggled), FALSE}
}; };
static void static void
on_capture_key_event_toggled (GtkToggleAction *action, on_monitor_key_event_toggled (GtkToggleAction *action,
GtkWidget *window) GtkWidget *window)
{ {
gboolean active; gboolean active;
@ -145,7 +165,7 @@ static const char ui_description[] =
" <menuitem action='Quit'/>" " <menuitem action='Quit'/>"
" </menu>" " </menu>"
" <menu action='KeyboardMenu'>" " <menu action='KeyboardMenu'>"
" <menuitem action='CaptureKeyEvent'/>" " <menuitem action='MonitorKeyEvent'/>"
" <menu action='SetLayout'>" " <menu action='SetLayout'>"
" <placeholder name='LayoutsPH'/>" " <placeholder name='LayoutsPH'/>"
" </menu>" " </menu>"
@ -386,6 +406,7 @@ main (int argc, char *argv[])
exit (1); exit (1);
} }
clutter_actor_show (stage); /* workaround for clutter-gtk (<= 0.10.2) */
eek_keyboard = create_keyboard (stage, layout, CSW, CSH); eek_keyboard = create_keyboard (stage, layout, CSW, CSH);
if (!eek_keyboard) { if (!eek_keyboard) {
g_object_unref (layout); g_object_unref (layout);