[iagno/arnaudb/wip/gtk4: 30/54] Make EventControllers work.
- From: Arnaud B. <arnaudb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [iagno/arnaudb/wip/gtk4: 30/54] Make EventControllers work.
- Date: Thu, 30 Apr 2020 13:19:57 +0000 (UTC)
commit e5fb2c8861a8eca551322459a49cd7c1bfe628a9
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date: Tue Feb 18 04:16:35 2020 +0100
Make EventControllers work.
src/base-window.vala | 1 +
src/reversi-view.vala | 3 +++
2 files changed, 4 insertions(+)
---
diff --git a/src/base-window.vala b/src/base-window.vala
index e1eb996..2a96664 100644
--- a/src/base-window.vala
+++ b/src/base-window.vala
@@ -317,6 +317,7 @@ private class BaseWindow : AdaptativeWindow, AdaptativeWidget
{
key_controller = new Gtk.EventControllerKey ();
key_controller.key_pressed.connect (on_key_pressed);
+ add_controller (key_controller);
}
protected inline bool on_key_pressed (Gtk.EventControllerKey _key_controller, uint keyval, uint keycode,
Gdk.ModifierType state)
diff --git a/src/reversi-view.vala b/src/reversi-view.vala
index 4762f69..f23503e 100644
--- a/src/reversi-view.vala
+++ b/src/reversi-view.vala
@@ -1067,10 +1067,12 @@ private class ReversiView : Gtk.DrawingArea
motion_controller.motion.connect (on_motion);
motion_controller.enter.connect (on_mouse_in);
motion_controller.leave.connect (on_mouse_out);
+ add_controller (motion_controller);
click_controller = new Gtk.GestureClick ();
click_controller.set_button (/* all buttons */ 0);
click_controller.pressed.connect (on_click);
+ add_controller (click_controller);
}
private inline void on_mouse_in (Gtk.EventControllerMotion _motion_controller, double event_x, double
event_y, Gdk.CrossingMode mode)
@@ -1239,6 +1241,7 @@ private class ReversiView : Gtk.DrawingArea
{
key_controller = new Gtk.EventControllerKey ();
key_controller.key_pressed.connect (on_key_pressed);
+ add_controller (key_controller);
}
private inline bool on_key_pressed (Gtk.EventControllerKey _key_controller, uint keyval, uint keycode,
Gdk.ModifierType state)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]