aboutsummaryrefslogtreecommitdiffstats
path: root/sway/focus.c
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2015-08-18 07:19:20 -0400
committerLibravatar Drew DeVault <sir@cmpwn.com>2015-08-18 07:20:34 -0400
commit2139001c9f61a84ed1ac581a54bb2bde68928afd (patch)
treea6efb486fdb71675775253d79e9550b5fc1d2f67 /sway/focus.c
parentfixed floating window crashing bug (diff)
downloadsway-2139001c9f61a84ed1ac581a54bb2bde68928afd.tar.gz
sway-2139001c9f61a84ed1ac581a54bb2bde68928afd.tar.zst
sway-2139001c9f61a84ed1ac581a54bb2bde68928afd.zip
Coding style enforcement
This was done by hand, so I might have missed things. If anyone knows of a good C style enforcement tool, let me know.
Diffstat (limited to 'sway/focus.c')
-rw-r--r--sway/focus.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/sway/focus.c b/sway/focus.c
index 14d27184..99cb2570 100644
--- a/sway/focus.c
+++ b/sway/focus.c
@@ -7,10 +7,10 @@
7bool locked_container_focus = false; 7bool locked_container_focus = false;
8bool locked_view_focus = false; 8bool locked_view_focus = false;
9 9
10//switches parent focus to c. will switch it accordingly 10// switches parent focus to c. will switch it accordingly
11//TODO, everything needs a handle, so we can set front/back position properly 11// TODO: Everything needs a handle, so we can set front/back position properly
12static void update_focus(swayc_t *c) { 12static void update_focus(swayc_t *c) {
13 //Handle if focus switches 13 // Handle if focus switches
14 swayc_t *parent = c->parent; 14 swayc_t *parent = c->parent;
15 if (parent->focused != c) { 15 if (parent->focused != c) {
16 switch (c->type) { 16 switch (c->type) {
@@ -18,14 +18,14 @@ static void update_focus(swayc_t *c) {
18 case C_OUTPUT: 18 case C_OUTPUT:
19 wlc_output_focus(c->parent->handle); 19 wlc_output_focus(c->parent->handle);
20 break; 20 break;
21 //switching workspaces 21 // switching workspaces
22 case C_WORKSPACE: 22 case C_WORKSPACE:
23 if (parent->focused) { 23 if (parent->focused) {
24 swayc_t *ws = parent->focused; 24 swayc_t *ws = parent->focused;
25 //hide visibility of old workspace 25 // hide visibility of old workspace
26 uint32_t mask = 1; 26 uint32_t mask = 1;
27 container_map(ws, set_view_visibility, &mask); 27 container_map(ws, set_view_visibility, &mask);
28 //set visibility of new workspace 28 // set visibility of new workspace
29 mask = 2; 29 mask = 2;
30 container_map(c, set_view_visibility, &mask); 30 container_map(c, set_view_visibility, &mask);
31 wlc_output_set_mask(parent->handle, 2); 31 wlc_output_set_mask(parent->handle, 2);
@@ -36,8 +36,8 @@ static void update_focus(swayc_t *c) {
36 default: 36 default:
37 case C_VIEW: 37 case C_VIEW:
38 case C_CONTAINER: 38 case C_CONTAINER:
39 //TODO whatever to do when container changes 39 // TODO whatever to do when container changes
40 //for example, stacked and tabbing change stuff. 40 // for example, stacked and tabbing change stuff.
41 break; 41 break;
42 } 42 }
43 } 43 }
@@ -115,7 +115,7 @@ swayc_t *get_focused_container(swayc_t *parent) {
115 while (parent && !parent->is_focused) { 115 while (parent && !parent->is_focused) {
116 parent = parent->focused; 116 parent = parent->focused;
117 } 117 }
118 //just incase 118 // just incase
119 if (parent == NULL) { 119 if (parent == NULL) {
120 sway_log(L_DEBUG, "get_focused_container unable to find container"); 120 sway_log(L_DEBUG, "get_focused_container unable to find container");
121 return active_workspace; 121 return active_workspace;
@@ -140,7 +140,7 @@ void set_focused_container(swayc_t *c) {
140 } 140 }
141 if (!locked_view_focus) { 141 if (!locked_view_focus) {
142 p = get_focused_view(c); 142 p = get_focused_view(c);
143 //Set focus to p 143 // Set focus to p
144 if (p && !(wlc_view_get_type(p->handle) & WLC_BIT_POPUP)) { 144 if (p && !(wlc_view_get_type(p->handle) & WLC_BIT_POPUP)) {
145 if (prev_view) { 145 if (prev_view) {
146 wlc_view_set_state(prev_view->handle, WLC_BIT_ACTIVATED, false); 146 wlc_view_set_state(prev_view->handle, WLC_BIT_ACTIVATED, false);
@@ -175,7 +175,7 @@ void set_focused_container_for(swayc_t *a, swayc_t *c) {
175 } 175 }
176 if (!locked_view_focus) { 176 if (!locked_view_focus) {
177 p = get_focused_view(c); 177 p = get_focused_view(c);
178 //Set focus to p 178 // Set focus to p
179 if (p) { 179 if (p) {
180 wlc_view_focus(p->handle); 180 wlc_view_focus(p->handle);
181 wlc_view_set_state(p->handle, WLC_BIT_ACTIVATED, true); 181 wlc_view_set_state(p->handle, WLC_BIT_ACTIVATED, true);
@@ -189,4 +189,3 @@ swayc_t *get_focused_view(swayc_t *parent) {
189 } 189 }
190 return parent; 190 return parent;
191} 191}
192