mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 10:50:10 +00:00
shortcutswindow: Drop usage of gtk_search_bar_handle_event()
Make it capture key events from the toplevel.
This commit is contained in:
parent
e59c6abd91
commit
1825aa377b
@ -22,7 +22,6 @@
|
||||
|
||||
#include "gtkbindings.h"
|
||||
#include "gtkbox.h"
|
||||
#include "gtkeventcontrollerkey.h"
|
||||
#include "gtkgrid.h"
|
||||
#include "gtkheaderbar.h"
|
||||
#include "gtkintl.h"
|
||||
@ -854,19 +853,6 @@ gtk_shortcuts_window_class_init (GtkShortcutsWindowClass *klass)
|
||||
g_type_ensure (GTK_TYPE_SHORTCUTS_SHORTCUT);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
window_key_pressed (GtkEventController *controller,
|
||||
guint keyval,
|
||||
guint keycode,
|
||||
GdkModifierType state,
|
||||
gpointer data)
|
||||
{
|
||||
GtkShortcutsWindow *self = GTK_SHORTCUTS_WINDOW (gtk_event_controller_get_widget (controller));
|
||||
GtkShortcutsWindowPrivate *priv = gtk_shortcuts_window_get_instance_private (self);
|
||||
|
||||
return gtk_search_bar_handle_event (priv->search_bar, gtk_get_current_event ());
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_shortcuts_window_init (GtkShortcutsWindow *self)
|
||||
{
|
||||
@ -879,16 +865,10 @@ gtk_shortcuts_window_init (GtkShortcutsWindow *self)
|
||||
GtkWidget *label;
|
||||
GtkWidget *empty;
|
||||
PangoAttrList *attributes;
|
||||
GtkEventController *controller;
|
||||
|
||||
gtk_window_set_resizable (GTK_WINDOW (self), FALSE);
|
||||
gtk_window_set_type_hint (GTK_WINDOW (self), GDK_SURFACE_TYPE_HINT_DIALOG);
|
||||
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed",
|
||||
G_CALLBACK (window_key_pressed), NULL);
|
||||
gtk_widget_add_controller (GTK_WIDGET (self), controller);
|
||||
|
||||
priv->keywords = g_hash_table_new_full (NULL, NULL, NULL, g_free);
|
||||
priv->search_items_hash = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
|
||||
|
||||
@ -916,6 +896,8 @@ gtk_shortcuts_window_init (GtkShortcutsWindow *self)
|
||||
search_button, "active",
|
||||
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
|
||||
gtk_container_add (GTK_CONTAINER (priv->main_box), GTK_WIDGET (priv->search_bar));
|
||||
gtk_search_bar_set_key_capture_widget (GTK_SEARCH_BAR (priv->search_bar),
|
||||
GTK_WIDGET (self));
|
||||
|
||||
priv->stack = g_object_new (GTK_TYPE_STACK,
|
||||
"expand", TRUE,
|
||||
|
Loading…
Reference in New Issue
Block a user