Commit Graph

108 Commits

Author SHA1 Message Date
Matthias Clasen
eb9223c008 Be more strict in ignoring ineffective modifiers
After my recent fix for this, nautilus was still having problems
telling keeping F10 and Shift-F10 apart. With this change, we are
treating levels with the same symbol like inactive levels, ignoring
them entirely.
2012-09-09 18:28:48 -04:00
Matthias Clasen
314b6abbe8 Try harder to discriminate Shift-F10 and F10
A change in xkeyboard-config 2.4.1 made it so that function keys
now have a shift level which has the same symbol, but 'eats' the
shift modifier. This would ordinarily make it impossible for us
to discriminate between these key combinations.

This commit tries harder to discriminate in 2 ways:
- XKB has a mechanism to tell us when a modifier should not be
  consumed even though it was used in determining the level.
  We now respect such 'preserved' modifiers. This does not fix
  the Shift-F10 vs F10 problem yet, since xkeyboard-config does
  not currently mark Shift as preserved for function keys.
- Don't consume modifiers that do not change the symbol. For
  the function keys, the symbol on the shift level is the same
  as the base level, so we don't consider Shift consumed.

For more background on the xkeyboard-config change, see
https://bugs.freedesktop.org/show_bug.cgi?id=45008

https://bugzilla.gnome.org/show_bug.cgi?id=661973
2012-09-01 23:25:18 -04:00
Owen W. Taylor
0aa989ae76 GtkPlug: fix handling of key events for different layouts
GtkPlug directly handles X KeyPress/Release events, instead of using
translation in GDK (which expects XI2 events for XI2). When this
was done, the handling of the group was stubbed out and never replaced.

Export gdk_keymap_x11_group_for_state() and gdk_keymap_x11_is_modifier()
so we can fill out the fields correctly.

https://bugzilla.gnome.org/show_bug.cgi?id=675167
2012-04-30 16:35:10 -04:00
Matthias Clasen
de62a1096b Drop support for pre-R6 X
X11 R6 was released in 1995 - time to let go.
2012-03-10 23:27:21 -05:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Matthias Clasen
9a92a1da89 Add a way to get the current modifier state
Xkb makes this available to us, and it is useful if you want
to do easter eggs that are triggered by Alt.
2012-02-21 01:50:18 +01:00
Bastien Nocera
6697d5c6de x11: Fix first call to _gdk_x11_keymap_key_is_modifier()
_gdk_x11_keymap_key_is_modifier() never tries to set min/max_keycode
if they haven't been set before, meaning that until another function
sets those, all the keys will be seen as non-modifiers.

This causes GdkKeyEvents to be wrongly tagged with "->is_modifier = 0"
when in actual fact the key is a modifier. This fixes keyboard
shortcuts captured with GtkCellRendererAccel in "raw" mode thinking
a modifier without any actual keys is a valid shortcut.

https://bugzilla.gnome.org/show_bug.cgi?id=670400
2012-02-19 17:18:13 +01:00
Michael Natterer
6bb495f6bd gdk: remove the GET_EFFECTIVE_KEYMAP() stuff from gdkkeys-x11.c
We don't support passing a NULL keymap any longer. Also pull some
precondition checks into the parent class.
2011-11-18 16:43:41 +01:00
Michael Natterer
90e73dd1c4 gdk_x11_keymap_get_modifier_mask(): always return a value 2011-11-18 15:26:09 +01:00
Michael Natterer
9c79f9f868 Turn the private #define for the group-shifting modifier into API
Add GDK_MODIFIER_INTENT_SHIFT_GROUP to enum GdkModifierIntent
and handle it in gdk_keymap_get_modifier_mask(). Add an X11
impl of the method and return keymap_x11->group_switch_mask.
Return 0 from the default impl because we don't know.
2011-11-18 15:14:31 +01:00
Michael Natterer
ac943bf69a gdk: exclude MOD1 from the virtual modifier mapping
which effectively nails down the MOD1 == ALT assumption that is valid
in all other parts of GTK+. After the modifier abstraction fixes for
OSX, the virtual mapping is now (correctly) used in more places, and
caused problems with the common default PC keyboard layout on X11 that
colocates ALT and META on the same key.
2011-11-07 20:09:00 +01:00
Michael Natterer
5b74ee38e8 gdk: fix gdk_keyval_to_lower/upper() for Quartz, Win32 and Broadway
In 2.x, the !HAVE_XCONVERTCASE fallback of keyval_convert_case() was
implicitly used as implementation for all !X11 backends.

In 3.x, when this function was virtualized in GdkDisplayManager,
this fallback was moved to the X11 backend and the other backends
"equipped" with /* FIXME implement */ implementations of
keyval_convert_case() which don't convert anything.

Move the fallback code back to gdk/ as default implementation
of GdkDisplayManager::keyval_convert_case() and remove its
implementations is all backends but X11. Also remove the
implementation in Wayland which was a plain copy of what
is now the default implementation.
(cherry picked from commit f46c1b76d8)
2011-10-07 16:19:41 +02:00
Patrick Welche
0388781e8f XK_Num_Lock is called GDK_KEY_Num_Lock in this source tree. 2011-07-22 19:19:33 +01:00
Matthias Clasen
c22fb1684c GdkKeymap: Prevent an infinite loop in the non-XKB case
Somehow the increment got lost, as comparison with the 2.x code
shows.
2011-06-30 14:45:16 -04:00
Matthias Clasen
2226996b80 Keymap: properly initialize lock state
We need to get explicitly lock state initially, before we can
rely on state changed events to track it.
https://bugzilla.gnome.org/show_bug.cgi?id=645341
2011-04-03 17:39:31 -04:00
Matthias Clasen
e96c193d06 Rename GdkKeymapX11 to GdkX11Keymap
And add a gdkx11keys.h header file.
2010-12-21 12:07:09 -05:00
Benjamin Otte
4db086da4b x11: Rename GdkDisplayX11 to GdkX11Display
Also rename all the macros etc.
2010-12-21 12:07:07 -05:00
Benjamin Otte
8e2240f699 x11: Rename GdkDisplayX11 to GdkX11Display 2010-12-21 12:07:07 -05:00
Matthias Clasen
519f09f7f4 Add vfuncs for keyval and window property functions
The keyval functions should really be generic, and the window
property api should be completely revisited, but for now this
will allow us to proceed.
2010-12-21 12:07:03 -05:00
Matthias Clasen
62e9bb06a0 Add a vfunc for gdk_keymap_get_for_display 2010-12-21 12:07:02 -05:00
Matthias Clasen
a97b1891b3 Rename private keymap symbols to _gdk_x11_keymap... 2010-12-21 12:07:02 -05:00
Matthias Clasen
214342eac5 Clean up gdkx.h a bit
Moving the direct-access redefinitions of various macros
to gdkprivate-x11.h and use that header throughout in x11/.

Also remove a workaround for a long-fixed X server bug.
2010-12-21 12:07:01 -05:00
Matthias Clasen
ea96e5e16f Explode gdkinternals.h into per-class private headers
At the same time, move some more class and instance structs
out of public headers.
2010-12-21 12:06:58 -05:00
Alexander Larsson
8c6162b50c Convert all gdk_keymap methods to vtable calls 2010-12-21 12:06:54 -05:00
Matthias Clasen
17e2c5391c Fix up parameter mismatches in the docs
And other minor gdk doc fixes.
2010-12-03 09:07:06 -05:00
Milan Bouchet-Valat
2e3935ba9d Fix missing (transfer) annotations in GDK
Mostly missing (transfer none).
2010-11-24 21:37:20 +01:00
John (J5) Palmieri
cdf517d1c8 [introspection] add transfer none annotation to gdk_keyval_name return
* moved docs from .sgml file to th e.c file so we can add the annotation
2010-11-09 21:00:14 -05:00
Matthias Clasen
bda1f35585 Inclusion cleanups in sources
Try to do inclusions in the same sequence, more or less.
2010-10-14 22:09:36 -04:00
John Ralls
c3851df92d Replace GDK_Tab and GDK_ISO_Left_Tab with GDK_KEY equivalents
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=631475

Signed-off-by: Javier Jardón <jjardon@gnome.org>
2010-10-06 01:20:29 +02:00
Colin Walters
913cdf3be7 GDK: Prefix key names with KEY_
The keysyms create a lot of potential namespace conflicts for
C, and are especially problematic for introspection, where we take
constants into the namespace, so GDK_Display conflicts with GdkDisplay.

For C application compatiblity, add gdkkeysyms-compat.h which uses
the old names.

Just one user in GTK+ continues to use gdkkeysyms-compat.h, which is
the gtkimcontextsimple.c, since porting that requires porting more
custom Perl code.
2010-09-08 18:51:44 -04:00
Matthias Clasen
d5c2cb7bcb Avoid segfault on xkbless systems
This was reported in bug 628932 to cause problems on VNC.
2010-09-07 00:10:26 -04:00
Matthias Clasen
d5a8a3c9bc Make gdk_keymap_map_virtual_modifiers work early
It needs to ensure that we have an uptodate modmap. Bug 616401
2010-08-25 01:05:29 -04:00
Javier Jardón
404e7d0e00 gdk/: fully remove gdkalias hacks
https://bugzilla.gnome.org/show_bug.cgi?id=623845
2010-07-10 02:21:31 +02:00
William Jon McCann
0cfb94cdd4 [gdk] Add gdk_keymap_get_num_lock_state
https://bugzilla.gnome.org/show_bug.cgi?id=623239
2010-07-01 21:44:09 -04:00
Matthias Clasen
f5c6712002 Minor doc cleanup 2010-03-22 23:10:38 -04:00
Matthias Clasen
13d69e552d Fix a compatibility problem
It turns out that my attempt at handling Super, Hyper and Meta better
is causing problems, mostly because Alt and Meta are commonly colocated
in the modmap, and apps do a check for the Alt modifier regularly.

See e.g bug 607697.
2010-02-12 18:55:42 -05:00
Alejandro Piñeiro
bc39d88b44 Solve a wrong reference on gdk_keymap_translate_keyboard_state
Solves https://bugzilla.gnome.org/show_bug.cgi?id=608345
2010-02-09 11:52:49 +01:00
Matthias Clasen
f286c6281a Minor doc fix 2010-01-25 22:32:00 -05:00
Matthias Clasen
03b179c5e8 Try harder to handle accelerators involving virtual modifiers
This patch changes GDK to add all matching virtual modifiers in
the state field of the key event. The corresponding GTK+ change makes
use of a new GdkKeymap function to map virtual modifiers back to
real modifiers and detect conflicts while doing so.

This should fix bug 603190 and bug 427409.
2009-12-21 11:15:28 -05:00
Colin Walters
18dc96caf8 Merge in Gdk-custom.c introspection annotations
The Gdk-custom.c file in gir-repository contained a number of
introspection annotations.  Merge those into the GDK source files.

Some documentation was moved from the tmpl/ files to accomodate
the addition of annotations.

https://bugzilla.gnome.org/show_bug.cgi?id=592279
2009-12-16 17:22:01 -02:00
Nicola Fontana
1e1131c959 Do not use static GTypeInfo and GInterfaceInfo
Either g_type_register_static_simple (used by G_DEFINE_TYPE_EXTENDED)
and G_IMPLEMENT_INTERFACE use automatic variables for GTypeInfo and
GInterfaceInfo structs, while tutorials and source code often use
static variables. This commit consistently adopts the former method.

https://bugzilla.gnome.org/show_bug.cgi?id=600158
2009-11-06 01:21:09 +01:00
Javier Jardón
3dbfc08a7a Fix some compilation warnings
Fixed the prototypes of MyEnhancedXkbTranslateKeyCode() and
translate_keysym() to take a gint* because those functions treat
these arguments as an int, so we get around the need to cast.
2009-10-30 18:33:16 +01:00
Matthias Clasen
8ea8b1ee48 Typo fixes and small doc improvements
svn path=/trunk/; revision=21929
2008-12-26 04:20:28 +00:00
Matthias Clasen
d6350143cc remove debug spew
svn path=/trunk/; revision=21561
2008-10-01 14:34:12 +00:00
Matthias Clasen
859aaf903d Bug 107000 – Add signals to GdkKeymap for monitoring caps_lock, etc.
2008-09-29  Matthias Clasen  <mclasen@redhat.com>

        Bug 107000 – Add signals to GdkKeymap for monitoring caps_lock, etc.

        * gdk/gdk.symbols:
        * gdk/gdkkeys.[ch]: Add a new GdkKeymap::state-changed signal, and
        a gdk_keymap_get_caps_lock_state function.

        * gdk/x11/gdkkeys-x11.c: Implement it here. For now, only emit
        state-changed when caps lock lockedness changes.

        * gdk/x11/gdkdisplay-x11.c: Also select for modifier lock status
        changes in the XkbSelectEventDetails call.


svn path=/trunk/; revision=21545
2008-09-29 20:40:45 +00:00
Johan Dahlin
d97cdbdf53 Include "config.h" instead of <config.h> Command used: find -name
2008-06-21  Johan Dahlin  <jdahlin@async.com.br>

    * *.[ch]: Include "config.h" instead of <config.h>
    Command used:
    find -name \*.[ch]|xargs perl -p -i -e 's/^#include <config.h>/#include "config.h"/g'
    Rubberstamped by Mitch and Tim


svn path=/trunk/; revision=20669
2008-06-22 14:28:52 +00:00
Matthias Clasen
080253c257 Protect against XKB being stupid. Reported by Pedro Villavicencio.
* gdk/x11/gdkkeys-x11.c (_gdk_keymap_key_is_modifier): Protect
        against XKB being stupid. Reported by Pedro Villavicencio.



svn path=/trunk/; revision=20413
2008-06-17 02:11:47 +00:00
Matthias Clasen
741cd0e2ae Fix a small doc issues.
2008-02-15  Matthias Clasen  <mclasen@redhat.com>

        * gdk/x11/gdkkeys-x11.c:
        * gdk/x11/gdkcolor-x11.c:
        * gdk/gdkpolyreg-generic.c: Fix a small doc issues.


svn path=/trunk/; revision=19579
2008-02-15 19:02:44 +00:00
Matthias Clasen
6ec22dfc1d Documentation fixes
svn path=/trunk/; revision=18522
2007-07-22 04:19:19 +00:00
Matthias Clasen
436a34e318 New function to determine if keyboard layouts for both LTR and LTR
2007-06-29  Matthias Clasen  <mclasen@redhat.com>

        * gdk/gdk.symbols:
        * gdk/gdkkeys.h:
        * gdk/x11/gdkkeys-x11.c (gdk_keymap_have_bidi_layouts): New
        function to determine if keyboard layouts for both LTR and LTR
        languages are in use. Refactor the direction caching code to
        make this information available.  (#451575, Behnam Esfahbod)



svn path=/trunk/; revision=18301
2007-06-30 01:43:04 +00:00