Hello community,

here is the log from the commit of package swaylock for openSUSE:Factory 
checked in at 2019-05-24 11:31:35
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/swaylock (Old)
 and      /work/SRC/openSUSE:Factory/.swaylock.new.5148 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "swaylock"

Fri May 24 11:31:35 2019 rev:2 rq:704916 version:1.4

Changes:
--------
--- /work/SRC/openSUSE:Factory/swaylock/swaylock.changes        2019-02-25 
18:00:56.614102553 +0100
+++ /work/SRC/openSUSE:Factory/.swaylock.new.5148/swaylock.changes      
2019-05-24 11:31:38.661402459 +0200
@@ -1,0 +2,17 @@
+Thu May 23 06:07:09 UTC 2019 - mvet...@suse.com
+
+- Update to 1.4:
+  * Decouple the drawing of the background from drawing the indicator.
+  * Allow spaces in image file path
+  * Display xkb layout while typing
+  * Submit password by pressing Ctrl+m (close #75)
+  * Fix lock indicator position on hidpi screens.
+  * Do not exit if no outputs are present
+  * Fix minor typo in man page
+  * Set version in project file
+  * Added hide keyboard layout option
+  * Described hide-keyboard-layout option in swaylock.1.scd
+  * Fix --version when building from tarball
+- Update swaylock-version.patch
+
+-------------------------------------------------------------------

Old:
----
  1.3.tar.gz

New:
----
  1.4.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ swaylock.spec ++++++
--- /var/tmp/diff_new_pack.0Yrb3W/_old  2019-05-24 11:31:39.489402245 +0200
+++ /var/tmp/diff_new_pack.0Yrb3W/_new  2019-05-24 11:31:39.493402244 +0200
@@ -12,12 +12,12 @@
 # license that conforms to the Open Source Definition (Version 1.9)
 # published by the Open Source Initiative.
 
-# Please submit bugfixes or comments via https://bugs.opensuse.org/
+# Please submit bugfixes or comments via http://bugs.opensuse.org/
 #
 
 
 Name:           swaylock
-Version:        1.3
+Version:        1.4
 Release:        0
 Summary:        Screen locker for Wayland
 License:        MIT
@@ -26,6 +26,7 @@
 Source0:        https://github.com/swaywm/swaylock/archive/%{version}.tar.gz
 Patch0:         swaylock-version.patch
 BuildRequires:  meson >= 0.48.0
+BuildRequires:  pam-devel
 BuildRequires:  pkgconfig
 BuildRequires:  scdoc
 BuildRequires:  pkgconfig(cairo)
@@ -33,7 +34,6 @@
 BuildRequires:  pkgconfig(wayland-client)
 BuildRequires:  pkgconfig(wayland-protocols) >= 1.14
 BuildRequires:  pkgconfig(xkbcommon)
-BuildRequires:  pam-devel
 Suggests:       %{name}-bash-completion
 Suggests:       %{name}-fish-completion
 Suggests:       %{name}-zsh-completion

++++++ 1.3.tar.gz -> 1.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/swaylock-1.3/include/swaylock.h 
new/swaylock-1.4/include/swaylock.h
--- old/swaylock-1.3/include/swaylock.h 2019-01-29 20:48:00.000000000 +0100
+++ new/swaylock-1.4/include/swaylock.h 2019-04-29 16:37:47.000000000 +0200
@@ -34,6 +34,9 @@
        uint32_t caps_lock_bs_highlight;
        uint32_t caps_lock_key_highlight;
        uint32_t separator;
+       uint32_t layout_background;
+       uint32_t layout_border;
+       uint32_t layout_text;
        struct swaylock_colorset inside;
        struct swaylock_colorset line;
        struct swaylock_colorset ring;
@@ -50,6 +53,8 @@
        bool show_indicator;
        bool show_caps_lock_text;
        bool show_caps_lock_indicator;
+       bool show_keyboard_layout;
+       bool hide_keyboard_layout;
        bool show_failed_attempts;
        bool daemonize;
 };
@@ -65,6 +70,7 @@
        struct loop_timer *clear_password_timer;  // clears the password buffer
        struct wl_display *display;
        struct wl_compositor *compositor;
+       struct wl_subcompositor *subcompositor;
        struct zwlr_layer_shell_v1 *layer_shell;
        struct zwlr_input_inhibit_manager_v1 *input_inhibit_manager;
        struct wl_shm *shm;
@@ -86,8 +92,11 @@
        uint32_t output_global_name;
        struct zxdg_output_v1 *xdg_output;
        struct wl_surface *surface;
+       struct wl_surface *child; // surface made into subsurface
+       struct wl_subsurface *subsurface;
        struct zwlr_layer_surface_v1 *layer_surface;
        struct pool_buffer buffers[2];
+       struct pool_buffer indicator_buffers[2];
        struct pool_buffer *current_buffer;
        bool frame_pending, dirty;
        uint32_t width, height;
@@ -107,6 +116,7 @@
 
 void swaylock_handle_key(struct swaylock_state *state,
                xkb_keysym_t keysym, uint32_t codepoint);
+void render_frame_background(struct swaylock_surface *surface);
 void render_frame(struct swaylock_surface *surface);
 void render_frames(struct swaylock_state *state);
 void damage_surface(struct swaylock_surface *surface);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/swaylock-1.3/main.c new/swaylock-1.4/main.c
--- old/swaylock-1.3/main.c     2019-01-29 20:48:00.000000000 +0100
+++ new/swaylock-1.4/main.c     2019-04-29 16:37:47.000000000 +0200
@@ -126,6 +126,12 @@
        surface->surface = wl_compositor_create_surface(state->compositor);
        assert(surface->surface);
 
+       surface->child = wl_compositor_create_surface(state->compositor);
+       assert(surface->child);
+       surface->subsurface = 
wl_subcompositor_get_subsurface(state->subcompositor, surface->child, 
surface->surface);
+       assert(surface->subsurface);
+       wl_subsurface_set_sync(surface->subsurface);
+
        surface->layer_surface = zwlr_layer_shell_v1_get_layer_surface(
                        state->layer_shell, surface->surface, surface->output,
                        ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY, "lockscreen");
@@ -163,6 +169,7 @@
        surface->width = width;
        surface->height = height;
        zwlr_layer_surface_v1_ack_configure(layer_surface, serial);
+       render_frame_background(surface);
        render_frame(surface);
 }
 
@@ -297,6 +304,9 @@
        if (strcmp(interface, wl_compositor_interface.name) == 0) {
                state->compositor = wl_registry_bind(registry, name,
                                &wl_compositor_interface, 3);
+       } else if (strcmp(interface, wl_subcompositor_interface.name) == 0) {
+               state->subcompositor = wl_registry_bind(registry, name,
+                               &wl_subcompositor_interface, 1);
        } else if (strcmp(interface, wl_shm_interface.name) == 0) {
                state->shm = wl_registry_bind(registry, name,
                                &wl_shm_interface, 1);
@@ -364,6 +374,23 @@
        return default_image;
 }
 
+static char *join_args(char **argv, int argc) {
+       assert(argc > 0);
+       int len = 0, i;
+       for (i = 0; i < argc; ++i) {
+               len += strlen(argv[i]) + 1;
+       }
+       char *res = malloc(len);
+       len = 0;
+       for (i = 0; i < argc; ++i) {
+               strcpy(res + len, argv[i]);
+               len += strlen(argv[i]);
+               res[len++] = ' ';
+       }
+       res[len - 1] = '\0';
+       return res;
+}
+
 static void load_image(char *arg, struct swaylock_state *state) {
        // [[<output>]:]<path>
        struct swaylock_image *image = calloc(1, sizeof(struct swaylock_image));
@@ -397,11 +424,19 @@
                }
        }
 
-       // Bash doesn't replace the ~ with $HOME if the output name is supplied
+       // The shell will not expand ~ to the value of $HOME when an output 
name is
+       // given. Also, any image paths given in the config file need to have 
shell
+       // expansions performed
        wordexp_t p;
+       while (strstr(image->path, "  ")) {
+               image->path = realloc(image->path, strlen(image->path) + 2);
+               char *ptr = strstr(image->path, "  ") + 1;
+               memmove(ptr + 1, ptr, strlen(ptr) + 1);
+               *ptr = '\\';
+       }
        if (wordexp(image->path, &p, 0) == 0) {
                free(image->path);
-               image->path = strdup(p.we_wordv[0]);
+               image->path = join_args(p.we_wordv, p.we_wordc);
                wordfree(&p);
        }
 
@@ -423,6 +458,9 @@
        colors->caps_lock_bs_highlight = 0xDB3300FF;
        colors->caps_lock_key_highlight = 0x33DB00FF;
        colors->separator = 0x000000FF;
+       colors->layout_background = 0x000000C0;
+       colors->layout_border = 0x00000000;
+       colors->layout_text = 0xFFFFFFFF;
        colors->inside = (struct swaylock_colorset){
                .input = 0x000000C0,
                .cleared = 0xE5A445C0,
@@ -474,6 +512,9 @@
                LO_INSIDE_VER_COLOR,
                LO_INSIDE_WRONG_COLOR,
                LO_KEY_HL_COLOR,
+               LO_LAYOUT_TXT_COLOR,
+               LO_LAYOUT_BG_COLOR,
+               LO_LAYOUT_BORDER_COLOR,
                LO_LINE_COLOR,
                LO_LINE_CLEAR_COLOR,
                LO_LINE_CAPS_LOCK_COLOR,
@@ -508,6 +549,8 @@
                {"scaling", required_argument, NULL, 's'},
                {"tiling", no_argument, NULL, 't'},
                {"no-unlock-indicator", no_argument, NULL, 'u'},
+               {"show-keyboard-layout", no_argument, NULL, 'k'},
+               {"hide-keyboard-layout", no_argument, NULL, 'K'},
                {"show-failed-attempts", no_argument, NULL, 'F'},
                {"version", no_argument, NULL, 'v'},
                {"bs-hl-color", required_argument, NULL, LO_BS_HL_COLOR},
@@ -522,6 +565,9 @@
                {"inside-ver-color", required_argument, NULL, 
LO_INSIDE_VER_COLOR},
                {"inside-wrong-color", required_argument, NULL, 
LO_INSIDE_WRONG_COLOR},
                {"key-hl-color", required_argument, NULL, LO_KEY_HL_COLOR},
+               {"layout-bg-color", required_argument, NULL, 
LO_LAYOUT_BG_COLOR},
+               {"layout-border-color", required_argument, NULL, 
LO_LAYOUT_BORDER_COLOR},
+               {"layout-text-color", required_argument, NULL, 
LO_LAYOUT_TXT_COLOR},
                {"line-color", required_argument, NULL, LO_LINE_COLOR},
                {"line-clear-color", required_argument, NULL, 
LO_LINE_CLEAR_COLOR},
                {"line-caps-lock-color", required_argument, NULL, 
LO_LINE_CAPS_LOCK_COLOR},
@@ -552,12 +598,18 @@
                        "Enable debugging output.\n"
                "  -e, --ignore-empty-password      "
                        "When an empty password is provided, do not validate 
it.\n"
+               "  -F, --show-failed-attempts       "
+                       "Show current count of failed authentication 
attempts.\n"
                "  -f, --daemonize                  "
                        "Detach from the controlling terminal after locking.\n"
                "  -h, --help                       "
                        "Show help message and quit.\n"
                "  -i, --image [[<output>]:]<path>  "
                        "Display the given image.\n"
+               "  -k, --show-keyboard-layout       "
+                       "Display the current xkb layout while typing.\n"
+               "  -K, --hide-keyboard-layout       "
+                       "Hide the current xkb layout while typing.\n"
                "  -L, --disable-caps-lock-text     "
                        "Disable the Caps Lock text.\n"
                "  -l, --indicator-caps-lock        "
@@ -568,8 +620,6 @@
                        "Same as --scaling=tile.\n"
                "  -u, --no-unlock-indicator        "
                        "Disable the unlock indicator.\n"
-               "  -F, --show-failed-attempts       "
-                       "Show current count of failed authentication 
attempts.\n"
                "  -v, --version                    "
                        "Show the version number and quit.\n"
                "  --bs-hl-color <color>            "
@@ -599,6 +649,12 @@
                        "Sets the color of the inside of the indicator when 
invalid.\n"
                "  --key-hl-color <color>           "
                        "Sets the color of the key press highlight segments.\n"
+               "  --layout-bg-color <color>        "
+                       "Sets the background color of the box containing the 
layout text.\n"
+               "  --layout-border-color <color>    "
+                       "Sets the color of the border of the box containing the 
layout text.\n"
+               "  --layout-text-color <color>      "
+                       "Sets the color of the layout text.\n"
                "  --line-color <color>             "
                        "Sets the color of the line between the inside and 
ring.\n"
                "  --line-clear-color <color>       "
@@ -647,7 +703,7 @@
        optind = 1;
        while (1) {
                int opt_idx = 0;
-               c = getopt_long(argc, argv, "c:deFfhi:Llnrs:tuvC:", 
long_options,
+               c = getopt_long(argc, argv, "c:deFfhi:kKLlnrs:tuvC:", 
long_options,
                                &opt_idx);
                if (c == -1) {
                        break;
@@ -671,6 +727,11 @@
                                state->args.ignore_empty = true;
                        }
                        break;
+               case 'F':
+                       if (state) {
+                               state->args.show_failed_attempts = true;
+                       }
+                       break;
                case 'f':
                        if (state) {
                                state->args.daemonize = true;
@@ -681,6 +742,16 @@
                                load_image(optarg, state);
                        }
                        break;
+               case 'k':
+                       if (state) {
+                               state->args.show_keyboard_layout = true;
+                       }
+                       break;
+               case 'K':
+                       if (state) {
+                               state->args.hide_keyboard_layout = true;
+                       }
+                       break;
                case 'L':
                        if (state) {
                                state->args.show_caps_lock_text = false;
@@ -719,11 +790,6 @@
                                state->args.show_indicator = false;
                        }
                        break;
-               case 'F':
-                       if (state) {
-                               state->args.show_failed_attempts = true;
-                       }
-                       break;
                case 'v':
                        fprintf(stdout, "swaylock version " SWAYLOCK_VERSION 
"\n");
                        exit(EXIT_SUCCESS);
@@ -789,6 +855,21 @@
                                state->args.colors.key_highlight = 
parse_color(optarg);
                        }
                        break;
+               case LO_LAYOUT_BG_COLOR:
+                       if (state) {
+                               state->args.colors.layout_background = 
parse_color(optarg);
+                       }
+                       break;
+               case LO_LAYOUT_BORDER_COLOR:
+                       if (state) {
+                               state->args.colors.layout_border = 
parse_color(optarg);
+                       }
+                       break;
+               case LO_LAYOUT_TXT_COLOR:
+                       if (state) {
+                               state->args.colors.layout_text = 
parse_color(optarg);
+                       }
+                       break;
                case LO_LINE_COLOR:
                        if (state) {
                                state->args.colors.line.input = 
parse_color(optarg);
@@ -989,6 +1070,8 @@
                .show_indicator = true,
                .show_caps_lock_indicator = false,
                .show_caps_lock_text = true,
+               .show_keyboard_layout = false,
+               .hide_keyboard_layout = false,
                .show_failed_attempts = false
        };
        wl_list_init(&state.images);
@@ -1059,12 +1142,6 @@
                return 1;
        }
 
-       if (wl_list_empty(&state.surfaces)) {
-               free(state.args.font);
-               swaylock_log(LOG_ERROR, "Exiting - no outputs to show on.");
-               return 0;
-       }
-
        
zwlr_input_inhibit_manager_v1_get_inhibitor(state.input_inhibit_manager);
        if (wl_display_roundtrip(state.display) == -1) {
                free(state.args.font);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/swaylock-1.3/meson.build new/swaylock-1.4/meson.build
--- old/swaylock-1.3/meson.build        2019-01-29 20:48:00.000000000 +0100
+++ new/swaylock-1.4/meson.build        2019-04-29 16:37:47.000000000 +0200
@@ -1,6 +1,7 @@
 project(
        'swaylock',
        'c',
+       version: '1.3',
        license: 'MIT',
        meson_version: '>=0.48.0',
        default_options: [
@@ -47,17 +48,13 @@
 scdoc = find_program('scdoc', required: get_option('man-pages'))
 wayland_scanner = find_program('wayland-scanner')
 
-version = get_option('swaylock-version')
-if version != ''
-       version = '"@0@"'.format(version)
-else
-       if not git.found()
-               error('git is required to make the version string')
+version = '"@0@"'.format(meson.project_version())
+if git.found()
+       git_commit_hash = run_command([git.path(), 'describe', '--always', 
'--tags'])
+       git_branch = run_command([git.path(), 'rev-parse', '--abbrev-ref', 
'HEAD'])
+       if git_commit_hash.returncode() == 0 and git_branch.returncode() == 0
+               version = '"@0@ (" __DATE__ ", branch 
\'@1@\')"'.format(git_commit_hash.stdout().strip(), git_branch.stdout().strip())
        endif
-
-       git_commit_hash = run_command([git.path(), 'describe', '--always', 
'--tags']).stdout().strip()
-       git_branch = run_command([git.path(), 'rev-parse', '--abbrev-ref', 
'HEAD']).stdout().strip()
-       version = '"@0@ (" __DATE__ ", branch 
\'@1@\')"'.format(git_commit_hash, git_branch)
 endif
 add_project_arguments('-DSWAYLOCK_VERSION=@0@'.format(version), language: 'c')
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/swaylock-1.3/meson_options.txt 
new/swaylock-1.4/meson_options.txt
--- old/swaylock-1.3/meson_options.txt  2019-01-29 20:48:00.000000000 +0100
+++ new/swaylock-1.4/meson_options.txt  2019-04-29 16:37:47.000000000 +0200
@@ -1,4 +1,3 @@
-option('swaylock-version', type : 'string', description: 'The version string 
reported in `swaylock --version`')
 option('pam', type: 'feature', value: 'auto', description: 'Use PAM instead of 
shadow')
 option('gdk-pixbuf', type: 'feature', value: 'auto', description: 'Enable 
support for more image formats')
 option('man-pages', type: 'feature', value: 'auto', description: 'Generate and 
install man pages')
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/swaylock-1.3/password.c new/swaylock-1.4/password.c
--- old/swaylock-1.3/password.c 2019-01-29 20:48:00.000000000 +0100
+++ new/swaylock-1.4/password.c 2019-04-29 16:37:47.000000000 +0200
@@ -137,6 +137,7 @@
                schedule_indicator_clear(state);
                schedule_password_clear(state);
                break;
+       case XKB_KEY_m: /* fallthrough */
        case XKB_KEY_d:
                if (state->xkb.control) {
                        submit_password(state);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/swaylock-1.3/render.c new/swaylock-1.4/render.c
--- old/swaylock-1.3/render.c   2019-01-29 20:48:00.000000000 +0100
+++ new/swaylock-1.4/render.c   2019-04-29 16:37:47.000000000 +0200
@@ -32,7 +32,7 @@
        }
 }
 
-void render_frame(struct swaylock_surface *surface) {
+void render_frame_background(struct swaylock_surface *surface) {
        struct swaylock_state *state = surface->state;
 
        int buffer_width = surface->width * surface->scale;
@@ -49,13 +49,6 @@
 
        cairo_t *cairo = surface->current_buffer->cairo;
        cairo_set_antialias(cairo, CAIRO_ANTIALIAS_BEST);
-       cairo_font_options_t *fo = cairo_font_options_create();
-       cairo_font_options_set_hint_style(fo, CAIRO_HINT_STYLE_FULL);
-       cairo_font_options_set_antialias(fo, CAIRO_ANTIALIAS_SUBPIXEL);
-       cairo_font_options_set_subpixel_order(fo, 
to_cairo_subpixel_order(surface->subpixel));
-       cairo_set_font_options(cairo, fo);
-       cairo_font_options_destroy(fo);
-       cairo_identity_matrix(cairo);
 
        cairo_save(cairo);
        cairo_set_operator(cairo, CAIRO_OPERATOR_SOURCE);
@@ -64,20 +57,64 @@
        if (surface->image && state->args.mode != BACKGROUND_MODE_SOLID_COLOR) {
                cairo_set_operator(cairo, CAIRO_OPERATOR_OVER);
                render_background_image(cairo, surface->image,
-                               state->args.mode, buffer_width, buffer_height);
+                       state->args.mode, buffer_width, buffer_height);
        }
        cairo_restore(cairo);
        cairo_identity_matrix(cairo);
 
+       wl_surface_set_buffer_scale(surface->surface, surface->scale);
+       wl_surface_attach(surface->surface, surface->current_buffer->buffer, 0, 
0);
+       wl_surface_damage(surface->surface, 0, 0, surface->width, 
surface->height);
+       wl_surface_commit(surface->surface);
+}
+
+void render_frame(struct swaylock_surface *surface) {
+       struct swaylock_state *state = surface->state;
+
        int arc_radius = state->args.radius * surface->scale;
        int arc_thickness = state->args.thickness * surface->scale;
+       int buffer_diameter = (arc_radius + arc_thickness) * 2;
+       int buffer_height = buffer_diameter * 2;
+
+       int indicator_radius = state->args.radius + state->args.thickness;
+       int subsurf_xpos = surface->width / 2 - indicator_radius;
+       int subsurf_ypos = surface->height / 2 - indicator_radius;
+       wl_subsurface_set_position(surface->subsurface, subsurf_xpos, 
subsurf_ypos);
+
+       surface->current_buffer = get_next_buffer(state->shm,
+                       surface->indicator_buffers, buffer_diameter, 
buffer_height);
+       if (surface->current_buffer == NULL) {
+               return;
+       }
+
+       // Hide subsurface until we want it visible
+       wl_surface_attach(surface->child, NULL, 0, 0);
+       wl_surface_commit(surface->child);
+
+       cairo_t *cairo = surface->current_buffer->cairo;
+       cairo_set_antialias(cairo, CAIRO_ANTIALIAS_BEST);
+       cairo_font_options_t *fo = cairo_font_options_create();
+       cairo_font_options_set_hint_style(fo, CAIRO_HINT_STYLE_FULL);
+       cairo_font_options_set_antialias(fo, CAIRO_ANTIALIAS_SUBPIXEL);
+       cairo_font_options_set_subpixel_order(fo, 
to_cairo_subpixel_order(surface->subpixel));
+       cairo_set_font_options(cairo, fo);
+       cairo_font_options_destroy(fo);
+       cairo_identity_matrix(cairo);
+
+       // Clear
+       cairo_save(cairo);
+       cairo_set_source_rgba(cairo, 0, 0, 0, 0);
+       cairo_set_operator(cairo, CAIRO_OPERATOR_SOURCE);
+       cairo_paint(cairo);
+       cairo_restore(cairo);
+
        float type_indicator_border_thickness =
                TYPE_INDICATOR_BORDER_THICKNESS * surface->scale;
 
        if (state->args.show_indicator && state->auth_state != AUTH_STATE_IDLE) 
{
                // Draw circle
                cairo_set_line_width(cairo, arc_thickness);
-               cairo_arc(cairo, buffer_width / 2, buffer_height / 2, 
arc_radius,
+               cairo_arc(cairo, buffer_diameter / 2, buffer_diameter / 2, 
arc_radius,
                                0, 2 * M_PI);
                set_color_for_state(cairo, state, &state->args.colors.inside);
                cairo_fill_preserve(cairo);
@@ -86,6 +123,7 @@
 
                // Draw a message
                char *text = NULL;
+               const char *layout_text = NULL;
                char attempts[4]; // like i3lock: count no more than 999
                set_color_for_state(cairo, state, &state->args.colors.text);
                cairo_select_font_face(cairo, state->args.font,
@@ -116,6 +154,21 @@
                                        text = attempts;
                                }
                        }
+
+                       xkb_layout_index_t num_layout = 
xkb_keymap_num_layouts(state->xkb.keymap);
+                       if (!state->args.hide_keyboard_layout && 
+                                       (state->args.show_keyboard_layout || 
num_layout > 1)) {
+                               xkb_layout_index_t curr_layout = 0;
+
+                               // advance to the first active layout (if any)
+                               while (curr_layout < num_layout &&
+                                       
xkb_state_layout_index_is_active(state->xkb.state,
+                                               curr_layout, 
XKB_STATE_LAYOUT_EFFECTIVE) != 1) {
+                                       ++curr_layout;
+                               }
+                               // will handle invalid index if none are active
+                               layout_text = 
xkb_keymap_layout_get_name(state->xkb.keymap, curr_layout);
+                       }
                        break;
                default:
                        break;
@@ -127,9 +180,9 @@
                        double x, y;
                        cairo_text_extents(cairo, text, &extents);
                        cairo_font_extents(cairo, &fe);
-                       x = (buffer_width / 2) -
+                       x = (buffer_diameter / 2) -
                                (extents.width / 2 + extents.x_bearing);
-                       y = (buffer_height / 2) +
+                       y = (buffer_diameter / 2) +
                                (fe.height / 2 - fe.descent);
 
                        cairo_move_to(cairo, x, y);
@@ -144,7 +197,7 @@
                        static double highlight_start = 0;
                        highlight_start +=
                                (rand() % (int)(M_PI * 100)) / 100.0 + M_PI * 
0.5;
-                       cairo_arc(cairo, buffer_width / 2, buffer_height / 2,
+                       cairo_arc(cairo, buffer_diameter / 2, buffer_diameter / 
2,
                                        arc_radius, highlight_start,
                                        highlight_start + TYPE_INDICATOR_RANGE);
                        if (state->auth_state == AUTH_STATE_INPUT) {
@@ -164,12 +217,12 @@
 
                        // Draw borders
                        cairo_set_source_u32(cairo, 
state->args.colors.separator);
-                       cairo_arc(cairo, buffer_width / 2, buffer_height / 2,
+                       cairo_arc(cairo, buffer_diameter / 2, buffer_diameter / 
2,
                                        arc_radius, highlight_start,
                                        highlight_start + 
type_indicator_border_thickness);
                        cairo_stroke(cairo);
 
-                       cairo_arc(cairo, buffer_width / 2, buffer_height / 2,
+                       cairo_arc(cairo, buffer_diameter / 2, buffer_diameter / 
2,
                                        arc_radius, highlight_start + 
TYPE_INDICATOR_RANGE,
                                        highlight_start + TYPE_INDICATOR_RANGE +
                                                
type_indicator_border_thickness);
@@ -179,17 +232,52 @@
                // Draw inner + outer border of the circle
                set_color_for_state(cairo, state, &state->args.colors.line);
                cairo_set_line_width(cairo, 2.0 * surface->scale);
-               cairo_arc(cairo, buffer_width / 2, buffer_height / 2,
+               cairo_arc(cairo, buffer_diameter / 2, buffer_diameter / 2,
                                arc_radius - arc_thickness / 2, 0, 2 * M_PI);
                cairo_stroke(cairo);
-               cairo_arc(cairo, buffer_width / 2, buffer_height / 2,
+               cairo_arc(cairo, buffer_diameter / 2, buffer_diameter / 2,
                                arc_radius + arc_thickness / 2, 0, 2 * M_PI);
                cairo_stroke(cairo);
+
+               // display layout text seperately
+               if (layout_text) {
+                       cairo_text_extents_t extents;
+                       cairo_font_extents_t fe;
+                       double x, y;
+                       double box_padding = 4.0 * surface->scale;
+                       cairo_text_extents(cairo, layout_text, &extents);
+                       cairo_font_extents(cairo, &fe);
+                       // upper left coordinates for box
+                       x = (buffer_diameter / 2) - (extents.width / 2) - 
box_padding;
+                       y = (buffer_diameter / 2) + arc_radius + 
arc_thickness/2 +
+                               box_padding; // use box_padding also as gap to 
indicator
+
+                       // background box
+                       cairo_rectangle(cairo, x, y,
+                               extents.width + 2.0 * box_padding,
+                               fe.height + 2.0 * box_padding);
+                       cairo_set_source_u32(cairo, 
state->args.colors.layout_background);
+                       cairo_fill_preserve(cairo);
+                       // border
+                       cairo_set_source_u32(cairo, 
state->args.colors.layout_border);
+                       cairo_stroke(cairo);
+                       cairo_new_sub_path(cairo);
+
+                       // take font extents and padding into account
+                       cairo_move_to(cairo,
+                               x - extents.x_bearing + box_padding,
+                               y + (fe.height - fe.descent) + box_padding);
+                       cairo_set_source_u32(cairo, 
state->args.colors.layout_text);
+                       cairo_show_text(cairo, layout_text);
+                       cairo_new_sub_path(cairo);
+               }
        }
 
-       wl_surface_set_buffer_scale(surface->surface, surface->scale);
-       wl_surface_attach(surface->surface, surface->current_buffer->buffer, 0, 
0);
-       wl_surface_damage(surface->surface, 0, 0, surface->width, 
surface->height);
+       wl_surface_set_buffer_scale(surface->child, surface->scale);
+       wl_surface_attach(surface->child, surface->current_buffer->buffer, 0, 
0);
+       wl_surface_damage(surface->child, 0, 0, surface->current_buffer->width, 
surface->current_buffer->height);
+       wl_surface_commit(surface->child);
+
        wl_surface_commit(surface->surface);
 }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/swaylock-1.3/swaylock.1.scd 
new/swaylock-1.4/swaylock.1.scd
--- old/swaylock-1.3/swaylock.1.scd     2019-01-29 20:48:00.000000000 +0100
+++ new/swaylock-1.4/swaylock.1.scd     2019-04-29 16:37:47.000000000 +0200
@@ -27,6 +27,9 @@
 *-e, --ignore-empty-password*
        When an empty password is provided by the user, do not validate it.
 
+*-F, --show-failed-attempts*
+       Show the number of failed authentication attempts on the indicator.
+
 *-f, --daemonize*
        Detach from the controlling terminal after locking.
 
@@ -48,15 +51,20 @@
        a background color. If the path potentially contains a ':', prefix it 
with another
        ':' to prevent interpreting part of it as <output>.
 
+*-k, --show-keyboard-layout*
+       Force displaying the current xkb layout while typing, even if only one 
layout
+       is configured.
+
+*-K, --hide-keyboard-layout*
+       Force hiding the current xkb layout while typing, even if more than one 
layout
+       is configured or the show-keyboard-layout option is set.
+
 *-L, --disable-caps-lock-text*
        Disable the Caps Lock Text.
 
 *-l, --indicator-caps-lock*
        Show the current Caps Lock state also on the indicator.
 
-*-F, --show-failed-attempts*
-       Show the number of failed authentication attempts on the indicator.
-
 *-s, --scaling*
        Scaling mode for images: _stretch_, _fill_, _fit_, _center_, or _tile_. 
Use
        the additional mode _solid\_color_ to display only the background 
color, even
@@ -75,7 +83,7 @@
 *--caps-lock-bs-hl-color* <rrggbb[aa]>
        Sets the color of backspace highlight segments when Caps Lock is active.
 
-*--caps-lock-bs-hl-color* <rrggbb[aa]>
+*--caps-lock-key-hl-color* <rrggbb[aa]>
        Sets the color of the key press highlight segments when Caps Lock is 
active.
 
 *--font* <font>
@@ -107,6 +115,15 @@
 *--key-hl-color* <rrggbb[aa]>
        Sets the color of key press highlight segments.
 
+*--layout-bg-color* <rrggbb[aa]>
+       Sets the background color of the box containing the layout text.
+
+*--layout-border-color* <rrggbb[aa]>
+       Sets the color of the border of the box containing the layout text.
+
+*--layout-text-color* <rrggbb[aa]>
+       Sets the color of the layout text.
+
 *--line-color* <rrggbb[aa]>
        Sets the color of the lines that separate the inside and outside of the
        indicator when typing or idle.

++++++ swaylock-version.patch ++++++
--- /var/tmp/diff_new_pack.0Yrb3W/_old  2019-05-24 11:31:39.629402210 +0200
+++ /var/tmp/diff_new_pack.0Yrb3W/_new  2019-05-24 11:31:39.633402209 +0200
@@ -1,28 +1,12 @@
-diff -urEbwB swaylock-1.3/meson.build swaylock-1.3.new/meson.build
---- swaylock-1.3/meson.build   2019-01-29 20:48:00.000000000 +0100
-+++ swaylock-1.3.new/meson.build       2019-02-05 14:00:08.728822898 +0100
-@@ -1,6 +1,7 @@
+diff -urEbwB swaylock-1.4/meson.build swaylock-1.4.new/meson.build
+--- swaylock-1.4/meson.build   2019-04-29 16:37:47.000000000 +0200
++++ swaylock-1.4.new/meson.build       2019-05-23 08:09:39.276483783 +0200
+@@ -1,7 +1,7 @@
  project(
        'swaylock',
        'c',
-+      version: '1.3',
+-      version: '1.3',
++      version: '1.4',
        license: 'MIT',
        meson_version: '>=0.48.0',
        default_options: [
-@@ -47,14 +48,9 @@
- scdoc = find_program('scdoc', required: get_option('man-pages'))
- wayland_scanner = find_program('wayland-scanner')
- 
--version = get_option('swaylock-version')
--if version != ''
--      version = '"@0@"'.format(version)
--else
-       if not git.found()
--              error('git is required to make the version string')
--      endif
--
-+      version = '"@0@"'.format(meson.project_version())
-+else
-       git_commit_hash = run_command([git.path(), 'describe', '--always', 
'--tags']).stdout().strip()
-       git_branch = run_command([git.path(), 'rev-parse', '--abbrev-ref', 
'HEAD']).stdout().strip()
-       version = '"@0@ (" __DATE__ ", branch 
\'@1@\')"'.format(git_commit_hash, git_branch)


Reply via email to