[gnome-games/wip/exalm/gtk4: 23/45] 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: 23/45] ui: Stop using 'button-press-event' signal
- Date: Sun, 17 Feb 2019 10:12:51 +0000 (UTC)
commit acbdcc86216b684372e232719f303911c8525cee
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 22b75634..e12823cc 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 c606c33c..108d379d 100644
--- a/src/ui/application-window.vala
+++ b/src/ui/application-window.vala
@@ -239,17 +239,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]