Merge pull request #673 from zandrmartin/swaylock-no-unlock-indicator

add --no-unlock-indicator to swaylock
This commit is contained in:
Drew DeVault 2016-05-26 11:37:34 -04:00
commit 907283d230
3 changed files with 14 additions and 3 deletions

View file

@ -8,4 +8,5 @@ _arguments -s \
'(-h --help)'{-h,--help}'[Show help message and quit]' \ '(-h --help)'{-h,--help}'[Show help message and quit]' \
'(-c --color)'{-c,--color}'[Specify a color (rrggbb) instead of white]' \ '(-c --color)'{-c,--color}'[Specify a color (rrggbb) instead of white]' \
'(-i --image)'{-i,--image}'[Display an image]:files:_files' \ '(-i --image)'{-i,--image}'[Display an image]:files:_files' \
'(-s --scaling)'{-s,--scaling}'[Scaling mode]:mode:(stretch fill fit center tile)' '(-s --scaling)'{-s,--scaling}'[Scaling mode]:mode:(stretch fill fit center tile)' \
'(-u --no-unlock-indicator)'{-u,--no-unlock-indicator}'[Disable the unlock indicator]'

View file

@ -10,6 +10,7 @@
#include <pwd.h> #include <pwd.h>
#include <getopt.h> #include <getopt.h>
#include <signal.h> #include <signal.h>
#include <stdbool.h>
#include "client/window.h" #include "client/window.h"
#include "client/registry.h" #include "client/registry.h"
@ -20,6 +21,7 @@
struct registry *registry; struct registry *registry;
struct render_data render_data; struct render_data render_data;
bool show_indicator = true;
void wl_dispatch_events() { void wl_dispatch_events() {
wl_display_flush(registry->display); wl_display_flush(registry->display);
@ -328,6 +330,7 @@ int main(int argc, char **argv) {
{"tiling", no_argument, NULL, 't'}, {"tiling", no_argument, NULL, 't'},
{"version", no_argument, NULL, 'v'}, {"version", no_argument, NULL, 'v'},
{"socket", required_argument, NULL, 'p'}, {"socket", required_argument, NULL, 'p'},
{"no-unlock-indicator", no_argument, NULL, 'u'},
{0, 0, 0, 0} {0, 0, 0, 0}
}; };
@ -340,6 +343,7 @@ int main(int argc, char **argv) {
" -t, --tiling Same as --scaling=tile.\n" " -t, --tiling Same as --scaling=tile.\n"
" -v, --version Show the version number and quit.\n" " -v, --version Show the version number and quit.\n"
" -i, --image [<output>:]<path> Display the given image.\n" " -i, --image [<output>:]<path> Display the given image.\n"
" -u, --no-unlock-indicator Disable the unlock indicator.\n"
" --socket <socket> Use the specified socket.\n"; " --socket <socket> Use the specified socket.\n";
registry = registry_poll(); registry = registry_poll();
@ -347,7 +351,7 @@ int main(int argc, char **argv) {
int c; int c;
while (1) { while (1) {
int option_index = 0; int option_index = 0;
c = getopt_long(argc, argv, "hc:i:s:tv", long_options, &option_index); c = getopt_long(argc, argv, "hc:i:s:tvu", long_options, &option_index);
if (c == -1) { if (c == -1) {
break; break;
} }
@ -412,6 +416,9 @@ int main(int argc, char **argv) {
#endif #endif
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
break; break;
case 'u':
show_indicator = false;
break;
default: default:
fprintf(stderr, "%s", usage); fprintf(stderr, "%s", usage);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
@ -575,7 +582,7 @@ void render(struct render_data *render_data) {
const float TYPE_INDICATOR_BORDER_THICKNESS = M_PI / 128.0f; const float TYPE_INDICATOR_BORDER_THICKNESS = M_PI / 128.0f;
// Add visual indicator // Add visual indicator
if (render_data->auth_state != AUTH_STATE_IDLE) { if (show_indicator && render_data->auth_state != AUTH_STATE_IDLE) {
// Draw circle // Draw circle
cairo_set_line_width(window->cairo, ARC_THICKNESS); cairo_set_line_width(window->cairo, ARC_THICKNESS);
cairo_arc(window->cairo, window->width/2, window->height/2, ARC_RADIUS, 0, 2 * M_PI); cairo_arc(window->cairo, window->width/2, window->height/2, ARC_RADIUS, 0, 2 * M_PI);

View file

@ -35,6 +35,9 @@ Options
*-t, --tiling*:: *-t, --tiling*::
Same as --scaling=tile. Same as --scaling=tile.
*-u, --no-unlock-indicator*::
Disable the unlock indicator.
*-v, \--version*:: *-v, \--version*::
Show the version number and quit. Show the version number and quit.