keyboard: Use GTK+ to parse keys
Instead of some custom code https://bugzilla.gnome.org/show_bug.cgi?id=663341
This commit is contained in:
parent
a795220be7
commit
df493ef93c
5 changed files with 10 additions and 7 deletions
|
@ -60,7 +60,7 @@ dnl Check that we meet the dependencies
|
||||||
dnl ==============================================
|
dnl ==============================================
|
||||||
|
|
||||||
GLIB_REQUIRED_VERSION=2.29.14
|
GLIB_REQUIRED_VERSION=2.29.14
|
||||||
GTK_REQUIRED_VERSION=3.1.19
|
GTK_REQUIRED_VERSION=3.3.3
|
||||||
DESKTOP_SCHEMAS_REQUIRED_VERSION=3.0.2
|
DESKTOP_SCHEMAS_REQUIRED_VERSION=3.0.2
|
||||||
PA_REQUIRED_VERSION=0.9.16
|
PA_REQUIRED_VERSION=0.9.16
|
||||||
CANBERRA_REQUIRED_VERSION=0.13
|
CANBERRA_REQUIRED_VERSION=0.13
|
||||||
|
|
|
@ -18,7 +18,7 @@ libkeyboard_la_SOURCES = \
|
||||||
keyboard-shortcuts.h
|
keyboard-shortcuts.h
|
||||||
|
|
||||||
libkeyboard_la_CFLAGS = $(PANEL_CFLAGS) $(KEYBOARD_PANEL_CFLAGS) -I$(top_srcdir)/panels/common/
|
libkeyboard_la_CFLAGS = $(PANEL_CFLAGS) $(KEYBOARD_PANEL_CFLAGS) -I$(top_srcdir)/panels/common/
|
||||||
libkeyboard_la_LIBADD = $(PANEL_LIBS) $(KEYBOARD_PANEL_LIBS) $(top_builddir)/panels/common/libshortcuts.la
|
libkeyboard_la_LIBADD = $(PANEL_LIBS) $(KEYBOARD_PANEL_LIBS)
|
||||||
libkeyboard_la_LDFLAGS = $(PANEL_LDFLAGS)
|
libkeyboard_la_LDFLAGS = $(PANEL_LDFLAGS)
|
||||||
|
|
||||||
@INTLTOOL_DESKTOP_RULE@
|
@INTLTOOL_DESKTOP_RULE@
|
||||||
|
|
|
@ -30,7 +30,6 @@
|
||||||
#include <gconf/gconf-client.h>
|
#include <gconf/gconf-client.h>
|
||||||
|
|
||||||
#include "cc-keyboard-item.h"
|
#include "cc-keyboard-item.h"
|
||||||
#include "eggaccelerators.h"
|
|
||||||
|
|
||||||
#define CC_KEYBOARD_ITEM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_KEYBOARD_ITEM, CcKeyboardItemPrivate))
|
#define CC_KEYBOARD_ITEM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CC_TYPE_KEYBOARD_ITEM, CcKeyboardItemPrivate))
|
||||||
|
|
||||||
|
@ -64,6 +63,7 @@ binding_from_string (const char *str,
|
||||||
GdkModifierType *accelerator_mods)
|
GdkModifierType *accelerator_mods)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (accelerator_key != NULL, FALSE);
|
g_return_val_if_fail (accelerator_key != NULL, FALSE);
|
||||||
|
guint *keycodes;
|
||||||
|
|
||||||
if (str == NULL || strcmp (str, "disabled") == 0)
|
if (str == NULL || strcmp (str, "disabled") == 0)
|
||||||
{
|
{
|
||||||
|
@ -73,7 +73,11 @@ binding_from_string (const char *str,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
egg_accelerator_parse_virtual (str, accelerator_key, keycode, (EggVirtualModifierType *) accelerator_mods);
|
gtk_accelerator_parse_with_keycode (str, accelerator_key, &keycodes, accelerator_mods);
|
||||||
|
|
||||||
|
if (keycode != NULL)
|
||||||
|
*keycode = (keycodes ? keycodes[0] : 0);
|
||||||
|
g_free (keycodes);
|
||||||
|
|
||||||
if (*accelerator_key == 0)
|
if (*accelerator_key == 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#define __CC_KEYBOARD_ITEM_H
|
#define __CC_KEYBOARD_ITEM_H
|
||||||
|
|
||||||
#include <glib-object.h>
|
#include <glib-object.h>
|
||||||
#include "eggaccelerators.h"
|
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
|
|
@ -1184,8 +1184,8 @@ binding_name (guint keyval,
|
||||||
{
|
{
|
||||||
if (keyval != 0 || keycode != 0)
|
if (keyval != 0 || keycode != 0)
|
||||||
return translate ?
|
return translate ?
|
||||||
egg_virtual_accelerator_label (keyval, keycode, mask) :
|
gtk_accelerator_get_label_with_keycode (NULL, keyval, keycode, mask) :
|
||||||
egg_virtual_accelerator_name (keyval, keycode, mask);
|
gtk_accelerator_name_with_keycode (NULL, keyval, keycode, mask);
|
||||||
else
|
else
|
||||||
return g_strdup (translate ? _("Disabled") : "");
|
return g_strdup (translate ? _("Disabled") : "");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue