diff options
author | Zandr Martin <zandrmartin+git@gmail.com> | 2016-05-26 10:16:34 -0500 |
---|---|---|
committer | Zandr Martin <zandrmartin+git@gmail.com> | 2016-05-26 10:16:34 -0500 |
commit | 54d38d3931c55bb7ce8c88a2c7578c14215f0741 (patch) | |
tree | b9259a3cb1025d5b4529a259421a75e9d4c9fa75 /swaylock/main.c | |
parent | Merge pull request #672 from zandrmartin/add-ctrlu-to-swaylock (diff) | |
download | sway-54d38d3931c55bb7ce8c88a2c7578c14215f0741.tar.gz sway-54d38d3931c55bb7ce8c88a2c7578c14215f0741.tar.zst sway-54d38d3931c55bb7ce8c88a2c7578c14215f0741.zip |
add --no-unlock-indicator to swaylock
Diffstat (limited to 'swaylock/main.c')
-rw-r--r-- | swaylock/main.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/swaylock/main.c b/swaylock/main.c index 666e59d2..2c69f7fd 100644 --- a/swaylock/main.c +++ b/swaylock/main.c | |||
@@ -10,6 +10,7 @@ | |||
10 | #include <pwd.h> | 10 | #include <pwd.h> |
11 | #include <getopt.h> | 11 | #include <getopt.h> |
12 | #include <signal.h> | 12 | #include <signal.h> |
13 | #include <stdbool.h> | ||
13 | 14 | ||
14 | #include "client/window.h" | 15 | #include "client/window.h" |
15 | #include "client/registry.h" | 16 | #include "client/registry.h" |
@@ -20,6 +21,7 @@ | |||
20 | 21 | ||
21 | struct registry *registry; | 22 | struct registry *registry; |
22 | struct render_data render_data; | 23 | struct render_data render_data; |
24 | bool show_indicator = true; | ||
23 | 25 | ||
24 | void wl_dispatch_events() { | 26 | void wl_dispatch_events() { |
25 | wl_display_flush(registry->display); | 27 | wl_display_flush(registry->display); |
@@ -328,6 +330,7 @@ int main(int argc, char **argv) { | |||
328 | {"tiling", no_argument, NULL, 't'}, | 330 | {"tiling", no_argument, NULL, 't'}, |
329 | {"version", no_argument, NULL, 'v'}, | 331 | {"version", no_argument, NULL, 'v'}, |
330 | {"socket", required_argument, NULL, 'p'}, | 332 | {"socket", required_argument, NULL, 'p'}, |
333 | {"no-unlock-indicator", no_argument, NULL, 'u'}, | ||
331 | {0, 0, 0, 0} | 334 | {0, 0, 0, 0} |
332 | }; | 335 | }; |
333 | 336 | ||
@@ -340,6 +343,7 @@ int main(int argc, char **argv) { | |||
340 | " -t, --tiling Same as --scaling=tile.\n" | 343 | " -t, --tiling Same as --scaling=tile.\n" |
341 | " -v, --version Show the version number and quit.\n" | 344 | " -v, --version Show the version number and quit.\n" |
342 | " -i, --image [<output>:]<path> Display the given image.\n" | 345 | " -i, --image [<output>:]<path> Display the given image.\n" |
346 | " -u, --no-unlock-indicator Disable the unlock indicator.\n" | ||
343 | " --socket <socket> Use the specified socket.\n"; | 347 | " --socket <socket> Use the specified socket.\n"; |
344 | 348 | ||
345 | registry = registry_poll(); | 349 | registry = registry_poll(); |
@@ -347,7 +351,7 @@ int main(int argc, char **argv) { | |||
347 | int c; | 351 | int c; |
348 | while (1) { | 352 | while (1) { |
349 | int option_index = 0; | 353 | int option_index = 0; |
350 | c = getopt_long(argc, argv, "hc:i:s:tv", long_options, &option_index); | 354 | c = getopt_long(argc, argv, "hc:i:s:tvu", long_options, &option_index); |
351 | if (c == -1) { | 355 | if (c == -1) { |
352 | break; | 356 | break; |
353 | } | 357 | } |
@@ -412,6 +416,9 @@ int main(int argc, char **argv) { | |||
412 | #endif | 416 | #endif |
413 | exit(EXIT_SUCCESS); | 417 | exit(EXIT_SUCCESS); |
414 | break; | 418 | break; |
419 | case 'u': | ||
420 | show_indicator = false; | ||
421 | break; | ||
415 | default: | 422 | default: |
416 | fprintf(stderr, "%s", usage); | 423 | fprintf(stderr, "%s", usage); |
417 | exit(EXIT_FAILURE); | 424 | exit(EXIT_FAILURE); |
@@ -575,7 +582,7 @@ void render(struct render_data *render_data) { | |||
575 | const float TYPE_INDICATOR_BORDER_THICKNESS = M_PI / 128.0f; | 582 | const float TYPE_INDICATOR_BORDER_THICKNESS = M_PI / 128.0f; |
576 | 583 | ||
577 | // Add visual indicator | 584 | // Add visual indicator |
578 | if (render_data->auth_state != AUTH_STATE_IDLE) { | 585 | if (show_indicator && render_data->auth_state != AUTH_STATE_IDLE) { |
579 | // Draw circle | 586 | // Draw circle |
580 | cairo_set_line_width(window->cairo, ARC_THICKNESS); | 587 | cairo_set_line_width(window->cairo, ARC_THICKNESS); |
581 | cairo_arc(window->cairo, window->width/2, window->height/2, ARC_RADIUS, 0, 2 * M_PI); | 588 | cairo_arc(window->cairo, window->width/2, window->height/2, ARC_RADIUS, 0, 2 * M_PI); |