gtk: Remove bindings
The whole binding functionality is now handled by shortcuts.
This commit is contained in:
@@ -5044,26 +5044,6 @@ gtk_drag_source_add_image_targets
|
||||
gtk_drag_source_add_uri_targets
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkbindings</FILE>
|
||||
<TITLE>Bindings</TITLE>
|
||||
GtkBindingSet
|
||||
GtkBindingEntry
|
||||
GtkBindingSignal
|
||||
GtkBindingArg
|
||||
gtk_binding_set_new
|
||||
gtk_binding_set_by_class
|
||||
gtk_binding_set_find
|
||||
gtk_bindings_activate
|
||||
gtk_bindings_activate_event
|
||||
gtk_binding_set_activate
|
||||
gtk_binding_entry_add_signal_variant
|
||||
gtk_binding_entry_add_signal
|
||||
gtk_binding_entry_add_signal_from_string
|
||||
gtk_binding_entry_skip
|
||||
gtk_binding_entry_remove
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gtkenums</FILE>
|
||||
<TITLE>Standard Enumerations</TITLE>
|
||||
|
||||
@@ -46,7 +46,6 @@
|
||||
#include <gtk/gtkassistant.h>
|
||||
#include <gtk/gtkbbox.h>
|
||||
#include <gtk/gtkbin.h>
|
||||
#include <gtk/gtkbindings.h>
|
||||
#include <gtk/gtkborder.h>
|
||||
#include <gtk/gtkbox.h>
|
||||
#include <gtk/gtkbuildable.h>
|
||||
|
||||
1582
gtk/gtkbindings.c
1582
gtk/gtkbindings.c
File diff suppressed because it is too large
Load Diff
@@ -1,93 +0,0 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
||||
*
|
||||
* GtkBindingSet: Keybinding manager for GObjects.
|
||||
* Copyright (C) 1998 Tim Janik
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
|
||||
* file for a list of people on the GTK+ Team. See the ChangeLog
|
||||
* files for a list of changes. These files are distributed with
|
||||
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_BINDINGS_H__
|
||||
#define __GTK_BINDINGS_H__
|
||||
|
||||
|
||||
#if !defined (__GTK_H_INSIDE__) && !defined (GTK_COMPILATION)
|
||||
#error "Only <gtk/gtk.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <gdk/gdk.h>
|
||||
#include <gtk/gtkenums.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
typedef struct _GtkBindingSet GtkBindingSet;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkBindingSet *gtk_binding_set_new (const gchar *set_name);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkBindingSet *gtk_binding_set_by_class (gpointer object_class);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkBindingSet *gtk_binding_set_find (const gchar *set_name);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_bindings_activate (GObject *object,
|
||||
guint keyval,
|
||||
GdkModifierType modifiers);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_bindings_activate_event (GObject *object,
|
||||
GdkEventKey *event);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_binding_set_activate (GtkBindingSet *binding_set,
|
||||
guint keyval,
|
||||
GdkModifierType modifiers,
|
||||
GObject *object);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_binding_entry_skip (GtkBindingSet *binding_set,
|
||||
guint keyval,
|
||||
GdkModifierType modifiers);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_binding_entry_add_signal_variant (GtkBindingSet*binding_set,
|
||||
guint keyval,
|
||||
GdkModifierType modifiers,
|
||||
const gchar *signal_name,
|
||||
GVariant *binding_args);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_binding_entry_add_signal (GtkBindingSet *binding_set,
|
||||
guint keyval,
|
||||
GdkModifierType modifiers,
|
||||
const gchar *signal_name,
|
||||
guint n_args,
|
||||
...);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GTokenType gtk_binding_entry_add_signal_from_string
|
||||
(GtkBindingSet *binding_set,
|
||||
const gchar *signal_desc);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_binding_entry_remove (GtkBindingSet *binding_set,
|
||||
guint keyval,
|
||||
GdkModifierType modifiers);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_BINDINGS_H__ */
|
||||
@@ -1,36 +0,0 @@
|
||||
/* GTK - The GIMP Toolkit
|
||||
* Copyright (C) 2011 Red Hat, Inc.
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#ifndef __GTK_BINDINGS_PRIVATE_H__
|
||||
#define __GTK_BINDINGS_PRIVATE_H__
|
||||
|
||||
#include "gtkbindings.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
guint _gtk_binding_parse_binding (GScanner *scanner);
|
||||
void _gtk_binding_reset_parsed (void);
|
||||
|
||||
gboolean gtk_binding_emit_signal (GObject *object,
|
||||
const char *signal,
|
||||
GVariant *args,
|
||||
gboolean *handled,
|
||||
GError **error);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_BINDINGS_PRIVATE_H__ */
|
||||
@@ -293,7 +293,6 @@ gtk_css_value_array_transition (GtkCssValue *start,
|
||||
case GTK_CSS_PROPERTY_TRANSITION_DURATION:
|
||||
case GTK_CSS_PROPERTY_TRANSITION_TIMING_FUNCTION:
|
||||
case GTK_CSS_PROPERTY_TRANSITION_DELAY:
|
||||
case GTK_CSS_PROPERTY_GTK_KEY_BINDINGS:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,6 @@
|
||||
#include "gtkstylepropertyprivate.h"
|
||||
#include "gtkstyleproviderprivate.h"
|
||||
#include "gtkwidgetpath.h"
|
||||
#include "gtkbindings.h"
|
||||
#include "gtkmarshalers.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkintl.h"
|
||||
@@ -898,111 +897,6 @@ parse_color_definition (GtkCssScanner *scanner)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
parse_binding_set (GtkCssScanner *scanner)
|
||||
{
|
||||
GtkBindingSet *binding_set;
|
||||
char *name;
|
||||
|
||||
gtk_css_scanner_push_section (scanner, GTK_CSS_SECTION_BINDING_SET);
|
||||
|
||||
if (!_gtk_css_parser_try (scanner->parser, "@binding-set", TRUE))
|
||||
{
|
||||
gtk_css_scanner_pop_section (scanner, GTK_CSS_SECTION_BINDING_SET);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
name = _gtk_css_parser_try_ident (scanner->parser, TRUE);
|
||||
if (name == NULL)
|
||||
{
|
||||
gtk_css_provider_error_literal (scanner->provider,
|
||||
scanner,
|
||||
GTK_CSS_PROVIDER_ERROR,
|
||||
GTK_CSS_PROVIDER_ERROR_SYNTAX,
|
||||
"Expected name for binding set");
|
||||
_gtk_css_parser_resync (scanner->parser, TRUE, 0);
|
||||
goto skip_semicolon;
|
||||
}
|
||||
|
||||
binding_set = gtk_binding_set_find (name);
|
||||
if (!binding_set)
|
||||
binding_set = gtk_binding_set_new (name);
|
||||
g_free (name);
|
||||
|
||||
if (!_gtk_css_parser_try (scanner->parser, "{", TRUE))
|
||||
{
|
||||
gtk_css_provider_error_literal (scanner->provider,
|
||||
scanner,
|
||||
GTK_CSS_PROVIDER_ERROR,
|
||||
GTK_CSS_PROVIDER_ERROR_SYNTAX,
|
||||
"Expected '{' for binding set");
|
||||
_gtk_css_parser_resync (scanner->parser, TRUE, 0);
|
||||
goto skip_semicolon;
|
||||
}
|
||||
|
||||
while (!_gtk_css_parser_is_eof (scanner->parser) &&
|
||||
!_gtk_css_parser_begins_with (scanner->parser, '}'))
|
||||
{
|
||||
name = _gtk_css_parser_read_value (scanner->parser);
|
||||
if (name == NULL)
|
||||
{
|
||||
_gtk_css_parser_resync (scanner->parser, TRUE, '}');
|
||||
continue;
|
||||
}
|
||||
|
||||
if (gtk_binding_entry_add_signal_from_string (binding_set, name) != G_TOKEN_NONE)
|
||||
{
|
||||
gtk_css_provider_error_literal (scanner->provider,
|
||||
scanner,
|
||||
GTK_CSS_PROVIDER_ERROR,
|
||||
GTK_CSS_PROVIDER_ERROR_SYNTAX,
|
||||
"Failed to parse binding set.");
|
||||
}
|
||||
|
||||
g_free (name);
|
||||
|
||||
if (!_gtk_css_parser_try (scanner->parser, ";", TRUE))
|
||||
{
|
||||
if (!_gtk_css_parser_begins_with (scanner->parser, '}') &&
|
||||
!_gtk_css_parser_is_eof (scanner->parser))
|
||||
{
|
||||
gtk_css_provider_error_literal (scanner->provider,
|
||||
scanner,
|
||||
GTK_CSS_PROVIDER_ERROR,
|
||||
GTK_CSS_PROVIDER_ERROR_SYNTAX,
|
||||
"Expected semicolon");
|
||||
_gtk_css_parser_resync (scanner->parser, TRUE, '}');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!_gtk_css_parser_try (scanner->parser, "}", TRUE))
|
||||
{
|
||||
gtk_css_provider_error_literal (scanner->provider,
|
||||
scanner,
|
||||
GTK_CSS_PROVIDER_ERROR,
|
||||
GTK_CSS_PROVIDER_ERROR_SYNTAX,
|
||||
"expected '}' after declarations");
|
||||
if (!_gtk_css_parser_is_eof (scanner->parser))
|
||||
_gtk_css_parser_resync (scanner->parser, FALSE, 0);
|
||||
}
|
||||
|
||||
skip_semicolon:
|
||||
if (_gtk_css_parser_begins_with (scanner->parser, ';'))
|
||||
{
|
||||
gtk_css_provider_error_literal (scanner->provider,
|
||||
scanner,
|
||||
GTK_CSS_PROVIDER_ERROR,
|
||||
GTK_CSS_PROVIDER_ERROR_DEPRECATED,
|
||||
"Nonstandard semicolon at end of binding set");
|
||||
_gtk_css_parser_try (scanner->parser, ";", TRUE);
|
||||
}
|
||||
|
||||
gtk_css_scanner_pop_section (scanner, GTK_CSS_SECTION_BINDING_SET);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
parse_keyframes (GtkCssScanner *scanner)
|
||||
{
|
||||
@@ -1076,8 +970,6 @@ parse_at_keyword (GtkCssScanner *scanner)
|
||||
return;
|
||||
if (parse_color_definition (scanner))
|
||||
return;
|
||||
if (parse_binding_set (scanner))
|
||||
return;
|
||||
if (parse_keyframes (scanner))
|
||||
return;
|
||||
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include "fallback-c89.c"
|
||||
|
||||
/* the actual parsers we have */
|
||||
#include "gtkbindings.h"
|
||||
#include "gtkcssarrayvalueprivate.h"
|
||||
#include "gtkcssbgsizevalueprivate.h"
|
||||
#include "gtkcssbordervalueprivate.h"
|
||||
@@ -419,75 +418,6 @@ icon_style_parse (GtkCssStyleProperty *property,
|
||||
return value;
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
bindings_value_parse_one (GtkCssParser *parser)
|
||||
{
|
||||
char *name;
|
||||
|
||||
name = _gtk_css_parser_try_ident (parser, TRUE);
|
||||
if (name == NULL)
|
||||
{
|
||||
_gtk_css_parser_error (parser, "Not a valid binding name");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (g_ascii_strcasecmp (name, "none") == 0)
|
||||
{
|
||||
name = NULL;
|
||||
}
|
||||
else if (!gtk_binding_set_find (name))
|
||||
{
|
||||
_gtk_css_parser_error (parser, "No binding set named '%s'", name);
|
||||
g_free (name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return _gtk_css_string_value_new_take (name);
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
bindings_value_parse (GtkCssStyleProperty *property,
|
||||
GtkCssParser *parser)
|
||||
{
|
||||
return _gtk_css_array_value_parse (parser, bindings_value_parse_one);
|
||||
}
|
||||
|
||||
static void
|
||||
bindings_value_query (GtkCssStyleProperty *property,
|
||||
const GtkCssValue *css_value,
|
||||
GValue *value)
|
||||
{
|
||||
GPtrArray *array;
|
||||
guint i;
|
||||
|
||||
g_value_init (value, G_TYPE_PTR_ARRAY);
|
||||
|
||||
if (_gtk_css_array_value_get_n_values (css_value) == 0)
|
||||
return;
|
||||
|
||||
array = NULL;
|
||||
|
||||
for (i = 0; i < _gtk_css_array_value_get_n_values (css_value); i++)
|
||||
{
|
||||
const char *name;
|
||||
GtkBindingSet *binding_set;
|
||||
|
||||
name = _gtk_css_string_value_get (_gtk_css_array_value_get_nth (css_value, i));
|
||||
if (name == NULL)
|
||||
continue;
|
||||
|
||||
binding_set = gtk_binding_set_find (name);
|
||||
if (binding_set == NULL)
|
||||
continue;
|
||||
|
||||
if (array == NULL)
|
||||
array = g_ptr_array_new ();
|
||||
g_ptr_array_add (array, binding_set);
|
||||
}
|
||||
|
||||
g_value_take_boxed (value, array);
|
||||
}
|
||||
|
||||
static GtkCssValue *
|
||||
parse_letter_spacing (GtkCssStyleProperty *property,
|
||||
GtkCssParser *parser)
|
||||
@@ -1754,16 +1684,6 @@ _gtk_css_style_property_init_properties (void)
|
||||
NULL,
|
||||
gtk_css_filter_value_new_none ());
|
||||
|
||||
/* Private property holding the binding sets */
|
||||
gtk_css_style_property_register ("-gtk-key-bindings",
|
||||
GTK_CSS_PROPERTY_GTK_KEY_BINDINGS,
|
||||
G_TYPE_PTR_ARRAY,
|
||||
0,
|
||||
0,
|
||||
bindings_value_parse,
|
||||
bindings_value_query,
|
||||
_gtk_css_array_value_new (_gtk_css_string_value_new (NULL)));
|
||||
|
||||
gtk_css_style_property_register ("caret-color",
|
||||
GTK_CSS_PROPERTY_CARET_COLOR,
|
||||
GDK_TYPE_RGBA,
|
||||
|
||||
@@ -238,7 +238,6 @@ enum { /*< skip >*/
|
||||
GTK_CSS_PROPERTY_ANIMATION_FILL_MODE,
|
||||
GTK_CSS_PROPERTY_OPACITY,
|
||||
GTK_CSS_PROPERTY_FILTER,
|
||||
GTK_CSS_PROPERTY_GTK_KEY_BINDINGS,
|
||||
GTK_CSS_PROPERTY_CARET_COLOR,
|
||||
GTK_CSS_PROPERTY_SECONDARY_CARET_COLOR,
|
||||
GTK_CSS_PROPERTY_FONT_FEATURE_SETTINGS,
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
|
||||
#include "gtkshortcut.h"
|
||||
|
||||
#include "gtkbindingsprivate.h"
|
||||
#include "gtkintl.h"
|
||||
#include "gtkshortcuttrigger.h"
|
||||
#include "gtkwidget.h"
|
||||
@@ -245,6 +244,221 @@ gtk_shortcut_trigger (GtkShortcut *self,
|
||||
return gtk_shortcut_trigger_trigger (self->trigger, event);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
binding_compose_params (GObject *object,
|
||||
GVariantIter *args,
|
||||
GSignalQuery *query,
|
||||
GValue **params_p)
|
||||
{
|
||||
GValue *params;
|
||||
const GType *types;
|
||||
guint i;
|
||||
gboolean valid;
|
||||
|
||||
params = g_new0 (GValue, query->n_params + 1);
|
||||
*params_p = params;
|
||||
|
||||
/* The instance we emit on is the first object in the array
|
||||
*/
|
||||
g_value_init (params, G_TYPE_OBJECT);
|
||||
g_value_set_object (params, G_OBJECT (object));
|
||||
params++;
|
||||
|
||||
types = query->param_types;
|
||||
valid = TRUE;
|
||||
for (i = 1; i < query->n_params + 1 && valid; i++)
|
||||
{
|
||||
GValue tmp_value = G_VALUE_INIT;
|
||||
GVariant *tmp_variant;
|
||||
|
||||
g_value_init (params, *types);
|
||||
tmp_variant = g_variant_iter_next_value (args);
|
||||
|
||||
switch ((guint) g_variant_classify (tmp_variant))
|
||||
{
|
||||
case G_VARIANT_CLASS_BOOLEAN:
|
||||
g_value_init (&tmp_value, G_TYPE_BOOLEAN);
|
||||
g_value_set_boolean (&tmp_value, g_variant_get_boolean (tmp_variant));
|
||||
break;
|
||||
case G_VARIANT_CLASS_DOUBLE:
|
||||
g_value_init (&tmp_value, G_TYPE_DOUBLE);
|
||||
g_value_set_double (&tmp_value, g_variant_get_double (tmp_variant));
|
||||
break;
|
||||
case G_VARIANT_CLASS_INT32:
|
||||
g_value_init (&tmp_value, G_TYPE_LONG);
|
||||
g_value_set_long (&tmp_value, g_variant_get_int32 (tmp_variant));
|
||||
break;
|
||||
case G_VARIANT_CLASS_UINT32:
|
||||
g_value_init (&tmp_value, G_TYPE_LONG);
|
||||
g_value_set_long (&tmp_value, g_variant_get_uint32 (tmp_variant));
|
||||
break;
|
||||
case G_VARIANT_CLASS_INT64:
|
||||
g_value_init (&tmp_value, G_TYPE_LONG);
|
||||
g_value_set_long (&tmp_value, g_variant_get_int64 (tmp_variant));
|
||||
break;
|
||||
case G_VARIANT_CLASS_STRING:
|
||||
/* gtk_rc_parse_flags/enum() has fancier parsing for this; we can't call
|
||||
* that since we don't have a GParamSpec, so just do something simple
|
||||
*/
|
||||
if (G_TYPE_FUNDAMENTAL (*types) == G_TYPE_ENUM)
|
||||
{
|
||||
GEnumClass *class = G_ENUM_CLASS (g_type_class_ref (*types));
|
||||
GEnumValue *enum_value;
|
||||
const char *s = g_variant_get_string (tmp_variant, NULL);
|
||||
|
||||
valid = FALSE;
|
||||
|
||||
enum_value = g_enum_get_value_by_name (class, s);
|
||||
if (!enum_value)
|
||||
enum_value = g_enum_get_value_by_nick (class, s);
|
||||
|
||||
if (enum_value)
|
||||
{
|
||||
g_value_init (&tmp_value, *types);
|
||||
g_value_set_enum (&tmp_value, enum_value->value);
|
||||
valid = TRUE;
|
||||
}
|
||||
|
||||
g_type_class_unref (class);
|
||||
}
|
||||
/* This is just a hack for compatibility with GTK+-1.2 where a string
|
||||
* could be used for a single flag value / without the support for multiple
|
||||
* values in gtk_rc_parse_flags(), this isn't very useful.
|
||||
*/
|
||||
else if (G_TYPE_FUNDAMENTAL (*types) == G_TYPE_FLAGS)
|
||||
{
|
||||
GFlagsClass *class = G_FLAGS_CLASS (g_type_class_ref (*types));
|
||||
GFlagsValue *flags_value;
|
||||
const char *s = g_variant_get_string (tmp_variant, NULL);
|
||||
|
||||
valid = FALSE;
|
||||
|
||||
flags_value = g_flags_get_value_by_name (class, s);
|
||||
if (!flags_value)
|
||||
flags_value = g_flags_get_value_by_nick (class, s);
|
||||
if (flags_value)
|
||||
{
|
||||
g_value_init (&tmp_value, *types);
|
||||
g_value_set_flags (&tmp_value, flags_value->value);
|
||||
valid = TRUE;
|
||||
}
|
||||
|
||||
g_type_class_unref (class);
|
||||
}
|
||||
else
|
||||
{
|
||||
g_value_init (&tmp_value, G_TYPE_STRING);
|
||||
g_value_set_static_string (&tmp_value, g_variant_get_string (tmp_variant, NULL));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
valid = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (valid)
|
||||
{
|
||||
if (!g_value_transform (&tmp_value, params))
|
||||
valid = FALSE;
|
||||
|
||||
g_value_unset (&tmp_value);
|
||||
}
|
||||
|
||||
g_variant_unref (tmp_variant);
|
||||
types++;
|
||||
params++;
|
||||
}
|
||||
|
||||
if (!valid)
|
||||
{
|
||||
guint j;
|
||||
|
||||
for (j = 0; j < i; j++)
|
||||
g_value_unset (&(*params_p)[j]);
|
||||
|
||||
g_free (*params_p);
|
||||
*params_p = NULL;
|
||||
}
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_shortcut_emit_signal (GObject *object,
|
||||
const char *signal,
|
||||
GVariant *args,
|
||||
gboolean *handled,
|
||||
GError **error)
|
||||
{
|
||||
GSignalQuery query;
|
||||
guint signal_id;
|
||||
GValue *params = NULL;
|
||||
GValue return_val = G_VALUE_INIT;
|
||||
GVariantIter args_iter;
|
||||
gsize n_args;
|
||||
guint i;
|
||||
|
||||
*handled = FALSE;
|
||||
|
||||
signal_id = g_signal_lookup (signal, G_OBJECT_TYPE (object));
|
||||
if (!signal_id)
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
"Could not find signal \"%s\" in the '%s' class ancestry",
|
||||
signal,
|
||||
g_type_name (G_OBJECT_TYPE (object)));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
g_signal_query (signal_id, &query);
|
||||
if (args)
|
||||
n_args = g_variant_iter_init (&args_iter, args);
|
||||
else
|
||||
n_args = 0;
|
||||
if (query.n_params != n_args ||
|
||||
(query.return_type != G_TYPE_NONE && query.return_type != G_TYPE_BOOLEAN) ||
|
||||
!binding_compose_params (object, &args_iter, &query, ¶ms))
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
"signature mismatch for signal \"%s\" in the '%s' class ancestry",
|
||||
signal,
|
||||
g_type_name (G_OBJECT_TYPE (object)));
|
||||
return FALSE;
|
||||
}
|
||||
else if (!(query.signal_flags & G_SIGNAL_ACTION))
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
|
||||
"signal \"%s\" in the '%s' class ancestry cannot be used for action emissions",
|
||||
signal,
|
||||
g_type_name (G_OBJECT_TYPE (object)));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (query.return_type == G_TYPE_BOOLEAN)
|
||||
g_value_init (&return_val, G_TYPE_BOOLEAN);
|
||||
|
||||
g_signal_emitv (params, signal_id, 0, &return_val);
|
||||
|
||||
if (query.return_type == G_TYPE_BOOLEAN)
|
||||
{
|
||||
if (g_value_get_boolean (&return_val))
|
||||
*handled = TRUE;
|
||||
g_value_unset (&return_val);
|
||||
}
|
||||
else
|
||||
*handled = TRUE;
|
||||
|
||||
if (params != NULL)
|
||||
{
|
||||
for (i = 0; i < query.n_params + 1; i++)
|
||||
g_value_unset (¶ms[i]);
|
||||
|
||||
g_free (params);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gtk_shortcut_activate (GtkShortcut *self,
|
||||
GtkWidget *widget)
|
||||
@@ -261,11 +475,11 @@ gtk_shortcut_activate (GtkShortcut *self,
|
||||
GError *error = NULL;
|
||||
gboolean handled;
|
||||
|
||||
if (!gtk_binding_emit_signal (G_OBJECT (widget),
|
||||
self->signal,
|
||||
self->args,
|
||||
&handled,
|
||||
&error))
|
||||
if (!gtk_shortcut_emit_signal (G_OBJECT (widget),
|
||||
self->signal,
|
||||
self->args,
|
||||
&handled,
|
||||
&error))
|
||||
{
|
||||
char *accelerator = gtk_shortcut_trigger_to_string (self->trigger);
|
||||
g_warning ("gtk_shortcut_activate(): \":%s\": %s",
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include "gtkshortcutcontrollerprivate.h"
|
||||
|
||||
#include "gtkeventcontrollerprivate.h"
|
||||
#include "gtkbindings.h"
|
||||
#include "gtkshortcut.h"
|
||||
#include "gtkwidgetprivate.h"
|
||||
|
||||
@@ -95,9 +94,6 @@ gtk_shortcut_controller_handle_event (GtkEventController *controller,
|
||||
{
|
||||
widget = gtk_event_controller_get_widget (controller);
|
||||
|
||||
if (gtk_bindings_activate_event (G_OBJECT (widget), (GdkEventKey *) event))
|
||||
return TRUE;
|
||||
|
||||
for (l = gtk_widget_class_get_shortcuts (GTK_WIDGET_GET_CLASS (widget)); l; l = l->next)
|
||||
{
|
||||
if (gtk_shortcut_controller_trigger_shortcut (self, l->data, event))
|
||||
|
||||
@@ -168,7 +168,6 @@ gtk_public_sources = files([
|
||||
'gtkassistant.c',
|
||||
'gtkbbox.c',
|
||||
'gtkbin.c',
|
||||
'gtkbindings.c',
|
||||
'gtkborder.c',
|
||||
'gtkbox.c',
|
||||
'gtkbuildable.c',
|
||||
@@ -415,7 +414,6 @@ gtk_public_headers = files([
|
||||
'gtkassistant.h',
|
||||
'gtkbbox.h',
|
||||
'gtkbin.h',
|
||||
'gtkbindings.h',
|
||||
'gtkborder.h',
|
||||
'gtkbox.h',
|
||||
'gtkbuildable.h',
|
||||
|
||||
@@ -76,7 +76,6 @@ gtk/gtkaspectframe.c
|
||||
gtk/gtkassistant.c
|
||||
gtk/gtkbbox.c
|
||||
gtk/gtkbin.c
|
||||
gtk/gtkbindings.c
|
||||
gtk/gtkbookmarksmanager.c
|
||||
gtk/gtkbox.c
|
||||
gtk/gtkbuildable.c
|
||||
|
||||
@@ -76,7 +76,6 @@ gtk/gtkaspectframe.c
|
||||
gtk/gtkassistant.c
|
||||
gtk/gtkbbox.c
|
||||
gtk/gtkbin.c
|
||||
gtk/gtkbindings.c
|
||||
gtk/gtkbookmarksmanager.c
|
||||
gtk/gtkbox.c
|
||||
gtk/gtkbuildable.c
|
||||
|
||||
@@ -7200,7 +7200,6 @@ main (int argc, char *argv[])
|
||||
{
|
||||
GtkCssProvider *provider, *memory_provider;
|
||||
GdkDisplay *display;
|
||||
GtkBindingSet *binding_set;
|
||||
int i;
|
||||
gboolean done_benchmarks = FALSE;
|
||||
|
||||
@@ -7284,15 +7283,6 @@ main (int argc, char *argv[])
|
||||
if (done_benchmarks)
|
||||
return 0;
|
||||
|
||||
/* bindings test
|
||||
*/
|
||||
binding_set = gtk_binding_set_by_class (g_type_class_ref (GTK_TYPE_WIDGET));
|
||||
gtk_binding_entry_add_signal (binding_set,
|
||||
'9', GDK_CONTROL_MASK | GDK_RELEASE_MASK,
|
||||
"debug_msg",
|
||||
1,
|
||||
G_TYPE_STRING, "GtkWidgetClass <ctrl><release>9 test");
|
||||
|
||||
memory_provider = gtk_css_provider_new ();
|
||||
gtk_css_provider_load_from_data (memory_provider,
|
||||
"#testgtk-version-label {\n"
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
/* testgtk2.css sets all the buttons in the main window to blue by default */
|
||||
@import url("testgtk2.css");
|
||||
|
||||
@binding-set entry-bindings {
|
||||
bind "<alt>s" { "move-cursor" (visual-positions, 3, 0) };
|
||||
bind "<alt>a" { "move-cursor" (visual-positions, -3, 0) };
|
||||
}
|
||||
|
||||
* {
|
||||
font-family: Sans;
|
||||
font-size: 12px;
|
||||
@@ -24,6 +19,3 @@ label:hover {
|
||||
background-color: rgb (0%, 75%, 0);
|
||||
}
|
||||
|
||||
entry {
|
||||
-gtk-key-bindings: entry-bindings;
|
||||
}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
@binding-set "foo";
|
||||
@@ -1 +0,0 @@
|
||||
at-invalid-22.css:1: error: GTK_CSS_PROVIDER_ERROR_SYNTAX
|
||||
@@ -1 +0,0 @@
|
||||
@binding-set foo { bind key { "action"() }; };
|
||||
@@ -1,2 +0,0 @@
|
||||
at-invalid-23.css:1: error: GTK_CSS_PROVIDER_ERROR_SYNTAX
|
||||
at-invalid-23.css:1: error: GTK_CSS_PROVIDER_ERROR_DEPRECATED
|
||||
@@ -1 +0,0 @@
|
||||
@binding-set foo { bind key { "action"() }; };
|
||||
@@ -1,2 +0,0 @@
|
||||
at-invalid-24.css:1: error: GTK_CSS_PROVIDER_ERROR_SYNTAX
|
||||
at-invalid-24.css:1: error: GTK_CSS_PROVIDER_ERROR_DEPRECATED
|
||||
@@ -1 +0,0 @@
|
||||
@binding-set foo { bind "key" { action() }; };
|
||||
@@ -1,2 +0,0 @@
|
||||
at-invalid-25.css:1: error: GTK_CSS_PROVIDER_ERROR_SYNTAX
|
||||
at-invalid-25.css:1: error: GTK_CSS_PROVIDER_ERROR_DEPRECATED
|
||||
@@ -1 +0,0 @@
|
||||
@binding-set foo { bind "key"; };
|
||||
@@ -1,2 +0,0 @@
|
||||
at-invalid-26.css:1: error: GTK_CSS_PROVIDER_ERROR_SYNTAX
|
||||
at-invalid-26.css:1: error: GTK_CSS_PROVIDER_ERROR_DEPRECATED
|
||||
@@ -1 +0,0 @@
|
||||
@binding-set foo { unbind "key" { "bla" () }; };
|
||||
@@ -1,2 +0,0 @@
|
||||
at-invalid-27.css:1: error: GTK_CSS_PROVIDER_ERROR_SYNTAX
|
||||
at-invalid-27.css:1: error: GTK_CSS_PROVIDER_ERROR_DEPRECATED
|
||||
@@ -1 +0,0 @@
|
||||
@binding-set gtk-emacs-menu { bind "<ctrl>n" { "move-current" (next) }; };
|
||||
@@ -1 +0,0 @@
|
||||
at-valid-19.css:1: error: GTK_CSS_PROVIDER_ERROR_DEPRECATED
|
||||
@@ -1,4 +0,0 @@
|
||||
@binding-set gtk-emacs-text-view {
|
||||
bind "<ctrl>u" { "move-cursor" (paragraph-ends, -1, 0)
|
||||
"delete-from-cursor" (paragraph-ends, 1) };
|
||||
};
|
||||
@@ -1 +0,0 @@
|
||||
at-valid-20.css:4: error: GTK_CSS_PROVIDER_ERROR_DEPRECATED
|
||||
@@ -1,4 +0,0 @@
|
||||
@binding-set test {
|
||||
bind "<ctrl>space" { "set-anchor" () };
|
||||
unbind "<ctrl>v";
|
||||
};
|
||||
@@ -1 +0,0 @@
|
||||
at-valid-21.css:4: error: GTK_CSS_PROVIDER_ERROR_DEPRECATED
|
||||
@@ -101,24 +101,6 @@ test_data = [
|
||||
'at-invalid-21.css',
|
||||
'at-invalid-21.errors',
|
||||
'at-invalid-21.ref.css',
|
||||
'at-invalid-22.css',
|
||||
'at-invalid-22.errors',
|
||||
'at-invalid-22.ref.css',
|
||||
'at-invalid-23.css',
|
||||
'at-invalid-23.errors',
|
||||
'at-invalid-23.ref.css',
|
||||
'at-invalid-24.css',
|
||||
'at-invalid-24.errors',
|
||||
'at-invalid-24.ref.css',
|
||||
'at-invalid-25.css',
|
||||
'at-invalid-25.errors',
|
||||
'at-invalid-25.ref.css',
|
||||
'at-invalid-26.css',
|
||||
'at-invalid-26.errors',
|
||||
'at-invalid-26.ref.css',
|
||||
'at-invalid-27.css',
|
||||
'at-invalid-27.errors',
|
||||
'at-invalid-27.ref.css',
|
||||
'at-valid-01.css',
|
||||
'at-valid-01.ref.css',
|
||||
'at-valid-02.css',
|
||||
@@ -153,15 +135,6 @@ test_data = [
|
||||
'at-valid-17.css',
|
||||
'at-valid-18.css',
|
||||
'at-valid-18.ref.css',
|
||||
'at-valid-19.css',
|
||||
'at-valid-19.errors',
|
||||
'at-valid-19.ref.css',
|
||||
'at-valid-20.css',
|
||||
'at-valid-20.errors',
|
||||
'at-valid-20.ref.css',
|
||||
'at-valid-21.css',
|
||||
'at-valid-21.errors',
|
||||
'at-valid-21.ref.css',
|
||||
'background-blend-mode.css',
|
||||
'background-blend-mode.ref.css',
|
||||
'background-clip.css',
|
||||
|
||||
Reference in New Issue
Block a user