[shotwell/wip/gtk4] Fix keypress handling in child classes of Page



commit fc30acdb7e3c66f3832bf8640af76eb60ce426d2
Author: Jens Georg <mail jensge org>
Date:   Fri Apr 22 08:47:44 2022 +0200

    Fix keypress handling in child classes of Page

 src/PhotoPage.vala     | 12 +++---------
 src/SlideshowPage.vala |  2 +-
 2 files changed, 4 insertions(+), 10 deletions(-)
---
diff --git a/src/PhotoPage.vala b/src/PhotoPage.vala
index 6160ce1a..fa32a8bf 100644
--- a/src/PhotoPage.vala
+++ b/src/PhotoPage.vala
@@ -2331,10 +2331,6 @@ public class LibraryPhotoPage : EditingHostPage {
         get_view().install_view_filter(filter);
         LibraryPhoto.global.items_unlinking.connect(on_photo_unlinking);
         LibraryPhoto.global.items_relinked.connect(on_photo_relinked);
-
-        var key = new Gtk.EventControllerKey();
-        key.key_pressed.connect(key_press_event);
-        add_controller(key);
     }
     
     ~LibraryPhotoPage() {
@@ -2708,12 +2704,10 @@ public class LibraryPhotoPage : EditingHostPage {
         base.notify_photo_backing_missing(photo, missing);
     }
     
-    public bool key_press_event(Gtk.EventControllerKey event, uint keyval, uint keycode, Gdk.ModifierType 
modifiers) {
-        #if 0
-        if (base.key_press_event != null && base.key_press_event(event) == true)
+    public override bool key_press_event(Gtk.EventControllerKey event, uint keyval, uint keycode, 
Gdk.ModifierType modifiers) {
+        if (base.key_press_event(event, keyval, keycode, modifiers))
             return true;
-        #endif
-        
+
         bool handled = true;
         string? format = null;
         switch (Gdk.keyval_name(keyval)) {
diff --git a/src/SlideshowPage.vala b/src/SlideshowPage.vala
index ab68b918..86589bb3 100644
--- a/src/SlideshowPage.vala
+++ b/src/SlideshowPage.vala
@@ -336,7 +336,7 @@ class SlideshowPage : SinglePhotoPage {
         return true;
     }
     
-    public bool key_press_event(Gtk.EventControllerKey event, uint keyval, uint keycode, Gdk.ModifierType 
modifiers) {
+    public override bool key_press_event(Gtk.EventControllerKey event, uint keyval, uint keycode, 
Gdk.ModifierType modifiers) {
         bool handled = true;
         switch (Gdk.keyval_name(keyval)) {
             // Block activating the toolbar on key down


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]