diff options
-rw-r--r-- | include/swaybar/bar.h | 2 | ||||
-rw-r--r-- | include/swaybar/config.h | 2 | ||||
-rw-r--r-- | include/swaybar/status_line.h | 1 | ||||
-rw-r--r-- | include/swaylock/seat.h | 1 | ||||
-rw-r--r-- | include/swaylock/swaylock.h | 2 | ||||
-rw-r--r-- | sway/desktop/xwayland.c | 11 | ||||
-rw-r--r-- | sway/input/seat.c | 30 | ||||
-rw-r--r-- | swaybar/bar.c | 25 | ||||
-rw-r--r-- | swaybar/config.c | 6 | ||||
-rw-r--r-- | swaybar/i3bar.c | 3 | ||||
-rw-r--r-- | swaybar/ipc.c | 13 | ||||
-rw-r--r-- | swaybar/status_line.c | 14 | ||||
-rw-r--r-- | swaylock/password.c | 30 | ||||
-rw-r--r-- | swaylock/render.c | 16 | ||||
-rw-r--r-- | swaylock/seat.c | 1 |
15 files changed, 112 insertions, 45 deletions
diff --git a/include/swaybar/bar.h b/include/swaybar/bar.h index 0037190b..af478f33 100644 --- a/include/swaybar/bar.h +++ b/include/swaybar/bar.h | |||
@@ -79,4 +79,6 @@ void bar_setup(struct swaybar *bar, | |||
79 | void bar_run(struct swaybar *bar); | 79 | void bar_run(struct swaybar *bar); |
80 | void bar_teardown(struct swaybar *bar); | 80 | void bar_teardown(struct swaybar *bar); |
81 | 81 | ||
82 | void free_workspaces(struct wl_list *list); | ||
83 | |||
82 | #endif | 84 | #endif |
diff --git a/include/swaybar/config.h b/include/swaybar/config.h index 7f321df8..6739c28a 100644 --- a/include/swaybar/config.h +++ b/include/swaybar/config.h | |||
@@ -29,7 +29,7 @@ struct swaybar_config { | |||
29 | bool binding_mode_indicator; | 29 | bool binding_mode_indicator; |
30 | bool wrap_scroll; | 30 | bool wrap_scroll; |
31 | bool workspace_buttons; | 31 | bool workspace_buttons; |
32 | struct wl_list outputs; | 32 | struct wl_list outputs; // config_output::link |
33 | bool all_outputs; | 33 | bool all_outputs; |
34 | int height; | 34 | int height; |
35 | 35 | ||
diff --git a/include/swaybar/status_line.h b/include/swaybar/status_line.h index 3538f49c..bf12a842 100644 --- a/include/swaybar/status_line.h +++ b/include/swaybar/status_line.h | |||
@@ -73,5 +73,6 @@ void status_line_free(struct status_line *status); | |||
73 | bool i3bar_handle_readable(struct status_line *status); | 73 | bool i3bar_handle_readable(struct status_line *status); |
74 | void i3bar_block_send_click(struct status_line *status, | 74 | void i3bar_block_send_click(struct status_line *status, |
75 | struct i3bar_block *block, int x, int y, uint32_t button); | 75 | struct i3bar_block *block, int x, int y, uint32_t button); |
76 | void i3bar_block_free(struct i3bar_block *block); | ||
76 | 77 | ||
77 | #endif | 78 | #endif |
diff --git a/include/swaylock/seat.h b/include/swaylock/seat.h index 44bc37d5..180ea7a0 100644 --- a/include/swaylock/seat.h +++ b/include/swaylock/seat.h | |||
@@ -27,6 +27,7 @@ enum mask { | |||
27 | 27 | ||
28 | struct swaylock_xkb { | 28 | struct swaylock_xkb { |
29 | uint32_t modifiers; | 29 | uint32_t modifiers; |
30 | bool caps_lock; | ||
30 | struct xkb_state *state; | 31 | struct xkb_state *state; |
31 | struct xkb_context *context; | 32 | struct xkb_context *context; |
32 | struct xkb_keymap *keymap; | 33 | struct xkb_keymap *keymap; |
diff --git a/include/swaylock/swaylock.h b/include/swaylock/swaylock.h index ed9fea19..07b908d7 100644 --- a/include/swaylock/swaylock.h +++ b/include/swaylock/swaylock.h | |||
@@ -11,7 +11,9 @@ | |||
11 | 11 | ||
12 | enum auth_state { | 12 | enum auth_state { |
13 | AUTH_STATE_IDLE, | 13 | AUTH_STATE_IDLE, |
14 | AUTH_STATE_CLEAR, | ||
14 | AUTH_STATE_INPUT, | 15 | AUTH_STATE_INPUT, |
16 | AUTH_STATE_INPUT_NOP, | ||
15 | AUTH_STATE_BACKSPACE, | 17 | AUTH_STATE_BACKSPACE, |
16 | AUTH_STATE_VALIDATING, | 18 | AUTH_STATE_VALIDATING, |
17 | AUTH_STATE_INVALID, | 19 | AUTH_STATE_INVALID, |
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index cad9156d..63d9c66e 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c | |||
@@ -266,10 +266,13 @@ static void handle_request_configure(struct wl_listener *listener, void *data) { | |||
266 | struct wlr_xwayland_surface_configure_event *ev = data; | 266 | struct wlr_xwayland_surface_configure_event *ev = data; |
267 | struct sway_view *view = &xwayland_view->view; | 267 | struct sway_view *view = &xwayland_view->view; |
268 | struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; | 268 | struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface; |
269 | // TODO: floating windows are allowed to move around like this, but make | 269 | if (!xsurface->mapped) { |
270 | // sure tiling windows always stay in place. | 270 | wlr_xwayland_surface_configure(xsurface, ev->x, ev->y, |
271 | wlr_xwayland_surface_configure(xsurface, ev->x, ev->y, | 271 | ev->width, ev->height); |
272 | ev->width, ev->height); | 272 | return; |
273 | } | ||
274 | // TODO: Let floating views do whatever | ||
275 | configure(view, view->swayc->x, view->swayc->y, view->width, view->height); | ||
273 | } | 276 | } |
274 | 277 | ||
275 | static void handle_request_fullscreen(struct wl_listener *listener, void *data) { | 278 | static void handle_request_fullscreen(struct wl_listener *listener, void *data) { |
diff --git a/sway/input/seat.c b/sway/input/seat.c index d1fc62c4..e88bcfd1 100644 --- a/sway/input/seat.c +++ b/sway/input/seat.c | |||
@@ -476,10 +476,11 @@ void seat_set_focus_warp(struct sway_seat *seat, | |||
476 | // find new output's old workspace, which might have to be removed if empty | 476 | // find new output's old workspace, which might have to be removed if empty |
477 | struct sway_container *new_output_last_ws = NULL; | 477 | struct sway_container *new_output_last_ws = NULL; |
478 | if (last_output && new_output && last_output != new_output) { | 478 | if (last_output && new_output && last_output != new_output) { |
479 | new_output_last_ws = seat_get_focus_by_type(seat, new_output, C_WORKSPACE); | 479 | new_output_last_ws = |
480 | seat_get_focus_by_type(seat, new_output, C_WORKSPACE); | ||
480 | } | 481 | } |
481 | 482 | ||
482 | if (container) { | 483 | if (container && container->parent) { |
483 | struct sway_seat_container *seat_con = | 484 | struct sway_seat_container *seat_con = |
484 | seat_container_from_container(seat, container); | 485 | seat_container_from_container(seat, container); |
485 | if (seat_con == NULL) { | 486 | if (seat_con == NULL) { |
@@ -488,8 +489,7 @@ void seat_set_focus_warp(struct sway_seat *seat, | |||
488 | 489 | ||
489 | // put all the anscestors of this container on top of the focus stack | 490 | // put all the anscestors of this container on top of the focus stack |
490 | struct sway_seat_container *parent = | 491 | struct sway_seat_container *parent = |
491 | seat_container_from_container(seat, | 492 | seat_container_from_container(seat, container->parent); |
492 | seat_con->container->parent); | ||
493 | while (parent) { | 493 | while (parent) { |
494 | wl_list_remove(&parent->link); | 494 | wl_list_remove(&parent->link); |
495 | wl_list_insert(&seat->focus_stack, &parent->link); | 495 | wl_list_insert(&seat->focus_stack, &parent->link); |
@@ -516,24 +516,24 @@ void seat_set_focus_warp(struct sway_seat *seat, | |||
516 | // clean up unfocused empty workspace on new output | 516 | // clean up unfocused empty workspace on new output |
517 | if (new_output_last_ws) { | 517 | if (new_output_last_ws) { |
518 | if (!workspace_is_visible(new_output_last_ws) | 518 | if (!workspace_is_visible(new_output_last_ws) |
519 | && new_output_last_ws->children->length == 0) { | 519 | && new_output_last_ws->children->length == 0) { |
520 | if (last_workspace == new_output_last_ws) { | ||
521 | last_focus = NULL; | ||
522 | last_workspace = NULL; | ||
523 | } | ||
520 | container_destroy(new_output_last_ws); | 524 | container_destroy(new_output_last_ws); |
521 | } | 525 | } |
522 | } | 526 | } |
523 | 527 | ||
524 | if (last_focus) { | 528 | if (last_focus) { |
525 | struct sway_container *last_ws = last_focus; | 529 | if (last_workspace) { |
526 | if (last_ws && last_ws->type != C_WORKSPACE) { | 530 | ipc_event_workspace(last_workspace, container, "focus"); |
527 | last_ws = container_parent(last_ws, C_WORKSPACE); | 531 | if (!workspace_is_visible(last_workspace) |
528 | } | 532 | && last_workspace->children->length == 0) { |
529 | if (last_ws) { | 533 | if (last_workspace == last_focus) { |
530 | ipc_event_workspace(last_ws, container, "focus"); | ||
531 | if (!workspace_is_visible(last_ws) | ||
532 | && last_ws->children->length == 0) { | ||
533 | if (last_ws == last_focus) { | ||
534 | last_focus = NULL; | 534 | last_focus = NULL; |
535 | } | 535 | } |
536 | container_destroy(last_ws); | 536 | container_destroy(last_workspace); |
537 | } | 537 | } |
538 | } | 538 | } |
539 | 539 | ||
diff --git a/swaybar/bar.c b/swaybar/bar.c index d407db4f..5b8028e5 100644 --- a/swaybar/bar.c +++ b/swaybar/bar.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include "ipc-client.h" | 25 | #include "ipc-client.h" |
26 | #include "list.h" | 26 | #include "list.h" |
27 | #include "log.h" | 27 | #include "log.h" |
28 | #include "pango.h" | ||
29 | #include "pool-buffer.h" | 28 | #include "pool-buffer.h" |
30 | #include "wlr-layer-shell-unstable-v1-client-protocol.h" | 29 | #include "wlr-layer-shell-unstable-v1-client-protocol.h" |
31 | 30 | ||
@@ -34,6 +33,15 @@ static void bar_init(struct swaybar *bar) { | |||
34 | wl_list_init(&bar->outputs); | 33 | wl_list_init(&bar->outputs); |
35 | } | 34 | } |
36 | 35 | ||
36 | void free_workspaces(struct wl_list *list) { | ||
37 | struct swaybar_workspace *ws, *tmp; | ||
38 | wl_list_for_each_safe(ws, tmp, list, link) { | ||
39 | wl_list_remove(&ws->link); | ||
40 | free(ws->name); | ||
41 | free(ws); | ||
42 | } | ||
43 | } | ||
44 | |||
37 | static void swaybar_output_free(struct swaybar_output *output) { | 45 | static void swaybar_output_free(struct swaybar_output *output) { |
38 | if (!output) { | 46 | if (!output) { |
39 | return; | 47 | return; |
@@ -44,12 +52,7 @@ static void swaybar_output_free(struct swaybar_output *output) { | |||
44 | wl_output_destroy(output->output); | 52 | wl_output_destroy(output->output); |
45 | destroy_buffer(&output->buffers[0]); | 53 | destroy_buffer(&output->buffers[0]); |
46 | destroy_buffer(&output->buffers[1]); | 54 | destroy_buffer(&output->buffers[1]); |
47 | struct swaybar_workspace *ws, *ws_tmp; | 55 | free_workspaces(&output->workspaces); |
48 | wl_list_for_each_safe(ws, ws_tmp, &output->workspaces, link) { | ||
49 | wl_list_remove(&ws->link); | ||
50 | free(ws->name); | ||
51 | free(ws); | ||
52 | } | ||
53 | struct swaybar_hotspot *hotspot, *hotspot_tmp; | 56 | struct swaybar_hotspot *hotspot, *hotspot_tmp; |
54 | wl_list_for_each_safe(hotspot, hotspot_tmp, &output->hotspots, link) { | 57 | wl_list_for_each_safe(hotspot, hotspot_tmp, &output->hotspots, link) { |
55 | if (hotspot->destroy) { | 58 | if (hotspot->destroy) { |
@@ -162,9 +165,11 @@ static void wl_pointer_axis(void *data, struct wl_pointer *wl_pointer, | |||
162 | return; | 165 | return; |
163 | } | 166 | } |
164 | 167 | ||
168 | // last doesn't actually need initialization, | ||
169 | // but gcc (7.3.1) is too dumb to figure it out | ||
165 | struct swaybar_workspace *first = NULL; | 170 | struct swaybar_workspace *first = NULL; |
166 | struct swaybar_workspace *active = NULL; | 171 | struct swaybar_workspace *active = NULL; |
167 | struct swaybar_workspace *last; | 172 | struct swaybar_workspace *last = NULL; |
168 | 173 | ||
169 | struct swaybar_workspace *iter; | 174 | struct swaybar_workspace *iter; |
170 | wl_list_for_each(iter, &output->workspaces, link) { | 175 | wl_list_for_each(iter, &output->workspaces, link) { |
@@ -466,9 +471,7 @@ void bar_run(struct swaybar *bar) { | |||
466 | static void free_outputs(struct wl_list *list) { | 471 | static void free_outputs(struct wl_list *list) { |
467 | struct swaybar_output *output, *tmp; | 472 | struct swaybar_output *output, *tmp; |
468 | wl_list_for_each_safe(output, tmp, list, link) { | 473 | wl_list_for_each_safe(output, tmp, list, link) { |
469 | wl_list_remove(&output->link); | 474 | swaybar_output_free(output); |
470 | free(output->name); | ||
471 | free(output); | ||
472 | } | 475 | } |
473 | } | 476 | } |
474 | 477 | ||
diff --git a/swaybar/config.c b/swaybar/config.c index 9169ad27..db7b0db6 100644 --- a/swaybar/config.c +++ b/swaybar/config.c | |||
@@ -74,5 +74,11 @@ void free_config(struct swaybar_config *config) { | |||
74 | free(config->font); | 74 | free(config->font); |
75 | free(config->mode); | 75 | free(config->mode); |
76 | free(config->sep_symbol); | 76 | free(config->sep_symbol); |
77 | struct config_output *coutput, *tmp; | ||
78 | wl_list_for_each_safe(coutput, tmp, &config->outputs, link) { | ||
79 | wl_list_remove(&coutput->link); | ||
80 | free(coutput->name); | ||
81 | free(coutput); | ||
82 | } | ||
77 | free(config); | 83 | free(config); |
78 | } | 84 | } |
diff --git a/swaybar/i3bar.c b/swaybar/i3bar.c index dced13d2..141612a6 100644 --- a/swaybar/i3bar.c +++ b/swaybar/i3bar.c | |||
@@ -7,7 +7,7 @@ | |||
7 | #include "swaybar/config.h" | 7 | #include "swaybar/config.h" |
8 | #include "swaybar/status_line.h" | 8 | #include "swaybar/status_line.h" |
9 | 9 | ||
10 | static void i3bar_block_free(struct i3bar_block *block) { | 10 | void i3bar_block_free(struct i3bar_block *block) { |
11 | if (!block) { | 11 | if (!block) { |
12 | return; | 12 | return; |
13 | } | 13 | } |
@@ -18,6 +18,7 @@ static void i3bar_block_free(struct i3bar_block *block) { | |||
18 | free(block->name); | 18 | free(block->name); |
19 | free(block->instance); | 19 | free(block->instance); |
20 | free(block->color); | 20 | free(block->color); |
21 | free(block); | ||
21 | } | 22 | } |
22 | 23 | ||
23 | static bool i3bar_parse_json(struct status_line *status, const char *text) { | 24 | static bool i3bar_parse_json(struct status_line *status, const char *text) { |
diff --git a/swaybar/ipc.c b/swaybar/ipc.c index ed5d9a31..959fa095 100644 --- a/swaybar/ipc.c +++ b/swaybar/ipc.c | |||
@@ -216,15 +216,6 @@ static void ipc_parse_config( | |||
216 | json_object_put(bar_config); | 216 | json_object_put(bar_config); |
217 | } | 217 | } |
218 | 218 | ||
219 | static void free_workspaces(struct wl_list *list) { | ||
220 | struct swaybar_workspace *ws, *tmp; | ||
221 | wl_list_for_each_safe(ws, tmp, list, link) { | ||
222 | wl_list_remove(&ws->link); | ||
223 | free(ws->name); | ||
224 | free(ws); | ||
225 | } | ||
226 | } | ||
227 | |||
228 | void ipc_get_workspaces(struct swaybar *bar) { | 219 | void ipc_get_workspaces(struct swaybar *bar) { |
229 | bar->focused_output = NULL; | 220 | bar->focused_output = NULL; |
230 | struct swaybar_output *output; | 221 | struct swaybar_output *output; |
@@ -290,8 +281,8 @@ static void ipc_get_outputs(struct swaybar *bar) { | |||
290 | continue; | 281 | continue; |
291 | } | 282 | } |
292 | if (bar->config->all_outputs) { | 283 | if (bar->config->all_outputs) { |
293 | struct config_output *coutput = calloc( | 284 | struct config_output *coutput = |
294 | 1, sizeof(struct config_output)); | 285 | calloc(1, sizeof(struct config_output)); |
295 | coutput->name = strdup(name); | 286 | coutput->name = strdup(name); |
296 | coutput->index = i; | 287 | coutput->index = i; |
297 | wl_list_insert(&bar->config->outputs, &coutput->link); | 288 | wl_list_insert(&bar->config->outputs, &coutput->link); |
diff --git a/swaybar/status_line.c b/swaybar/status_line.c index 8d781ca3..e0e7414a 100644 --- a/swaybar/status_line.c +++ b/swaybar/status_line.c | |||
@@ -1,4 +1,4 @@ | |||
1 | #define _POSIX_C_SOURCE 199309L | 1 | #define _POSIX_C_SOURCE 200809L |
2 | #include <fcntl.h> | 2 | #include <fcntl.h> |
3 | #include <json-c/json.h> | 3 | #include <json-c/json.h> |
4 | #include <stdlib.h> | 4 | #include <stdlib.h> |
@@ -126,5 +126,17 @@ void status_line_free(struct status_line *status) { | |||
126 | close(status->read_fd); | 126 | close(status->read_fd); |
127 | close(status->write_fd); | 127 | close(status->write_fd); |
128 | kill(status->pid, SIGTERM); | 128 | kill(status->pid, SIGTERM); |
129 | switch (status->protocol) { | ||
130 | case PROTOCOL_I3BAR:; | ||
131 | struct i3bar_block *block, *tmp; | ||
132 | wl_list_for_each_safe(block, tmp, &status->blocks, link) { | ||
133 | i3bar_block_free(block); | ||
134 | } | ||
135 | free(status->i3bar_state.buffer); | ||
136 | break; | ||
137 | default: | ||
138 | free(status->text_state.buffer); | ||
139 | break; | ||
140 | } | ||
129 | free(status); | 141 | free(status); |
130 | } | 142 | } |
diff --git a/swaylock/password.c b/swaylock/password.c index c8df3de8..1ad5cd81 100644 --- a/swaylock/password.c +++ b/swaylock/password.c | |||
@@ -105,11 +105,39 @@ void swaylock_handle_key(struct swaylock_state *state, | |||
105 | state->auth_state = AUTH_STATE_INVALID; | 105 | state->auth_state = AUTH_STATE_INVALID; |
106 | render_frames(state); | 106 | render_frames(state); |
107 | break; | 107 | break; |
108 | case XKB_KEY_Delete: | ||
108 | case XKB_KEY_BackSpace: | 109 | case XKB_KEY_BackSpace: |
109 | if (backspace(&state->password)) { | 110 | if (backspace(&state->password)) { |
110 | state->auth_state = AUTH_STATE_BACKSPACE; | 111 | state->auth_state = AUTH_STATE_BACKSPACE; |
111 | render_frames(state); | 112 | } else { |
113 | state->auth_state = AUTH_STATE_CLEAR; | ||
112 | } | 114 | } |
115 | render_frames(state); | ||
116 | break; | ||
117 | case XKB_KEY_Escape: | ||
118 | clear_password_buffer(&state->password); | ||
119 | state->auth_state = AUTH_STATE_CLEAR; | ||
120 | render_frames(state); | ||
121 | break; | ||
122 | case XKB_KEY_Caps_Lock: | ||
123 | /* The state is getting active after this | ||
124 | * so we need to manually toggle it */ | ||
125 | state->xkb.caps_lock = !state->xkb.caps_lock; | ||
126 | state->auth_state = AUTH_STATE_INPUT_NOP; | ||
127 | render_frames(state); | ||
128 | break; | ||
129 | case XKB_KEY_Shift_L: | ||
130 | case XKB_KEY_Shift_R: | ||
131 | case XKB_KEY_Control_L: | ||
132 | case XKB_KEY_Control_R: | ||
133 | case XKB_KEY_Meta_L: | ||
134 | case XKB_KEY_Meta_R: | ||
135 | case XKB_KEY_Alt_L: | ||
136 | case XKB_KEY_Alt_R: | ||
137 | case XKB_KEY_Super_L: | ||
138 | case XKB_KEY_Super_R: | ||
139 | state->auth_state = AUTH_STATE_INPUT_NOP; | ||
140 | render_frames(state); | ||
113 | break; | 141 | break; |
114 | default: | 142 | default: |
115 | if (codepoint) { | 143 | if (codepoint) { |
diff --git a/swaylock/render.c b/swaylock/render.c index cd387be5..7d9d25a5 100644 --- a/swaylock/render.c +++ b/swaylock/render.c | |||
@@ -43,6 +43,7 @@ void render_frame(struct swaylock_surface *surface) { | |||
43 | cairo_arc(cairo, buffer_width / 2, buffer_height / 2, arc_radius, 0, 2 * M_PI); | 43 | cairo_arc(cairo, buffer_width / 2, buffer_height / 2, arc_radius, 0, 2 * M_PI); |
44 | switch (state->auth_state) { | 44 | switch (state->auth_state) { |
45 | case AUTH_STATE_INPUT: | 45 | case AUTH_STATE_INPUT: |
46 | case AUTH_STATE_INPUT_NOP: | ||
46 | case AUTH_STATE_BACKSPACE: { | 47 | case AUTH_STATE_BACKSPACE: { |
47 | cairo_set_source_rgba(cairo, 0, 0, 0, 0.75); | 48 | cairo_set_source_rgba(cairo, 0, 0, 0, 0.75); |
48 | cairo_fill_preserve(cairo); | 49 | cairo_fill_preserve(cairo); |
@@ -61,6 +62,12 @@ void render_frame(struct swaylock_surface *surface) { | |||
61 | cairo_set_source_rgb(cairo, 125.0 / 255, 51.0 / 255, 0); | 62 | cairo_set_source_rgb(cairo, 125.0 / 255, 51.0 / 255, 0); |
62 | cairo_stroke(cairo); | 63 | cairo_stroke(cairo); |
63 | } break; | 64 | } break; |
65 | case AUTH_STATE_CLEAR: { | ||
66 | cairo_set_source_rgba(cairo, 229.0/255, 164.0/255, 69.0/255, 0.75); | ||
67 | cairo_fill_preserve(cairo); | ||
68 | cairo_set_source_rgb(cairo, 229.0/255, 164.0/255, 69.0/255); | ||
69 | cairo_stroke(cairo); | ||
70 | } break; | ||
64 | default: break; | 71 | default: break; |
65 | } | 72 | } |
66 | 73 | ||
@@ -77,6 +84,15 @@ void render_frame(struct swaylock_surface *surface) { | |||
77 | case AUTH_STATE_INVALID: | 84 | case AUTH_STATE_INVALID: |
78 | text = "wrong"; | 85 | text = "wrong"; |
79 | break; | 86 | break; |
87 | case AUTH_STATE_CLEAR: | ||
88 | text = "cleared"; | ||
89 | break; | ||
90 | case AUTH_STATE_INPUT: | ||
91 | case AUTH_STATE_INPUT_NOP: | ||
92 | if (state->xkb.caps_lock) { | ||
93 | text = "Caps Lock"; | ||
94 | cairo_set_source_rgb(cairo, 229.0/255, 164.0/255, 69.0/255); | ||
95 | } | ||
80 | default: break; | 96 | default: break; |
81 | } | 97 | } |
82 | 98 | ||
diff --git a/swaylock/seat.c b/swaylock/seat.c index 21db7c4f..a81899a6 100644 --- a/swaylock/seat.c +++ b/swaylock/seat.c | |||
@@ -88,6 +88,7 @@ static void keyboard_modifiers(void *data, struct wl_keyboard *wl_keyboard, | |||
88 | xkb_mod_mask_t mask = xkb_state_serialize_mods(state->xkb.state, | 88 | xkb_mod_mask_t mask = xkb_state_serialize_mods(state->xkb.state, |
89 | XKB_STATE_MODS_DEPRESSED | XKB_STATE_MODS_LATCHED); | 89 | XKB_STATE_MODS_DEPRESSED | XKB_STATE_MODS_LATCHED); |
90 | state->xkb.modifiers = 0; | 90 | state->xkb.modifiers = 0; |
91 | state->xkb.caps_lock = xkb_state_mod_name_is_active(state->xkb.state, XKB_MOD_NAME_CAPS, XKB_STATE_MODS_LOCKED); | ||
91 | for (uint32_t i = 0; i < MASK_LAST; ++i) { | 92 | for (uint32_t i = 0; i < MASK_LAST; ++i) { |
92 | if (mask & state->xkb.masks[i]) { | 93 | if (mask & state->xkb.masks[i]) { |
93 | state->xkb.modifiers |= XKB_MODS[i]; | 94 | state->xkb.modifiers |= XKB_MODS[i]; |