mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 13:11:13 +00:00
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
)
This commit is contained in:
parent
87cc0dc79f
commit
5b74ee38e8
@ -87,19 +87,6 @@ gdk_broadway_display_manager_lookup_keyval (GdkDisplayManager *manager,
|
||||
return _gdk_keyval_from_name (name);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_display_manager_keyval_convert_case (GdkDisplayManager *manager,
|
||||
guint symbol,
|
||||
guint *lower,
|
||||
guint *upper)
|
||||
{
|
||||
/* FIXME implement this */
|
||||
if (lower)
|
||||
*lower = symbol;
|
||||
if (upper)
|
||||
*upper = symbol;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_broadway_display_manager_init (GdkBroadwayDisplayManager *manager)
|
||||
{
|
||||
@ -129,7 +116,6 @@ gdk_broadway_display_manager_class_init (GdkBroadwayDisplayManagerClass *class)
|
||||
manager_class->get_atom_name = _gdk_broadway_display_manager_get_atom_name;
|
||||
manager_class->lookup_keyval = gdk_broadway_display_manager_lookup_keyval;
|
||||
manager_class->get_keyval_name = gdk_broadway_display_manager_get_keyval_name;
|
||||
manager_class->keyval_convert_case = gdk_broadway_display_manager_keyval_convert_case;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "gdkconfig.h"
|
||||
#include "gdkdisplaymanagerprivate.h"
|
||||
#include "gdkinternals.h"
|
||||
#include "gdkkeysprivate.h"
|
||||
#include "gdkmarshalers.h"
|
||||
#include "gdkintl.h"
|
||||
|
||||
@ -136,6 +137,8 @@ gdk_display_manager_class_init (GdkDisplayManagerClass *klass)
|
||||
object_class->set_property = gdk_display_manager_set_property;
|
||||
object_class->get_property = gdk_display_manager_get_property;
|
||||
|
||||
klass->keyval_convert_case = _gdk_display_manager_real_keyval_convert_case;
|
||||
|
||||
/**
|
||||
* GdkDisplayManager::display-opened:
|
||||
* @manager: the object on which the signal is emitted
|
||||
|
127
gdk/gdkkeys.c
127
gdk/gdkkeys.c
@ -26,6 +26,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "gdkkeysyms.h"
|
||||
#include "gdkkeysprivate.h"
|
||||
#include "gdkdisplay.h"
|
||||
#include "gdkdisplaymanagerprivate.h"
|
||||
@ -711,3 +712,129 @@ gdk_keyval_from_name (const gchar *keyval_name)
|
||||
return GDK_DISPLAY_MANAGER_GET_CLASS (manager)->lookup_keyval (manager,
|
||||
keyval_name);
|
||||
}
|
||||
|
||||
void
|
||||
_gdk_display_manager_real_keyval_convert_case (GdkDisplayManager *manager,
|
||||
guint symbol,
|
||||
guint *lower,
|
||||
guint *upper)
|
||||
{
|
||||
guint xlower = symbol;
|
||||
guint xupper = symbol;
|
||||
|
||||
/* Check for directly encoded 24-bit UCS characters: */
|
||||
if ((symbol & 0xff000000) == 0x01000000)
|
||||
{
|
||||
if (lower)
|
||||
*lower = gdk_unicode_to_keyval (g_unichar_tolower (symbol & 0x00ffffff));
|
||||
if (upper)
|
||||
*upper = gdk_unicode_to_keyval (g_unichar_toupper (symbol & 0x00ffffff));
|
||||
return;
|
||||
}
|
||||
|
||||
switch (symbol >> 8)
|
||||
{
|
||||
case 0: /* Latin 1 */
|
||||
if ((symbol >= GDK_KEY_A) && (symbol <= GDK_KEY_Z))
|
||||
xlower += (GDK_KEY_a - GDK_KEY_A);
|
||||
else if ((symbol >= GDK_KEY_a) && (symbol <= GDK_KEY_z))
|
||||
xupper -= (GDK_KEY_a - GDK_KEY_A);
|
||||
else if ((symbol >= GDK_KEY_Agrave) && (symbol <= GDK_KEY_Odiaeresis))
|
||||
xlower += (GDK_KEY_agrave - GDK_KEY_Agrave);
|
||||
else if ((symbol >= GDK_KEY_agrave) && (symbol <= GDK_KEY_odiaeresis))
|
||||
xupper -= (GDK_KEY_agrave - GDK_KEY_Agrave);
|
||||
else if ((symbol >= GDK_KEY_Ooblique) && (symbol <= GDK_KEY_Thorn))
|
||||
xlower += (GDK_KEY_oslash - GDK_KEY_Ooblique);
|
||||
else if ((symbol >= GDK_KEY_oslash) && (symbol <= GDK_KEY_thorn))
|
||||
xupper -= (GDK_KEY_oslash - GDK_KEY_Ooblique);
|
||||
break;
|
||||
|
||||
case 1: /* Latin 2 */
|
||||
/* Assume the KeySym is a legal value (ignore discontinuities) */
|
||||
if (symbol == GDK_KEY_Aogonek)
|
||||
xlower = GDK_KEY_aogonek;
|
||||
else if (symbol >= GDK_KEY_Lstroke && symbol <= GDK_KEY_Sacute)
|
||||
xlower += (GDK_KEY_lstroke - GDK_KEY_Lstroke);
|
||||
else if (symbol >= GDK_KEY_Scaron && symbol <= GDK_KEY_Zacute)
|
||||
xlower += (GDK_KEY_scaron - GDK_KEY_Scaron);
|
||||
else if (symbol >= GDK_KEY_Zcaron && symbol <= GDK_KEY_Zabovedot)
|
||||
xlower += (GDK_KEY_zcaron - GDK_KEY_Zcaron);
|
||||
else if (symbol == GDK_KEY_aogonek)
|
||||
xupper = GDK_KEY_Aogonek;
|
||||
else if (symbol >= GDK_KEY_lstroke && symbol <= GDK_KEY_sacute)
|
||||
xupper -= (GDK_KEY_lstroke - GDK_KEY_Lstroke);
|
||||
else if (symbol >= GDK_KEY_scaron && symbol <= GDK_KEY_zacute)
|
||||
xupper -= (GDK_KEY_scaron - GDK_KEY_Scaron);
|
||||
else if (symbol >= GDK_KEY_zcaron && symbol <= GDK_KEY_zabovedot)
|
||||
xupper -= (GDK_KEY_zcaron - GDK_KEY_Zcaron);
|
||||
else if (symbol >= GDK_KEY_Racute && symbol <= GDK_KEY_Tcedilla)
|
||||
xlower += (GDK_KEY_racute - GDK_KEY_Racute);
|
||||
else if (symbol >= GDK_KEY_racute && symbol <= GDK_KEY_tcedilla)
|
||||
xupper -= (GDK_KEY_racute - GDK_KEY_Racute);
|
||||
break;
|
||||
|
||||
case 2: /* Latin 3 */
|
||||
/* Assume the KeySym is a legal value (ignore discontinuities) */
|
||||
if (symbol >= GDK_KEY_Hstroke && symbol <= GDK_KEY_Hcircumflex)
|
||||
xlower += (GDK_KEY_hstroke - GDK_KEY_Hstroke);
|
||||
else if (symbol >= GDK_KEY_Gbreve && symbol <= GDK_KEY_Jcircumflex)
|
||||
xlower += (GDK_KEY_gbreve - GDK_KEY_Gbreve);
|
||||
else if (symbol >= GDK_KEY_hstroke && symbol <= GDK_KEY_hcircumflex)
|
||||
xupper -= (GDK_KEY_hstroke - GDK_KEY_Hstroke);
|
||||
else if (symbol >= GDK_KEY_gbreve && symbol <= GDK_KEY_jcircumflex)
|
||||
xupper -= (GDK_KEY_gbreve - GDK_KEY_Gbreve);
|
||||
else if (symbol >= GDK_KEY_Cabovedot && symbol <= GDK_KEY_Scircumflex)
|
||||
xlower += (GDK_KEY_cabovedot - GDK_KEY_Cabovedot);
|
||||
else if (symbol >= GDK_KEY_cabovedot && symbol <= GDK_KEY_scircumflex)
|
||||
xupper -= (GDK_KEY_cabovedot - GDK_KEY_Cabovedot);
|
||||
break;
|
||||
|
||||
case 3: /* Latin 4 */
|
||||
/* Assume the KeySym is a legal value (ignore discontinuities) */
|
||||
if (symbol >= GDK_KEY_Rcedilla && symbol <= GDK_KEY_Tslash)
|
||||
xlower += (GDK_KEY_rcedilla - GDK_KEY_Rcedilla);
|
||||
else if (symbol >= GDK_KEY_rcedilla && symbol <= GDK_KEY_tslash)
|
||||
xupper -= (GDK_KEY_rcedilla - GDK_KEY_Rcedilla);
|
||||
else if (symbol == GDK_KEY_ENG)
|
||||
xlower = GDK_KEY_eng;
|
||||
else if (symbol == GDK_KEY_eng)
|
||||
xupper = GDK_KEY_ENG;
|
||||
else if (symbol >= GDK_KEY_Amacron && symbol <= GDK_KEY_Umacron)
|
||||
xlower += (GDK_KEY_amacron - GDK_KEY_Amacron);
|
||||
else if (symbol >= GDK_KEY_amacron && symbol <= GDK_KEY_umacron)
|
||||
xupper -= (GDK_KEY_amacron - GDK_KEY_Amacron);
|
||||
break;
|
||||
|
||||
case 6: /* Cyrillic */
|
||||
/* Assume the KeySym is a legal value (ignore discontinuities) */
|
||||
if (symbol >= GDK_KEY_Serbian_DJE && symbol <= GDK_KEY_Serbian_DZE)
|
||||
xlower -= (GDK_KEY_Serbian_DJE - GDK_KEY_Serbian_dje);
|
||||
else if (symbol >= GDK_KEY_Serbian_dje && symbol <= GDK_KEY_Serbian_dze)
|
||||
xupper += (GDK_KEY_Serbian_DJE - GDK_KEY_Serbian_dje);
|
||||
else if (symbol >= GDK_KEY_Cyrillic_YU && symbol <= GDK_KEY_Cyrillic_HARDSIGN)
|
||||
xlower -= (GDK_KEY_Cyrillic_YU - GDK_KEY_Cyrillic_yu);
|
||||
else if (symbol >= GDK_KEY_Cyrillic_yu && symbol <= GDK_KEY_Cyrillic_hardsign)
|
||||
xupper += (GDK_KEY_Cyrillic_YU - GDK_KEY_Cyrillic_yu);
|
||||
break;
|
||||
|
||||
case 7: /* Greek */
|
||||
/* Assume the KeySym is a legal value (ignore discontinuities) */
|
||||
if (symbol >= GDK_KEY_Greek_ALPHAaccent && symbol <= GDK_KEY_Greek_OMEGAaccent)
|
||||
xlower += (GDK_KEY_Greek_alphaaccent - GDK_KEY_Greek_ALPHAaccent);
|
||||
else if (symbol >= GDK_KEY_Greek_alphaaccent && symbol <= GDK_KEY_Greek_omegaaccent &&
|
||||
symbol != GDK_KEY_Greek_iotaaccentdieresis &&
|
||||
symbol != GDK_KEY_Greek_upsilonaccentdieresis)
|
||||
xupper -= (GDK_KEY_Greek_alphaaccent - GDK_KEY_Greek_ALPHAaccent);
|
||||
else if (symbol >= GDK_KEY_Greek_ALPHA && symbol <= GDK_KEY_Greek_OMEGA)
|
||||
xlower += (GDK_KEY_Greek_alpha - GDK_KEY_Greek_ALPHA);
|
||||
else if (symbol >= GDK_KEY_Greek_alpha && symbol <= GDK_KEY_Greek_omega &&
|
||||
symbol != GDK_KEY_Greek_finalsmallsigma)
|
||||
xupper -= (GDK_KEY_Greek_alpha - GDK_KEY_Greek_ALPHA);
|
||||
break;
|
||||
}
|
||||
|
||||
if (lower)
|
||||
*lower = xlower;
|
||||
if (upper)
|
||||
*upper = xupper;
|
||||
}
|
||||
|
@ -77,6 +77,11 @@ struct _GdkKeymap
|
||||
GdkDisplay *display;
|
||||
};
|
||||
|
||||
void _gdk_display_manager_real_keyval_convert_case (GdkDisplayManager *manager,
|
||||
guint symbol,
|
||||
guint *lower,
|
||||
guint *upper);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
||||
|
@ -91,19 +91,6 @@ gdk_quartz_display_manager_lookup_keyval (GdkDisplayManager *manager,
|
||||
return _gdk_keyval_from_name (name);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_quartz_display_manager_keyval_convert_case (GdkDisplayManager *manager,
|
||||
guint symbol,
|
||||
guint *lower,
|
||||
guint *upper)
|
||||
{
|
||||
/* FIXME implement this */
|
||||
if (lower)
|
||||
*lower = symbol;
|
||||
if (upper)
|
||||
*upper = symbol;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_quartz_display_manager_init (GdkQuartzDisplayManager *manager)
|
||||
{
|
||||
@ -144,7 +131,6 @@ gdk_quartz_display_manager_class_init (GdkQuartzDisplayManagerClass *class)
|
||||
manager_class->get_atom_name = _gdk_quartz_display_manager_get_atom_name;
|
||||
manager_class->lookup_keyval = gdk_quartz_display_manager_lookup_keyval;
|
||||
manager_class->get_keyval_name = gdk_quartz_display_manager_get_keyval_name;
|
||||
manager_class->keyval_convert_case = gdk_quartz_display_manager_keyval_convert_case;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -138,132 +138,6 @@ gdk_wayland_display_manager_get_keyval_name (GdkDisplayManager *manager,
|
||||
return buf;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_display_manager_keyval_convert_case (GdkDisplayManager *manager,
|
||||
guint symbol,
|
||||
guint *lower,
|
||||
guint *upper)
|
||||
{
|
||||
guint xlower = symbol;
|
||||
guint xupper = symbol;
|
||||
|
||||
/* Check for directly encoded 24-bit UCS characters: */
|
||||
if ((symbol & 0xff000000) == 0x01000000)
|
||||
{
|
||||
if (lower)
|
||||
*lower = gdk_unicode_to_keyval (g_unichar_tolower (symbol & 0x00ffffff));
|
||||
if (upper)
|
||||
*upper = gdk_unicode_to_keyval (g_unichar_toupper (symbol & 0x00ffffff));
|
||||
return;
|
||||
}
|
||||
|
||||
switch (symbol >> 8)
|
||||
{
|
||||
case 0: /* Latin 1 */
|
||||
if ((symbol >= GDK_KEY_A) && (symbol <= GDK_KEY_Z))
|
||||
xlower += (GDK_KEY_a - GDK_KEY_A);
|
||||
else if ((symbol >= GDK_KEY_a) && (symbol <= GDK_KEY_z))
|
||||
xupper -= (GDK_KEY_a - GDK_KEY_A);
|
||||
else if ((symbol >= GDK_KEY_Agrave) && (symbol <= GDK_KEY_Odiaeresis))
|
||||
xlower += (GDK_KEY_agrave - GDK_KEY_Agrave);
|
||||
else if ((symbol >= GDK_KEY_agrave) && (symbol <= GDK_KEY_odiaeresis))
|
||||
xupper -= (GDK_KEY_agrave - GDK_KEY_Agrave);
|
||||
else if ((symbol >= GDK_KEY_Ooblique) && (symbol <= GDK_KEY_Thorn))
|
||||
xlower += (GDK_KEY_oslash - GDK_KEY_Ooblique);
|
||||
else if ((symbol >= GDK_KEY_oslash) && (symbol <= GDK_KEY_thorn))
|
||||
xupper -= (GDK_KEY_oslash - GDK_KEY_Ooblique);
|
||||
break;
|
||||
|
||||
case 1: /* Latin 2 */
|
||||
/* Assume the KeySym is a legal value (ignore discontinuities) */
|
||||
if (symbol == GDK_KEY_Aogonek)
|
||||
xlower = GDK_KEY_aogonek;
|
||||
else if (symbol >= GDK_KEY_Lstroke && symbol <= GDK_KEY_Sacute)
|
||||
xlower += (GDK_KEY_lstroke - GDK_KEY_Lstroke);
|
||||
else if (symbol >= GDK_KEY_Scaron && symbol <= GDK_KEY_Zacute)
|
||||
xlower += (GDK_KEY_scaron - GDK_KEY_Scaron);
|
||||
else if (symbol >= GDK_KEY_Zcaron && symbol <= GDK_KEY_Zabovedot)
|
||||
xlower += (GDK_KEY_zcaron - GDK_KEY_Zcaron);
|
||||
else if (symbol == GDK_KEY_aogonek)
|
||||
xupper = GDK_KEY_Aogonek;
|
||||
else if (symbol >= GDK_KEY_lstroke && symbol <= GDK_KEY_sacute)
|
||||
xupper -= (GDK_KEY_lstroke - GDK_KEY_Lstroke);
|
||||
else if (symbol >= GDK_KEY_scaron && symbol <= GDK_KEY_zacute)
|
||||
xupper -= (GDK_KEY_scaron - GDK_KEY_Scaron);
|
||||
else if (symbol >= GDK_KEY_zcaron && symbol <= GDK_KEY_zabovedot)
|
||||
xupper -= (GDK_KEY_zcaron - GDK_KEY_Zcaron);
|
||||
else if (symbol >= GDK_KEY_Racute && symbol <= GDK_KEY_Tcedilla)
|
||||
xlower += (GDK_KEY_racute - GDK_KEY_Racute);
|
||||
else if (symbol >= GDK_KEY_racute && symbol <= GDK_KEY_tcedilla)
|
||||
xupper -= (GDK_KEY_racute - GDK_KEY_Racute);
|
||||
break;
|
||||
|
||||
case 2: /* Latin 3 */
|
||||
/* Assume the KeySym is a legal value (ignore discontinuities) */
|
||||
if (symbol >= GDK_KEY_Hstroke && symbol <= GDK_KEY_Hcircumflex)
|
||||
xlower += (GDK_KEY_hstroke - GDK_KEY_Hstroke);
|
||||
else if (symbol >= GDK_KEY_Gbreve && symbol <= GDK_KEY_Jcircumflex)
|
||||
xlower += (GDK_KEY_gbreve - GDK_KEY_Gbreve);
|
||||
else if (symbol >= GDK_KEY_hstroke && symbol <= GDK_KEY_hcircumflex)
|
||||
xupper -= (GDK_KEY_hstroke - GDK_KEY_Hstroke);
|
||||
else if (symbol >= GDK_KEY_gbreve && symbol <= GDK_KEY_jcircumflex)
|
||||
xupper -= (GDK_KEY_gbreve - GDK_KEY_Gbreve);
|
||||
else if (symbol >= GDK_KEY_Cabovedot && symbol <= GDK_KEY_Scircumflex)
|
||||
xlower += (GDK_KEY_cabovedot - GDK_KEY_Cabovedot);
|
||||
else if (symbol >= GDK_KEY_cabovedot && symbol <= GDK_KEY_scircumflex)
|
||||
xupper -= (GDK_KEY_cabovedot - GDK_KEY_Cabovedot);
|
||||
break;
|
||||
|
||||
case 3: /* Latin 4 */
|
||||
/* Assume the KeySym is a legal value (ignore discontinuities) */
|
||||
if (symbol >= GDK_KEY_Rcedilla && symbol <= GDK_KEY_Tslash)
|
||||
xlower += (GDK_KEY_rcedilla - GDK_KEY_Rcedilla);
|
||||
else if (symbol >= GDK_KEY_rcedilla && symbol <= GDK_KEY_tslash)
|
||||
xupper -= (GDK_KEY_rcedilla - GDK_KEY_Rcedilla);
|
||||
else if (symbol == GDK_KEY_ENG)
|
||||
xlower = GDK_KEY_eng;
|
||||
else if (symbol == GDK_KEY_eng)
|
||||
xupper = GDK_KEY_ENG;
|
||||
else if (symbol >= GDK_KEY_Amacron && symbol <= GDK_KEY_Umacron)
|
||||
xlower += (GDK_KEY_amacron - GDK_KEY_Amacron);
|
||||
else if (symbol >= GDK_KEY_amacron && symbol <= GDK_KEY_umacron)
|
||||
xupper -= (GDK_KEY_amacron - GDK_KEY_Amacron);
|
||||
break;
|
||||
|
||||
case 6: /* Cyrillic */
|
||||
/* Assume the KeySym is a legal value (ignore discontinuities) */
|
||||
if (symbol >= GDK_KEY_Serbian_DJE && symbol <= GDK_KEY_Serbian_DZE)
|
||||
xlower -= (GDK_KEY_Serbian_DJE - GDK_KEY_Serbian_dje);
|
||||
else if (symbol >= GDK_KEY_Serbian_dje && symbol <= GDK_KEY_Serbian_dze)
|
||||
xupper += (GDK_KEY_Serbian_DJE - GDK_KEY_Serbian_dje);
|
||||
else if (symbol >= GDK_KEY_Cyrillic_YU && symbol <= GDK_KEY_Cyrillic_HARDSIGN)
|
||||
xlower -= (GDK_KEY_Cyrillic_YU - GDK_KEY_Cyrillic_yu);
|
||||
else if (symbol >= GDK_KEY_Cyrillic_yu && symbol <= GDK_KEY_Cyrillic_hardsign)
|
||||
xupper += (GDK_KEY_Cyrillic_YU - GDK_KEY_Cyrillic_yu);
|
||||
break;
|
||||
|
||||
case 7: /* Greek */
|
||||
/* Assume the KeySym is a legal value (ignore discontinuities) */
|
||||
if (symbol >= GDK_KEY_Greek_ALPHAaccent && symbol <= GDK_KEY_Greek_OMEGAaccent)
|
||||
xlower += (GDK_KEY_Greek_alphaaccent - GDK_KEY_Greek_ALPHAaccent);
|
||||
else if (symbol >= GDK_KEY_Greek_alphaaccent && symbol <= GDK_KEY_Greek_omegaaccent &&
|
||||
symbol != GDK_KEY_Greek_iotaaccentdieresis &&
|
||||
symbol != GDK_KEY_Greek_upsilonaccentdieresis)
|
||||
xupper -= (GDK_KEY_Greek_alphaaccent - GDK_KEY_Greek_ALPHAaccent);
|
||||
else if (symbol >= GDK_KEY_Greek_ALPHA && symbol <= GDK_KEY_Greek_OMEGA)
|
||||
xlower += (GDK_KEY_Greek_alpha - GDK_KEY_Greek_ALPHA);
|
||||
else if (symbol >= GDK_KEY_Greek_alpha && symbol <= GDK_KEY_Greek_omega &&
|
||||
symbol != GDK_KEY_Greek_finalsmallsigma)
|
||||
xupper -= (GDK_KEY_Greek_alpha - GDK_KEY_Greek_ALPHA);
|
||||
break;
|
||||
}
|
||||
|
||||
if (lower)
|
||||
*lower = xlower;
|
||||
if (upper)
|
||||
*upper = xupper;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_wayland_display_manager_class_init (GdkWaylandDisplayManagerClass *class)
|
||||
{
|
||||
@ -280,7 +154,6 @@ gdk_wayland_display_manager_class_init (GdkWaylandDisplayManagerClass *class)
|
||||
manager_class->get_atom_name = gdk_wayland_display_manager_get_atom_name;
|
||||
manager_class->lookup_keyval = gdk_wayland_display_manager_lookup_keyval;
|
||||
manager_class->get_keyval_name = gdk_wayland_display_manager_get_keyval_name;
|
||||
manager_class->keyval_convert_case = gdk_wayland_display_manager_keyval_convert_case;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -82,19 +82,6 @@ gdk_win32_display_manager_lookup_keyval (GdkDisplayManager *manager,
|
||||
return _gdk_keyval_from_name (name);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_display_manager_keyval_convert_case (GdkDisplayManager *manager,
|
||||
guint symbol,
|
||||
guint *lower,
|
||||
guint *upper)
|
||||
{
|
||||
/* FIXME implement this */
|
||||
if (lower)
|
||||
*lower = symbol;
|
||||
if (upper)
|
||||
*upper = symbol;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_display_manager_init (GdkWin32DisplayManager *manager)
|
||||
{
|
||||
@ -131,5 +118,4 @@ gdk_win32_display_manager_class_init (GdkWin32DisplayManagerClass *class)
|
||||
manager_class->get_atom_name = _gdk_win32_display_manager_get_atom_name;
|
||||
manager_class->lookup_keyval = gdk_win32_display_manager_lookup_keyval;
|
||||
manager_class->get_keyval_name = gdk_win32_display_manager_get_keyval_name;
|
||||
manager_class->keyval_convert_case = gdk_win32_display_manager_keyval_convert_case;
|
||||
}
|
||||
|
@ -110,7 +110,9 @@ gdk_x11_display_manager_class_init (GdkX11DisplayManagerClass *class)
|
||||
manager_class->get_atom_name = _gdk_x11_display_manager_get_atom_name;
|
||||
manager_class->lookup_keyval = _gdk_x11_display_manager_lookup_keyval;
|
||||
manager_class->get_keyval_name = _gdk_x11_display_manager_get_keyval_name;
|
||||
#ifdef HAVE_XCONVERTCASE
|
||||
manager_class->keyval_convert_case = _gdk_x11_display_manager_keyval_convert_case;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1457,133 +1457,7 @@ _gdk_x11_display_manager_keyval_convert_case (GdkDisplayManager *manager,
|
||||
if (upper)
|
||||
*upper = xupper;
|
||||
}
|
||||
#else /* !HAVE_XCONVERTCASE */
|
||||
void
|
||||
_gdk_x11_display_manager_keyval_convert_case (GdkDisplayManager *manager,
|
||||
guint symbol,
|
||||
guint *lower,
|
||||
guint *upper)
|
||||
{
|
||||
guint xlower = symbol;
|
||||
guint xupper = symbol;
|
||||
|
||||
/* Check for directly encoded 24-bit UCS characters: */
|
||||
if ((symbol & 0xff000000) == 0x01000000)
|
||||
{
|
||||
if (lower)
|
||||
*lower = gdk_unicode_to_keyval (g_unichar_tolower (symbol & 0x00ffffff));
|
||||
if (upper)
|
||||
*upper = gdk_unicode_to_keyval (g_unichar_toupper (symbol & 0x00ffffff));
|
||||
return;
|
||||
}
|
||||
|
||||
switch (symbol >> 8)
|
||||
{
|
||||
case 0: /* Latin 1 */
|
||||
if ((symbol >= GDK_KEY_A) && (symbol <= GDK_KEY_Z))
|
||||
xlower += (GDK_KEY_a - GDK_KEY_A);
|
||||
else if ((symbol >= GDK_KEY_a) && (symbol <= GDK_KEY_z))
|
||||
xupper -= (GDK_KEY_a - GDK_KEY_A);
|
||||
else if ((symbol >= GDK_KEY_Agrave) && (symbol <= GDK_KEY_Odiaeresis))
|
||||
xlower += (GDK_KEY_agrave - GDK_KEY_Agrave);
|
||||
else if ((symbol >= GDK_KEY_agrave) && (symbol <= GDK_KEY_odiaeresis))
|
||||
xupper -= (GDK_KEY_agrave - GDK_KEY_Agrave);
|
||||
else if ((symbol >= GDK_KEY_Ooblique) && (symbol <= GDK_KEY_Thorn))
|
||||
xlower += (GDK_KEY_oslash - GDK_KEY_Ooblique);
|
||||
else if ((symbol >= GDK_KEY_oslash) && (symbol <= GDK_KEY_thorn))
|
||||
xupper -= (GDK_KEY_oslash - GDK_KEY_Ooblique);
|
||||
break;
|
||||
|
||||
case 1: /* Latin 2 */
|
||||
/* Assume the KeySym is a legal value (ignore discontinuities) */
|
||||
if (symbol == GDK_KEY_Aogonek)
|
||||
xlower = GDK_KEY_aogonek;
|
||||
else if (symbol >= GDK_KEY_Lstroke && symbol <= GDK_KEY_Sacute)
|
||||
xlower += (GDK_KEY_lstroke - GDK_KEY_Lstroke);
|
||||
else if (symbol >= GDK_KEY_Scaron && symbol <= GDK_KEY_Zacute)
|
||||
xlower += (GDK_KEY_scaron - GDK_KEY_Scaron);
|
||||
else if (symbol >= GDK_KEY_Zcaron && symbol <= GDK_KEY_Zabovedot)
|
||||
xlower += (GDK_KEY_zcaron - GDK_KEY_Zcaron);
|
||||
else if (symbol == GDK_KEY_aogonek)
|
||||
xupper = GDK_KEY_Aogonek;
|
||||
else if (symbol >= GDK_KEY_lstroke && symbol <= GDK_KEY_sacute)
|
||||
xupper -= (GDK_KEY_lstroke - GDK_KEY_Lstroke);
|
||||
else if (symbol >= GDK_KEY_scaron && symbol <= GDK_KEY_zacute)
|
||||
xupper -= (GDK_KEY_scaron - GDK_KEY_Scaron);
|
||||
else if (symbol >= GDK_KEY_zcaron && symbol <= GDK_KEY_zabovedot)
|
||||
xupper -= (GDK_KEY_zcaron - GDK_KEY_Zcaron);
|
||||
else if (symbol >= GDK_KEY_Racute && symbol <= GDK_KEY_Tcedilla)
|
||||
xlower += (GDK_KEY_racute - GDK_KEY_Racute);
|
||||
else if (symbol >= GDK_KEY_racute && symbol <= GDK_KEY_tcedilla)
|
||||
xupper -= (GDK_KEY_racute - GDK_KEY_Racute);
|
||||
break;
|
||||
|
||||
case 2: /* Latin 3 */
|
||||
/* Assume the KeySym is a legal value (ignore discontinuities) */
|
||||
if (symbol >= GDK_KEY_Hstroke && symbol <= GDK_KEY_Hcircumflex)
|
||||
xlower += (GDK_KEY_hstroke - GDK_KEY_Hstroke);
|
||||
else if (symbol >= GDK_KEY_Gbreve && symbol <= GDK_KEY_Jcircumflex)
|
||||
xlower += (GDK_KEY_gbreve - GDK_KEY_Gbreve);
|
||||
else if (symbol >= GDK_KEY_hstroke && symbol <= GDK_KEY_hcircumflex)
|
||||
xupper -= (GDK_KEY_hstroke - GDK_KEY_Hstroke);
|
||||
else if (symbol >= GDK_KEY_gbreve && symbol <= GDK_KEY_jcircumflex)
|
||||
xupper -= (GDK_KEY_gbreve - GDK_KEY_Gbreve);
|
||||
else if (symbol >= GDK_KEY_Cabovedot && symbol <= GDK_KEY_Scircumflex)
|
||||
xlower += (GDK_KEY_cabovedot - GDK_KEY_Cabovedot);
|
||||
else if (symbol >= GDK_KEY_cabovedot && symbol <= GDK_KEY_scircumflex)
|
||||
xupper -= (GDK_KEY_cabovedot - GDK_KEY_Cabovedot);
|
||||
break;
|
||||
|
||||
case 3: /* Latin 4 */
|
||||
/* Assume the KeySym is a legal value (ignore discontinuities) */
|
||||
if (symbol >= GDK_KEY_Rcedilla && symbol <= GDK_KEY_Tslash)
|
||||
xlower += (GDK_KEY_rcedilla - GDK_KEY_Rcedilla);
|
||||
else if (symbol >= GDK_KEY_rcedilla && symbol <= GDK_KEY_tslash)
|
||||
xupper -= (GDK_KEY_rcedilla - GDK_KEY_Rcedilla);
|
||||
else if (symbol == GDK_KEY_ENG)
|
||||
xlower = GDK_KEY_eng;
|
||||
else if (symbol == GDK_KEY_eng)
|
||||
xupper = GDK_KEY_ENG;
|
||||
else if (symbol >= GDK_KEY_Amacron && symbol <= GDK_KEY_Umacron)
|
||||
xlower += (GDK_KEY_amacron - GDK_KEY_Amacron);
|
||||
else if (symbol >= GDK_KEY_amacron && symbol <= GDK_KEY_umacron)
|
||||
xupper -= (GDK_KEY_amacron - GDK_KEY_Amacron);
|
||||
break;
|
||||
|
||||
case 6: /* Cyrillic */
|
||||
/* Assume the KeySym is a legal value (ignore discontinuities) */
|
||||
if (symbol >= GDK_KEY_Serbian_DJE && symbol <= GDK_KEY_Serbian_DZE)
|
||||
xlower -= (GDK_KEY_Serbian_DJE - GDK_KEY_Serbian_dje);
|
||||
else if (symbol >= GDK_KEY_Serbian_dje && symbol <= GDK_KEY_Serbian_dze)
|
||||
xupper += (GDK_KEY_Serbian_DJE - GDK_KEY_Serbian_dje);
|
||||
else if (symbol >= GDK_KEY_Cyrillic_YU && symbol <= GDK_KEY_Cyrillic_HARDSIGN)
|
||||
xlower -= (GDK_KEY_Cyrillic_YU - GDK_KEY_Cyrillic_yu);
|
||||
else if (symbol >= GDK_KEY_Cyrillic_yu && symbol <= GDK_KEY_Cyrillic_hardsign)
|
||||
xupper += (GDK_KEY_Cyrillic_YU - GDK_KEY_Cyrillic_yu);
|
||||
break;
|
||||
|
||||
case 7: /* Greek */
|
||||
/* Assume the KeySym is a legal value (ignore discontinuities) */
|
||||
if (symbol >= GDK_KEY_Greek_ALPHAaccent && symbol <= GDK_KEY_Greek_OMEGAaccent)
|
||||
xlower += (GDK_KEY_Greek_alphaaccent - GDK_KEY_Greek_ALPHAaccent);
|
||||
else if (symbol >= GDK_KEY_Greek_alphaaccent && symbol <= GDK_KEY_Greek_omegaaccent &&
|
||||
symbol != GDK_KEY_Greek_iotaaccentdieresis &&
|
||||
symbol != GDK_KEY_Greek_upsilonaccentdieresis)
|
||||
xupper -= (GDK_KEY_Greek_alphaaccent - GDK_KEY_Greek_ALPHAaccent);
|
||||
else if (symbol >= GDK_KEY_Greek_ALPHA && symbol <= GDK_KEY_Greek_OMEGA)
|
||||
xlower += (GDK_KEY_Greek_alpha - GDK_KEY_Greek_ALPHA);
|
||||
else if (symbol >= GDK_KEY_Greek_alpha && symbol <= GDK_KEY_Greek_omega &&
|
||||
symbol != GDK_KEY_Greek_finalsmallsigma)
|
||||
xupper -= (GDK_KEY_Greek_alpha - GDK_KEY_Greek_ALPHA);
|
||||
break;
|
||||
}
|
||||
|
||||
if (lower)
|
||||
*lower = xlower;
|
||||
if (upper)
|
||||
*upper = xupper;
|
||||
}
|
||||
#endif
|
||||
#endif /* HAVE_XCONVERTCASE */
|
||||
|
||||
gint
|
||||
_gdk_x11_get_group_for_state (GdkDisplay *display,
|
||||
|
@ -275,10 +275,12 @@ guint _gdk_x11_display_manager_lookup_keyval (GdkDisplayManager *manager,
|
||||
const gchar *name);
|
||||
gchar * _gdk_x11_display_manager_get_keyval_name (GdkDisplayManager *manager,
|
||||
guint keyval);
|
||||
#ifdef HAVE_XCONVERTCASE
|
||||
void _gdk_x11_display_manager_keyval_convert_case (GdkDisplayManager *manager,
|
||||
guint symbol,
|
||||
guint *lower,
|
||||
guint *upper);
|
||||
#endif
|
||||
|
||||
GdkCursor *_gdk_x11_display_get_cursor_for_type (GdkDisplay *display,
|
||||
GdkCursorType type);
|
||||
|
Loading…
Reference in New Issue
Block a user