aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/seat.c
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-07-15 22:43:33 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-07-16 08:19:25 +1000
commit315d5311b2004b9e148e7b52a7de161b6dfe3878 (patch)
tree1a70d1d73cbffb26bf432c1c7b395ee996651ad3 /sway/input/seat.c
parentMerge pull request #2280 from ianyfan/leaks (diff)
downloadsway-315d5311b2004b9e148e7b52a7de161b6dfe3878.tar.gz
sway-315d5311b2004b9e148e7b52a7de161b6dfe3878.tar.zst
sway-315d5311b2004b9e148e7b52a7de161b6dfe3878.zip
Implement urgency base functionality
Introduces a command to manually set urgency, as well as rendering of urgent views, sending the IPC event, removing urgency after focused for one second, and matching urgent views via criteria.
Diffstat (limited to 'sway/input/seat.c')
-rw-r--r--sway/input/seat.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/sway/input/seat.c b/sway/input/seat.c
index 74f1375e..7058cc92 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -594,6 +594,12 @@ static void seat_send_unfocus(struct sway_container *container,
594 } 594 }
595} 595}
596 596
597static int handle_urgent_timeout(void *data) {
598 struct sway_view *view = data;
599 view_set_urgent(view, false);
600 return 0;
601}
602
597void seat_set_focus_warp(struct sway_seat *seat, 603void seat_set_focus_warp(struct sway_seat *seat,
598 struct sway_container *container, bool warp) { 604 struct sway_container *container, bool warp) {
599 if (seat->focused_layer) { 605 if (seat->focused_layer) {
@@ -670,6 +676,16 @@ void seat_set_focus_warp(struct sway_seat *seat,
670 } 676 }
671 } 677 }
672 678
679 // If urgent, start a timer to unset it
680 if (container && container->type == C_VIEW &&
681 view_is_urgent(container->sway_view) &&
682 !container->sway_view->urgent_timer) {
683 struct sway_view *view = container->sway_view;
684 view->urgent_timer = wl_event_loop_add_timer(server.wl_event_loop,
685 handle_urgent_timeout, view);
686 wl_event_source_timer_update(view->urgent_timer, 1000);
687 }
688
673 // If we've focused a floating container, bring it to the front. 689 // If we've focused a floating container, bring it to the front.
674 // We do this by putting it at the end of the floating list. 690 // We do this by putting it at the end of the floating list.
675 // This must happen for both the pending and current children lists. 691 // This must happen for both the pending and current children lists.