~proycon/wvkbd

ba778478e67bd675e39cd5b25e970c6cc6037eeb — Maarten van Gompel a month ago d423720
added -R parameter to configure rounding
2 files changed, 16 insertions(+), 2 deletions(-)

M config.def.h
M main.c
M config.def.h => config.def.h +3 -2
@@ 2,6 2,7 @@
#define config_def_h_INCLUDED

#define DEFAULT_FONT "Sans 14"
#define DEFAULT_ROUNDING 5
static const int transparency = 255;

struct clr_scheme schemes[] = {


@@ 13,7 14,7 @@ struct clr_scheme schemes[] = {
  .swipe = {.bgra = {100, 255, 100, 64}},
  .text = {.color = UINT32_MAX},
  .font = DEFAULT_FONT,
  .rounding = 5,
  .rounding = DEFAULT_ROUNDING,
},
{
  /* colors */


@@ 23,7 24,7 @@ struct clr_scheme schemes[] = {
  .swipe = {.bgra = {100, 255, 100, 64}},
  .text = {.color = UINT32_MAX},
  .font = DEFAULT_FONT,
  .rounding = 5,
  .rounding = DEFAULT_ROUNDING,
}
};


M main.c => main.c +13 -0
@@ 76,6 76,7 @@ static int cur_x = -1, cur_y = -1;
static bool cur_press = false;
static struct kbd keyboard;
static uint32_t height, normal_height, landscape_height;
static int rounding = DEFAULT_ROUNDING;
static bool hidden = false;

/* event handler prototypes */


@@ 680,6 681,7 @@ usage(char *argv0)
            "  -O          - Print intersected keys to standard output\n");
    fprintf(stderr, "  -H [int]    - Height in pixels\n");
    fprintf(stderr, "  -L [int]    - Landscape height in pixels\n");
    fprintf(stderr, "  -R [int]    - Rounding radius in pixels\n");
    fprintf(stderr, "  --fn [font] - Set font (e.g: DejaVu Sans 20)\n");
    fprintf(stderr, "  --hidden    - Start hidden (send SIGUSR2 to show)\n");
    fprintf(


@@ 948,6 950,12 @@ main(int argc, char **argv)
                exit(1);
            }
            height = landscape_height = atoi(argv[++i]);
        } else if (!strcmp(argv[i], "-R")) {
            if (i >= argc - 1) {
                usage(argv[0]);
                exit(1);
            }
            rounding = atoi(argv[++i]);
        } else if (!strcmp(argv[i], "-D")) {
            keyboard.debug = true;
        } else if ((!strcmp(argv[i], "-fn")) || (!strcmp(argv[i], "--fn"))) {


@@ 988,6 996,11 @@ main(int argc, char **argv)
            schemes[i].font = fc_font_pattern;
    }

    if (rounding != DEFAULT_ROUNDING) {
        for (i = 0; i < countof(schemes); i++)
            schemes[i].rounding = rounding;
    }

    display = wl_display_connect(NULL);
    if (display == NULL) {
        die("Failed to create display\n");