Commit 913cdf3b authored by Colin Walters's avatar Colin Walters

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.
parent 03c19e37
......@@ -113,8 +113,8 @@ key_press_event (GtkWidget *text_view,
switch (event->keyval)
{
case GDK_Return:
case GDK_KP_Enter:
case GDK_KEY_Return:
case GDK_KEY_KP_Enter:
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
gtk_text_buffer_get_iter_at_mark (buffer, &iter,
gtk_text_buffer_get_insert (buffer));
......
......@@ -270,7 +270,7 @@ create_accel_label (void)
info = new_widget_info ("accel-label", box, SMALL);
gtk_widget_add_accelerator (button, "activate", accel_group, GDK_Q, GDK_CONTROL_MASK,
gtk_widget_add_accelerator (button, "activate", accel_group, GDK_KEY_Q, GDK_CONTROL_MASK,
GTK_ACCEL_VISIBLE | GTK_ACCEL_LOCKED);
return info;
......
......@@ -84,6 +84,7 @@ gdk_public_h_sources = \
gdkinput.h \
gdkkeys.h \
gdkkeysyms.h \
gdkkeysyms-compat.h \
gdkpango.h \
gdkpixbuf.h \
gdkpixmap.h \
......@@ -171,7 +172,7 @@ libgdk_win32_3_0_la_LDFLAGS = -Wl,win32/rc/gdk-win32-res.o -export-symbols $(src
if HAVE_INTROSPECTION
introspection_files = \
$(gdk_public_h_sources) \
$(filter-out gdkkeysyms-compat.h, $(gdk_public_h_sources)) \
$(gdk_c_sources) \
gdkenumtypes.c \
gdkenumtypes.h
......
This diff is collapsed.
......@@ -63,7 +63,10 @@ die "Could not open file keysymdef.h: $!\n" unless open(IN_KEYSYMDEF, "<:utf8",
# Output: gtk+/gdk/gdkkeysyms.h
die "Could not open file gdkkeysyms.h: $!\n" unless open(OUT_GDKKEYSYMS, ">:utf8", "gdkkeysyms.h");
print OUT_GDKKEYSYMS<<EOF;
# Output: gtk+/gdk/gdkkeysyms-compat.h
die "Could not open file gdkkeysyms-compat.h: $!\n" unless open(OUT_GDKKEYSYMS_COMPAT, ">:utf8", "gdkkeysyms-compat.h");
my $LICENSE_HEADER= <<EOF;
/* GDK - The GIMP Drawing Kit
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
* Copyright (C) 2005, 2006, 2007, 2009 GNOME Foundation
......@@ -84,6 +87,13 @@ print OUT_GDKKEYSYMS<<EOF;
* Boston, MA 02111-1307, USA.
*/
EOF
print OUT_GDKKEYSYMS $LICENSE_HEADER;
print OUT_GDKKEYSYMS_COMPAT $LICENSE_HEADER;
print OUT_GDKKEYSYMS<<EOF;
/*
* File auto-generated from script http://git.gnome.org/cgit/gtk+/tree/gdk/gdkkeysyms-update.pl
* using the input file
......@@ -105,6 +115,19 @@ print OUT_GDKKEYSYMS<<EOF;
EOF
print OUT_GDKKEYSYMS_COMPAT<<EOF;
/*
* Compatibility version of gdkkeysyms.h.
*
* In GTK3, keysyms changed to have a KEY_ prefix. This is a compatibility header
* your application can include to gain access to the old names as well. Consider
* porting to the new names instead.
*/
#ifndef __GDK_KEYSYMS_COMPAT_H__
#define __GDK_KEYSYMS_COMPAT_H__
EOF
while (<IN_KEYSYMDEF>)
{
......@@ -119,9 +142,14 @@ while (<IN_KEYSYMDEF>)
$_ = $keysymelements[2];
die "Internal error, was expecting \"0x*\", found: $_\n" if ( ! /^0x/ );
$keysymelements[1] =~ s/^XK_/GDK_/g;
my $element = $keysymelements[1];
my $binding = $element;
$binding =~ s/^XK_/GDK_KEY_/g;
my $compat_binding = $element;
$compat_binding =~ s/^XK_/GDK_/g;
printf OUT_GDKKEYSYMS "#define %s 0x%03x\n", $keysymelements[1], hex($keysymelements[2]);
printf OUT_GDKKEYSYMS "#define %s 0x%03x\n", $binding, hex($keysymelements[2]);
printf OUT_GDKKEYSYMS_COMPAT "#define %s 0x%03x\n", $compat_binding, hex($keysymelements[2]);
}
close IN_KEYSYMDEF;
......@@ -162,9 +190,14 @@ while (<IN_XF86KEYSYM>)
$_ = $keysymelements[2];
die "Internal error, was expecting \"0x*\", found: $_\n" if ( ! /^0x/ );
$keysymelements[1] =~ s/^XF86XK_/GDK_/g;
my $element = $keysymelements[1];
my $binding = $element;
$binding =~ s/^XF86XK_/GDK_KEY_/g;
my $compat_binding = $element;
$compat_binding =~ s/^XF86XK_/GDK_/g;
printf OUT_GDKKEYSYMS "#define %s 0x%03x\n", $keysymelements[1], hex($keysymelements[2]);
printf OUT_GDKKEYSYMS "#define %s 0x%03x\n", $binding, hex($keysymelements[2]);
printf OUT_GDKKEYSYMS_COMPAT "#define %s 0x%03x\n", $compat_binding, hex($keysymelements[2]);
}
close IN_XF86KEYSYM;
......@@ -175,4 +208,9 @@ print OUT_GDKKEYSYMS<<EOF;
#endif /* __GDK_KEYSYMS_H__ */
EOF
printf "We just finished converting keysymdef.h to gdkkeysyms.h\nThank you\n";
print OUT_GDKKEYSYMS_COMPAT<<EOF;
#endif /* __GDK_KEYSYMS_COMPAT_H__ */
EOF
printf "We just finished converting keysymdef.h to gdkkeysyms.h and gdkkeysyms-compat.h\nThank you\n";
This diff is collapsed.
......@@ -155,7 +155,7 @@ translate_key_event (GdkDisplay *display,
event->key.group = _gdk_x11_get_group_for_state (display, xevent->xkey.state);
event->key.hardware_keycode = xevent->xkey.keycode;
event->key.keyval = GDK_VoidSymbol;
event->key.keyval = GDK_KEY_VoidSymbol;
gdk_keymap_translate_keyboard_state (keymap,
event->key.hardware_keycode,
......@@ -175,7 +175,7 @@ translate_key_event (GdkDisplay *display,
*/
event->key.string = NULL;
if (event->key.keyval != GDK_VoidSymbol)
if (event->key.keyval != GDK_KEY_VoidSymbol)
c = gdk_keyval_to_unicode (event->key.keyval);
if (c)
......@@ -209,13 +209,13 @@ translate_key_event (GdkDisplay *display,
if (event->key.string)
event->key.length = bytes_written;
}
else if (event->key.keyval == GDK_Escape)
else if (event->key.keyval == GDK_KEY_Escape)
{
event->key.length = 1;
event->key.string = g_strdup ("\033");
}
else if (event->key.keyval == GDK_Return ||
event->key.keyval == GDK_KP_Enter)
else if (event->key.keyval == GDK_KEY_Return ||
event->key.keyval == GDK_KEY_KP_Enter)
{
event->key.length = 1;
event->key.string = g_strdup ("\r");
......
......@@ -577,7 +577,7 @@ translate_keyboard_string (GdkEventKey *event)
*/
event->string = NULL;
if (event->keyval != GDK_VoidSymbol)
if (event->keyval != GDK_KEY_VoidSymbol)
c = gdk_keyval_to_unicode (event->keyval);
if (c)
......@@ -611,13 +611,13 @@ translate_keyboard_string (GdkEventKey *event)
if (event->string)
event->length = bytes_written;
}
else if (event->keyval == GDK_Escape)
else if (event->keyval == GDK_KEY_Escape)
{
event->length = 1;
event->string = g_strdup ("\033");
}
else if (event->keyval == GDK_Return ||
event->keyval == GDK_KP_Enter)
else if (event->keyval == GDK_KEY_Return ||
event->keyval == GDK_KEY_KP_Enter)
{
event->length = 1;
event->string = g_strdup ("\r");
......@@ -924,7 +924,7 @@ gdk_device_manager_xi2_translate_event (GdkEventTranslator *translator,
GUINT_TO_POINTER (xev->deviceid));
gdk_event_set_device (event, device);
event->key.keyval = GDK_VoidSymbol;
event->key.keyval = GDK_KEY_VoidSymbol;
gdk_keymap_translate_keyboard_state (keymap,
event->key.hardware_keycode,
......
......@@ -163,7 +163,7 @@ gdk_keymap_x11_init (GdkKeymapX11 *keymap)
keymap->num_lock_mask = 0;
keymap->sun_keypad = FALSE;
keymap->group_switch_mask = 0;
keymap->lock_keysym = GDK_Caps_Lock;
keymap->lock_keysym = GDK_KEY_Caps_Lock;
keymap->have_direction = FALSE;
keymap->current_serial = 0;
......@@ -396,8 +396,8 @@ update_keymaps (GdkKeymapX11 *keymap_x11)
/* Check both groups */
for (i = 0 ; i < 2 ; i++)
{
if (get_symbol (syms, keymap_x11, i, 0) == GDK_Tab)
set_symbol (syms, keymap_x11, i, 1, GDK_ISO_Left_Tab);
if (get_symbol (syms, keymap_x11, i, 0) == GDK_KEY_Tab)
set_symbol (syms, keymap_x11, i, 1, GDK_KEY_ISO_Left_Tab);
}
/*
......@@ -423,7 +423,7 @@ update_keymaps (GdkKeymapX11 *keymap_x11)
keymap_x11->mod_keymap = XGetModifierMapping (xdisplay);
keymap_x11->lock_keysym = GDK_VoidSymbol;
keymap_x11->lock_keysym = GDK_KEY_VoidSymbol;
keymap_x11->group_switch_mask = 0;
keymap_x11->num_lock_mask = 0;
......@@ -452,14 +452,14 @@ update_keymaps (GdkKeymapX11 *keymap_x11)
mask = 0;
for (j = 0; j < keymap_x11->keysyms_per_keycode; j++)
{
if (syms[j] == GDK_Meta_L ||
syms[j] == GDK_Meta_R)
if (syms[j] == GDK_KEY_Meta_L ||
syms[j] == GDK_KEY_Meta_R)
mask |= GDK_META_MASK;
else if (syms[j] == GDK_Hyper_L ||
syms[j] == GDK_Hyper_R)
else if (syms[j] == GDK_KEY_Hyper_L ||
syms[j] == GDK_KEY_Hyper_R)
mask |= GDK_HYPER_MASK;
else if (syms[j] == GDK_Super_L ||
syms[j] == GDK_Super_R)
else if (syms[j] == GDK_KEY_Super_L ||
syms[j] == GDK_KEY_Super_R)
mask |= GDK_SUPER_MASK;
}
......@@ -481,11 +481,11 @@ update_keymaps (GdkKeymapX11 *keymap_x11)
*/
for (j = 0; j < keymap_x11->keysyms_per_keycode; j++)
{
if (syms[j] == GDK_Caps_Lock)
keymap_x11->lock_keysym = GDK_Caps_Lock;
else if (syms[j] == GDK_Shift_Lock &&
keymap_x11->lock_keysym == GDK_VoidSymbol)
keymap_x11->lock_keysym = GDK_Shift_Lock;
if (syms[j] == GDK_KEY_Caps_Lock)
keymap_x11->lock_keysym = GDK_KEY_Caps_Lock;
else if (syms[j] == GDK_KEY_Shift_Lock &&
keymap_x11->lock_keysym == GDK_KEY_VoidSymbol)
keymap_x11->lock_keysym = GDK_KEY_Shift_Lock;
}
break;
......@@ -502,12 +502,12 @@ update_keymaps (GdkKeymapX11 *keymap_x11)
/* Find the Mode_Switch and Num_Lock modifiers. */
for (j = 0; j < keymap_x11->keysyms_per_keycode; j++)
{
if (syms[j] == GDK_Mode_switch)
if (syms[j] == GDK_KEY_Mode_switch)
{
/* This modifier swaps groups */
keymap_x11->group_switch_mask |= mask;
}
else if (syms[j] == GDK_Num_Lock)
else if (syms[j] == GDK_KEY_Num_Lock)
{
/* This modifier is used for Num_Lock */
keymap_x11->num_lock_mask |= mask;
......@@ -1366,7 +1366,7 @@ translate_keysym (GdkKeymapX11 *keymap_x11,
gint num_lock_index;
shift_modifiers = GDK_SHIFT_MASK;
if (keymap_x11->lock_keysym == GDK_Shift_Lock)
if (keymap_x11->lock_keysym == GDK_KEY_Shift_Lock)
shift_modifiers |= GDK_LOCK_MASK;
/* Fall back to the first group if the passed in group is empty
......@@ -1416,7 +1416,7 @@ translate_keysym (GdkKeymapX11 *keymap_x11,
tmp_keyval = SYM (keymap_x11, group, shift_level);
if (keymap_x11->lock_keysym == GDK_Caps_Lock && (state & GDK_LOCK_MASK) != 0)
if (keymap_x11->lock_keysym == GDK_KEY_Caps_Lock && (state & GDK_LOCK_MASK) != 0)
{
guint upper = gdk_keyval_to_upper (tmp_keyval);
if (upper != tmp_keyval)
......@@ -1614,13 +1614,13 @@ gdk_keyval_name (guint keyval)
{
switch (keyval)
{
case GDK_Page_Up:
case GDK_KEY_Page_Up:
return "Page_Up";
case GDK_Page_Down:
case GDK_KEY_Page_Down:
return "Page_Down";
case GDK_KP_Page_Up:
case GDK_KEY_KP_Page_Up:
return "KP_Page_Up";
case GDK_KP_Page_Down:
case GDK_KEY_KP_Page_Down:
return "KP_Page_Down";
}
......
......@@ -1878,9 +1878,9 @@ text_view_key_press_event (GtkWidget *text_view,
switch (event->keyval)
{
case GDK_Return:
case GDK_ISO_Enter:
case GDK_KP_Enter:
case GDK_KEY_Return:
case GDK_KEY_ISO_Enter:
case GDK_KEY_KP_Enter:
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_view));
gtk_text_buffer_get_iter_at_mark (buffer, &iter,
gtk_text_buffer_get_insert (buffer));
......
......@@ -963,22 +963,22 @@ gtk_accelerator_valid (guint keyval,
GdkModifierType modifiers)
{
static const guint invalid_accelerator_vals[] = {
GDK_Shift_L, GDK_Shift_R, GDK_Shift_Lock, GDK_Caps_Lock, GDK_ISO_Lock,
GDK_Control_L, GDK_Control_R, GDK_Meta_L, GDK_Meta_R,
GDK_Alt_L, GDK_Alt_R, GDK_Super_L, GDK_Super_R, GDK_Hyper_L, GDK_Hyper_R,
GDK_ISO_Level3_Shift, GDK_ISO_Next_Group, GDK_ISO_Prev_Group,
GDK_ISO_First_Group, GDK_ISO_Last_Group,
GDK_Mode_switch, GDK_Num_Lock, GDK_Multi_key,
GDK_Scroll_Lock, GDK_Sys_Req,
GDK_Tab, GDK_ISO_Left_Tab, GDK_KP_Tab,
GDK_First_Virtual_Screen, GDK_Prev_Virtual_Screen,
GDK_Next_Virtual_Screen, GDK_Last_Virtual_Screen,
GDK_Terminate_Server, GDK_AudibleBell_Enable,
GDK_KEY_Shift_L, GDK_KEY_Shift_R, GDK_KEY_Shift_Lock, GDK_KEY_Caps_Lock, GDK_KEY_ISO_Lock,
GDK_KEY_Control_L, GDK_KEY_Control_R, GDK_KEY_Meta_L, GDK_KEY_Meta_R,
GDK_KEY_Alt_L, GDK_KEY_Alt_R, GDK_KEY_Super_L, GDK_KEY_Super_R, GDK_KEY_Hyper_L, GDK_KEY_Hyper_R,
GDK_KEY_ISO_Level3_Shift, GDK_KEY_ISO_Next_Group, GDK_KEY_ISO_Prev_Group,
GDK_KEY_ISO_First_Group, GDK_KEY_ISO_Last_Group,
GDK_KEY_Mode_switch, GDK_KEY_Num_Lock, GDK_KEY_Multi_key,
GDK_KEY_Scroll_Lock, GDK_KEY_Sys_Req,
GDK_KEY_Tab, GDK_KEY_ISO_Left_Tab, GDK_KEY_KP_Tab,
GDK_KEY_First_Virtual_Screen, GDK_KEY_Prev_Virtual_Screen,
GDK_KEY_Next_Virtual_Screen, GDK_KEY_Last_Virtual_Screen,
GDK_KEY_Terminate_Server, GDK_KEY_AudibleBell_Enable,
0
};
static const guint invalid_unmodified_vals[] = {
GDK_Up, GDK_Down, GDK_Left, GDK_Right,
GDK_KP_Up, GDK_KP_Down, GDK_KP_Left, GDK_KP_Right,
GDK_KEY_Up, GDK_KEY_Down, GDK_KEY_Left, GDK_KEY_Right,
GDK_KEY_KP_Up, GDK_KEY_KP_Down, GDK_KEY_KP_Left, GDK_KEY_KP_Right,
0
};
const guint *ac_val;
......
......@@ -131,8 +131,8 @@ binding_key_hash_insert_entry (GtkKeyHash *key_hash,
*/
if (entry->modifiers & GDK_SHIFT_MASK)
{
if (keyval == GDK_Tab)
keyval = GDK_ISO_Left_Tab;
if (keyval == GDK_KEY_Tab)
keyval = GDK_KEY_ISO_Left_Tab;
else
keyval = gdk_keyval_to_upper (keyval);
}
......
......@@ -3367,8 +3367,8 @@ gtk_calendar_key_press (GtkWidget *widget,
switch (event->keyval)
{
case GDK_KP_Left:
case GDK_Left:
case GDK_KEY_KP_Left:
case GDK_KEY_Left:
return_val = TRUE;
if (event->state & GDK_CONTROL_MASK)
calendar_set_month_prev (calendar);
......@@ -3380,8 +3380,8 @@ gtk_calendar_key_press (GtkWidget *widget,
priv->focus_col);
}
break;
case GDK_KP_Right:
case GDK_Right:
case GDK_KEY_KP_Right:
case GDK_KEY_Right:
return_val = TRUE;
if (event->state & GDK_CONTROL_MASK)
calendar_set_month_next (calendar);
......@@ -3393,8 +3393,8 @@ gtk_calendar_key_press (GtkWidget *widget,
priv->focus_col);
}
break;
case GDK_KP_Up:
case GDK_Up:
case GDK_KEY_KP_Up:
case GDK_KEY_Up:
return_val = TRUE;
if (event->state & GDK_CONTROL_MASK)
calendar_set_year_prev (calendar);
......@@ -3411,8 +3411,8 @@ gtk_calendar_key_press (GtkWidget *widget,
priv->focus_col);
}
break;
case GDK_KP_Down:
case GDK_Down:
case GDK_KEY_KP_Down:
case GDK_KEY_Down:
return_val = TRUE;
if (event->state & GDK_CONTROL_MASK)
calendar_set_year_next (calendar);
......@@ -3427,8 +3427,8 @@ gtk_calendar_key_press (GtkWidget *widget,
priv->focus_col);
}
break;
case GDK_KP_Space:
case GDK_space:
case GDK_KEY_KP_Space:
case GDK_KEY_space:
row = priv->focus_row;
col = priv->focus_col;
......
......@@ -454,8 +454,8 @@ grab_key_callback (GtkWidget *widget,
NULL, NULL, NULL, &consumed_modifiers);
accel_key = gdk_keyval_to_lower (event->keyval);
if (accel_key == GDK_ISO_Left_Tab)
accel_key = GDK_Tab;
if (accel_key == GDK_KEY_ISO_Left_Tab)
accel_key = GDK_KEY_Tab;
accel_mods = event->state & gtk_accelerator_get_default_mod_mask ();
......@@ -473,9 +473,9 @@ grab_key_callback (GtkWidget *widget,
{
switch (event->keyval)
{
case GDK_Escape:
case GDK_KEY_Escape:
goto out; /* cancel */
case GDK_BackSpace:
case GDK_KEY_BackSpace:
/* clear the accelerator on Backspace */
cleared = TRUE;
goto out;
......
......@@ -259,12 +259,12 @@ gtk_cell_renderer_spin_key_press_event (GtkWidget *widget,
{
if (event->state == 0)
{
if (event->keyval == GDK_Up)
if (event->keyval == GDK_KEY_Up)
{
gtk_spin_button_spin (GTK_SPIN_BUTTON (widget), GTK_SPIN_STEP_FORWARD, 1);
return TRUE;
}
else if (event->keyval == GDK_Down)
else if (event->keyval == GDK_KEY_Down)
{
gtk_spin_button_spin (GTK_SPIN_BUTTON (widget), GTK_SPIN_STEP_BACKWARD, 1);
return TRUE;
......
......@@ -1527,11 +1527,11 @@ palette_activate (GtkWidget *widget,
gpointer data)
{
/* should have a drawing area subclass with an activate signal */
if ((event->keyval == GDK_space) ||
(event->keyval == GDK_Return) ||
(event->keyval == GDK_ISO_Enter) ||
(event->keyval == GDK_KP_Enter) ||
(event->keyval == GDK_KP_Space))
if ((event->keyval == GDK_KEY_space) ||
(event->keyval == GDK_KEY_Return) ||
(event->keyval == GDK_KEY_ISO_Enter) ||
(event->keyval == GDK_KEY_KP_Enter) ||
(event->keyval == GDK_KEY_KP_Space))
{
if (GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "color_set")) != 0)
{
......@@ -1811,15 +1811,15 @@ key_press (GtkWidget *invisible,
switch (event->keyval)
{
case GDK_space:
case GDK_Return:
case GDK_ISO_Enter:
case GDK_KP_Enter:
case GDK_KP_Space:
case GDK_KEY_space:
case GDK_KEY_Return:
case GDK_KEY_ISO_Enter:
case GDK_KEY_KP_Enter:
case GDK_KEY_KP_Space:
grab_color_at_pointer (screen, pointer_device, x, y, data);
/* fall through */
case GDK_Escape:
case GDK_KEY_Escape:
shutdown_eyedropper (data);
g_signal_handlers_disconnect_by_func (invisible,
......@@ -1832,23 +1832,23 @@ key_press (GtkWidget *invisible,
return TRUE;
#if defined GDK_WINDOWING_X11 || defined GDK_WINDOWING_WIN32
case GDK_Up:
case GDK_KP_Up:
case GDK_KEY_Up:
case GDK_KEY_KP_Up:
dy = state == GDK_MOD1_MASK ? -BIG_STEP : -1;
break;
case GDK_Down:
case GDK_KP_Down:
case GDK_KEY_Down:
case GDK_KEY_KP_Down:
dy = state == GDK_MOD1_MASK ? BIG_STEP : 1;
break;
case GDK_Left:
case GDK_KP_Left:
case GDK_KEY_Left:
case GDK_KEY_KP_Left:
dx = state == GDK_MOD1_MASK ? -BIG_STEP : -1;
break;
case GDK_Right:
case GDK_KP_Right:
case GDK_KEY_Right:
case GDK_KEY_KP_Right:
dx = state == GDK_MOD1_MASK ? BIG_STEP : 1;
break;
#endif
......
......@@ -617,53 +617,53 @@ gtk_combo_box_class_init (GtkComboBoxClass *klass)
/* key bindings */
binding_set = gtk_binding_set_by_class (widget_class);
gtk_binding_entry_add_signal (binding_set, GDK_Down, GDK_MOD1_MASK,
gtk_binding_entry_add_signal (binding_set, GDK_KEY_Down, GDK_MOD1_MASK,
"popup", 0);
gtk_binding_entry_add_signal (binding_set, GDK_KP_Down, GDK_MOD1_MASK,
gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Down, GDK_MOD1_MASK,
"popup", 0);
gtk_binding_entry_add_signal (binding_set, GDK_Up, GDK_MOD1_MASK,
gtk_binding_entry_add_signal (binding_set, GDK_KEY_Up, GDK_MOD1_MASK,
"popdown", 0);
gtk_binding_entry_add_signal (binding_set, GDK_KP_Up, GDK_MOD1_MASK,
gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Up, GDK_MOD1_MASK,
"popdown", 0);
gtk_binding_entry_add_signal (binding_set, GDK_Escape, 0,
gtk_binding_entry_add_signal (binding_set, GDK_KEY_Escape, 0,
"popdown", 0);
gtk_binding_entry_add_signal (binding_set, GDK_Up, 0,
gtk_binding_entry_add_signal (binding_set, GDK_KEY_Up, 0,
"move-active", 1,
GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_STEP_UP);
gtk_binding_entry_add_signal (binding_set, GDK_KP_Up, 0,
gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Up, 0,
"move-active", 1,
GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_STEP_UP);
gtk_binding_entry_add_signal (binding_set, GDK_Page_Up, 0,
gtk_binding_entry_add_signal (binding_set, GDK_KEY_Page_Up, 0,
"move-active", 1,
GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_PAGE_UP);
gtk_binding_entry_add_signal (binding_set, GDK_KP_Page_Up, 0,
gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Page_Up, 0,
"move-active", 1,
GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_PAGE_UP);
gtk_binding_entry_add_signal (binding_set, GDK_Home, 0,
gtk_binding_entry_add_signal (binding_set, GDK_KEY_Home, 0,
"move-active", 1,
GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_START);
gtk_binding_entry_add_signal (binding_set, GDK_KP_Home, 0,
gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Home, 0,
"move-active", 1,
GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_START);
gtk_binding_entry_add_signal (binding_set, GDK_Down, 0,
gtk_binding_entry_add_signal (binding_set, GDK_KEY_Down, 0,
"move-active", 1,
GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_STEP_DOWN);
gtk_binding_entry_add_signal (binding_set, GDK_KP_Down, 0,
gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Down, 0,
"move-active", 1,
GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_STEP_DOWN);
gtk_binding_entry_add_signal (binding_set, GDK_Page_Down, 0,
gtk_binding_entry_add_signal (binding_set, GDK_KEY_Page_Down, 0,
"move-active", 1,
GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_PAGE_DOWN);
gtk_binding_entry_add_signal (binding_set, GDK_KP_Page_Down, 0,
gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_Page_Down, 0,
"move-active", 1,
GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_PAGE_DOWN);
gtk_binding_entry_add_signal (binding_set, GDK_End, 0,
gtk_binding_entry_add_signal (binding_set, GDK_KEY_End, 0,
"move-active", 1,
GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_END);
gtk_binding_entry_add_signal (binding_set, GDK_KP_End, 0,
gtk_binding_entry_add_signal (binding_set, GDK_KEY_KP_End, 0,
"move-active", 1,
GTK_TYPE_SCROLL_TYPE, GTK_SCROLL_END);
......@@ -3986,8 +3986,8 @@ gtk_combo_box_list_key_press (GtkWidget *widget,
GtkComboBox *combo_box = GTK_COMBO_BOX (data);
GtkTreeIter iter;
if (event->keyval == GDK_Return || event->keyval == GDK_ISO_Enter || event->keyval == GDK_KP_Enter ||
event->keyval == GDK_space || event->keyval == GDK_KP_Space)
if (event->keyval == GDK_KEY_Return || event->keyval == GDK_KEY_ISO_Enter || event->keyval == GDK_KEY_KP_Enter ||
event->keyval == GDK_KEY_space || event->keyval == GDK_KEY_KP_Space)
{
GtkTreeModel *model = NULL;
......@@ -5503,7 +5503,7 @@ gtk_cell_editable_key_press (GtkWidget *widget,
{
GtkComboBox *combo_box = GTK_COMBO_BOX (data);
if (event->keyval == GDK_Escape)
if (event->keyval == GDK_KEY_Escape)
{
g_object_set (combo_box,
"editing-canceled", TRUE,
......@@ -5513,9 +5513,9 @@ gtk_cell_editable_key_press (GtkWidget *widget,
return TRUE;
}
else if (event->keyval == GDK_Return ||
event->keyval == GDK_ISO_Enter ||
event->keyval == GDK_KP_Enter)
else if (event->keyval == GDK_KEY_Return ||
event->keyval == GDK_KEY_ISO_Enter ||
event->keyval == GDK_KEY_KP_Enter)
{
gtk_cell_editable_editing_done (GTK_CELL_EDITABLE (combo_box));
gtk_cell_editable_remove_widget (GTK_CELL_EDITABLE (combo_box));
......
......@@ -206,7 +206,7 @@ gtk_dialog_class_init (GtkDialogClass *class)
binding_set = gtk_binding_set_by_class (class);
gtk_binding_entry_add_signal (binding_set, GDK_Escape, 0, "close", 0);
gtk_binding_entry_add_signal (binding_set, GDK_KEY_Escape, 0, "close", 0);
}
static void
......
......@@ -4219,36 +4219,36 @@ gtk_drag_key_cb (GtkWidget *widget,
{
switch (event->keyval)
{
case GDK_Escape:
case GDK_KEY_Escape:
gtk_drag_cancel (info, GTK_DRAG_RESULT_USER_CANCELLED, event->time);
return TRUE;
case GDK_space:
case GDK_Return:
case GDK_ISO_Enter:
case GDK_KP_Enter:
case GDK_KP_Space:
case GDK_KEY_space:
case GDK_KEY_Return:
case GDK_KEY_ISO_Enter:
case GDK_KEY_KP_Enter:
case GDK_KEY_KP_Space:
gtk_drag_end (info, event->time);
gtk_drag_drop (info, event->time);
return TRUE;
case GDK_Up:
case GDK_KP_Up:
case GDK_KEY_Up:
case GDK_KEY_KP_Up:
dy = (state & GDK_MOD1_MASK) ? -BIG_STEP : -SMALL_STEP;
break;
case GDK_Down:
case GDK_KP_Down:
case GDK_KEY_Down:
case GDK_KEY_KP_Down:
dy = (state & GDK_MOD1_MASK) ? BIG_STEP : SMALL_STEP;
break;
case GDK_Left:
case GDK_KP_Left:
case GDK_KEY_Left:
case GDK_KEY_KP_Left:
dx = (state & GDK_MOD1_MASK) ? -BIG_STEP : -SMALL_STEP;
break;
case GDK_Right:
case GDK_KP_Right:
case GDK_KEY_Right:
case GDK_KEY_KP_Right:
dx = (state & GDK_MOD1_MASK) ? BIG_STEP : SMALL_STEP;
break;
}
......
This diff is collapsed.
......@@ -459,7 +459,7 @@ static void
_gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class)