diff options
-rw-r--r-- | include/container.h | 4 | ||||
-rw-r--r-- | sway/commands.c | 20 | ||||
-rw-r--r-- | sway/container.c | 4 | ||||
-rw-r--r-- | sway/focus.c | 4 | ||||
-rw-r--r-- | sway/handlers.c | 14 | ||||
-rw-r--r-- | sway/input_state.c | 2 | ||||
-rw-r--r-- | sway/layout.c | 12 | ||||
-rw-r--r-- | sway/log.c | 8 | ||||
-rw-r--r-- | sway/workspace.c | 2 |
9 files changed, 35 insertions, 35 deletions
diff --git a/include/container.h b/include/container.h index 4f1877e3..bd92058d 100644 --- a/include/container.h +++ b/include/container.h | |||
@@ -11,7 +11,7 @@ enum swayc_types{ | |||
11 | C_WORKSPACE, | 11 | C_WORKSPACE, |
12 | C_CONTAINER, | 12 | C_CONTAINER, |
13 | C_VIEW, | 13 | C_VIEW, |
14 | //Keep last | 14 | // Keep last |
15 | C_TYPES, | 15 | C_TYPES, |
16 | }; | 16 | }; |
17 | 17 | ||
@@ -22,7 +22,7 @@ enum swayc_layouts{ | |||
22 | L_STACKED, | 22 | L_STACKED, |
23 | L_TABBED, | 23 | L_TABBED, |
24 | L_FLOATING, | 24 | L_FLOATING, |
25 | //Keep last | 25 | // Keep last |
26 | L_LAYOUTS, | 26 | L_LAYOUTS, |
27 | }; | 27 | }; |
28 | 28 | ||
diff --git a/sway/commands.c b/sway/commands.c index babefd02..a3f74747 100644 --- a/sway/commands.c +++ b/sway/commands.c | |||
@@ -81,7 +81,7 @@ static int bindsym_sort(const void *_lbind, const void *_rbind) { | |||
81 | const struct sway_binding *rbind = *(void **)_rbind; | 81 | const struct sway_binding *rbind = *(void **)_rbind; |
82 | unsigned int lmod = 0, rmod = 0, i; | 82 | unsigned int lmod = 0, rmod = 0, i; |
83 | 83 | ||
84 | //Count how any modifiers are pressed | 84 | // Count how any modifiers are pressed |
85 | for (i = 0; i < 8 * sizeof(lbind->modifiers); ++i) { | 85 | for (i = 0; i < 8 * sizeof(lbind->modifiers); ++i) { |
86 | lmod += lbind->modifiers & 1 << i; | 86 | lmod += lbind->modifiers & 1 << i; |
87 | rmod += rbind->modifiers & 1 << i; | 87 | rmod += rbind->modifiers & 1 << i; |
@@ -203,10 +203,10 @@ static bool cmd_floating(struct sway_config *config, int argc, char **argv) { | |||
203 | } | 203 | } |
204 | // Change from nonfloating to floating | 204 | // Change from nonfloating to floating |
205 | if (!view->is_floating) { | 205 | if (!view->is_floating) { |
206 | //Remove view from its current location | 206 | // Remove view from its current location |
207 | destroy_container(remove_child(view)); | 207 | destroy_container(remove_child(view)); |
208 | 208 | ||
209 | //and move it into workspace floating | 209 | // and move it into workspace floating |
210 | add_floating(active_workspace,view); | 210 | add_floating(active_workspace,view); |
211 | view->x = (active_workspace->width - view->width)/2; | 211 | view->x = (active_workspace->width - view->width)/2; |
212 | view->y = (active_workspace->height - view->height)/2; | 212 | view->y = (active_workspace->height - view->height)/2; |
@@ -233,11 +233,11 @@ static bool cmd_floating(struct sway_config *config, int argc, char **argv) { | |||
233 | 233 | ||
234 | sway_log(L_DEBUG, "Non-floating focused container is %p", focused); | 234 | sway_log(L_DEBUG, "Non-floating focused container is %p", focused); |
235 | 235 | ||
236 | //Case of focused workspace, just create as child of it | 236 | // Case of focused workspace, just create as child of it |
237 | if (focused->type == C_WORKSPACE) { | 237 | if (focused->type == C_WORKSPACE) { |
238 | add_child(focused, view); | 238 | add_child(focused, view); |
239 | } | 239 | } |
240 | //Regular case, create as sibling of current container | 240 | // Regular case, create as sibling of current container |
241 | else { | 241 | else { |
242 | add_sibling(focused, view); | 242 | add_sibling(focused, view); |
243 | } | 243 | } |
@@ -258,7 +258,7 @@ static bool cmd_floating_mod(struct sway_config *config, int argc, char **argv) | |||
258 | list_t *split = split_string(argv[0], "+"); | 258 | list_t *split = split_string(argv[0], "+"); |
259 | config->floating_mod = 0; | 259 | config->floating_mod = 0; |
260 | 260 | ||
261 | //set modifer keys | 261 | // set modifer keys |
262 | for (i = 0; i < split->length; ++i) { | 262 | for (i = 0; i < split->length; ++i) { |
263 | for (j = 0; j < sizeof(modifiers) / sizeof(struct modifier_key); ++j) { | 263 | for (j = 0; j < sizeof(modifiers) / sizeof(struct modifier_key); ++j) { |
264 | if (strcasecmp(modifiers[j].name, split->items[i]) == 0) { | 264 | if (strcasecmp(modifiers[j].name, split->items[i]) == 0) { |
@@ -508,14 +508,14 @@ static bool cmd_fullscreen(struct sway_config *config, int argc, char **argv) { | |||
508 | swayc_t *container = get_focused_view(&root_container); | 508 | swayc_t *container = get_focused_view(&root_container); |
509 | bool current = (wlc_view_get_state(container->handle) & WLC_BIT_FULLSCREEN) > 0; | 509 | bool current = (wlc_view_get_state(container->handle) & WLC_BIT_FULLSCREEN) > 0; |
510 | wlc_view_set_state(container->handle, WLC_BIT_FULLSCREEN, !current); | 510 | wlc_view_set_state(container->handle, WLC_BIT_FULLSCREEN, !current); |
511 | //Resize workspace if going from fullscreen -> notfullscreen | 511 | // Resize workspace if going from fullscreen -> notfullscreen |
512 | //otherwise just resize container | 512 | // otherwise just resize container |
513 | if (current) { | 513 | if (current) { |
514 | while (container->type != C_WORKSPACE) { | 514 | while (container->type != C_WORKSPACE) { |
515 | container = container->parent; | 515 | container = container->parent; |
516 | } | 516 | } |
517 | } | 517 | } |
518 | //Only resize container when going into fullscreen | 518 | // Only resize container when going into fullscreen |
519 | arrange_windows(container, -1, -1); | 519 | arrange_windows(container, -1, -1); |
520 | 520 | ||
521 | return true; | 521 | return true; |
@@ -679,7 +679,7 @@ bool handle_command(struct sway_config *config, char *exec) { | |||
679 | char **argv = split_directive(exec + strlen(handler->command), &argc); | 679 | char **argv = split_directive(exec + strlen(handler->command), &argc); |
680 | int i; | 680 | int i; |
681 | 681 | ||
682 | //Perform var subs on all parts of the command | 682 | // Perform var subs on all parts of the command |
683 | for (i = 0; i < argc; ++i) { | 683 | for (i = 0; i < argc; ++i) { |
684 | argv[i] = do_var_replacement(config, argv[i]); | 684 | argv[i] = do_var_replacement(config, argv[i]); |
685 | } | 685 | } |
diff --git a/sway/container.c b/sway/container.c index 0e247393..4559a5f5 100644 --- a/sway/container.c +++ b/sway/container.c | |||
@@ -171,7 +171,7 @@ swayc_t *new_view(swayc_t *sibling, wlc_handle handle) { | |||
171 | view->name = title ? strdup(title) : NULL; | 171 | view->name = title ? strdup(title) : NULL; |
172 | view->visible = true; | 172 | view->visible = true; |
173 | view->is_focused = true; | 173 | view->is_focused = true; |
174 | //Setup geometry | 174 | // Setup geometry |
175 | view->width = 0; | 175 | view->width = 0; |
176 | view->height = 0; | 176 | view->height = 0; |
177 | 177 | ||
@@ -205,7 +205,7 @@ swayc_t *new_floating_view(wlc_handle handle) { | |||
205 | // Set the geometry of the floating view | 205 | // Set the geometry of the floating view |
206 | const struct wlc_geometry* geometry = wlc_view_get_geometry(handle); | 206 | const struct wlc_geometry* geometry = wlc_view_get_geometry(handle); |
207 | 207 | ||
208 | //give it requested geometry, but place in center | 208 | // give it requested geometry, but place in center |
209 | view->x = (active_workspace->width - geometry->size.w) / 2; | 209 | view->x = (active_workspace->width - geometry->size.w) / 2; |
210 | view->y = (active_workspace->height- geometry->size.h) / 2; | 210 | view->y = (active_workspace->height- geometry->size.h) / 2; |
211 | view->width = geometry->size.w; | 211 | view->width = geometry->size.w; |
diff --git a/sway/focus.c b/sway/focus.c index a6ffe73f..5008dbbf 100644 --- a/sway/focus.c +++ b/sway/focus.c | |||
@@ -21,7 +21,7 @@ static void update_focus(swayc_t *c) { | |||
21 | // Case where output changes | 21 | // Case where output changes |
22 | case C_OUTPUT: | 22 | case C_OUTPUT: |
23 | wlc_output_focus(c->handle); | 23 | wlc_output_focus(c->handle); |
24 | //Set new workspace to the outputs focused workspace | 24 | // Set new workspace to the outputs focused workspace |
25 | active_workspace = c->focused; | 25 | active_workspace = c->focused; |
26 | break; | 26 | break; |
27 | 27 | ||
@@ -118,7 +118,7 @@ void set_focused_container(swayc_t *c) { | |||
118 | // activate current focus | 118 | // activate current focus |
119 | if (p->type == C_VIEW) { | 119 | if (p->type == C_VIEW) { |
120 | wlc_view_set_state(p->handle, WLC_BIT_ACTIVATED, true); | 120 | wlc_view_set_state(p->handle, WLC_BIT_ACTIVATED, true); |
121 | //set focus if view_focus is unlocked | 121 | // set focus if view_focus is unlocked |
122 | if (!locked_view_focus) { | 122 | if (!locked_view_focus) { |
123 | wlc_view_focus(p->handle); | 123 | wlc_view_focus(p->handle); |
124 | } | 124 | } |
diff --git a/sway/handlers.c b/sway/handlers.c index 6c103b02..5993223d 100644 --- a/sway/handlers.c +++ b/sway/handlers.c | |||
@@ -87,7 +87,7 @@ swayc_t *container_under_pointer(void) { | |||
87 | static bool handle_output_created(wlc_handle output) { | 87 | static bool handle_output_created(wlc_handle output) { |
88 | swayc_t *op = new_output(output); | 88 | swayc_t *op = new_output(output); |
89 | 89 | ||
90 | //Switch to workspace if we need to | 90 | // Switch to workspace if we need to |
91 | if (active_workspace == NULL) { | 91 | if (active_workspace == NULL) { |
92 | swayc_t *ws = op->children->items[0]; | 92 | swayc_t *ws = op->children->items[0]; |
93 | workspace_switch(ws); | 93 | workspace_switch(ws); |
@@ -109,7 +109,7 @@ static void handle_output_destroyed(wlc_handle output) { | |||
109 | if (list->length == 0) { | 109 | if (list->length == 0) { |
110 | active_workspace = NULL; | 110 | active_workspace = NULL; |
111 | } else { | 111 | } else { |
112 | //switch to other outputs active workspace | 112 | // switch to other outputs active workspace |
113 | workspace_switch(((swayc_t *)root_container.children->items[0])->focused); | 113 | workspace_switch(((swayc_t *)root_container.children->items[0])->focused); |
114 | } | 114 | } |
115 | } | 115 | } |
@@ -167,7 +167,7 @@ static bool handle_view_created(wlc_handle handle) { | |||
167 | // Dmenu keeps viewfocus, but others with this flag dont, for now simulate | 167 | // Dmenu keeps viewfocus, but others with this flag dont, for now simulate |
168 | // dmenu | 168 | // dmenu |
169 | case WLC_BIT_OVERRIDE_REDIRECT: | 169 | case WLC_BIT_OVERRIDE_REDIRECT: |
170 | // locked_view_focus = true; | 170 | // locked_view_focus = true; |
171 | wlc_view_focus(handle); | 171 | wlc_view_focus(handle); |
172 | wlc_view_set_state(handle, WLC_BIT_ACTIVATED, true); | 172 | wlc_view_set_state(handle, WLC_BIT_ACTIVATED, true); |
173 | wlc_view_bring_to_front(handle); | 173 | wlc_view_bring_to_front(handle); |
@@ -217,7 +217,7 @@ static void handle_view_destroyed(wlc_handle handle) { | |||
217 | // DMENU has this flag, and takes view_focus, but other things with this | 217 | // DMENU has this flag, and takes view_focus, but other things with this |
218 | // flag dont | 218 | // flag dont |
219 | case WLC_BIT_OVERRIDE_REDIRECT: | 219 | case WLC_BIT_OVERRIDE_REDIRECT: |
220 | // locked_view_focus = false; | 220 | // locked_view_focus = false; |
221 | break; | 221 | break; |
222 | case WLC_BIT_OVERRIDE_REDIRECT|WLC_BIT_UNMANAGED: | 222 | case WLC_BIT_OVERRIDE_REDIRECT|WLC_BIT_UNMANAGED: |
223 | locked_container_focus = false; | 223 | locked_container_focus = false; |
@@ -429,7 +429,7 @@ static bool handle_pointer_motion(wlc_handle handle, uint32_t time, const struct | |||
429 | } | 429 | } |
430 | } | 430 | } |
431 | if (config->focus_follows_mouse && prev_handle != handle) { | 431 | if (config->focus_follows_mouse && prev_handle != handle) { |
432 | //Dont change focus if fullscreen | 432 | // Dont change focus if fullscreen |
433 | swayc_t *focused = get_focused_view(view); | 433 | swayc_t *focused = get_focused_view(view); |
434 | if (!(focused->type == C_VIEW && wlc_view_get_state(focused->handle) & WLC_BIT_FULLSCREEN) | 434 | if (!(focused->type == C_VIEW && wlc_view_get_state(focused->handle) & WLC_BIT_FULLSCREEN) |
435 | && !(pointer_state.l_held || pointer_state.r_held)) { | 435 | && !(pointer_state.l_held || pointer_state.r_held)) { |
@@ -459,7 +459,7 @@ static bool handle_pointer_motion(wlc_handle handle, uint32_t time, const struct | |||
459 | static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct wlc_modifiers *modifiers, | 459 | static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct wlc_modifiers *modifiers, |
460 | uint32_t button, enum wlc_button_state state, const struct wlc_origin *origin) { | 460 | uint32_t button, enum wlc_button_state state, const struct wlc_origin *origin) { |
461 | swayc_t *focused = get_focused_container(&root_container); | 461 | swayc_t *focused = get_focused_container(&root_container); |
462 | //dont change focus if fullscreen | 462 | // dont change focus if fullscreen |
463 | if (focused->type == C_VIEW && wlc_view_get_state(focused->handle) & WLC_BIT_FULLSCREEN) { | 463 | if (focused->type == C_VIEW && wlc_view_get_state(focused->handle) & WLC_BIT_FULLSCREEN) { |
464 | return false; | 464 | return false; |
465 | } | 465 | } |
@@ -495,7 +495,7 @@ static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct w | |||
495 | pointer_state.lock.left = !pointer_state.lock.right; | 495 | pointer_state.lock.left = !pointer_state.lock.right; |
496 | start_floating(pointer); | 496 | start_floating(pointer); |
497 | } | 497 | } |
498 | //Dont want pointer sent to window while dragging or resizing | 498 | // Dont want pointer sent to window while dragging or resizing |
499 | return (pointer_state.floating.drag || pointer_state.floating.resize); | 499 | return (pointer_state.floating.drag || pointer_state.floating.resize); |
500 | } | 500 | } |
501 | return (pointer && pointer != focused); | 501 | return (pointer && pointer != focused); |
diff --git a/sway/input_state.c b/sway/input_state.c index 51213b19..a7f88d4a 100644 --- a/sway/input_state.c +++ b/sway/input_state.c | |||
@@ -36,7 +36,7 @@ void press_key(keycode key) { | |||
36 | void release_key(keycode key) { | 36 | void release_key(keycode key) { |
37 | uint8_t index = find_key(key); | 37 | uint8_t index = find_key(key); |
38 | if (index < KEY_STATE_MAX_LENGTH) { | 38 | if (index < KEY_STATE_MAX_LENGTH) { |
39 | //shift it over and remove key | 39 | // shift it over and remove key |
40 | key_state_array[index] = 0; | 40 | key_state_array[index] = 0; |
41 | } | 41 | } |
42 | } | 42 | } |
diff --git a/sway/layout.c b/sway/layout.c index 54fdbcf8..78b3dd27 100644 --- a/sway/layout.c +++ b/sway/layout.c | |||
@@ -33,7 +33,7 @@ void add_child(swayc_t *parent, swayc_t *child) { | |||
33 | child->width, child->height, parent, parent->type, parent->width, parent->height); | 33 | child->width, child->height, parent, parent->type, parent->width, parent->height); |
34 | list_add(parent->children, child); | 34 | list_add(parent->children, child); |
35 | child->parent = parent; | 35 | child->parent = parent; |
36 | //set focus for this container | 36 | // set focus for this container |
37 | if (parent->children->length == 1) { | 37 | if (parent->children->length == 1) { |
38 | set_focused_container_for(parent, child); | 38 | set_focused_container_for(parent, child); |
39 | } | 39 | } |
@@ -97,7 +97,7 @@ swayc_t *remove_child(swayc_t *child) { | |||
97 | } | 97 | } |
98 | } | 98 | } |
99 | } | 99 | } |
100 | //Set focused to new container | 100 | // Set focused to new container |
101 | if (parent->focused == child) { | 101 | if (parent->focused == child) { |
102 | if (parent->children->length > 0) { | 102 | if (parent->children->length > 0) { |
103 | set_focused_container_for(parent, parent->children->items[i?i-1:0]); | 103 | set_focused_container_for(parent, parent->children->items[i?i-1:0]); |
@@ -191,7 +191,7 @@ void arrange_windows(swayc_t *container, int width, int height) { | |||
191 | switch (container->layout) { | 191 | switch (container->layout) { |
192 | case L_HORIZ: | 192 | case L_HORIZ: |
193 | default: | 193 | default: |
194 | //Calculate total width | 194 | // Calculate total width |
195 | for (i = 0; i < container->children->length; ++i) { | 195 | for (i = 0; i < container->children->length; ++i) { |
196 | int *old_width = &((swayc_t *)container->children->items[i])->width; | 196 | int *old_width = &((swayc_t *)container->children->items[i])->width; |
197 | if (*old_width <= 0) { | 197 | if (*old_width <= 0) { |
@@ -203,7 +203,7 @@ void arrange_windows(swayc_t *container, int width, int height) { | |||
203 | } | 203 | } |
204 | scale += *old_width; | 204 | scale += *old_width; |
205 | } | 205 | } |
206 | //Resize windows | 206 | // Resize windows |
207 | if (scale > 0.1) { | 207 | if (scale > 0.1) { |
208 | scale = width / scale; | 208 | scale = width / scale; |
209 | sway_log(L_DEBUG, "Arranging %p horizontally", container); | 209 | sway_log(L_DEBUG, "Arranging %p horizontally", container); |
@@ -218,7 +218,7 @@ void arrange_windows(swayc_t *container, int width, int height) { | |||
218 | } | 218 | } |
219 | break; | 219 | break; |
220 | case L_VERT: | 220 | case L_VERT: |
221 | //Calculate total height | 221 | // Calculate total height |
222 | for (i = 0; i < container->children->length; ++i) { | 222 | for (i = 0; i < container->children->length; ++i) { |
223 | int *old_height = &((swayc_t *)container->children->items[i])->height; | 223 | int *old_height = &((swayc_t *)container->children->items[i])->height; |
224 | if (*old_height <= 0) { | 224 | if (*old_height <= 0) { |
@@ -230,7 +230,7 @@ void arrange_windows(swayc_t *container, int width, int height) { | |||
230 | } | 230 | } |
231 | scale += *old_height; | 231 | scale += *old_height; |
232 | } | 232 | } |
233 | //Resize | 233 | // Resize |
234 | if (scale > 0.1) { | 234 | if (scale > 0.1) { |
235 | scale = height / scale; | 235 | scale = height / scale; |
236 | sway_log(L_DEBUG, "Arranging %p vertically", container); | 236 | sway_log(L_DEBUG, "Arranging %p vertically", container); |
@@ -88,10 +88,10 @@ bool sway_assert(bool condition, const char* format, ...) { | |||
88 | /* XXX:DEBUG:XXX */ | 88 | /* XXX:DEBUG:XXX */ |
89 | static void container_log(const swayc_t *c) { | 89 | static void container_log(const swayc_t *c) { |
90 | fprintf(stderr, "focus:%c|", | 90 | fprintf(stderr, "focus:%c|", |
91 | c->is_focused ? 'F' : //Focused | 91 | c->is_focused ? 'F' : // Focused |
92 | c == active_workspace ? 'W' : //active workspace | 92 | c == active_workspace ? 'W' : // active workspace |
93 | c == &root_container ? 'R' : //root | 93 | c == &root_container ? 'R' : // root |
94 | 'X');//not any others | 94 | 'X');// not any others |
95 | fprintf(stderr,"(%p)",c); | 95 | fprintf(stderr,"(%p)",c); |
96 | fprintf(stderr,"(p:%p)",c->parent); | 96 | fprintf(stderr,"(p:%p)",c->parent); |
97 | fprintf(stderr,"(f:%p)",c->focused); | 97 | fprintf(stderr,"(f:%p)",c->focused); |
diff --git a/sway/workspace.c b/sway/workspace.c index ec60c8e0..0f44d3b0 100644 --- a/sway/workspace.c +++ b/sway/workspace.c | |||
@@ -47,7 +47,7 @@ char *workspace_next_name(void) { | |||
47 | continue; | 47 | continue; |
48 | } | 48 | } |
49 | 49 | ||
50 | //Make sure that the workspace doesn't already exist | 50 | // Make sure that the workspace doesn't already exist |
51 | if (workspace_find_by_name(target)) { | 51 | if (workspace_find_by_name(target)) { |
52 | list_free(args); | 52 | list_free(args); |
53 | continue; | 53 | continue; |