[shotwell/wip/gtk4: 73/88] More keyboard handling fixes




commit 6e215e32be20025e7c76c9cefa5a4e8ace9cc678
Author: Jens Georg <mail jensge org>
Date:   Tue Apr 19 13:53:47 2022 +0200

    More keyboard handling fixes

 src/CheckerboardPage.vala                | 17 +++---
 src/CollectionPage.vala                  |  3 +-
 src/FullscreenWindow.vala                | 21 ++++---
 src/PageWindow.vala                      |  8 ++-
 src/PhotoPage.vala                       | 99 +++++++++++++++++---------------
 src/SinglePhotoPage.vala                 | 22 ++++---
 src/SlideshowPage.vala                   | 11 +---
 src/direct/DirectWindow.vala             | 15 ++---
 src/editing_tools/EditingToolWindow.vala | 15 ++---
 src/library/LibraryWindow.vala           | 14 ++---
 src/sidebar/Tree.vala                    | 21 +++----
 11 files changed, 125 insertions(+), 121 deletions(-)
---
diff --git a/src/CheckerboardPage.vala b/src/CheckerboardPage.vala
index 2bb3e5f9..6ed2edd0 100644
--- a/src/CheckerboardPage.vala
+++ b/src/CheckerboardPage.vala
@@ -70,6 +70,10 @@ public abstract class CheckerboardPage : Page {
 
         // scrollbar policy
         scrolled.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
+
+        var key_controller = new Gtk.EventControllerKey();
+        key_controller.key_pressed.connect(key_press_event);
+        add_controller (key_controller);
     }
 
     public void init_item_context_menu(string path) {
@@ -252,14 +256,13 @@ public abstract class CheckerboardPage : Page {
         }
     }
 
-#if 0
-    protected override bool key_press_event(Gdk.EventKey event) {
+    protected bool key_press_event(Gtk.EventControllerKey event, uint keyval, uint keycode, Gdk.ModifierType 
modifiers) {
         bool handled = true;
 
         // mask out the modifiers we're interested in
-        uint state = event.state & Gdk.ModifierType.SHIFT_MASK;
+        uint state = modifiers & Gdk.ModifierType.SHIFT_MASK;
 
-        switch (Gdk.keyval_name(event.keyval)) {
+        switch (Gdk.keyval_name(keyval)) {
             case "Up":
             case "KP_Up":
                 move_cursor(CompassPoint.NORTH);
@@ -319,12 +322,8 @@ public abstract class CheckerboardPage : Page {
             break;
         }
 
-        if (handled)
-            return true;
-
-        return (base.key_press_event != null) ? base.key_press_event(event) : true;
+        return handled;
     }
-    #endif
 
     protected override bool on_left_click(Gtk.EventController event, int press, double x, double y) {
         // only interested in single-click and double-clicks for now
diff --git a/src/CollectionPage.vala b/src/CollectionPage.vala
index 6a150842..7d200a59 100644
--- a/src/CollectionPage.vala
+++ b/src/CollectionPage.vala
@@ -357,8 +357,7 @@ public abstract class CollectionPage : MediaPage {
             case "KP_Home":
             case "End":
             case "KP_End":
-                // TODO: Should be forwarded
-                handled = false;
+                event.forward(this);
             break;
             case "bracketright":
                 activate_action("RotateClockwise", format);
diff --git a/src/FullscreenWindow.vala b/src/FullscreenWindow.vala
index 4adf5e02..39ee13ea 100644
--- a/src/FullscreenWindow.vala
+++ b/src/FullscreenWindow.vala
@@ -73,8 +73,6 @@ public class FullscreenWindow : PageWindow {
         show();
 
         // capture motion events to show the toolbar
-        //add_events(Gdk.EventMask.POINTER_MOTION_MASK);
-
         var motion = new Gtk.EventControllerMotion();
         motion.enter.connect(() => {
             pointer_in_toolbar = true;
@@ -88,6 +86,10 @@ public class FullscreenWindow : PageWindow {
         motion.motion.connect(motion_notify_event);
         page.add_controller(motion);
 
+
+        var key = new Gtk.EventControllerKey();
+        key.key_pressed.connect(key_press_event);
+        ((Gtk.Widget)this).add_controller(key);
         
         // If toolbar is enabled in "normal" ui OR was pinned in
         // fullscreen, start off with toolbar invoked, as a clue for the
@@ -125,23 +127,20 @@ public class FullscreenWindow : PageWindow {
         return result;
     }
 
-    #if 0
-    public override bool key_press_event(Gdk.EventKey event) {
+    public override bool key_press_event(Gtk.EventControllerKey event, uint keyval, uint keycode, 
Gdk.ModifierType modifiers) {
         // check for an escape/abort 
-        if (Gdk.keyval_name(event.keyval) == "Escape") {
+        if (Gdk.keyval_name(keyval) == "Escape") {
             on_close();
             
             return true;
         }
-        
-        // propagate to this (fullscreen) window respecting "stop propagation" result...
-        if (base.key_press_event != null && base.key_press_event(event))
+
+        if (base.key_press_event(event, keyval, keycode, modifiers))
             return true;
-        
+                
         // ... then propagate to the underlying window hidden behind this fullscreen one
-        return AppWindow.get_instance().key_press_event(event);
+        return event.forward (AppWindow.get_instance());
     }
-    #endif
     
     private void on_close() {
         Config.Facade.get_instance().set_pin_toolbar_state(is_toolbar_dismissal_enabled);
diff --git a/src/PageWindow.vala b/src/PageWindow.vala
index 2fb8522e..9c8f52e0 100644
--- a/src/PageWindow.vala
+++ b/src/PageWindow.vala
@@ -79,7 +79,10 @@ public abstract class PageWindow : Gtk.ApplicationWindow {
         switched_pages(old_page, null);
     }
 
-    public bool key_press_event(Gtk.EventControllerKey event, uint keyval, uint keycode, Gdk.ModifierType 
modifiers) {
+    public virtual bool key_press_event(Gtk.EventControllerKey event, uint keyval, uint keycode, 
Gdk.ModifierType modifiers) {
+        if ((get_focus() is Gtk.Entry) && event.forward(get_focus())) 
+            return true;
+
         if (current_page != null && current_page.notify_app_key_pressed(event, keyval, keycode, modifiers))
             return true;
 
@@ -87,6 +90,9 @@ public abstract class PageWindow : Gtk.ApplicationWindow {
     }
 
     public void key_release_event(Gtk.EventControllerKey event, uint keyval, uint keycode, Gdk.ModifierType 
modifiers) {
+        if ((get_focus() is Gtk.Entry) && event.forward(get_focus()))
+            return;
+
         if (current_page != null)
             current_page.notify_app_key_released(event, keyval, keycode, modifiers);
     }
diff --git a/src/PhotoPage.vala b/src/PhotoPage.vala
index e80e638e..145d5984 100644
--- a/src/PhotoPage.vala
+++ b/src/PhotoPage.vala
@@ -542,6 +542,10 @@ public abstract class EditingHostPage : SinglePhotoPage {
         next_button.set_icon_name("go-next-symbolic");
         next_button.clicked.connect(on_next_photo);
         toolbar.append(next_button);
+
+        var key = new Gtk.EventControllerKey();
+        key.key_pressed.connect(key_press_event);
+        add_controller(key);
     }
     
     ~EditingHostPage() {
@@ -1366,36 +1370,34 @@ public abstract class EditingHostPage : SinglePhotoPage {
         base.update_actions(selected_count, count);
     }
     
-    #if 0
-    protected override bool on_shift_pressed(Gdk.EventKey? event) {
+    protected override bool on_shift_pressed() {
         // show quick compare of original only if no tool is in use, the original pixbuf is handy
         if (current_tool == null && !get_ctrl_pressed() && !get_alt_pressed() && has_photo())
             swap_in_original();
         
-        return base.on_shift_pressed(event);
+        return base.on_shift_pressed();
     }
     
-    protected override bool on_shift_released(Gdk.EventKey? event) {
+    protected override bool on_shift_released() {
         if (current_tool == null)
             swap_out_original();
         
-        return base.on_shift_released(event);
+        return base.on_shift_released();
     }
 
-    protected override bool on_alt_pressed(Gdk.EventKey? event) {
+    protected override bool on_alt_pressed() {
         if (current_tool == null)
             swap_out_original();
         
-        return base.on_alt_pressed(event);
+        return base.on_alt_pressed();
     }
     
-    protected override bool on_alt_released(Gdk.EventKey? event) {
+    protected override bool on_alt_released() {
         if (current_tool == null && get_shift_pressed() && !get_ctrl_pressed())
             swap_in_original();
         
-        return base.on_alt_released(event);
+        return base.on_alt_released();
     }
-    #endif
 
     private void swap_in_original() {
         Gdk.Pixbuf original;
@@ -1699,13 +1701,11 @@ public abstract class EditingHostPage : SinglePhotoPage {
         base.on_leave_notify_event(event);
     }
     
-    #if 0
-
-    private bool on_keyboard_pan_event(Gdk.EventKey event) {
+    private bool on_keyboard_pan_event(uint keyval) {
         ZoomState current_zoom_state = get_zoom_state();
         Gdk.Point viewport_center = current_zoom_state.get_viewport_center();
 
-        switch (Gdk.keyval_name(event.keyval)) {
+        switch (Gdk.keyval_name(keyval)) {
             case "Left":
             case "KP_Left":
             case "KP_4":
@@ -1741,28 +1741,32 @@ public abstract class EditingHostPage : SinglePhotoPage {
         return true;
     }
     
-    public override bool key_press_event(Gdk.EventKey event) {
+    public override bool key_press_event(Gtk.EventControllerKey event, uint keyval, uint keycode, 
Gdk.ModifierType modifiers) {
         // editing tool gets first crack at the keypress
         if (current_tool != null) {
-            if (current_tool.on_keypress(event))
+            if (current_tool.on_keypress(event, keyval, keycode, modifiers))
                 return true;
         }
         
         // if panning is possible, the pan handler (on MUNI?) gets second crack at the keypress
         if (is_panning_possible()) {
-            if (on_keyboard_pan_event(event))
+            if (on_keyboard_pan_event(keyval))
                 return true;
         }
 
+        #if 0
         // if the user pressed the "0", "1" or "2" keys then handle the event as if were
         // directed at the zoom slider ("0", "1" and "2" are hotkeys that jump to preset
         // zoom levels
         if (on_zoom_slider_key_press(event))
             return true;
+
+        #endif
         
         bool handled = true;
+        string? format = null;
         
-        switch (Gdk.keyval_name(event.keyval)) {
+        switch (Gdk.keyval_name(keyval)) {
             // this block is only here to prevent base from moving focus to toolbar
             case "Down":
             case "KP_Down":
@@ -1772,14 +1776,14 @@ public abstract class EditingHostPage : SinglePhotoPage {
             case "equal":
             case "plus":
             case "KP_Add":
-                activate_action("IncreaseSize");
+                activate_action("IncreaseSize", format);
             break;
             
             // underscore is the keysym generated by SHIFT-[minus sign] -- this means zoom out
             case "minus":
             case "underscore":
             case "KP_Subtract":
-                activate_action("DecreaseSize");
+                activate_action("DecreaseSize", format);
             break;
             
             default:
@@ -1787,12 +1791,8 @@ public abstract class EditingHostPage : SinglePhotoPage {
             break;
         }
         
-        if (handled)
-            return true;
-
-        return (base.key_press_event != null) ? base.key_press_event(event) : true;
+        return base.key_press_event(event, keyval, keycode, modifiers);
     }
-    #endif
     
     protected override void new_surface(Cairo.Context default_ctx, Dimensions dim) {
         // if tool is open, update its canvas object
@@ -1894,7 +1894,7 @@ public abstract class EditingHostPage : SinglePhotoPage {
     private void rotate(Rotation rotation, string name, string description) {
         cancel_zoom();
 
-        //deactivate_tool();
+        deactivate_tool();
         
         if (!has_photo())
             return;
@@ -2381,6 +2381,10 @@ public class LibraryPhotoPage : EditingHostPage {
         LibraryPhoto.global.item_destroyed.disconnect(on_photo_destroyed);
         LibraryPhoto.global.items_altered.disconnect(on_metadata_altered);
         Config.Facade.get_instance().external_app_changed.disconnect(on_external_app_changed);
+
+        var key = new Gtk.EventControllerKey();
+        key.key_pressed.connect(key_press_event);
+        add_controller(key);
     }
     
     public bool not_trashed_view_filter(DataView view) {
@@ -2540,9 +2544,9 @@ public class LibraryPhotoPage : EditingHostPage {
         set_action_sensitive("FlipVertically", rotate_possible);
 
         if (has_photo()) {
-//            set_action_sensitive("Crop", EditingTools.CropTool.is_available(get_photo(), 
Scaling.for_original()));
-//            set_action_sensitive("RedEye", EditingTools.RedeyeTool.is_available(get_photo(), 
-//                Scaling.for_original()));
+            set_action_sensitive("Crop", EditingTools.CropTool.is_available(get_photo(), 
Scaling.for_original()));
+            set_action_sensitive("RedEye", EditingTools.RedeyeTool.is_available(get_photo(), 
+                Scaling.for_original()));
         }
                  
         update_flag_action();
@@ -2762,13 +2766,15 @@ public class LibraryPhotoPage : EditingHostPage {
         base.notify_photo_backing_missing(photo, missing);
     }
     
-    #if 0
-    public override bool key_press_event(Gdk.EventKey event) {
+    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)
             return true;
+        #endif
         
         bool handled = true;
-        switch (Gdk.keyval_name(event.keyval)) {
+        string? format = null;
+        switch (Gdk.keyval_name(keyval)) {
             case "Escape":
             case "Return":
             case "KP_Enter":
@@ -2780,57 +2786,57 @@ public class LibraryPhotoPage : EditingHostPage {
                 // although bound as an accelerator in the menu, accelerators are currently
                 // unavailable in fullscreen mode (a variant of #324), so we do this manually
                 // here
-                activate_action("MoveToTrash");
+                activate_action("MoveToTrash", format);
             break;
 
             case "period":
             case "greater":
-                activate_action("IncreaseRating");
+                activate_action("IncreaseRating", format);
             break;
             
             case "comma":
             case "less":
-                activate_action("DecreaseRating");
+                activate_action("DecreaseRating", format);
             break;
 
             case "KP_1":
-                activate_action("RateOne");
+                activate_action("RateOne", format);
             break;
             
             case "KP_2":
-                activate_action("RateTwo");
+                activate_action("RateTwo", format);
             break;
 
             case "KP_3":
-                activate_action("RateThree");
+                activate_action("RateThree", format);
             break;
         
             case "KP_4":
-                activate_action("RateFour");
+                activate_action("RateFour", format);
             break;
 
             case "KP_5":
-                activate_action("RateFive");
+                activate_action("RateFive", format);
             break;
 
             case "KP_0":
-                activate_action("RateUnrated");
+                activate_action("RateUnrated", format);
             break;
 
             case "KP_9":
-                activate_action("RateRejected");
+                activate_action("RateRejected", format);
             break;
             
             case "bracketright":
-                activate_action("RotateClockwise");
+                activate_action("RotateClockwise", format);
             break;
             
             case "bracketleft":
-                activate_action("RotateCounterclockwise");
+                activate_action("RotateCounterclockwise", format);
             break;
             
             case "slash":
-                activate_action("Flag");
+                activate_action("Flag", format);
             break;
             
             default:
@@ -2840,7 +2846,8 @@ public class LibraryPhotoPage : EditingHostPage {
         
         return handled;
     }
-    
+
+    #if 0
     protected override bool on_double_click(Gdk.EventButton event) {
         FullscreenWindow? fs = get_container() as FullscreenWindow;
         if (fs == null)
diff --git a/src/SinglePhotoPage.vala b/src/SinglePhotoPage.vala
index 798879bc..7714e32b 100644
--- a/src/SinglePhotoPage.vala
+++ b/src/SinglePhotoPage.vala
@@ -60,6 +60,10 @@ public abstract class SinglePhotoPage : Page {
         canvas.set_name ("SinglePhoto drawing");
         set_event_source(canvas);
         Config.Facade.get_instance().colors_changed.connect(on_colors_changed);
+
+        var key = new Gtk.EventControllerKey();
+        key.key_pressed.connect(key_press_event);
+        add_controller(key);
     }
 
     ~SinglePhotoPage() {
@@ -473,21 +477,20 @@ public abstract class SinglePhotoPage : Page {
 
     protected virtual void on_next_photo() {}
 
-#if 0
-    public override bool key_press_event(Gdk.EventKey event) {
+    public virtual bool key_press_event(Gtk.EventControllerKey event, uint keyval, uint keycode, 
Gdk.ModifierType modifiers) {
         // if the user holds the arrow keys down, we will receive a steady stream of key press
         // events for an operation that isn't designed for a rapid succession of output ...
         // we staunch the supply of new photos to under a quarter second (#533)
-        bool nav_ok = (event.time - last_nav_key) > KEY_REPEAT_INTERVAL_MSEC;
+        bool nav_ok = (event.get_current_event_time() - last_nav_key) > KEY_REPEAT_INTERVAL_MSEC;
 
         bool handled = true;
-        switch (Gdk.keyval_name(event.keyval)) {
+        switch (Gdk.keyval_name(keyval)) {
             case "Left":
             case "KP_Left":
             case "BackSpace":
                 if (nav_ok) {
                     on_previous_photo();
-                    last_nav_key = event.time;
+                    last_nav_key = event.get_current_event_time();
                 }
             break;
 
@@ -496,7 +499,7 @@ public abstract class SinglePhotoPage : Page {
             case "space":
                 if (nav_ok) {
                     on_next_photo();
-                    last_nav_key = event.time;
+                    last_nav_key = event.get_current_event_time();
                 }
             break;
 
@@ -505,14 +508,9 @@ public abstract class SinglePhotoPage : Page {
             break;
         }
 
-        if (handled)
-            return true;
-
-        return (base.key_press_event != null) ? base.key_press_event(event) : true;
+        return handled;
     }
 
-    #endif
-
     private void on_colors_changed() {
         invalidate_transparent_background();
         repaint();
diff --git a/src/SlideshowPage.vala b/src/SlideshowPage.vala
index 8a6d1e9d..ab68b918 100644
--- a/src/SlideshowPage.vala
+++ b/src/SlideshowPage.vala
@@ -336,10 +336,9 @@ class SlideshowPage : SinglePhotoPage {
         return true;
     }
     
-    #if 0
-    public override bool key_press_event(Gdk.EventKey event) {
+    public bool key_press_event(Gtk.EventControllerKey event, uint keyval, uint keycode, Gdk.ModifierType 
modifiers) {
         bool handled = true;
-        switch (Gdk.keyval_name(event.keyval)) {
+        switch (Gdk.keyval_name(keyval)) {
             // Block activating the toolbar on key down
             // FIXME: Why is SinglePhotoPage not a PhotoPage which already does this?
             case "Down":
@@ -355,12 +354,8 @@ class SlideshowPage : SinglePhotoPage {
             break;
         }
         
-        if (handled)
-            return true;
-        
-        return (base.key_press_event != null) ? base.key_press_event(event) : true;
+        return handled;
     }
-    #endif
 
     private void on_change_settings() {
         SettingsDialog settings_dialog = new SettingsDialog();
diff --git a/src/direct/DirectWindow.vala b/src/direct/DirectWindow.vala
index 95d93cd8..2cf575e7 100644
--- a/src/direct/DirectWindow.vala
+++ b/src/direct/DirectWindow.vala
@@ -29,6 +29,10 @@ public class DirectWindow : AppWindow {
         Application.set_menubar (direct_photo_page.get_menubar ());
 
         set_child(layout);
+
+        var key = new Gtk.EventControllerKey();
+        key.key_pressed.connect(key_press_event);
+        ((Gtk.Widget)this).add_controller(key);
     }
     
     public static DirectWindow get_app() {
@@ -81,18 +85,15 @@ public class DirectWindow : AppWindow {
         return false;
     }
 
-#if 0
-    public override bool key_press_event(Gdk.EventKey event) {
+    public override bool key_press_event(Gtk.EventControllerKey event, uint keyval, uint keycode, 
Gdk.ModifierType modifiers) {
         // check for an escape
-        if (Gdk.keyval_name(event.keyval) == "Escape") {
+        if (Gdk.keyval_name(keyval) == "Escape") {
             on_quit();
             
             return true;
         }
-        
-       // ...then let the base class take over
-       return (base.key_press_event != null) ? base.key_press_event(event) : false;
+
+        return base.key_press_event(event, keyval, keycode, modifiers);
     }
-    #endif
 }
 
diff --git a/src/editing_tools/EditingToolWindow.vala b/src/editing_tools/EditingToolWindow.vala
index 268d3be0..a2c35001 100644
--- a/src/editing_tools/EditingToolWindow.vala
+++ b/src/editing_tools/EditingToolWindow.vala
@@ -17,6 +17,10 @@ public abstract class EditingTools.EditingToolWindow : Gtk.Window {
         focusable = true;
         set_can_focus(true);
         ((Gtk.Widget) this).set_opacity(Resources.TRANSIENT_WINDOW_OPACITY);
+
+        var key = new Gtk.EventControllerKey();
+        key.key_pressed.connect(key_press_event);
+        ((Gtk.Widget)this).add_controller(key);
     }
 
     ~EditingToolWindow() {
@@ -30,14 +34,11 @@ public abstract class EditingTools.EditingToolWindow : Gtk.Window {
         return user_moved;
     }
 
-    #if 0
-    public override bool key_press_event(Gdk.EventKey event) {
-        if (base.key_press_event(event)) {
-            return true;
-        }
-        return AppWindow.get_instance().key_press_event(event);
+    public bool key_press_event(Gtk.EventControllerKey event, uint keyval, uint keycode, Gdk.ModifierType 
modifiers) {
+        return event.forward(AppWindow.get_instance());
     }
-
+    
+    #if 0
     public override bool button_press_event(Gdk.EventButton event) {
         // LMB only
         if (event.button != 1)
diff --git a/src/library/LibraryWindow.vala b/src/library/LibraryWindow.vala
index a5896704..62d3216c 100644
--- a/src/library/LibraryWindow.vala
+++ b/src/library/LibraryWindow.vala
@@ -1361,23 +1361,21 @@ public class LibraryWindow : AppWindow {
         }
     }
     
-    #if 0
-    public override bool key_press_event(Gdk.EventKey event) {
-        if (sidebar_tree.has_focus && sidebar_tree.is_keypress_interpreted(event)
-            && sidebar_tree.key_press_event(event)) {
+    public override bool key_press_event(Gtk.EventControllerKey event, uint keyval, uint keycode, 
Gdk.ModifierType modifiers) {
+        if (sidebar_tree.has_focus && sidebar_tree.is_keypress_interpreted(event, keyval, keycode, modifiers)
+            && event.forward(sidebar_tree)) {
             return true;
         }
         
-        if (base.key_press_event(event))
+        if (base.key_press_event(event, keyval, keycode, modifiers))
             return true;
-        
-        if (Gdk.keyval_name(event.keyval) == "Escape") {
+
+        if (Gdk.keyval_name(keyval) == "Escape") {
             on_clear_search();
             return true;
         }
         
         return false;
     }
-    #endif
 }
 
diff --git a/src/sidebar/Tree.vala b/src/sidebar/Tree.vala
index f4e2418a..d9550cb4 100644
--- a/src/sidebar/Tree.vala
+++ b/src/sidebar/Tree.vala
@@ -144,13 +144,16 @@ public class Sidebar.Tree : Gtk.TreeView {
         #endif
 
         var click = new Gtk.GestureClick();
-        click.set_name ("CheckerboardPage click source");
+        click.set_name ("Sidebar Tree click source");
         click.set_button (0); // Listen to all buttons
         //click.set_exclusive (true); // TODO: Need to be true or false?
         click.pressed.connect (on_click_pressed);
         add_controller(click);
 
-        
+        var key = new Gtk.EventControllerKey();
+        key.key_pressed.connect(key_press_event);
+        add_controller(key);
+
         //popup_menu.connect(on_context_menu_keypress);
         
         setup_default_context_menu();
@@ -969,9 +972,8 @@ public class Sidebar.Tree : Gtk.TreeView {
         old_path_ref = new Gtk.TreeRowReference(store, path);
     }
     
-    #if 0
-    public bool is_keypress_interpreted(Gdk.EventKey event) {
-        switch (Gdk.keyval_name(event.keyval)) {
+    public bool is_keypress_interpreted(Gtk.EventControllerKey event, uint keyval, uint keycode, 
Gdk.ModifierType modifiers) {
+        switch (Gdk.keyval_name(keyval)) {
             case "F2":
             case "Delete":
             case "Return":
@@ -982,9 +984,9 @@ public class Sidebar.Tree : Gtk.TreeView {
                 return false;
         }
     }
-    
-    public override bool key_press_event(Gdk.EventKey event) {
-        switch (Gdk.keyval_name(event.keyval)) {
+
+    public bool key_press_event(Gtk.EventControllerKey event, uint keyval, uint keycode, Gdk.ModifierType 
modifiers) {
+        switch (Gdk.keyval_name(keyval)) {
             case "Return":
             case "KP_Enter":
                 Gtk.TreePath? path = get_current_path();
@@ -1002,9 +1004,8 @@ public class Sidebar.Tree : Gtk.TreeView {
                 return (path != null) ? destroy_path(path) : false;
         }
         
-        return base.key_press_event(event);
+        return false;
     }
-    #endif
     
     public bool rename_entry_in_place(Sidebar.Entry entry) {
         if (!expand_to_entry(entry))


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