keysyms: Update the macros to CLUTTER_KEY_*

The keysyms defines in clutter-keysyms.h are generated from the X11 key
symbols headers by doing the equivalent of a pass of sed from XK_* to
CLUTTER_*. This might lead to namespace collisions, down the road.
Instead, we should use the CLUTTER_KEY_* namespace.

This commit includes the script, taken from GDK, that parses the X11
key symbols and generates two headers:

  - clutter-keysyms.h: the default included header, with CLUTTER_KEY_*
  - clutter-keysyms-compat.h: the compatibility header, with CLUTTER_*

The compat.h header file is included if CLUTTER_DISABLE_DEPRECATED is
not defined - essentially deprecating all the old key symbols.

This does not change any ABI and, assuming that an application or
library is not compiling with CLUTTER_DISABLE_DEPRECATED, the source
compatibility is still guaranteed.
This commit is contained in:
Emmanuele Bassi 2010-09-10 13:41:49 +01:00
parent 1447eff00f
commit 4ee05f8e21
22 changed files with 4725 additions and 2091 deletions

5
README
View File

@ -307,6 +307,11 @@ Release Notes for Clutter 1.4
actors. You can still explicitly override the :request-mode value, or
you can unset the :sync-size property to control the size yourself.
• All the key symbol macros have been renamed from CLUTTER_* to
CLUTTER_KEY_*. The old names are still available inside the
clutter-keysyms-compat.h header, which is included by clutter-keysyms.h
unless CLUTTER_DISABLE_DEPRECATED is defined.
Release Notes for Clutter 1.2
-------------------------------------------------------------------------------

View File

@ -114,6 +114,7 @@ source_h = \
$(srcdir)/clutter-input-device.h \
$(srcdir)/clutter-interval.h \
$(srcdir)/clutter-keysyms.h \
$(srcdir)/clutter-keysyms-compat.h \
$(srcdir)/clutter-layout-manager.h \
$(srcdir)/clutter-layout-meta.h \
$(srcdir)/clutter-list-model.h \
@ -443,5 +444,7 @@ typelibs_DATA = $(BUILT_GIRSOURCES:.gir=.typelib) $(INTROSPECTION_GIRS:.gir=.typ
CLEANFILES += $(dist_gir_DATA) $(typelibs_DATA)
endif # HAVE_INTROSPECTION
EXTRA_DIST += clutter-keysyms-update.pl
gcov_sources = $(source_c)
include $(top_srcdir)/build/autotools/Makefile.am.gcov

File diff suppressed because it is too large Load Diff

216
clutter/clutter-keysyms-update.pl Executable file
View File

@ -0,0 +1,216 @@
#!/usr/bin/env perl
# Author : Simos Xenitellis <simos at gnome dot org>.
# Authos : Bastien Nocera <hadess@hadess.net>
# Version : 1.2
#
# Notes : It downloads keysymdef.h from the Internet, if not found locally,
# Notes : and creates an updated clutter-keysyms.h
use strict;
my $update_url = 'http://git.clutter-project.org/clutter/plain/clutter/clutter-keysyms-update.pl';
# Used for reading the keysymdef symbols.
my @keysymelements;
my $keysymdef_url = 'http://cgit.freedesktop.org/xorg/proto/x11proto/plain/keysymdef.h';
if ( ! -f "keysymdef.h" )
{
print "Trying to download keysymdef.h from\n", $keysymdef_url, "\n";
die "Unable to download keysymdef.h: $!"
unless system("wget -c -O keysymdef.h \"$keysymdef_url\"") == 0;
print " done.\n\n";
}
else
{
print "We are using existing keysymdef.h found in this directory.\n";
print "It is assumed that you took care and it is a recent version\n";
}
my $XF86keysym_url = 'http://cgit.freedesktop.org/xorg/proto/x11proto/plain/XF86keysym.h';
if ( ! -f "XF86keysym.h" )
{
print "Trying to download XF86keysym.h from\n", $XF86keysym_url, "\n";
die "Unable to download keysymdef.h: $!\n"
unless system("wget -c -O XF86keysym.h \"$XF86keysym_url\"") == 0;
print " done.\n\n";
}
else
{
print "We are using existing XF86keysym.h found in this directory.\n";
print "It is assumed that you took care and it is a recent version\n";
}
if ( -f "clutter-keysyms.h" )
{
print "There is already a clutter-keysyms.h file in this directory. We are not overwriting it.\n";
print "Please move it somewhere else in order to run this script.\n";
die "Exiting...\n\n";
}
die "Could not open file keysymdef.h: $!\n"
unless open(IN_KEYSYMDEF, "<:utf8", "keysymdef.h");
# Output: clutter/clutter/clutter-keysyms.h
die "Could not open file clutter-keysyms.h: $!\n"
unless open(OUT_KEYSYMS, ">:utf8", "clutter-keysyms.h");
# Output: clutter/clutter/clutter-keysyms-compat.h
die "Could not open file clutter-keysyms-compat.h: $!\n"
unless open(OUT_KEYSYMS_COMPAT, ">:utf8", "clutter-keysyms-compat.h");
my $LICENSE_HEADER= <<EOF;
/* Clutter
*
* Copyright (C) 2006, 2007, 2008 OpenedHand Ltd
* Copyright (C) 2009, 2010 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>.
*/
EOF
print OUT_KEYSYMS $LICENSE_HEADER;
print OUT_KEYSYMS_COMPAT $LICENSE_HEADER;
print OUT_KEYSYMS<<EOF;
/*
* File auto-generated from script at:
* $update_url
*
* using the input files:
* $keysymdef_url
* and
* $XF86keysym_url
*/
#ifndef __CLUTTER_KEYSYMS_H__
#define __CLUTTER_KEYSYMS_H__
EOF
print OUT_KEYSYMS_COMPAT<<EOF;
/*
* Compatibility version of clutter-keysyms.h.
*
* Since Clutter 1.4, the key symbol defines have been changed to have
* a KEY_ prefix. This is a compatibility header that is included when
* deprecated symbols are enabled. Consider porting to the new names
* instead.
*/
#ifndef __CLUTTER_KEYSYMS_COMPAT_H__
#define __CLUTTER_KEYSYMS_COMPAT_H__
EOF
while (<IN_KEYSYMDEF>)
{
next if ( ! /^#define / );
@keysymelements = split(/\s+/);
die "Internal error, no \@keysymelements: $_\n" unless @keysymelements;
$_ = $keysymelements[1];
die "Internal error, was expecting \"XC_*\", found: $_\n" if ( ! /^XK_/ );
$_ = $keysymelements[2];
die "Internal error, was expecting \"0x*\", found: $_\n" if ( ! /^0x/ );
my $element = $keysymelements[1];
my $binding = $element;
$binding =~ s/^XK_/CLUTTER_KEY_/g;
my $compat_binding = $element;
$compat_binding =~ s/^XK_/CLUTTER_/g;
printf OUT_KEYSYMS "#define %s 0x%03x\n", $binding, hex($keysymelements[2]);
printf OUT_KEYSYMS_COMPAT "#define %s 0x%03x\n", $compat_binding, hex($keysymelements[2]);
}
close IN_KEYSYMDEF;
#$cluttersyms{"0"} = "0000";
# Source: http://gitweb.freedesktop.org/?p=xorg/proto/x11proto.git;a=blob;f=XF86keysym.h
die "Could not open file XF86keysym.h: $!\n" unless open(IN_XF86KEYSYM, "<:utf8", "XF86keysym.h");
while (<IN_XF86KEYSYM>)
{
next if ( ! /^#define / );
@keysymelements = split(/\s+/);
die "Internal error, no \@keysymelements: $_\n" unless @keysymelements;
$_ = $keysymelements[1];
die "Internal error, was expecting \"XF86XK_*\", found: $_\n" if ( ! /^XF86XK_/ );
# Work-around https://bugs.freedesktop.org/show_bug.cgi?id=11193
if ($_ eq "XF86XK_XF86BackForward") {
$keysymelements[1] = "XF86XK_AudioForward";
}
# XF86XK_Clear could end up a dupe of XK_Clear
# XF86XK_Select could end up a dupe of XK_Select
if ($_ eq "XF86XK_Clear") {
$keysymelements[1] = "XF86XK_WindowClear";
}
if ($_ eq "XF86XK_Select") {
$keysymelements[1] = "XF86XK_SelectButton";
}
# Ignore XF86XK_Q
next if ( $_ eq "XF86XK_Q");
# XF86XK_Calculater is misspelled, and a dupe
next if ( $_ eq "XF86XK_Calculater");
$_ = $keysymelements[2];
die "Internal error, was expecting \"0x*\", found: $_\n" if ( ! /^0x/ );
my $element = $keysymelements[1];
my $binding = $element;
$binding =~ s/^XF86XK_/CLUTTER_KEY_/g;
my $compat_binding = $element;
$compat_binding =~ s/^XF86XK_/CLUTTER_/g;
printf OUT_KEYSYMS "#define %s 0x%03x\n", $binding, hex($keysymelements[2]);
printf OUT_KEYSYMS_COMPAT "#define %s 0x%03x\n", $compat_binding, hex($keysymelements[2]);
}
close IN_XF86KEYSYM;
print OUT_KEYSYMS<<EOF;
/* include the compatibility header */
#ifndef CLUTTER_DISABLE_DEPRECATED
#include "clutter-keysyms-compat.h"
#endif
#endif /* __CLUTTER_KEYSYMS_H__ */
EOF
print OUT_KEYSYMS_COMPAT<<EOF;
#endif /* __CLUTTER_KEYSYMS_COMPAT_H__ */
EOF
foreach my $f (qw/ keysymdef.h XF86keysym.h /) {
unlink $f or die "Unable to delete $f: $!";
}
printf "We just finished converting keysymdef.h to clutter-keysyms.h "
. "and clutter-keysyms-compat.h\nThank you\n";

File diff suppressed because it is too large Load Diff

View File

@ -3027,86 +3027,86 @@ clutter_text_class_init (ClutterTextClass *klass)
binding_pool = clutter_binding_pool_get_for_class (klass);
clutter_text_add_move_binding (binding_pool, "move-left",
CLUTTER_Left, CLUTTER_CONTROL_MASK,
CLUTTER_KEY_Left, CLUTTER_CONTROL_MASK,
G_CALLBACK (clutter_text_real_move_left));
clutter_text_add_move_binding (binding_pool, "move-left",
CLUTTER_KP_Left, CLUTTER_CONTROL_MASK,
CLUTTER_KEY_KP_Left, CLUTTER_CONTROL_MASK,
G_CALLBACK (clutter_text_real_move_left));
clutter_text_add_move_binding (binding_pool, "move-right",
CLUTTER_Right, CLUTTER_CONTROL_MASK,
CLUTTER_KEY_Right, CLUTTER_CONTROL_MASK,
G_CALLBACK (clutter_text_real_move_right));
clutter_text_add_move_binding (binding_pool, "move-right",
CLUTTER_KP_Right, CLUTTER_CONTROL_MASK,
CLUTTER_KEY_KP_Right, CLUTTER_CONTROL_MASK,
G_CALLBACK (clutter_text_real_move_right));
clutter_text_add_move_binding (binding_pool, "move-up",
CLUTTER_Up, 0,
CLUTTER_KEY_Up, 0,
G_CALLBACK (clutter_text_real_move_up));
clutter_text_add_move_binding (binding_pool, "move-up",
CLUTTER_KP_Up, 0,
CLUTTER_KEY_KP_Up, 0,
G_CALLBACK (clutter_text_real_move_up));
clutter_text_add_move_binding (binding_pool, "move-down",
CLUTTER_Down, 0,
CLUTTER_KEY_Down, 0,
G_CALLBACK (clutter_text_real_move_down));
clutter_text_add_move_binding (binding_pool, "move-down",
CLUTTER_KP_Down, 0,
CLUTTER_KEY_KP_Down, 0,
G_CALLBACK (clutter_text_real_move_down));
clutter_text_add_move_binding (binding_pool, "line-start",
CLUTTER_Home, 0,
CLUTTER_KEY_Home, 0,
G_CALLBACK (clutter_text_real_line_start));
clutter_text_add_move_binding (binding_pool, "line-start",
CLUTTER_KP_Home, 0,
CLUTTER_KEY_KP_Home, 0,
G_CALLBACK (clutter_text_real_line_start));
clutter_text_add_move_binding (binding_pool, "line-start",
CLUTTER_Begin, 0,
CLUTTER_KEY_Begin, 0,
G_CALLBACK (clutter_text_real_line_start));
clutter_text_add_move_binding (binding_pool, "line-end",
CLUTTER_End, 0,
CLUTTER_KEY_End, 0,
G_CALLBACK (clutter_text_real_line_end));
clutter_text_add_move_binding (binding_pool, "line-end",
CLUTTER_KP_End, 0,
CLUTTER_KEY_KP_End, 0,
G_CALLBACK (clutter_text_real_line_end));
clutter_binding_pool_install_action (binding_pool, "select-all",
CLUTTER_a, CLUTTER_CONTROL_MASK,
CLUTTER_KEY_a, CLUTTER_CONTROL_MASK,
G_CALLBACK (clutter_text_real_select_all),
NULL, NULL);
clutter_binding_pool_install_action (binding_pool, "delete-next",
CLUTTER_Delete, 0,
CLUTTER_KEY_Delete, 0,
G_CALLBACK (clutter_text_real_del_next),
NULL, NULL);
clutter_binding_pool_install_action (binding_pool, "delete-next",
CLUTTER_Delete, CLUTTER_CONTROL_MASK,
CLUTTER_KEY_Delete, CLUTTER_CONTROL_MASK,
G_CALLBACK (clutter_text_real_del_word_next),
NULL, NULL);
clutter_binding_pool_install_action (binding_pool, "delete-next",
CLUTTER_KP_Delete, 0,
CLUTTER_KEY_KP_Delete, 0,
G_CALLBACK (clutter_text_real_del_next),
NULL, NULL);
clutter_binding_pool_install_action (binding_pool, "delete-next",
CLUTTER_KP_Delete, CLUTTER_CONTROL_MASK,
CLUTTER_KEY_KP_Delete, CLUTTER_CONTROL_MASK,
G_CALLBACK (clutter_text_real_del_word_next),
NULL, NULL);
clutter_binding_pool_install_action (binding_pool, "delete-prev",
CLUTTER_BackSpace, 0,
CLUTTER_KEY_BackSpace, 0,
G_CALLBACK (clutter_text_real_del_prev),
NULL, NULL);
clutter_binding_pool_install_action (binding_pool, "delete-prev",
CLUTTER_BackSpace, CLUTTER_CONTROL_MASK,
CLUTTER_KEY_BackSpace, CLUTTER_CONTROL_MASK,
G_CALLBACK (clutter_text_real_del_word_prev),
NULL, NULL);
clutter_binding_pool_install_action (binding_pool, "activate",
CLUTTER_Return, 0,
CLUTTER_KEY_Return, 0,
G_CALLBACK (clutter_text_real_activate),
NULL, NULL);
clutter_binding_pool_install_action (binding_pool, "activate",
CLUTTER_KP_Enter, 0,
CLUTTER_KEY_KP_Enter, 0,
G_CALLBACK (clutter_text_real_activate),
NULL, NULL);
clutter_binding_pool_install_action (binding_pool, "activate",
CLUTTER_ISO_Enter, 0,
CLUTTER_KEY_ISO_Enter, 0,
G_CALLBACK (clutter_text_real_activate),
NULL, NULL);
}

View File

@ -73,6 +73,7 @@ IGNORE_HFILES=\
clutter-id-pool.h \
clutter-json.h \
clutter-keysyms.h \
clutter-keysyms-compat.h \
clutter-keysyms-table.h \
clutter-marshal.h \
clutter-master-clock.h \

View File

@ -51,7 +51,7 @@ key_group_action_move_left (KeyGroup *self,
gint n_children;
g_assert_cmpstr (action_name, ==, "move-left");
g_assert_cmpint (key_val, ==, CLUTTER_Left);
g_assert_cmpint (key_val, ==, CLUTTER_KEY_Left);
n_children = clutter_group_get_n_children (CLUTTER_GROUP (self));
@ -72,7 +72,7 @@ key_group_action_move_right (KeyGroup *self,
gint n_children;
g_assert_cmpstr (action_name, ==, "move-right");
g_assert_cmpint (key_val, ==, CLUTTER_Right);
g_assert_cmpint (key_val, ==, CLUTTER_KEY_Right);
n_children = clutter_group_get_n_children (CLUTTER_GROUP (self));
@ -93,9 +93,9 @@ key_group_action_activate (KeyGroup *self,
ClutterActor *child = NULL;
g_assert_cmpstr (action_name, ==, "activate");
g_assert (key_val == CLUTTER_Return ||
key_val == CLUTTER_KP_Enter ||
key_val == CLUTTER_ISO_Enter);
g_assert (key_val == CLUTTER_KEY_Return ||
key_val == CLUTTER_KEY_KP_Enter ||
key_val == CLUTTER_KEY_ISO_Enter);
if (self->selected_index == -1)
return FALSE;
@ -200,23 +200,23 @@ key_group_class_init (KeyGroupClass *klass)
binding_pool = clutter_binding_pool_get_for_class (klass);
clutter_binding_pool_install_action (binding_pool, "move-right",
CLUTTER_Right, 0,
CLUTTER_KEY_Right, 0,
G_CALLBACK (key_group_action_move_right),
NULL, NULL);
clutter_binding_pool_install_action (binding_pool, "move-left",
CLUTTER_Left, 0,
CLUTTER_KEY_Left, 0,
G_CALLBACK (key_group_action_move_left),
NULL, NULL);
clutter_binding_pool_install_action (binding_pool, "activate",
CLUTTER_Return, 0,
CLUTTER_KEY_Return, 0,
G_CALLBACK (key_group_action_activate),
NULL, NULL);
clutter_binding_pool_install_action (binding_pool, "activate",
CLUTTER_KP_Enter, 0,
CLUTTER_KEY_KP_Enter, 0,
G_CALLBACK (key_group_action_activate),
NULL, NULL);
clutter_binding_pool_install_action (binding_pool, "activate",
CLUTTER_ISO_Enter, 0,
CLUTTER_KEY_ISO_Enter, 0,
G_CALLBACK (key_group_action_activate),
NULL, NULL);
}
@ -287,23 +287,23 @@ test_binding_pool (TestConformSimpleFixture *fixture,
g_assert_cmpint (key_group->selected_index, ==, -1);
send_keyval (key_group, CLUTTER_Left);
send_keyval (key_group, CLUTTER_KEY_Left);
g_assert_cmpint (key_group->selected_index, ==, 2);
send_keyval (key_group, CLUTTER_Left);
send_keyval (key_group, CLUTTER_KEY_Left);
g_assert_cmpint (key_group->selected_index, ==, 1);
send_keyval (key_group, CLUTTER_Right);
send_keyval (key_group, CLUTTER_KEY_Right);
g_assert_cmpint (key_group->selected_index, ==, 2);
send_keyval (key_group, CLUTTER_Right);
send_keyval (key_group, CLUTTER_KEY_Right);
g_assert_cmpint (key_group->selected_index, ==, 0);
g_signal_connect (key_group,
"activate", G_CALLBACK (on_activate),
GINT_TO_POINTER (0));
send_keyval (key_group, CLUTTER_Return);
send_keyval (key_group, CLUTTER_KEY_Return);
clutter_actor_destroy (CLUTTER_ACTOR (key_group));
}

View File

@ -377,13 +377,13 @@ test_text_cursor (TestConformSimpleFixture *fixture,
clutter_text_set_cursor_position (text, 2);
/* test cursor moves and is clamped */
send_keyval (text, CLUTTER_Left);
send_keyval (text, CLUTTER_KEY_Left);
g_assert_cmpint (clutter_text_get_cursor_position (text), ==, 1);
send_keyval (text, CLUTTER_Left);
send_keyval (text, CLUTTER_KEY_Left);
g_assert_cmpint (clutter_text_get_cursor_position (text), ==, 0);
send_keyval (text, CLUTTER_Left);
send_keyval (text, CLUTTER_KEY_Left);
g_assert_cmpint (clutter_text_get_cursor_position (text), ==, 0);
/* delete text containing the cursor */
@ -391,7 +391,7 @@ test_text_cursor (TestConformSimpleFixture *fixture,
g_assert_cmpint (clutter_text_get_cursor_position (text), ==, 3);
clutter_text_delete_text (text, 2, 4);
send_keyval (text, CLUTTER_Left);
send_keyval (text, CLUTTER_KEY_Left);
/* FIXME: cursor position should be -1?
g_assert_cmpint (clutter_text_get_cursor_position (text), ==, -1);

View File

@ -113,7 +113,9 @@ test_interactive_SOURCES = test-main.c $(UNIT_TESTS)
test_interactive_CFLAGS = $(CLUTTER_CFLAGS) $(MAINTAINER_CFLAGS)
test_interactive_CPPFLAGS = \
-DTESTS_DATADIR=\""$(abs_top_srcdir)/tests/data"\" \
-DG_DISABLE_SINGLE_INCLUDES
-DG_DISABLE_SINGLE_INCLUDES \
-DCOGL_DISABLE_DEPRECATED \
-DCLUTTER_DISABLE_DEPRECATED
test_interactive_LDFLAGS = -export-dynamic
test_interactive_LDADD = $(CLUTTER_LIBS) $(common_ldadd)

View File

@ -66,13 +66,13 @@ input_cb (ClutterActor *stage,
g_print ("*** key press event (key:%c) ***\n",
clutter_event_get_key_symbol (event));
if (clutter_event_get_key_symbol (event) == CLUTTER_q)
if (clutter_event_get_key_symbol (event) == CLUTTER_KEY_q)
{
clutter_main_quit ();
return TRUE;
}
else if (clutter_event_get_key_symbol (event) == CLUTTER_r)
else if (clutter_event_get_key_symbol (event) == CLUTTER_KEY_r)
{
gint i;

View File

@ -67,13 +67,13 @@ input_cb (ClutterActor *stage,
g_print ("*** key press event (key:%c) ***\n",
clutter_event_get_key_symbol (event));
if (clutter_event_get_key_symbol (event) == CLUTTER_q)
if (clutter_event_get_key_symbol (event) == CLUTTER_KEY_q)
{
clutter_main_quit ();
return TRUE;
}
else if (clutter_event_get_key_symbol (event) == CLUTTER_r)
else if (clutter_event_get_key_symbol (event) == CLUTTER_KEY_r)
{
gint i;

View File

@ -207,23 +207,23 @@ key_group_class_init (KeyGroupClass *klass)
binding_pool = clutter_binding_pool_get_for_class (klass);
clutter_binding_pool_install_action (binding_pool, "move-right",
CLUTTER_Right, 0,
CLUTTER_KEY_Right, 0,
G_CALLBACK (key_group_action_move_right),
NULL, NULL);
clutter_binding_pool_install_action (binding_pool, "move-left",
CLUTTER_Left, 0,
CLUTTER_KEY_Left, 0,
G_CALLBACK (key_group_action_move_left),
NULL, NULL);
clutter_binding_pool_install_action (binding_pool, "activate",
CLUTTER_Return, 0,
CLUTTER_KEY_Return, 0,
G_CALLBACK (key_group_action_activate),
NULL, NULL);
clutter_binding_pool_install_action (binding_pool, "activate",
CLUTTER_KP_Enter, 0,
CLUTTER_KEY_KP_Enter, 0,
G_CALLBACK (key_group_action_activate),
NULL, NULL);
clutter_binding_pool_install_action (binding_pool, "activate",
CLUTTER_ISO_Enter, 0,
CLUTTER_KEY_ISO_Enter, 0,
G_CALLBACK (key_group_action_activate),
NULL, NULL);
}

View File

@ -171,27 +171,27 @@ key_release_cb (ClutterActor *actor,
switch (clutter_event_get_key_symbol (event))
{
case CLUTTER_a:
case CLUTTER_KEY_a:
toggle = clutter_box_layout_get_use_animations (layout);
clutter_box_layout_set_use_animations (layout, !toggle);
break;
case CLUTTER_v:
case CLUTTER_KEY_v:
toggle = clutter_box_layout_get_vertical (layout);
clutter_box_layout_set_vertical (layout, !toggle);
break;
case CLUTTER_h:
case CLUTTER_KEY_h:
toggle = clutter_box_layout_get_homogeneous (layout);
clutter_box_layout_set_homogeneous (layout, !toggle);
break;
case CLUTTER_p:
case CLUTTER_KEY_p:
toggle = clutter_box_layout_get_pack_start (layout);
clutter_box_layout_set_pack_start (layout, !toggle);
break;
case CLUTTER_s:
case CLUTTER_KEY_s:
spacing = clutter_box_layout_get_spacing (layout);
if (spacing > 12)
@ -202,11 +202,11 @@ key_release_cb (ClutterActor *actor,
clutter_box_layout_set_spacing (layout, spacing);
break;
case CLUTTER_plus:
case CLUTTER_KEY_plus:
add_actor (layout, last_index++);
break;
case CLUTTER_q:
case CLUTTER_KEY_q:
clutter_main_quit ();
break;

View File

@ -261,17 +261,18 @@ free_clips (CallbackData *data)
}
static gboolean
on_key_press (ClutterActor *stage, ClutterKeyEvent *event,
on_key_press (ClutterActor *stage,
ClutterEvent *event,
CallbackData *data)
{
switch (event->keyval)
switch (clutter_event_get_key_symbol (event))
{
case CLUTTER_r:
case CLUTTER_KEY_r:
free_clips (data);
clutter_actor_queue_redraw (stage);
break;
case CLUTTER_u:
case CLUTTER_KEY_u:
if (data->clips)
{
g_slice_free (Clip, data->clips->data);

View File

@ -316,7 +316,11 @@ key_release_cb (ClutterActor *actor,
ClutterEvent *event,
void *user_data)
{
if (event->key.keyval == CLUTTER_Q || event->key.keyval == CLUTTER_q)
guint keysym = clutter_event_get_key_symbol (event);
ClutterModifierType mods = clutter_event_get_state (event);
if (keysym == CLUTTER_KEY_q ||
((mods & CLUTTER_SHIFT_MASK) && keysym == CLUTTER_KEY_q))
clutter_main_quit ();
return FALSE;

View File

@ -292,7 +292,11 @@ key_release_cb (ClutterActor *actor,
ClutterEvent *event,
void *user_data)
{
if (event->key.keyval == CLUTTER_Q || event->key.keyval == CLUTTER_q)
guint keysym = clutter_event_get_key_symbol (event);
ClutterModifierType mods = clutter_event_get_state (event);
if (keysym == CLUTTER_KEY_q ||
((mods & CLUTTER_SHIFT_MASK) && keysym == CLUTTER_KEY_q))
clutter_main_quit ();
return FALSE;

View File

@ -640,12 +640,11 @@ keypress_cb (ClutterActor *actor,
{
switch (clutter_event_get_key_symbol (event))
{
case CLUTTER_q:
{
clutter_main_quit ();
}
case CLUTTER_KEY_q:
clutter_main_quit ();
break;
case CLUTTER_a:
case CLUTTER_KEY_a:
{
if (icon != NULL)
{
@ -657,7 +656,7 @@ keypress_cb (ClutterActor *actor,
break;
}
case CLUTTER_d:
case CLUTTER_KEY_d:
{
GList *children =
clutter_container_get_children (CLUTTER_CONTAINER (box));
@ -673,37 +672,37 @@ keypress_cb (ClutterActor *actor,
break;
}
case CLUTTER_w:
case CLUTTER_KEY_w:
{
decrease_property_value (box, "padding");
break;
}
case CLUTTER_e:
case CLUTTER_KEY_e:
{
increase_property_value (box, "padding");
break;
}
case CLUTTER_r:
case CLUTTER_KEY_r:
{
decrease_property_value (box, "spacing");
break;
}
case CLUTTER_s:
case CLUTTER_KEY_s:
{
toggle_property_value (box, "use-transformed-box");
break;
}
case CLUTTER_t:
case CLUTTER_KEY_t:
{
increase_property_value (box, "spacing");
break;
}
case CLUTTER_z:
case CLUTTER_KEY_z:
{
if (clutter_timeline_is_playing (main_timeline))
clutter_timeline_pause (main_timeline);

View File

@ -87,13 +87,13 @@ input_cb (ClutterActor *stage,
g_print ("*** key press event (key:%c) ***\n",
clutter_event_get_key_symbol (event));
if (clutter_event_get_key_symbol (event) == CLUTTER_q)
if (clutter_event_get_key_symbol (event) == CLUTTER_KEY_q)
{
clutter_main_quit ();
return TRUE;
}
else if (clutter_event_get_key_symbol (event) == CLUTTER_r)
else if (clutter_event_get_key_symbol (event) == CLUTTER_KEY_r)
{
gint i;

View File

@ -84,12 +84,12 @@ stage_key_release_cb (ClutterActor *actor,
{
switch (clutter_event_get_key_symbol (event))
{
case CLUTTER_q:
case CLUTTER_Q:
case CLUTTER_KEY_q:
case CLUTTER_KEY_Q:
clutter_main_quit ();
break;
case CLUTTER_m:
case CLUTTER_KEY_m:
toggle_texture_quality (actor);
break;
}

View File

@ -50,7 +50,7 @@ on_captured_event (ClutterText *text,
c = clutter_event_get_key_unicode (event);
keyval = clutter_event_get_key_symbol (event);
if (keyval == CLUTTER_u)
if (keyval == CLUTTER_KEY_u)
{
ClutterModifierType mods = clutter_event_get_state (event);
@ -133,7 +133,7 @@ on_captured_event (ClutterText *text,
return TRUE;
}
else if (is_unicode_mode && (keyval == CLUTTER_BackSpace))
else if (is_unicode_mode && (keyval == CLUTTER_KEY_BackSpace))
{
GString *str = g_object_get_data (G_OBJECT (text), "unicode-str");
PangoAttrList *attrs;
@ -155,10 +155,10 @@ on_captured_event (ClutterText *text,
return TRUE;
}
else if (is_unicode_mode &&
(keyval == CLUTTER_Return ||
keyval == CLUTTER_KP_Enter ||
keyval == CLUTTER_ISO_Enter ||
keyval == CLUTTER_KP_Space))
(keyval == CLUTTER_KEY_Return ||
keyval == CLUTTER_KEY_KP_Enter ||
keyval == CLUTTER_KEY_ISO_Enter ||
keyval == CLUTTER_KEY_KP_Space))
{
GString *str = g_object_get_data (G_OBJECT (text), "unicode-str");
const gchar *contents = clutter_text_get_text (text);

View File

@ -150,7 +150,7 @@ on_key_press_event (ClutterStage *stage,
switch (clutter_event_get_key_symbol (event))
{
case CLUTTER_s:
case CLUTTER_KEY_s:
clutter_text_set_text (CLUTTER_TEXT (help_label), "Press 'q' to quit");
clutter_timeline_start (timeline);
@ -163,7 +163,7 @@ on_key_press_event (ClutterStage *stage,
g_thread_create (test_thread_func, data, FALSE, NULL);
return TRUE;
case CLUTTER_q:
case CLUTTER_KEY_q:
clutter_main_quit ();
return TRUE;