forked from AuroraMiddleware/gtk
keymap: Remove virtual modifier mapping functions
These are not used anymore. Drop the vfuncs and their implementations in the broadway, x11, wayland and win32 backends as well.
This commit is contained in:
parent
89ad7893ad
commit
dce8d251c6
@ -187,19 +187,6 @@ gdk_broadway_keymap_translate_keyboard_state (GdkKeymap *keymap,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_keymap_add_virtual_modifiers (GdkKeymap *keymap,
|
||||
GdkModifierType *state)
|
||||
{
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_broadway_keymap_map_virtual_modifiers (GdkKeymap *keymap,
|
||||
GdkModifierType *state)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_keymap_class_init (GdkBroadwayKeymapClass *klass)
|
||||
{
|
||||
@ -217,7 +204,5 @@ gdk_broadway_keymap_class_init (GdkBroadwayKeymapClass *klass)
|
||||
keymap_class->get_entries_for_keycode = gdk_broadway_keymap_get_entries_for_keycode;
|
||||
keymap_class->lookup_key = gdk_broadway_keymap_lookup_key;
|
||||
keymap_class->translate_keyboard_state = gdk_broadway_keymap_translate_keyboard_state;
|
||||
keymap_class->add_virtual_modifiers = gdk_broadway_keymap_add_virtual_modifiers;
|
||||
keymap_class->map_virtual_modifiers = gdk_broadway_keymap_map_virtual_modifiers;
|
||||
}
|
||||
|
||||
|
@ -615,57 +615,6 @@ gdk_keymap_translate_keyboard_state (GdkKeymap *keymap,
|
||||
consumed_modifiers);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_keymap_add_virtual_modifiers:
|
||||
* @keymap: a #GdkKeymap
|
||||
* @state: (inout): pointer to the modifier mask to change
|
||||
*
|
||||
* Maps the non-virtual modifiers (i.e Mod2, Mod3, ...) which are set
|
||||
* in @state to the virtual modifiers (i.e. Super, Hyper and Meta) and
|
||||
* set the corresponding bits in @state.
|
||||
*
|
||||
* GDK already does this before delivering key events, but for
|
||||
* compatibility reasons, it only sets the first virtual modifier
|
||||
* it finds, whereas this function sets all matching virtual modifiers.
|
||||
*
|
||||
* This function is useful when matching key events against
|
||||
* accelerators.
|
||||
*/
|
||||
void
|
||||
gdk_keymap_add_virtual_modifiers (GdkKeymap *keymap,
|
||||
GdkModifierType *state)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_KEYMAP (keymap));
|
||||
|
||||
GDK_KEYMAP_GET_CLASS (keymap)->add_virtual_modifiers (keymap, state);
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_keymap_map_virtual_modifiers:
|
||||
* @keymap: a #GdkKeymap
|
||||
* @state: (inout): pointer to the modifier state to map
|
||||
*
|
||||
* Maps the virtual modifiers (i.e. Super, Hyper and Meta) which
|
||||
* are set in @state to their non-virtual counterparts (i.e. Mod2,
|
||||
* Mod3,...) and set the corresponding bits in @state.
|
||||
*
|
||||
* This function is useful when matching key events against
|
||||
* accelerators.
|
||||
*
|
||||
* Returns: %FALSE if two virtual modifiers were mapped to the
|
||||
* same non-virtual modifier. Note that %FALSE is also returned
|
||||
* if a virtual modifier is mapped to a non-virtual modifier that
|
||||
* was already set in @state.
|
||||
*/
|
||||
gboolean
|
||||
gdk_keymap_map_virtual_modifiers (GdkKeymap *keymap,
|
||||
GdkModifierType *state)
|
||||
{
|
||||
g_return_val_if_fail (GDK_IS_KEYMAP (keymap), FALSE);
|
||||
|
||||
return GDK_KEYMAP_GET_CLASS(keymap)->map_virtual_modifiers (keymap, state);
|
||||
}
|
||||
|
||||
static GdkModifierType
|
||||
gdk_keymap_real_get_modifier_mask (GdkKeymap *keymap,
|
||||
GdkModifierIntent intent)
|
||||
|
@ -60,10 +60,6 @@ struct _GdkKeymapClass
|
||||
gint *effective_group,
|
||||
gint *level,
|
||||
GdkModifierType *consumed_modifiers);
|
||||
void (* add_virtual_modifiers) (GdkKeymap *keymap,
|
||||
GdkModifierType *state);
|
||||
gboolean (* map_virtual_modifiers) (GdkKeymap *keymap,
|
||||
GdkModifierType *state);
|
||||
GdkModifierType (*get_modifier_mask) (GdkKeymap *keymap,
|
||||
GdkModifierIntent intent);
|
||||
guint (* get_modifier_state) (GdkKeymap *keymap);
|
||||
@ -111,10 +107,6 @@ gboolean gdk_keymap_get_caps_lock_state (GdkKeymap *keymap)
|
||||
gboolean gdk_keymap_get_num_lock_state (GdkKeymap *keymap);
|
||||
gboolean gdk_keymap_get_scroll_lock_state (GdkKeymap *keymap);
|
||||
guint gdk_keymap_get_modifier_state (GdkKeymap *keymap);
|
||||
void gdk_keymap_add_virtual_modifiers (GdkKeymap *keymap,
|
||||
GdkModifierType *state);
|
||||
gboolean gdk_keymap_map_virtual_modifiers (GdkKeymap *keymap,
|
||||
GdkModifierType *state);
|
||||
GdkModifierType gdk_keymap_get_modifier_mask (GdkKeymap *keymap,
|
||||
GdkModifierIntent intent);
|
||||
|
||||
|
@ -369,68 +369,6 @@ gdk_wayland_keymap_get_modifier_state (GdkKeymap *keymap)
|
||||
return get_gdk_modifiers (xkb_keymap, mods);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_keymap_add_virtual_modifiers (GdkKeymap *keymap,
|
||||
GdkModifierType *state)
|
||||
{
|
||||
struct xkb_keymap *xkb_keymap;
|
||||
struct xkb_state *xkb_state;
|
||||
xkb_mod_index_t idx;
|
||||
uint32_t mods, real;
|
||||
struct { const char *name; GdkModifierType mask; } vmods[] = {
|
||||
{ "Super", GDK_SUPER_MASK },
|
||||
{ "Hyper", GDK_HYPER_MASK },
|
||||
{ "Meta", GDK_META_MASK },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
int i;
|
||||
|
||||
xkb_keymap = GDK_WAYLAND_KEYMAP (keymap)->xkb_keymap;
|
||||
mods = get_xkb_modifiers (xkb_keymap, *state);
|
||||
|
||||
xkb_state = xkb_state_new (xkb_keymap);
|
||||
|
||||
for (i = 0; vmods[i].name; i++)
|
||||
{
|
||||
idx = xkb_keymap_mod_get_index (xkb_keymap, vmods[i].name);
|
||||
if (idx == XKB_MOD_INVALID)
|
||||
continue;
|
||||
|
||||
xkb_state_update_mask (xkb_state, 1 << idx, 0, 0, 0, 0, 0);
|
||||
real = xkb_state_serialize_mods (xkb_state, XKB_STATE_MODS_EFFECTIVE);
|
||||
real &= 0xf0; /* ignore mapping to Lock, Shift, Control, Mod1 */
|
||||
if (mods & real)
|
||||
*state |= vmods[i].mask;
|
||||
xkb_state_update_mask (xkb_state, 0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
xkb_state_unref (xkb_state);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_wayland_keymap_map_virtual_modifiers (GdkKeymap *keymap,
|
||||
GdkModifierType *state)
|
||||
{
|
||||
struct xkb_keymap *xkb_keymap;
|
||||
struct xkb_state *xkb_state;
|
||||
uint32_t mods, mapped;
|
||||
gboolean ret = TRUE;
|
||||
|
||||
xkb_keymap = GDK_WAYLAND_KEYMAP (keymap)->xkb_keymap;
|
||||
mods = get_xkb_modifiers (xkb_keymap, *state);
|
||||
|
||||
xkb_state = xkb_state_new (xkb_keymap);
|
||||
xkb_state_update_mask (xkb_state, mods & ~0xff, 0, 0, 0, 0, 0);
|
||||
mapped = xkb_state_serialize_mods (xkb_state, XKB_STATE_MODS_EFFECTIVE);
|
||||
if ((mapped & mods & 0xff) != 0)
|
||||
ret = FALSE;
|
||||
*state |= get_gdk_modifiers (xkb_keymap, mapped);
|
||||
|
||||
xkb_state_unref (xkb_state);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
_gdk_wayland_keymap_class_init (GdkWaylandKeymapClass *klass)
|
||||
{
|
||||
@ -449,8 +387,6 @@ _gdk_wayland_keymap_class_init (GdkWaylandKeymapClass *klass)
|
||||
keymap_class->lookup_key = gdk_wayland_keymap_lookup_key;
|
||||
keymap_class->translate_keyboard_state = gdk_wayland_keymap_translate_keyboard_state;
|
||||
keymap_class->get_modifier_state = gdk_wayland_keymap_get_modifier_state;
|
||||
keymap_class->add_virtual_modifiers = gdk_wayland_keymap_add_virtual_modifiers;
|
||||
keymap_class->map_virtual_modifiers = gdk_wayland_keymap_map_virtual_modifiers;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1673,20 +1673,6 @@ gdk_win32_keymap_translate_keyboard_state (GdkKeymap *gdk_keymap,
|
||||
return tmp_keyval != GDK_KEY_VoidSymbol;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_keymap_add_virtual_modifiers (GdkKeymap *keymap,
|
||||
GdkModifierType *state)
|
||||
{
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_win32_keymap_map_virtual_modifiers (GdkKeymap *keymap,
|
||||
GdkModifierType *state)
|
||||
{
|
||||
/* FIXME: Is this the right thing to do? */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_keymap_class_init (GdkWin32KeymapClass *klass)
|
||||
{
|
||||
@ -1704,6 +1690,4 @@ gdk_win32_keymap_class_init (GdkWin32KeymapClass *klass)
|
||||
keymap_class->get_entries_for_keycode = gdk_win32_keymap_get_entries_for_keycode;
|
||||
keymap_class->lookup_key = gdk_win32_keymap_lookup_key;
|
||||
keymap_class->translate_keyboard_state = gdk_win32_keymap_translate_keyboard_state;
|
||||
keymap_class->add_virtual_modifiers = gdk_win32_keymap_add_virtual_modifiers;
|
||||
keymap_class->map_virtual_modifiers = gdk_win32_keymap_map_virtual_modifiers;
|
||||
}
|
||||
|
@ -1455,7 +1455,12 @@ _gdk_x11_keymap_add_virt_mods (GdkKeymap *keymap,
|
||||
GdkX11Keymap *keymap_x11 = GDK_X11_KEYMAP (keymap);
|
||||
int i;
|
||||
|
||||
/* See comment in add_virtual_modifiers() */
|
||||
/* This loop used to start at 3, which included MOD1 in the
|
||||
* virtual mapping. However, all of GTK+ treats MOD1 as a
|
||||
* synonym for Alt, and does not expect it to be mapped around,
|
||||
* therefore it's more sane to simply treat MOD1 like SHIFT and
|
||||
* CONTROL, which are not mappable either.
|
||||
*/
|
||||
for (i = 4; i < 8; i++)
|
||||
{
|
||||
if ((1 << i) & *modifiers)
|
||||
@ -1470,33 +1475,6 @@ _gdk_x11_keymap_add_virt_mods (GdkKeymap *keymap,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_x11_keymap_add_virtual_modifiers (GdkKeymap *keymap,
|
||||
GdkModifierType *state)
|
||||
{
|
||||
GdkX11Keymap *keymap_x11 = GDK_X11_KEYMAP (keymap);
|
||||
int i;
|
||||
|
||||
/* This loop used to start at 3, which included MOD1 in the
|
||||
* virtual mapping. However, all of GTK+ treats MOD1 as a
|
||||
* synonym for Alt, and does not expect it to be mapped around,
|
||||
* therefore it's more sane to simply treat MOD1 like SHIFT and
|
||||
* CONTROL, which are not mappable either.
|
||||
*/
|
||||
for (i = 4; i < 8; i++)
|
||||
{
|
||||
if ((1 << i) & *state)
|
||||
{
|
||||
if (keymap_x11->modmap[i] & GDK_SUPER_MASK)
|
||||
*state |= GDK_SUPER_MASK;
|
||||
if (keymap_x11->modmap[i] & GDK_HYPER_MASK)
|
||||
*state |= GDK_HYPER_MASK;
|
||||
if (keymap_x11->modmap[i] & GDK_META_MASK)
|
||||
*state |= GDK_META_MASK;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_x11_keymap_key_is_modifier:
|
||||
* @keymap: (type GdkX11Keymap): a #GdkX11Keymap
|
||||
@ -1546,43 +1524,6 @@ gdk_x11_keymap_key_is_modifier (GdkKeymap *keymap,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gdk_x11_keymap_map_virtual_modifiers (GdkKeymap *keymap,
|
||||
GdkModifierType *state)
|
||||
{
|
||||
GdkX11Keymap *keymap_x11 = GDK_X11_KEYMAP (keymap);
|
||||
const guint vmods[] = { GDK_SUPER_MASK, GDK_HYPER_MASK, GDK_META_MASK };
|
||||
int i, j;
|
||||
gboolean retval;
|
||||
|
||||
#ifdef HAVE_XKB
|
||||
if (KEYMAP_USE_XKB (keymap))
|
||||
get_xkb (keymap_x11);
|
||||
#endif
|
||||
|
||||
retval = TRUE;
|
||||
|
||||
for (j = 0; j < 3; j++)
|
||||
{
|
||||
if (*state & vmods[j])
|
||||
{
|
||||
/* See comment in add_virtual_modifiers() */
|
||||
for (i = 4; i < 8; i++)
|
||||
{
|
||||
if (keymap_x11->modmap[i] & vmods[j])
|
||||
{
|
||||
if (*state & (1 << i))
|
||||
retval = FALSE;
|
||||
else
|
||||
*state |= 1 << i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static GdkModifierType
|
||||
gdk_x11_keymap_get_modifier_mask (GdkKeymap *keymap,
|
||||
GdkModifierIntent intent)
|
||||
@ -1614,7 +1555,5 @@ gdk_x11_keymap_class_init (GdkX11KeymapClass *klass)
|
||||
keymap_class->get_entries_for_keycode = gdk_x11_keymap_get_entries_for_keycode;
|
||||
keymap_class->lookup_key = gdk_x11_keymap_lookup_key;
|
||||
keymap_class->translate_keyboard_state = gdk_x11_keymap_translate_keyboard_state;
|
||||
keymap_class->add_virtual_modifiers = gdk_x11_keymap_add_virtual_modifiers;
|
||||
keymap_class->map_virtual_modifiers = gdk_x11_keymap_map_virtual_modifiers;
|
||||
keymap_class->get_modifier_mask = gdk_x11_keymap_get_modifier_mask;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user