1
0
Fork 0
mutter-performance-source/src/backends/x11/meta-keymap-x11.h
Ray Strode 6060b6a240 backends/x11: Fix key repeat of on-screen keyboard for second level keysyms
Certains keys (such as ~ and |) are in the keyboard map behind the
second shift level. This means in order for them to be input, the
shift key needs to be held down by the user.

The GNOME Shell on-screen keyboard presents these keys separately on
a page of keys that has no shift key. Instead, it relies on mutter
to set a shift latch before the key event is emitted. A shift latch
is a virtual press of the shift key that automatically gets released
after the next key press (in our case the ~ or | key).

The problem is using a shift latch doesn't work very well in the face
of key repeat. The latch is automatically released after the first
press, and subsequent repeats of that press no longer have shift
latched to them.

This commit fixes the problem by using a shift lock instead of a shift
latch. A shift lock is never implicitly released, so it remains
in place for the duration of key repeat.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2045>
2021-11-04 13:15:25 +00:00

61 lines
2.8 KiB
C

/*
* Copyright (C) 2009 Intel Corp.
*
* 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, see <http://www.gnu.org/licenses/>.
*
* Author: Emmanuele Bassi <ebassi@linux.intel.com>
*/
#ifndef META_KEYMAP_X11_H
#define META_KEYMAP_X11_H
#include <glib-object.h>
#include <pango/pango.h>
#include "clutter/clutter.h"
G_BEGIN_DECLS
#define META_TYPE_KEYMAP_X11 (meta_keymap_x11_get_type ())
G_DECLARE_FINAL_TYPE (MetaKeymapX11, meta_keymap_x11,
META, KEYMAP_X11, ClutterKeymap)
int meta_keymap_x11_get_key_group (MetaKeymapX11 *keymap,
ClutterModifierType state);
int meta_keymap_x11_translate_key_state (MetaKeymapX11 *keymap,
guint hardware_keycode,
ClutterModifierType *modifier_state_p,
ClutterModifierType *mods_p);
gboolean meta_keymap_x11_get_is_modifier (MetaKeymapX11 *keymap,
int keycode);
gboolean meta_keymap_x11_keycode_for_keyval (MetaKeymapX11 *keymap_x11,
guint keyval,
guint *keycode_out,
guint *level_out);
void meta_keymap_x11_lock_modifiers (MetaKeymapX11 *keymap_x11,
uint32_t level,
gboolean enable);
gboolean meta_keymap_x11_reserve_keycode (MetaKeymapX11 *keymap_x11,
guint keyval,
guint *keycode_out);
void meta_keymap_x11_release_keycode_if_needed (MetaKeymapX11 *keymap_x11,
guint keycode);
gboolean meta_keymap_x11_handle_event (MetaKeymapX11 *keymap_x11,
XEvent *xevent);
G_END_DECLS
#endif /* META_KEYMAP_X11_H */