[gnome-games/wip/exalm/gtk4: 15/35] ui: Stop using 'button-press-event' signal
- From: Alexander Mikhaylenko <alexm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/wip/exalm/gtk4: 15/35] ui: Stop using 'button-press-event' signal
- Date: Sat, 15 Sep 2018 19:45:10 +0000 (UTC)
commit 1acf3c6c9dfdfc5fafbb7de746fee9a30d101b6d
Author: Alexander Mikhaylenko <exalm7659 gmail com>
Date: Sat Jul 28 20:04:38 2018 +0500
ui: Stop using 'button-press-event' signal
Replace it with GtkGestureMultiPress and its 'pressed' signal.
data/ui/application-window.ui | 8 +++++++-
src/ui/application-window.vala | 12 ++----------
2 files changed, 9 insertions(+), 11 deletions(-)
---
diff --git a/data/ui/application-window.ui b/data/ui/application-window.ui
index 9efae3e7..d3df3813 100644
--- a/data/ui/application-window.ui
+++ b/data/ui/application-window.ui
@@ -8,9 +8,15 @@
<property name="show_menubar">False</property>
<signal name="delete-event" after="yes" handler="on_delete_event"/>
<signal name="key-press-event" after="yes" handler="on_key_pressed"/>
- <signal name="button-press-event" after="yes" handler="on_button_pressed"/>
<signal name="window-state-event" after="yes" handler="on_window_state_event"/>
<signal name="notify::is-active" after="yes" handler="on_active_changed"/>
+ <child>
+ <object class="GtkGestureMultiPress">
+ <!-- Mouse button 8 is the navigation previous button -->
+ <property name="button">8</property>
+ <signal name="pressed" handler="on_button_pressed" swapped="no"/>
+ </object>
+ </child>
<child>
<object class="GtkStack" id="content_box">
<property name="visible">True</property>
diff --git a/src/ui/application-window.vala b/src/ui/application-window.vala
index 7082d393..c2b3d7f3 100644
--- a/src/ui/application-window.vala
+++ b/src/ui/application-window.vala
@@ -232,17 +232,9 @@ private class Games.ApplicationWindow : Gtk.ApplicationWindow {
}
[GtkCallback]
- public bool on_button_pressed (Gdk.EventButton event) {
- // Mouse button 8 is the navigation previous button
- if (event.button == 8) {
- if (ui_state != UiState.DISPLAY)
- return false;
-
+ public void on_button_pressed (Gtk.GestureMultiPress gesture, int n_press, double x, double y) {
+ if (ui_state == UiState.DISPLAY)
on_display_back ();
- return true;
- }
-
- return false;
}
[GtkCallback]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]