[gtk/wip/baedert/transforms6] imcontextxim: Avoid "event" signal usage
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/baedert/transforms6] imcontextxim: Avoid "event" signal usage
- Date: Wed, 12 Dec 2018 07:10:45 +0000 (UTC)
commit ab6ada8d383c3559619e4c4d4fd88f22f7bbe7a6
Author: Timm Bäder <mail baedert org>
Date: Wed Dec 12 08:05:48 2018 +0100
imcontextxim: Avoid "event" signal usage
Use a GtkEventControllerLegacy on the toplevel widget instead.
gtk/gtkimcontextxim.c | 31 +++++++++++++++++++++++++------
1 file changed, 25 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtkimcontextxim.c b/gtk/gtkimcontextxim.c
index 01629ab054..7633b8d591 100644
--- a/gtk/gtkimcontextxim.c
+++ b/gtk/gtkimcontextxim.c
@@ -22,6 +22,7 @@
#include "gtkimcontextxim.h"
#include "gtkimmoduleprivate.h"
+#include "gtkeventcontrollerlegacy.h"
#include "gtk/gtkintl.h"
@@ -102,6 +103,9 @@ struct _StatusWindow
/* Currently focused GtkIMContextXIM for the toplevel, if any */
GtkIMContextXIM *context;
+
+ /* Event controller used to track configure events */
+ GtkEventController *event_controller;
};
static void gtk_im_context_xim_finalize (GObject *obj);
@@ -1629,6 +1633,16 @@ on_status_toplevel_configure (GtkWidget *toplevel,
return GDK_EVENT_PROPAGATE;
}
+static void
+toplevel_controller_event_cb (GtkEventControllerLegacy *controller,
+ GdkEvent *event,
+ gpointer user_data)
+{
+ on_status_toplevel_configure (gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (controller)),
+ event,
+ user_data);
+}
+
/* Frees a status window and removes its link from the status_windows list
*/
static void
@@ -1645,9 +1659,9 @@ status_window_free (StatusWindow *status_window)
g_signal_handlers_disconnect_by_func (status_window->toplevel,
G_CALLBACK (on_status_toplevel_notify_display),
status_window);
- g_signal_handlers_disconnect_by_func (status_window->toplevel,
- G_CALLBACK (on_status_toplevel_configure),
- status_window);
+
+ gtk_widget_remove_controller (status_window->toplevel,
+ status_window->event_controller);
if (status_window->window)
gtk_widget_destroy (status_window->window);
@@ -1670,19 +1684,24 @@ status_window_get (GtkWidget *toplevel)
status_window = g_new0 (StatusWindow, 1);
status_window->toplevel = toplevel;
+ status_window->event_controller = gtk_event_controller_legacy_new ();
status_windows = g_slist_prepend (status_windows, status_window);
g_signal_connect (toplevel, "destroy",
G_CALLBACK (on_status_toplevel_destroy),
status_window);
- g_signal_connect (toplevel, "event",
- G_CALLBACK (on_status_toplevel_configure),
- status_window);
g_signal_connect (toplevel, "notify::display",
G_CALLBACK (on_status_toplevel_notify_display),
status_window);
+
+ g_signal_connect (status_window->event_controller,
+ "event",
+ G_CALLBACK (toplevel_controller_event_cb),
+ status_window);
+ gtk_widget_add_controller (toplevel, status_window->event_controller);
+
g_object_set_data (G_OBJECT (toplevel), "gtk-im-xim-status-window", status_window);
return status_window;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]