forked from AuroraMiddleware/gtk
gtk: Stop using GdkEventKey
We should just use GdkEvent, instead of taking a GdkEventKey, and then cast it everywhere.
This commit is contained in:
parent
9e415ad017
commit
8823882f97
@ -1756,7 +1756,7 @@ gtk_bindings_activate (GObject *object,
|
||||
/**
|
||||
* gtk_bindings_activate_event:
|
||||
* @object: a #GObject (generally must be a widget)
|
||||
* @event: a #GdkEventKey
|
||||
* @event: a key event
|
||||
*
|
||||
* Looks up key bindings for @object to find one matching
|
||||
* @event, and if one was found, activate it.
|
||||
@ -1764,8 +1764,8 @@ gtk_bindings_activate (GObject *object,
|
||||
* Returns: %TRUE if a matching key binding was found
|
||||
*/
|
||||
gboolean
|
||||
gtk_bindings_activate_event (GObject *object,
|
||||
GdkEventKey *event)
|
||||
gtk_bindings_activate_event (GObject *object,
|
||||
GdkEvent *event)
|
||||
{
|
||||
GSList *entries = NULL;
|
||||
GdkDisplay *display;
|
||||
@ -1779,13 +1779,13 @@ gtk_bindings_activate_event (GObject *object,
|
||||
key_hash = binding_key_hash_for_keymap (gdk_display_get_keymap (display));
|
||||
|
||||
entries = _gtk_key_hash_lookup (key_hash,
|
||||
gdk_key_event_get_keycode ((GdkEvent *)event),
|
||||
gdk_event_get_modifier_state ((GdkEvent *)event),
|
||||
gdk_key_event_get_keycode (event),
|
||||
gdk_event_get_modifier_state (event),
|
||||
BINDING_MOD_MASK () & ~GDK_RELEASE_MASK,
|
||||
gdk_key_event_get_group((GdkEvent *)event));
|
||||
gdk_key_event_get_group(event));
|
||||
|
||||
handled = gtk_bindings_activate_list (object, entries,
|
||||
gdk_event_get_event_type ((GdkEvent *) event) == GDK_KEY_RELEASE);
|
||||
gdk_event_get_event_type (event) == GDK_KEY_RELEASE);
|
||||
|
||||
g_slist_free (entries);
|
||||
|
||||
|
@ -67,7 +67,7 @@ gboolean gtk_bindings_activate (GObject *object,
|
||||
GdkModifierType modifiers);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_bindings_activate_event (GObject *object,
|
||||
GdkEventKey *event);
|
||||
GdkEvent *event);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_binding_set_activate (GtkBindingSet *binding_set,
|
||||
guint keyval,
|
||||
|
@ -1795,7 +1795,7 @@ gtk_combo_box_menu_key (GtkEventControllerKey *key,
|
||||
widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (key));
|
||||
event = gtk_get_current_event ();
|
||||
|
||||
if (!gtk_bindings_activate_event (G_OBJECT (widget), (GdkEventKey *)event))
|
||||
if (!gtk_bindings_activate_event (G_OBJECT (widget), event))
|
||||
{
|
||||
gtk_event_controller_key_forward (key, GTK_WIDGET (combo_box));
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ gtk_event_controller_key_handle_event (GtkEventController *controller,
|
||||
return FALSE;
|
||||
|
||||
if (key->im_context &&
|
||||
gtk_im_context_filter_keypress (key->im_context, (GdkEventKey *) event))
|
||||
gtk_im_context_filter_keypress (key->im_context, event))
|
||||
{
|
||||
g_signal_emit (controller, signals[IM_UPDATE], 0);
|
||||
return TRUE;
|
||||
@ -368,7 +368,7 @@ gtk_event_controller_key_forward (GtkEventControllerKey *controller,
|
||||
GTK_PHASE_BUBBLE))
|
||||
return TRUE;
|
||||
|
||||
if (gtk_bindings_activate_event (G_OBJECT (widget), (GdkEventKey *)controller->current_event))
|
||||
if (gtk_bindings_activate_event (G_OBJECT (widget), controller->current_event))
|
||||
return TRUE;
|
||||
|
||||
return FALSE;
|
||||
|
@ -127,7 +127,7 @@ static void gtk_im_context_real_get_preedit_string (GtkIMContext *context,
|
||||
PangoAttrList **attrs,
|
||||
gint *cursor_pos);
|
||||
static gboolean gtk_im_context_real_filter_keypress (GtkIMContext *context,
|
||||
GdkEventKey *event);
|
||||
GdkEvent *event);
|
||||
static gboolean gtk_im_context_real_get_surrounding (GtkIMContext *context,
|
||||
gchar **text,
|
||||
gint *cursor_index);
|
||||
@ -371,8 +371,8 @@ gtk_im_context_real_get_preedit_string (GtkIMContext *context,
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gtk_im_context_real_filter_keypress (GtkIMContext *context,
|
||||
GdkEventKey *event)
|
||||
gtk_im_context_real_filter_keypress (GtkIMContext *context,
|
||||
GdkEvent *event)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
@ -511,7 +511,7 @@ gtk_im_context_get_preedit_string (GtkIMContext *context,
|
||||
**/
|
||||
gboolean
|
||||
gtk_im_context_filter_keypress (GtkIMContext *context,
|
||||
GdkEventKey *key)
|
||||
GdkEvent *key)
|
||||
{
|
||||
GtkIMContextClass *klass;
|
||||
|
||||
|
@ -68,7 +68,7 @@ struct _GtkIMContextClass
|
||||
PangoAttrList **attrs,
|
||||
gint *cursor_pos);
|
||||
gboolean (*filter_keypress) (GtkIMContext *context,
|
||||
GdkEventKey *event);
|
||||
GdkEvent *event);
|
||||
void (*focus_in) (GtkIMContext *context);
|
||||
void (*focus_out) (GtkIMContext *context);
|
||||
void (*reset) (GtkIMContext *context);
|
||||
@ -106,7 +106,7 @@ void gtk_im_context_get_preedit_string (GtkIMContext *context,
|
||||
gint *cursor_pos);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_im_context_filter_keypress (GtkIMContext *context,
|
||||
GdkEventKey *event);
|
||||
GdkEvent *event);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_im_context_focus_in (GtkIMContext *context);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
|
@ -98,7 +98,7 @@ static void gtk_im_context_ime_get_property (GObject *object,
|
||||
static void gtk_im_context_ime_set_client_widget (GtkIMContext *context,
|
||||
GtkWidget *widget);
|
||||
static gboolean gtk_im_context_ime_filter_keypress (GtkIMContext *context,
|
||||
GdkEventKey *event);
|
||||
GdkEvent *event);
|
||||
static void gtk_im_context_ime_reset (GtkIMContext *context);
|
||||
static void gtk_im_context_ime_get_preedit_string (GtkIMContext *context,
|
||||
gchar **str,
|
||||
@ -345,7 +345,7 @@ _gtk_im_context_ime_commit_unichar (GtkIMContextIME *context_ime,
|
||||
|
||||
static gboolean
|
||||
gtk_im_context_ime_filter_keypress (GtkIMContext *context,
|
||||
GdkEventKey *event)
|
||||
GdkEvent *event)
|
||||
{
|
||||
GtkIMContextIME *context_ime;
|
||||
gboolean retval = FALSE;
|
||||
|
@ -163,7 +163,7 @@ output_result (GtkIMContext *context,
|
||||
|
||||
static gboolean
|
||||
quartz_filter_keypress (GtkIMContext *context,
|
||||
GdkEventKey *event)
|
||||
GdkEvent *event)
|
||||
{
|
||||
GtkIMContextQuartz *qc = GTK_IM_CONTEXT_QUARTZ (context);
|
||||
gboolean retval;
|
||||
|
@ -114,7 +114,7 @@ static const guint16 gtk_compose_ignore[] = {
|
||||
|
||||
static void gtk_im_context_simple_finalize (GObject *obj);
|
||||
static gboolean gtk_im_context_simple_filter_keypress (GtkIMContext *context,
|
||||
GdkEventKey *key);
|
||||
GdkEvent *key);
|
||||
static void gtk_im_context_simple_reset (GtkIMContext *context);
|
||||
static void gtk_im_context_simple_get_preedit_string (GtkIMContext *context,
|
||||
gchar **str,
|
||||
@ -928,11 +928,11 @@ no_sequence_matches (GtkIMContextSimple *context_simple,
|
||||
0,
|
||||
0);
|
||||
|
||||
gtk_im_context_filter_keypress (context, (GdkEventKey *)tmp_event);
|
||||
gtk_im_context_filter_keypress (context, tmp_event);
|
||||
g_object_unref (tmp_event);
|
||||
}
|
||||
|
||||
return gtk_im_context_filter_keypress (context, (GdkEventKey *)event);
|
||||
return gtk_im_context_filter_keypress (context, event);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -966,7 +966,7 @@ is_hex_keyval (guint keyval)
|
||||
}
|
||||
|
||||
static guint
|
||||
canonical_hex_keyval (GdkEventKey *event)
|
||||
canonical_hex_keyval (GdkEvent *event)
|
||||
{
|
||||
GdkSurface *surface = gdk_event_get_surface ((GdkEvent *) event);
|
||||
GdkKeymap *keymap = gdk_display_get_keymap (gdk_surface_get_display (surface));
|
||||
@ -1014,7 +1014,7 @@ canonical_hex_keyval (GdkEventKey *event)
|
||||
|
||||
static gboolean
|
||||
gtk_im_context_simple_filter_keypress (GtkIMContext *context,
|
||||
GdkEventKey *event)
|
||||
GdkEvent *event)
|
||||
{
|
||||
GtkIMContextSimple *context_simple = GTK_IM_CONTEXT_SIMPLE (context);
|
||||
GtkIMContextSimplePrivate *priv = context_simple->priv;
|
||||
|
@ -615,7 +615,7 @@ gtk_im_context_wayland_get_preedit_string (GtkIMContext *context,
|
||||
|
||||
static gboolean
|
||||
gtk_im_context_wayland_filter_keypress (GtkIMContext *context,
|
||||
GdkEventKey *key)
|
||||
GdkEvent *key)
|
||||
{
|
||||
/* This is done by the compositor */
|
||||
return GTK_IM_CONTEXT_CLASS (gtk_im_context_wayland_parent_class)->filter_keypress (context, key);
|
||||
|
@ -66,7 +66,7 @@ static void gtk_im_multicontext_get_preedit_string (GtkIMContext
|
||||
PangoAttrList **attrs,
|
||||
gint *cursor_pos);
|
||||
static gboolean gtk_im_multicontext_filter_keypress (GtkIMContext *context,
|
||||
GdkEventKey *event);
|
||||
GdkEvent *event);
|
||||
static void gtk_im_multicontext_focus_in (GtkIMContext *context);
|
||||
static void gtk_im_multicontext_focus_out (GtkIMContext *context);
|
||||
static void gtk_im_multicontext_reset (GtkIMContext *context);
|
||||
@ -343,7 +343,7 @@ gtk_im_multicontext_get_preedit_string (GtkIMContext *context,
|
||||
|
||||
static gboolean
|
||||
gtk_im_multicontext_filter_keypress (GtkIMContext *context,
|
||||
GdkEventKey *event)
|
||||
GdkEvent *event)
|
||||
{
|
||||
GtkIMMulticontext *multicontext = GTK_IM_MULTICONTEXT (context);
|
||||
GtkIMContext *slave = gtk_im_multicontext_get_slave (multicontext);
|
||||
@ -358,15 +358,15 @@ gtk_im_multicontext_filter_keypress (GtkIMContext *context,
|
||||
GdkDisplay *display;
|
||||
GdkModifierType no_text_input_mask;
|
||||
|
||||
keyval = gdk_key_event_get_keyval ((GdkEvent *) event);
|
||||
state = gdk_event_get_modifier_state ((GdkEvent *) event);
|
||||
display = gdk_event_get_display ((GdkEvent *) event);
|
||||
keyval = gdk_key_event_get_keyval (event);
|
||||
state = gdk_event_get_modifier_state (event);
|
||||
display = gdk_event_get_display (event);
|
||||
|
||||
no_text_input_mask =
|
||||
gdk_keymap_get_modifier_mask (gdk_display_get_keymap (display),
|
||||
GDK_MODIFIER_INTENT_NO_TEXT_INPUT);
|
||||
|
||||
if (gdk_event_get_event_type ((GdkEvent *) event) == GDK_KEY_PRESS &&
|
||||
if (gdk_event_get_event_type (event) == GDK_KEY_PRESS &&
|
||||
(state & no_text_input_mask) == 0)
|
||||
{
|
||||
gunichar ch;
|
||||
|
@ -355,11 +355,11 @@ keyval_in_group (GdkKeymap *keymap,
|
||||
/**
|
||||
* _gtk_key_hash_lookup:
|
||||
* @key_hash: a #GtkKeyHash
|
||||
* @hardware_keycode: hardware keycode field from a #GdkEventKey
|
||||
* @state: state field from a #GdkEventKey
|
||||
* @hardware_keycode: hardware keycode field from a #GdkEvent
|
||||
* @state: state field from a #GdkEvent
|
||||
* @mask: mask of modifiers to consider when matching against the
|
||||
* modifiers in entries.
|
||||
* @group: group field from a #GdkEventKey
|
||||
* @group: group field from a #GdkEvent
|
||||
*
|
||||
* Looks up the best matching entry or entries in the hash table for
|
||||
* a given event. The results are sorted so that entries with less
|
||||
@ -530,7 +530,7 @@ _gtk_key_hash_lookup (GtkKeyHash *key_hash,
|
||||
*
|
||||
* Looks up the best matching entry or entries in the hash table for a
|
||||
* given keyval/modifiers pair. It’s better to use
|
||||
* _gtk_key_hash_lookup() if you have the original #GdkEventKey
|
||||
* _gtk_key_hash_lookup() if you have the original #GdkEvent
|
||||
* available. The results are sorted so that entries with less
|
||||
* modifiers come before entries with more modifiers.
|
||||
*
|
||||
|
@ -7647,8 +7647,8 @@ gtk_text_view_reset_im_context (GtkTextView *text_view)
|
||||
*
|
||||
* |[<!-- language="C" -->
|
||||
* static gboolean
|
||||
* gtk_foo_bar_key_press_event (GtkWidget *widget,
|
||||
* GdkEventKey *event)
|
||||
* gtk_foo_bar_key_press_event (GtkWidget *widget,
|
||||
* GdkEvent *event)
|
||||
* {
|
||||
* guint keyval;
|
||||
*
|
||||
@ -7669,8 +7669,8 @@ gtk_text_view_reset_im_context (GtkTextView *text_view)
|
||||
* Returns: %TRUE if the input method handled the key event.
|
||||
*/
|
||||
gboolean
|
||||
gtk_text_view_im_context_filter_keypress (GtkTextView *text_view,
|
||||
GdkEventKey *event)
|
||||
gtk_text_view_im_context_filter_keypress (GtkTextView *text_view,
|
||||
GdkEvent *event)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_TEXT_VIEW (text_view), FALSE);
|
||||
|
||||
|
@ -299,10 +299,10 @@ gboolean gtk_text_view_move_visually (GtkTextView *text_v
|
||||
gint count);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_text_view_im_context_filter_keypress (GtkTextView *text_view,
|
||||
GdkEventKey *event);
|
||||
gboolean gtk_text_view_im_context_filter_keypress (GtkTextView *text_view,
|
||||
GdkEvent *event);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_text_view_reset_im_context (GtkTextView *text_view);
|
||||
void gtk_text_view_reset_im_context (GtkTextView *text_view);
|
||||
|
||||
/* Adding child widgets */
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
|
@ -5436,7 +5436,7 @@ gtk_tree_view_key_controller_key_pressed (GtkEventControllerKey *key,
|
||||
|
||||
/* Handle the keybindings. */
|
||||
event = gtk_get_current_event ();
|
||||
if (gtk_bindings_activate_event (G_OBJECT (widget), (GdkEventKey *)event))
|
||||
if (gtk_bindings_activate_event (G_OBJECT (widget), event))
|
||||
{
|
||||
gdk_event_unref (event);
|
||||
return TRUE;
|
||||
@ -5496,7 +5496,7 @@ gtk_tree_view_key_controller_key_released (GtkEventControllerKey *key,
|
||||
|
||||
/* Handle the keybindings. */
|
||||
event = gtk_get_current_event ();
|
||||
gtk_bindings_activate_event (G_OBJECT (tree_view), (GdkEventKey *)event);
|
||||
gtk_bindings_activate_event (G_OBJECT (tree_view), event);
|
||||
gdk_event_unref (event);
|
||||
}
|
||||
|
||||
|
@ -4991,7 +4991,7 @@ gtk_widget_event (GtkWidget *widget,
|
||||
if (return_val == FALSE &&
|
||||
(gdk_event_get_event_type (event) == GDK_KEY_PRESS ||
|
||||
gdk_event_get_event_type (event) == GDK_KEY_RELEASE))
|
||||
return_val |= gtk_bindings_activate_event (G_OBJECT (widget), (GdkEventKey *) event);
|
||||
return_val |= gtk_bindings_activate_event (G_OBJECT (widget), event);
|
||||
|
||||
return return_val;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user