Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions src/Views/GridView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,19 @@ public class Slingshot.Widgets.Grid : Gtk.Box {

var focus_controller = new Gtk.EventControllerFocus ();
focus_controller.enter.connect (refocus);
focus_controller.leave.connect (() => {
_focused_column = 1;
_focused_row = 1;
});
add_controller (focus_controller);

var key_controller = new Gtk.EventControllerKey ();
key_controller.key_pressed.connect (on_key_press);
paginator.page_changed.connect (() => {
if (paginator.get_position () == 0 && _focused_column == 1) {
return;
}

add_controller (focus_controller);
add_controller (key_controller);
refocus ();
});
}

public void populate (Backend.AppSystem app_system) {
Expand Down Expand Up @@ -111,6 +118,9 @@ public class Slingshot.Widgets.Grid : Gtk.Box {
unowned var app = apps.nth_data (app_idx);

var app_button = new Widgets.AppButton (app);
var key_controller = new Gtk.EventControllerKey ();
key_controller.key_pressed.connect (on_key_press);
app_button.add_controller (key_controller);
app_button.app_launched.connect (() => ((Gtk.Popover) get_ancestor (typeof (Gtk.Popover))).popdown ());

widget_to_attach = app_button;
Expand Down Expand Up @@ -242,6 +252,5 @@ public class Slingshot.Widgets.Grid : Gtk.Box {
}

paginator.scroll_to (grid, true);
refocus ();
}
}
Loading