Commit 5b791861a1d4f5560401207f9dd44edd598f99b9 Parent: d592e880797c7010d79ff2f15323576fe021b2de Author: mcol <mcol@posteo.net> Date: 2021-01-30 18:25:28 +0000 Committer: mcol <mcol@posteo.net> Committed: 2021-01-30 18:25:28 +0000 Fix send_to_desk crash and add action to example config
wimp.conf Modified
@@ -59,6 +59,8 @@ bind h focus left bind l focus right bind f toggle_fullscreen +bind Shift 1 send_to_desk 1 +bind Shift 2 send_to_desk 2 # These give the focussed window half of the screen bind Shift j halfimize down
src/desk.c Modified
@@ -70,15 +70,20 @@ void view_to_desk(struct view *view, int index) { struct desk *desk; + wimp.can_steal_focus = false; + wl_list_for_each(desk, &wimp.desks, link) { if (desk->index == index) { wl_list_remove(&view->link); - if (desk == wimp.current_desk) { - map_view(view); - } else { - unmap_view(view); - } + desk == wimp.current_desk ? map_view(view) : unmap_view(view); wl_list_insert(&desk->views, &view->link); + break; } } + + wimp.can_steal_focus = true; + if (!wl_list_empty(&wimp.current_desk->views)) { + struct view *next_view = wl_container_of(wimp.current_desk->views.next, view, link); + focus_view(next_view, next_view->surface->surface); + } }
src/action.c Modified
@@ -350,6 +350,6 @@ void send_to_desk(void *data) { struct view *view = wl_container_of(wimp.current_desk->views.next, view, link); - int index = *(int*)data; + int index = *(double*)data - 1; view_to_desk(view, index); }