forked from AuroraMiddleware/gtk
eventcontrollerkey: Port to new API model
This commit is contained in:
parent
ba7849960e
commit
15e00759c7
@ -1718,9 +1718,10 @@ do_font_features (GtkWidget *do_widget)
|
||||
entry = GTK_WIDGET (gtk_builder_get_object (builder, "entry"));
|
||||
edit_toggle = GTK_WIDGET (gtk_builder_get_object (builder, "edit_toggle"));
|
||||
|
||||
controller = gtk_event_controller_key_new (entry);
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_object_set_data_full (G_OBJECT (entry), "controller", controller, g_object_unref);
|
||||
g_signal_connect (controller, "key-pressed", G_CALLBACK (entry_key_press), entry);
|
||||
gtk_widget_add_controller (entry, controller);
|
||||
|
||||
add_check_group (feature_list, _("Kerning"), (const char *[]){ "kern", NULL });
|
||||
add_check_group (feature_list, _("Ligatures"), (const char *[]){ "liga",
|
||||
|
@ -256,9 +256,9 @@ do_hypertext (GtkWidget *do_widget)
|
||||
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), GTK_WRAP_WORD);
|
||||
gtk_text_view_set_left_margin (GTK_TEXT_VIEW (view), 20);
|
||||
gtk_text_view_set_right_margin (GTK_TEXT_VIEW (view), 20);
|
||||
controller = gtk_event_controller_key_new (view);
|
||||
g_object_set_data_full (G_OBJECT (view), "controller", controller, g_object_unref);
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed", G_CALLBACK (key_pressed), view);
|
||||
gtk_widget_add_controller (view, controller);
|
||||
g_signal_connect (view, "event",
|
||||
G_CALLBACK (event_cb), NULL);
|
||||
|
||||
|
@ -54,7 +54,6 @@ struct _IconBrowserWindow
|
||||
GtkWidget *image6;
|
||||
GtkWidget *label6;
|
||||
GtkWidget *description;
|
||||
GtkEventController *controller;
|
||||
};
|
||||
|
||||
struct _IconBrowserWindowClass
|
||||
@ -455,6 +454,7 @@ static void
|
||||
icon_browser_window_init (IconBrowserWindow *win)
|
||||
{
|
||||
GdkContentFormats *list;
|
||||
GtkEventController *controller;
|
||||
|
||||
gtk_widget_init_template (GTK_WIDGET (win));
|
||||
|
||||
@ -484,8 +484,9 @@ icon_browser_window_init (IconBrowserWindow *win)
|
||||
|
||||
symbolic_toggled (GTK_TOGGLE_BUTTON (win->symbolic_radio), win);
|
||||
|
||||
win->controller = gtk_event_controller_key_new (GTK_WIDGET (win));
|
||||
g_signal_connect (win->controller, "key-pressed", G_CALLBACK (key_event_cb), win);
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed", G_CALLBACK (key_event_cb), win);
|
||||
gtk_widget_add_controller (GTK_WIDGET (win), controller);
|
||||
|
||||
populate (win);
|
||||
}
|
||||
@ -497,8 +498,6 @@ icon_browser_window_finalize (GObject *object)
|
||||
|
||||
g_hash_table_unref (win->contexts);
|
||||
|
||||
g_object_unref (win->controller);
|
||||
|
||||
G_OBJECT_CLASS (icon_browser_window_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
@ -41,10 +41,11 @@ activate_cb (GtkApplication *app,
|
||||
|
||||
gtk_search_bar_connect_entry (GTK_SEARCH_BAR (search_bar), GTK_ENTRY (entry));
|
||||
|
||||
controller = gtk_event_controller_key_new (window);
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_object_set_data_full (G_OBJECT (window), "controller", controller, g_object_unref);
|
||||
g_signal_connect (controller, "key-pressed",
|
||||
G_CALLBACK (window_key_pressed), search_bar);
|
||||
gtk_widget_add_controller (window, controller);
|
||||
}
|
||||
|
||||
gint
|
||||
|
@ -248,11 +248,8 @@ struct _GtkCalendarPrivate
|
||||
gint detail_height_rows;
|
||||
gint detail_width_chars;
|
||||
gint detail_overflow[6];
|
||||
|
||||
GtkEventController *key_controller;
|
||||
};
|
||||
|
||||
static void gtk_calendar_finalize (GObject *object);
|
||||
static void gtk_calendar_destroy (GtkWidget *widget);
|
||||
static void gtk_calendar_set_property (GObject *object,
|
||||
guint prop_id,
|
||||
@ -369,7 +366,6 @@ gtk_calendar_class_init (GtkCalendarClass *class)
|
||||
|
||||
gobject_class->set_property = gtk_calendar_set_property;
|
||||
gobject_class->get_property = gtk_calendar_get_property;
|
||||
gobject_class->finalize = gtk_calendar_finalize;
|
||||
|
||||
widget_class->destroy = gtk_calendar_destroy;
|
||||
widget_class->snapshot = gtk_calendar_snapshot;
|
||||
@ -689,17 +685,17 @@ gtk_calendar_init (GtkCalendar *calendar)
|
||||
calendar);
|
||||
gtk_widget_add_controller (GTK_WIDGET (calendar), controller);
|
||||
|
||||
priv->key_controller =
|
||||
gtk_event_controller_key_new (GTK_WIDGET (calendar));
|
||||
g_signal_connect (priv->key_controller, "key-pressed",
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed",
|
||||
G_CALLBACK (gtk_calendar_key_controller_key_pressed),
|
||||
calendar);
|
||||
g_signal_connect (priv->key_controller, "focus-in",
|
||||
g_signal_connect (controller, "focus-in",
|
||||
G_CALLBACK (gtk_calendar_key_controller_focus),
|
||||
calendar);
|
||||
g_signal_connect (priv->key_controller, "focus-out",
|
||||
g_signal_connect (controller, "focus-out",
|
||||
G_CALLBACK (gtk_calendar_key_controller_focus),
|
||||
calendar);
|
||||
gtk_widget_add_controller (GTK_WIDGET (calendar), controller);
|
||||
|
||||
if (!default_abbreviated_dayname[0])
|
||||
for (i=0; i<7; i++)
|
||||
@ -1328,16 +1324,6 @@ calendar_set_month_prev (GtkCalendar *calendar)
|
||||
* Basic object methods *
|
||||
****************************************/
|
||||
|
||||
static void
|
||||
gtk_calendar_finalize (GObject *object)
|
||||
{
|
||||
GtkCalendarPrivate *priv = GTK_CALENDAR (object)->priv;
|
||||
|
||||
g_object_unref (priv->key_controller);
|
||||
|
||||
G_OBJECT_CLASS (gtk_calendar_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_calendar_destroy (GtkWidget *widget)
|
||||
{
|
||||
|
@ -520,7 +520,6 @@ struct _GtkCellEditableWidget
|
||||
GtkCellRendererAccelMode accel_mode;
|
||||
gchar *path;
|
||||
GtkCellRenderer *cell;
|
||||
GtkEventController *key_controller;
|
||||
};
|
||||
|
||||
enum {
|
||||
@ -718,7 +717,6 @@ gtk_cell_editable_widget_finalize (GObject *object)
|
||||
{
|
||||
GtkCellEditableWidget *box = (GtkCellEditableWidget*)object;
|
||||
|
||||
g_object_unref (box->key_controller);
|
||||
g_free (box->path);
|
||||
|
||||
G_OBJECT_CLASS (gtk_cell_editable_widget_parent_class)->finalize (object);
|
||||
@ -757,14 +755,16 @@ static void
|
||||
gtk_cell_editable_widget_init (GtkCellEditableWidget *box)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (box);
|
||||
GtkEventController *controller;
|
||||
|
||||
gtk_widget_set_can_focus (widget, TRUE);
|
||||
|
||||
box->key_controller = gtk_event_controller_key_new (widget);
|
||||
g_signal_connect (box->key_controller, "key-pressed",
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed",
|
||||
G_CALLBACK (key_controller_key_pressed), box);
|
||||
g_signal_connect (box->key_controller, "modifiers",
|
||||
g_signal_connect (controller, "modifiers",
|
||||
G_CALLBACK (key_controller_modifiers), box);
|
||||
gtk_widget_add_controller (widget, controller);
|
||||
|
||||
gtk_widget_set_has_surface (widget, FALSE);
|
||||
}
|
||||
|
@ -91,7 +91,6 @@ enum {
|
||||
};
|
||||
|
||||
#define GTK_CELL_RENDERER_SPIN_PATH "gtk-cell-renderer-spin-path"
|
||||
#define GTK_CELL_RENDERER_SPIN_KEY_CONTROLLER "gtk-cell-renderer-spin-key-controller"
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GtkCellRendererSpin, gtk_cell_renderer_spin, GTK_TYPE_CELL_RENDERER_TEXT)
|
||||
|
||||
@ -340,13 +339,12 @@ gtk_cell_renderer_spin_start_editing (GtkCellRenderer *cell,
|
||||
g_free (text);
|
||||
}
|
||||
|
||||
key_controller = gtk_event_controller_key_new (spin);
|
||||
key_controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (key_controller, "key-pressed",
|
||||
G_CALLBACK (gtk_cell_renderer_spin_key_pressed),
|
||||
spin);
|
||||
gtk_widget_add_controller (spin, key_controller);
|
||||
|
||||
g_object_set_data_full (G_OBJECT (spin), GTK_CELL_RENDERER_SPIN_KEY_CONTROLLER,
|
||||
key_controller, g_object_unref);
|
||||
g_object_set_data_full (G_OBJECT (spin), GTK_CELL_RENDERER_SPIN_PATH,
|
||||
g_strdup (path), g_free);
|
||||
|
||||
|
@ -61,11 +61,6 @@ struct _GtkColorEditorPrivate
|
||||
GtkAdjustment *v_adj;
|
||||
GtkAdjustment *a_adj;
|
||||
|
||||
GtkEventController *h_key;
|
||||
GtkEventController *s_key;
|
||||
GtkEventController *v_key;
|
||||
GtkEventController *a_key;
|
||||
|
||||
gint popup_position;
|
||||
|
||||
guint text_changed : 1;
|
||||
@ -345,6 +340,8 @@ scaled_adjustment (GtkAdjustment *a,
|
||||
static void
|
||||
gtk_color_editor_init (GtkColorEditor *editor)
|
||||
{
|
||||
GtkEventController *controller;
|
||||
|
||||
editor->priv = gtk_color_editor_get_instance_private (editor);
|
||||
editor->priv->use_alpha = TRUE;
|
||||
|
||||
@ -374,14 +371,18 @@ gtk_color_editor_init (GtkColorEditor *editor)
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (editor->priv->overlay), editor->priv->h_popup);
|
||||
gtk_overlay_add_overlay (GTK_OVERLAY (editor->priv->overlay), editor->priv->a_popup);
|
||||
|
||||
editor->priv->h_key = gtk_event_controller_key_new (editor->priv->h_entry);
|
||||
g_signal_connect (editor->priv->h_key, "key-pressed", G_CALLBACK (popup_key_pressed), editor);
|
||||
editor->priv->s_key = gtk_event_controller_key_new (editor->priv->s_entry);
|
||||
g_signal_connect (editor->priv->s_key, "key-pressed", G_CALLBACK (popup_key_pressed), editor);
|
||||
editor->priv->v_key = gtk_event_controller_key_new (editor->priv->v_entry);
|
||||
g_signal_connect (editor->priv->v_key, "key-pressed", G_CALLBACK (popup_key_pressed), editor);
|
||||
editor->priv->a_key = gtk_event_controller_key_new (editor->priv->a_entry);
|
||||
g_signal_connect (editor->priv->a_key, "key-pressed", G_CALLBACK (popup_key_pressed), editor);
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed", G_CALLBACK (popup_key_pressed), editor);
|
||||
gtk_widget_add_controller (editor->priv->h_entry, controller);
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed", G_CALLBACK (popup_key_pressed), editor);
|
||||
gtk_widget_add_controller (editor->priv->s_entry, controller);
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed", G_CALLBACK (popup_key_pressed), editor);
|
||||
gtk_widget_add_controller (editor->priv->v_entry, controller);
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed", G_CALLBACK (popup_key_pressed), editor);
|
||||
gtk_widget_add_controller (editor->priv->a_entry, controller);
|
||||
|
||||
gtk_style_context_remove_class (gtk_widget_get_style_context (editor->priv->swatch), "activatable");
|
||||
}
|
||||
@ -393,11 +394,6 @@ gtk_color_editor_dispose (GObject *object)
|
||||
|
||||
dismiss_current_popup (editor);
|
||||
|
||||
g_clear_object (&editor->priv->h_key);
|
||||
g_clear_object (&editor->priv->s_key);
|
||||
g_clear_object (&editor->priv->v_key);
|
||||
g_clear_object (&editor->priv->a_key);
|
||||
|
||||
G_OBJECT_CLASS (gtk_color_editor_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
|
@ -36,8 +36,6 @@ struct _GtkColorPlanePrivate
|
||||
GtkAdjustment *v_adj;
|
||||
|
||||
GdkTexture *texture;
|
||||
|
||||
GtkEventController *key_controller;
|
||||
};
|
||||
|
||||
enum {
|
||||
@ -392,6 +390,7 @@ plane_drag_gesture_end (GtkGestureDrag *gesture,
|
||||
static void
|
||||
gtk_color_plane_init (GtkColorPlane *plane)
|
||||
{
|
||||
GtkEventController *controller;
|
||||
GtkGesture *gesture;
|
||||
AtkObject *atk_obj;
|
||||
|
||||
@ -424,9 +423,10 @@ gtk_color_plane_init (GtkColorPlane *plane)
|
||||
TRUE);
|
||||
gtk_widget_add_controller (GTK_WIDGET (plane), GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
plane->priv->key_controller = gtk_event_controller_key_new (GTK_WIDGET (plane));
|
||||
g_signal_connect (plane->priv->key_controller, "key-pressed",
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed",
|
||||
G_CALLBACK (key_controller_key_pressed), plane);
|
||||
gtk_widget_add_controller (GTK_WIDGET (plane), controller);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -440,8 +440,6 @@ plane_finalize (GObject *object)
|
||||
g_clear_object (&plane->priv->s_adj);
|
||||
g_clear_object (&plane->priv->v_adj);
|
||||
|
||||
g_clear_object (&plane->priv->key_controller);
|
||||
|
||||
G_OBJECT_CLASS (gtk_color_plane_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,6 @@ struct _GtkColorSwatchPrivate
|
||||
guint selectable : 1;
|
||||
guint has_menu : 1;
|
||||
|
||||
GtkEventController *key_controller;
|
||||
GtkWidget *overlay_widget;
|
||||
|
||||
GtkWidget *popover;
|
||||
@ -502,8 +501,6 @@ swatch_dispose (GObject *object)
|
||||
swatch->priv->popover = NULL;
|
||||
}
|
||||
|
||||
g_clear_object (&swatch->priv->key_controller);
|
||||
|
||||
G_OBJECT_CLASS (gtk_color_swatch_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
@ -558,6 +555,7 @@ gtk_color_swatch_class_init (GtkColorSwatchClass *class)
|
||||
static void
|
||||
gtk_color_swatch_init (GtkColorSwatch *swatch)
|
||||
{
|
||||
GtkEventController *controller;
|
||||
GtkGesture *gesture;
|
||||
|
||||
swatch->priv = gtk_color_swatch_get_instance_private (swatch);
|
||||
@ -581,9 +579,10 @@ gtk_color_swatch_init (GtkColorSwatch *swatch)
|
||||
G_CALLBACK (tap_action), swatch);
|
||||
gtk_widget_add_controller (GTK_WIDGET (swatch), GTK_EVENT_CONTROLLER (gesture));
|
||||
|
||||
swatch->priv->key_controller = gtk_event_controller_key_new (GTK_WIDGET (swatch));
|
||||
g_signal_connect (swatch->priv->key_controller, "key-pressed",
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed",
|
||||
G_CALLBACK (key_controller_key_pressed), swatch);
|
||||
gtk_widget_add_controller (GTK_WIDGET (swatch), controller);
|
||||
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (swatch)), "activatable");
|
||||
|
||||
|
@ -2578,7 +2578,7 @@ gtk_entry_init (GtkEntry *entry)
|
||||
G_CALLBACK (entry_motion_cb), entry);
|
||||
gtk_widget_add_controller (GTK_WIDGET (entry), controller);
|
||||
|
||||
priv->key_controller = gtk_event_controller_key_new (GTK_WIDGET (entry));
|
||||
priv->key_controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (priv->key_controller, "key-pressed",
|
||||
G_CALLBACK (gtk_entry_key_controller_key_pressed), entry);
|
||||
g_signal_connect_swapped (priv->key_controller, "im-update",
|
||||
@ -2589,6 +2589,7 @@ gtk_entry_init (GtkEntry *entry)
|
||||
G_CALLBACK (gtk_entry_focus_out), entry);
|
||||
gtk_event_controller_key_set_im_context (GTK_EVENT_CONTROLLER_KEY (priv->key_controller),
|
||||
priv->im_context);
|
||||
gtk_widget_add_controller (GTK_WIDGET (entry), priv->key_controller);
|
||||
|
||||
widget_node = gtk_widget_get_css_node (GTK_WIDGET (entry));
|
||||
for (i = 0; i < 2; i++)
|
||||
|
@ -2471,10 +2471,12 @@ maybe_accept_completion (GtkEntry *entry,
|
||||
static void
|
||||
connect_completion_signals (GtkEntryCompletion *completion)
|
||||
{
|
||||
completion->priv->entry_key_controller =
|
||||
gtk_event_controller_key_new (completion->priv->entry);
|
||||
g_signal_connect (completion->priv->entry_key_controller, "key-pressed",
|
||||
GtkEventController *controller;
|
||||
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed",
|
||||
G_CALLBACK (gtk_entry_completion_key_pressed), completion);
|
||||
gtk_widget_add_controller (completion->priv->entry, controller);
|
||||
|
||||
completion->priv->changed_id =
|
||||
g_signal_connect (completion->priv->entry, "changed",
|
||||
@ -2524,8 +2526,6 @@ unset_accessible_relation (GtkWidget *window,
|
||||
static void
|
||||
disconnect_completion_signals (GtkEntryCompletion *completion)
|
||||
{
|
||||
g_clear_object (&completion->priv->entry_key_controller);
|
||||
|
||||
if (completion->priv->changed_id > 0 &&
|
||||
g_signal_handler_is_connected (completion->priv->entry,
|
||||
completion->priv->changed_id))
|
||||
|
@ -205,12 +205,9 @@ gtk_event_controller_key_init (GtkEventControllerKey *controller)
|
||||
}
|
||||
|
||||
GtkEventController *
|
||||
gtk_event_controller_key_new (GtkWidget *widget)
|
||||
gtk_event_controller_key_new (void)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
|
||||
|
||||
return g_object_new (GTK_TYPE_EVENT_CONTROLLER_KEY,
|
||||
"widget", widget,
|
||||
NULL);
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_event_controller_key_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkEventController *gtk_event_controller_key_new (GtkWidget *widget);
|
||||
GtkEventController *gtk_event_controller_key_new (void);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_event_controller_key_set_im_context (GtkEventControllerKey *controller,
|
||||
|
@ -666,7 +666,6 @@ struct _GtkFlowBoxPrivate {
|
||||
GDestroyNotify sort_destroy;
|
||||
|
||||
GtkGesture *drag_gesture;
|
||||
GtkEventController *key_controller;
|
||||
|
||||
GtkFlowBoxChild *rubberband_first;
|
||||
GtkFlowBoxChild *rubberband_last;
|
||||
@ -3377,8 +3376,6 @@ gtk_flow_box_finalize (GObject *obj)
|
||||
g_clear_object (&priv->hadjustment);
|
||||
g_clear_object (&priv->vadjustment);
|
||||
|
||||
g_object_unref (priv->key_controller);
|
||||
|
||||
if (priv->bound_model)
|
||||
{
|
||||
if (priv->create_widget_func_data_destroy)
|
||||
@ -3724,6 +3721,7 @@ static void
|
||||
gtk_flow_box_init (GtkFlowBox *box)
|
||||
{
|
||||
GtkFlowBoxPrivate *priv = BOX_PRIV (box);
|
||||
GtkEventController *controller;
|
||||
GtkGesture *gesture;
|
||||
|
||||
gtk_widget_set_has_surface (GTK_WIDGET (box), FALSE);
|
||||
@ -3771,9 +3769,10 @@ gtk_flow_box_init (GtkFlowBox *box)
|
||||
G_CALLBACK (gtk_flow_box_drag_gesture_end), box);
|
||||
gtk_widget_add_controller (GTK_WIDGET (box), GTK_EVENT_CONTROLLER (priv->drag_gesture));
|
||||
|
||||
priv->key_controller = gtk_event_controller_key_new (GTK_WIDGET (box));
|
||||
g_signal_connect (priv->key_controller, "key-pressed",
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed",
|
||||
G_CALLBACK (gtk_flow_box_key_controller_key_pressed), box);
|
||||
gtk_widget_add_controller (GTK_WIDGET (box), controller);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -974,9 +974,10 @@ gtk_icon_view_init (GtkIconView *icon_view)
|
||||
icon_view);
|
||||
gtk_widget_add_controller (GTK_WIDGET (icon_view), controller);
|
||||
|
||||
icon_view->priv->key_controller = gtk_event_controller_key_new (GTK_WIDGET (icon_view));
|
||||
g_signal_connect (icon_view->priv->key_controller, "key-pressed", G_CALLBACK (gtk_icon_view_key_pressed),
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed", G_CALLBACK (gtk_icon_view_key_pressed),
|
||||
icon_view);
|
||||
gtk_widget_add_controller (GTK_WIDGET (icon_view), controller);
|
||||
}
|
||||
|
||||
/* GObject methods */
|
||||
|
@ -1150,10 +1150,10 @@ gtk_menu_init (GtkMenu *menu)
|
||||
g_signal_connect (controller, "leave", G_CALLBACK (gtk_menu_leave), menu);
|
||||
gtk_widget_add_controller (GTK_WIDGET (menu), controller);
|
||||
|
||||
priv->key_controller =
|
||||
gtk_event_controller_key_new (GTK_WIDGET (menu));
|
||||
g_signal_connect (priv->key_controller, "key-pressed",
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed",
|
||||
G_CALLBACK (gtk_menu_key_pressed), menu);
|
||||
gtk_widget_add_controller (GTK_WIDGET (menu), controller);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1225,7 +1225,6 @@ gtk_menu_finalize (GObject *object)
|
||||
|
||||
gtk_widget_unparent (priv->top_arrow_widget);
|
||||
gtk_widget_unparent (priv->bottom_arrow_widget);
|
||||
g_clear_object (&priv->key_controller);
|
||||
|
||||
G_OBJECT_CLASS (gtk_menu_parent_class)->finalize (object);
|
||||
}
|
||||
|
@ -411,13 +411,15 @@ static void
|
||||
gtk_menu_shell_init (GtkMenuShell *menu_shell)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (menu_shell);
|
||||
GtkEventController *controller;
|
||||
|
||||
menu_shell->priv = gtk_menu_shell_get_instance_private (menu_shell);
|
||||
menu_shell->priv->take_focus = TRUE;
|
||||
|
||||
menu_shell->priv->key_controller = gtk_event_controller_key_new (widget);
|
||||
g_signal_connect (menu_shell->priv->key_controller, "key-pressed",
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed",
|
||||
G_CALLBACK (gtk_menu_shell_key_press), widget);
|
||||
gtk_widget_add_controller (widget, controller);
|
||||
|
||||
gtk_widget_set_has_surface (widget, FALSE);
|
||||
}
|
||||
@ -471,8 +473,6 @@ gtk_menu_shell_finalize (GObject *object)
|
||||
if (priv->key_hash)
|
||||
_gtk_key_hash_free (priv->key_hash);
|
||||
|
||||
g_object_unref (priv->key_controller);
|
||||
|
||||
G_OBJECT_CLASS (gtk_menu_shell_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
|
@ -174,8 +174,6 @@ struct _GtkPlacesSidebar {
|
||||
|
||||
GActionGroup *action_group;
|
||||
|
||||
GtkEventController *list_box_key_controller;
|
||||
|
||||
guint mounting : 1;
|
||||
guint drag_data_received : 1;
|
||||
guint drop_occurred : 1;
|
||||
@ -4007,6 +4005,7 @@ gtk_places_sidebar_init (GtkPlacesSidebar *sidebar)
|
||||
GdkContentFormats *target_list;
|
||||
gboolean show_desktop;
|
||||
GtkStyleContext *context;
|
||||
GtkEventController *controller;
|
||||
GtkGesture *gesture;
|
||||
|
||||
sidebar->cancellable = g_cancellable_new ();
|
||||
@ -4046,10 +4045,10 @@ gtk_places_sidebar_init (GtkPlacesSidebar *sidebar)
|
||||
g_signal_connect (sidebar->list_box, "row-activated",
|
||||
G_CALLBACK (on_row_activated), sidebar);
|
||||
|
||||
sidebar->list_box_key_controller =
|
||||
gtk_event_controller_key_new (sidebar->list_box);
|
||||
g_signal_connect (sidebar->list_box_key_controller, "key-pressed",
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed",
|
||||
G_CALLBACK (on_key_pressed), sidebar);
|
||||
gtk_widget_add_controller (sidebar->list_box, controller);
|
||||
|
||||
gesture = gtk_gesture_long_press_new ();
|
||||
gtk_gesture_single_set_touch_only (GTK_GESTURE_SINGLE (gesture), TRUE);
|
||||
@ -4324,8 +4323,6 @@ gtk_places_sidebar_dispose (GObject *object)
|
||||
g_clear_object (&sidebar->current_location);
|
||||
g_clear_pointer (&sidebar->rename_uri, g_free);
|
||||
|
||||
g_clear_object (&sidebar->list_box_key_controller);
|
||||
|
||||
if (sidebar->source_targets)
|
||||
{
|
||||
gdk_content_formats_unref (sidebar->source_targets);
|
||||
|
@ -82,7 +82,6 @@ struct _GtkPlacesViewPrivate
|
||||
|
||||
GtkEntryCompletion *address_entry_completion;
|
||||
GtkListStore *completion_store;
|
||||
GtkEventController *key_controller;
|
||||
|
||||
GCancellable *networks_fetching_cancellable;
|
||||
|
||||
@ -419,7 +418,6 @@ gtk_places_view_finalize (GObject *object)
|
||||
g_clear_object (&priv->networks_fetching_cancellable);
|
||||
g_clear_object (&priv->path_size_group);
|
||||
g_clear_object (&priv->space_size_group);
|
||||
g_clear_object (&priv->key_controller);
|
||||
|
||||
G_OBJECT_CLASS (gtk_places_view_parent_class)->finalize (object);
|
||||
}
|
||||
@ -2267,6 +2265,7 @@ static void
|
||||
gtk_places_view_init (GtkPlacesView *self)
|
||||
{
|
||||
GtkPlacesViewPrivate *priv;
|
||||
GtkEventController *controller;
|
||||
|
||||
priv = gtk_places_view_get_instance_private (self);
|
||||
|
||||
@ -2274,8 +2273,10 @@ gtk_places_view_init (GtkPlacesView *self)
|
||||
priv->open_flags = GTK_PLACES_OPEN_NORMAL;
|
||||
priv->path_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
||||
priv->space_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
|
||||
priv->key_controller = gtk_event_controller_key_new (GTK_WIDGET (self));
|
||||
g_signal_connect (priv->key_controller, "key-pressed", G_CALLBACK (on_key_press_event), self);
|
||||
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed", G_CALLBACK (on_key_press_event), self);
|
||||
gtk_widget_add_controller (GTK_WIDGET (self), controller);
|
||||
|
||||
gtk_widget_init_template (GTK_WIDGET (self));
|
||||
}
|
||||
|
@ -117,7 +117,6 @@ struct _GtkRangePrivate
|
||||
|
||||
GtkGesture *multipress_gesture;
|
||||
GtkGesture *drag_gesture;
|
||||
GtkEventController *key_controller;
|
||||
|
||||
GtkScrollType autoscroll_mode;
|
||||
guint autoscroll_id;
|
||||
@ -596,10 +595,10 @@ gtk_range_init (GtkRange *range)
|
||||
G_CALLBACK (gtk_range_scroll_controller_scroll), range);
|
||||
gtk_widget_add_controller (GTK_WIDGET (range), controller);
|
||||
|
||||
priv->key_controller =
|
||||
gtk_event_controller_key_new (GTK_WIDGET (range));
|
||||
g_signal_connect (priv->key_controller, "key-pressed",
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (controller, "key-pressed",
|
||||
G_CALLBACK (gtk_range_key_controller_key_pressed), range);
|
||||
gtk_widget_add_controller (GTK_WIDGET (range), controller);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1293,8 +1292,6 @@ gtk_range_finalize (GObject *object)
|
||||
GtkRange *range = GTK_RANGE (object);
|
||||
GtkRangePrivate *priv = gtk_range_get_instance_private (range);
|
||||
|
||||
g_clear_object (&priv->key_controller);
|
||||
|
||||
gtk_widget_unparent (priv->slider_widget);
|
||||
|
||||
if (priv->fill_widget)
|
||||
|
@ -727,7 +727,8 @@ gtk_search_bar_set_key_capture_widget (GtkSearchBar *bar,
|
||||
|
||||
if (priv->capture_widget)
|
||||
{
|
||||
g_clear_object (&priv->capture_widget_controller);
|
||||
gtk_widget_remove_controller (priv->capture_widget,
|
||||
priv->capture_widget_controller);
|
||||
g_object_remove_weak_pointer (G_OBJECT (priv->capture_widget),
|
||||
(gpointer *) &priv->capture_widget);
|
||||
}
|
||||
@ -739,13 +740,14 @@ gtk_search_bar_set_key_capture_widget (GtkSearchBar *bar,
|
||||
g_object_add_weak_pointer (G_OBJECT (priv->capture_widget),
|
||||
(gpointer *) &priv->capture_widget);
|
||||
|
||||
priv->capture_widget_controller = gtk_event_controller_key_new (widget);
|
||||
priv->capture_widget_controller = gtk_event_controller_key_new ();
|
||||
gtk_event_controller_set_propagation_phase (priv->capture_widget_controller,
|
||||
GTK_PHASE_CAPTURE);
|
||||
g_signal_connect (priv->capture_widget_controller, "key-pressed",
|
||||
G_CALLBACK (capture_widget_key_handled), bar);
|
||||
g_signal_connect (priv->capture_widget_controller, "key-released",
|
||||
G_CALLBACK (capture_widget_key_handled), bar);
|
||||
gtk_widget_add_controller (widget, priv->capture_widget_controller);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -504,7 +504,8 @@ gtk_search_entry_set_key_capture_widget (GtkSearchEntry *entry,
|
||||
|
||||
if (priv->capture_widget)
|
||||
{
|
||||
g_object_unref (priv->capture_widget_controller);
|
||||
gtk_widget_remove_controller (priv->capture_widget,
|
||||
priv->capture_widget_controller);
|
||||
g_object_remove_weak_pointer (G_OBJECT (priv->capture_widget),
|
||||
(gpointer *) &priv->capture_widget);
|
||||
}
|
||||
@ -516,13 +517,14 @@ gtk_search_entry_set_key_capture_widget (GtkSearchEntry *entry,
|
||||
g_object_add_weak_pointer (G_OBJECT (priv->capture_widget),
|
||||
(gpointer *) &priv->capture_widget);
|
||||
|
||||
priv->capture_widget_controller = gtk_event_controller_key_new (widget);
|
||||
priv->capture_widget_controller = gtk_event_controller_key_new ();
|
||||
gtk_event_controller_set_propagation_phase (priv->capture_widget_controller,
|
||||
GTK_PHASE_CAPTURE);
|
||||
g_signal_connect (priv->capture_widget_controller, "key-pressed",
|
||||
G_CALLBACK (capture_widget_key_handled), entry);
|
||||
g_signal_connect (priv->capture_widget_controller, "key-released",
|
||||
G_CALLBACK (capture_widget_key_handled), entry);
|
||||
gtk_widget_add_controller (widget, priv->capture_widget_controller);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,6 @@ typedef struct
|
||||
GtkListBox *list_box;
|
||||
GtkBox *search_gestures;
|
||||
GtkBox *search_shortcuts;
|
||||
GtkEventController *controller;
|
||||
|
||||
GtkWindow *window;
|
||||
gulong keys_changed_id;
|
||||
@ -651,7 +650,6 @@ gtk_shortcuts_window_finalize (GObject *object)
|
||||
|
||||
g_clear_object (&priv->search_image_group);
|
||||
g_clear_object (&priv->search_text_group);
|
||||
g_clear_object (&priv->controller);
|
||||
|
||||
G_OBJECT_CLASS (gtk_shortcuts_window_parent_class)->finalize (object);
|
||||
}
|
||||
@ -882,13 +880,15 @@ 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);
|
||||
|
||||
priv->controller = gtk_event_controller_key_new (GTK_WIDGET (self));
|
||||
g_signal_connect (priv->controller, "key-pressed",
|
||||
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);
|
||||
|
@ -1691,7 +1691,7 @@ gtk_text_view_init (GtkTextView *text_view)
|
||||
g_signal_connect (controller, "motion", G_CALLBACK (gtk_text_view_motion), widget);
|
||||
gtk_widget_add_controller (widget, controller);
|
||||
|
||||
priv->key_controller = gtk_event_controller_key_new (widget);
|
||||
priv->key_controller = gtk_event_controller_key_new ();
|
||||
g_signal_connect (priv->key_controller, "key-pressed",
|
||||
G_CALLBACK (gtk_text_view_key_controller_key_pressed),
|
||||
widget);
|
||||
@ -1706,6 +1706,7 @@ gtk_text_view_init (GtkTextView *text_view)
|
||||
widget);
|
||||
gtk_event_controller_key_set_im_context (GTK_EVENT_CONTROLLER_KEY (priv->key_controller),
|
||||
priv->im_context);
|
||||
gtk_widget_add_controller (widget, priv->key_controller);
|
||||
|
||||
priv->selection_node = gtk_css_node_new ();
|
||||
gtk_css_node_set_name (priv->selection_node, I_("selection"));
|
||||
@ -3602,8 +3603,6 @@ gtk_text_view_finalize (GObject *object)
|
||||
|
||||
cancel_pending_scroll (text_view);
|
||||
|
||||
g_object_unref (priv->key_controller);
|
||||
|
||||
if (priv->tabs)
|
||||
pango_tab_array_free (priv->tabs);
|
||||
|
||||
|
@ -801,9 +801,10 @@ on_hierarchy_changed (GtkWidget *widget,
|
||||
g_object_set_data (G_OBJECT (previous_toplevel), "controller", NULL);
|
||||
|
||||
toplevel = gtk_widget_get_toplevel (widget);
|
||||
controller = gtk_event_controller_key_new (toplevel);
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_object_set_data_full (G_OBJECT (toplevel), "controller", controller, g_object_unref);
|
||||
g_signal_connect (controller, "key-pressed", G_CALLBACK (key_pressed), widget);
|
||||
gtk_widget_add_controller (toplevel, controller);
|
||||
|
||||
gtk_search_bar_set_key_capture_widget (GTK_SEARCH_BAR (wt->priv->search_bar),
|
||||
toplevel);
|
||||
|
@ -114,9 +114,10 @@ hierarchy_changed (GtkWidget *widget,
|
||||
g_object_set_data (G_OBJECT (previous_toplevel), "controller", NULL);
|
||||
|
||||
toplevel = gtk_widget_get_toplevel (widget);
|
||||
controller = gtk_event_controller_key_new (toplevel);
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_object_set_data_full (G_OBJECT (toplevel), "controller", controller, g_object_unref);
|
||||
g_signal_connect (controller, "key-pressed", G_CALLBACK (key_pressed), widget);
|
||||
gtk_widget_add_controller (toplevel, controller);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -481,9 +481,10 @@ on_hierarchy_changed (GtkWidget *widget,
|
||||
g_object_set_data (G_OBJECT (previous_toplevel), "controller", NULL);
|
||||
|
||||
toplevel = gtk_widget_get_toplevel (widget);
|
||||
controller = gtk_event_controller_key_new (toplevel);
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_object_set_data_full (G_OBJECT (toplevel), "controller", controller, g_object_unref);
|
||||
g_signal_connect (controller, "key-pressed", G_CALLBACK (key_pressed), widget);
|
||||
gtk_widget_add_controller (toplevel, controller);
|
||||
|
||||
gtk_search_bar_set_key_capture_widget (GTK_SEARCH_BAR (sl->priv->search_bar),
|
||||
toplevel);
|
||||
|
@ -332,9 +332,10 @@ hierarchy_changed (GtkWidget *widget,
|
||||
g_object_set_data (G_OBJECT (previous_toplevel), "controller", NULL);
|
||||
|
||||
toplevel = gtk_widget_get_toplevel (widget);
|
||||
controller = gtk_event_controller_key_new (toplevel);
|
||||
controller = gtk_event_controller_key_new ();
|
||||
g_object_set_data_full (G_OBJECT (toplevel), "controller", controller, g_object_unref);
|
||||
g_signal_connect (controller, "key-pressed", G_CALLBACK (key_pressed), widget);
|
||||
gtk_widget_add_controller (toplevel, controller);
|
||||
|
||||
gtk_search_bar_set_key_capture_widget (GTK_SEARCH_BAR (sl->priv->search_bar),
|
||||
toplevel);
|
||||
|
Loading…
Reference in New Issue
Block a user