aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/view.c
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2018-07-16 15:39:08 -0700
committerLibravatar GitHub <noreply@github.com>2018-07-16 15:39:08 -0700
commitd6bd314dffb7385eec73de40f0fdd5775cd5941b (patch)
tree1cec389e971cda3e42766c07789d0f51c2d39715 /sway/tree/view.c
parentMerge pull request #2265 from RedSoxFan/implement-1962 (diff)
parentswaybar: Read urgent colors from IPC (diff)
downloadsway-d6bd314dffb7385eec73de40f0fdd5775cd5941b.tar.gz
sway-d6bd314dffb7385eec73de40f0fdd5775cd5941b.tar.zst
sway-d6bd314dffb7385eec73de40f0fdd5775cd5941b.zip
Merge pull request #2276 from RyanDwyer/urgency
Implement urgency base functionality
Diffstat (limited to 'sway/tree/view.c')
-rw-r--r--sway/tree/view.c41
1 files changed, 39 insertions, 2 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c
index 10c97518..76e0f42c 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -25,6 +25,7 @@ void view_init(struct sway_view *view, enum sway_view_type type,
25 view->impl = impl; 25 view->impl = impl;
26 view->executed_criteria = create_list(); 26 view->executed_criteria = create_list();
27 view->marks = create_list(); 27 view->marks = create_list();
28 view->allow_request_urgent = true;
28 wl_signal_init(&view->events.unmap); 29 wl_signal_init(&view->events.unmap);
29} 30}
30 31
@@ -609,16 +610,26 @@ void view_unmap(struct sway_view *view) {
609 wl_list_remove(&view->surface_new_subsurface.link); 610 wl_list_remove(&view->surface_new_subsurface.link);
610 wl_list_remove(&view->container_reparent.link); 611 wl_list_remove(&view->container_reparent.link);
611 612
613 if (view->urgent_timer) {
614 wl_event_source_remove(view->urgent_timer);
615 view->urgent_timer = NULL;
616 }
617
618 struct sway_container *parent;
619 struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE);
620
612 if (view->is_fullscreen) { 621 if (view->is_fullscreen) {
613 struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE);
614 ws->sway_workspace->fullscreen = NULL; 622 ws->sway_workspace->fullscreen = NULL;
615 container_destroy(view->swayc); 623 parent = container_destroy(view->swayc);
616 624
617 arrange_windows(ws->parent); 625 arrange_windows(ws->parent);
618 } else { 626 } else {
619 struct sway_container *parent = container_destroy(view->swayc); 627 struct sway_container *parent = container_destroy(view->swayc);
620 arrange_windows(parent); 628 arrange_windows(parent);
621 } 629 }
630 if (parent->type >= C_WORKSPACE) { // if the workspace still exists
631 workspace_detect_urgent(ws);
632 }
622 transaction_commit_dirty(); 633 transaction_commit_dirty();
623 view->surface = NULL; 634 view->surface = NULL;
624} 635}
@@ -1067,3 +1078,29 @@ bool view_is_visible(struct sway_view *view) {
1067 } 1078 }
1068 return true; 1079 return true;
1069} 1080}
1081
1082void view_set_urgent(struct sway_view *view, bool enable) {
1083 if (enable) {
1084 struct sway_seat *seat = input_manager_current_seat(input_manager);
1085 if (seat_get_focus(seat) == view->swayc) {
1086 return;
1087 }
1088 clock_gettime(CLOCK_MONOTONIC, &view->urgent);
1089 } else {
1090 view->urgent = (struct timespec){ 0 };
1091 if (view->urgent_timer) {
1092 wl_event_source_remove(view->urgent_timer);
1093 view->urgent_timer = NULL;
1094 }
1095 }
1096 container_damage_whole(view->swayc);
1097
1098 ipc_event_window(view->swayc, "urgent");
1099
1100 struct sway_container *ws = container_parent(view->swayc, C_WORKSPACE);
1101 workspace_detect_urgent(ws);
1102}
1103
1104bool view_is_urgent(struct sway_view *view) {
1105 return view->urgent.tv_sec || view->urgent.tv_nsec;
1106}