mirror of
https://github.com/jjsullivan5196/wvkbd.git
synced 2025-07-13 14:34:36 +02:00
Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
3cccdab2e8 | |||
2d01b8963b | |||
c457d697aa | |||
5471e2ea0e | |||
a126945401 | |||
aa9e8ab7ab | |||
d6439afcb9 | |||
6e52be343d | |||
aaff22a105 | |||
ab56a2748b | |||
7ff5605303 | |||
02027621af | |||
63c209ec7f |
12
config.def.h
12
config.def.h
@ -1,24 +1,28 @@
|
||||
#ifndef config_def_h_INCLUDED
|
||||
#define config_def_h_INCLUDED
|
||||
|
||||
static const char *default_font = "Sans 14";
|
||||
#define DEFAULT_FONT "Sans 14"
|
||||
static const int transparency = 255;
|
||||
|
||||
struct clr_scheme scheme = {
|
||||
struct clr_scheme schemes[] = {
|
||||
{
|
||||
/* colors */
|
||||
.bg = {.bgra = {15, 15, 15, transparency}},
|
||||
.fg = {.bgra = {45, 45, 45, transparency}},
|
||||
.high = {.bgra = {100, 100, 100, transparency}},
|
||||
.swipe = {.bgra = {100, 255, 100, 64}},
|
||||
.text = {.color = UINT32_MAX},
|
||||
};
|
||||
struct clr_scheme scheme1 = {
|
||||
.font = DEFAULT_FONT,
|
||||
},
|
||||
{
|
||||
/* colors */
|
||||
.bg = {.bgra = {15, 15, 15, transparency}},
|
||||
.fg = {.bgra = {32, 32, 32, transparency}},
|
||||
.high = {.bgra = {100, 100, 100, transparency}},
|
||||
.swipe = {.bgra = {100, 255, 100, 64}},
|
||||
.text = {.color = UINT32_MAX},
|
||||
.font = DEFAULT_FONT,
|
||||
}
|
||||
};
|
||||
|
||||
/* layers is an ordered list of layouts, used to cycle through */
|
||||
|
@ -1,4 +1,4 @@
|
||||
VERSION = 0.14
|
||||
VERSION = 0.14.2
|
||||
CFLAGS = -DVERSION=\"$(VERSION)\" -D_XOPEN_SOURCE=700
|
||||
PREFIX = /usr/local
|
||||
MANPREFIX = ${PREFIX}/share/man
|
||||
|
7
drw.c
7
drw.c
@ -30,11 +30,14 @@ drwsurf_flip(struct drwsurf *ds)
|
||||
|
||||
void
|
||||
drw_draw_text(struct drwsurf *d, Color color, uint32_t x, uint32_t y,
|
||||
uint32_t w, uint32_t h, uint32_t b, const char *label)
|
||||
uint32_t w, uint32_t h, uint32_t b, const char *label,
|
||||
PangoFontDescription *font_description)
|
||||
{
|
||||
|
||||
cairo_save(d->cairo);
|
||||
|
||||
pango_layout_set_font_description(d->layout, font_description);
|
||||
|
||||
cairo_set_source_rgba(
|
||||
d->cairo, color.bgra[2] / (double)255, color.bgra[1] / (double)255,
|
||||
color.bgra[0] / (double)255, color.bgra[3] / (double)255);
|
||||
@ -134,8 +137,6 @@ setup_buffer(struct drwsurf *drwsurf)
|
||||
cairo_scale(drwsurf->cairo, drwsurf->scale, drwsurf->scale);
|
||||
cairo_set_antialias(drwsurf->cairo, CAIRO_ANTIALIAS_NONE);
|
||||
drwsurf->layout = pango_cairo_create_layout(drwsurf->cairo);
|
||||
pango_layout_set_font_description(drwsurf->layout,
|
||||
drwsurf->ctx->font_description);
|
||||
pango_layout_set_auto_dir(drwsurf->layout, false);
|
||||
cairo_save(drwsurf->cairo);
|
||||
|
||||
|
4
drw.h
4
drw.h
@ -6,7 +6,6 @@
|
||||
|
||||
struct drw {
|
||||
struct wl_shm *shm;
|
||||
PangoFontDescription *font_description;
|
||||
};
|
||||
struct drwsurf {
|
||||
uint32_t width, height, size;
|
||||
@ -41,7 +40,8 @@ void drw_over_rectangle(struct drwsurf *d, Color color, uint32_t x, uint32_t y,
|
||||
uint32_t w, uint32_t h);
|
||||
|
||||
void drw_draw_text(struct drwsurf *d, Color color, uint32_t x, uint32_t y,
|
||||
uint32_t w, uint32_t h, uint32_t b, const char *label);
|
||||
uint32_t w, uint32_t h, uint32_t b, const char *label,
|
||||
PangoFontDescription *font_description);
|
||||
|
||||
uint32_t setup_buffer(struct drwsurf *drwsurf);
|
||||
|
||||
|
12
keyboard.c
12
keyboard.c
@ -555,8 +555,7 @@ kbd_draw_key(struct kbd *kb, struct key *k, enum key_draw_type type)
|
||||
if (kb->debug)
|
||||
fprintf(stderr, "Draw key +%d+%d %dx%d -> %s\n", k->x, k->y, k->w, k->h,
|
||||
label);
|
||||
struct clr_scheme *scheme =
|
||||
(k->scheme == 0) ? &(kb->scheme) : &(kb->scheme1);
|
||||
struct clr_scheme *scheme = &kb->schemes[k->scheme];
|
||||
|
||||
switch (type) {
|
||||
case None:
|
||||
@ -575,7 +574,7 @@ kbd_draw_key(struct kbd *kb, struct key *k, enum key_draw_type type)
|
||||
}
|
||||
|
||||
drw_draw_text(kb->surf, scheme->text, k->x, k->y, k->w, k->h,
|
||||
KBD_KEY_BORDER, label);
|
||||
KBD_KEY_BORDER, label, scheme->font_description);
|
||||
wl_surface_damage(kb->surf->surf, k->x, k->y, k->w, k->h);
|
||||
|
||||
if (type == Press || type == Unpress) {
|
||||
@ -586,12 +585,13 @@ kbd_draw_key(struct kbd *kb, struct key *k, enum key_draw_type type)
|
||||
kb->last_popup_w = k->w;
|
||||
kb->last_popup_h = k->h;
|
||||
|
||||
drw_fill_rectangle(kb->popup_surf, kb->scheme.bg, k->x,
|
||||
drw_fill_rectangle(kb->popup_surf, scheme->bg, k->x,
|
||||
kb->last_popup_y, k->w, k->h);
|
||||
draw_inset(kb->popup_surf, k->x, kb->last_popup_y, k->w, k->h,
|
||||
KBD_KEY_BORDER, scheme->high);
|
||||
drw_draw_text(kb->popup_surf, scheme->text, k->x, kb->last_popup_y,
|
||||
k->w, k->h, KBD_KEY_BORDER, label);
|
||||
k->w, k->h, KBD_KEY_BORDER, label,
|
||||
scheme->font_description);
|
||||
wl_surface_damage(kb->popup_surf->surf, k->x, kb->last_popup_y, k->w,
|
||||
k->h);
|
||||
}
|
||||
@ -605,7 +605,7 @@ kbd_draw_layout(struct kbd *kb)
|
||||
if (kb->debug)
|
||||
fprintf(stderr, "Draw layout\n");
|
||||
|
||||
drw_fill_rectangle(d, kb->scheme.bg, 0, 0, kb->w, kb->h);
|
||||
drw_fill_rectangle(d, kb->schemes[0].bg, 0, 0, kb->w, kb->h);
|
||||
|
||||
while (next_key->type != Last) {
|
||||
if ((next_key->type == Pad) || (next_key->type == EndRow)) {
|
||||
|
@ -54,6 +54,8 @@ struct clr_scheme {
|
||||
Color high;
|
||||
Color swipe;
|
||||
Color text;
|
||||
char *font;
|
||||
PangoFontDescription *font_description;
|
||||
};
|
||||
|
||||
struct key {
|
||||
@ -90,13 +92,13 @@ struct kbd {
|
||||
bool debug;
|
||||
|
||||
struct layout *layout;
|
||||
struct clr_scheme scheme;
|
||||
struct clr_scheme scheme1;
|
||||
struct clr_scheme *schemes;
|
||||
|
||||
bool print;
|
||||
bool print_intersect;
|
||||
uint32_t w, h;
|
||||
double scale, pending_scale;
|
||||
double scale;
|
||||
double preferred_scale, preferred_fractional_scale;
|
||||
bool landscape;
|
||||
uint8_t mods;
|
||||
uint8_t compose;
|
||||
|
149
main.c
149
main.c
@ -3,6 +3,7 @@
|
||||
#include "proto/xdg-shell-client-protocol.h"
|
||||
#include "proto/fractional-scale-v1-client-protocol.h"
|
||||
#include "proto/viewporter-client-protocol.h"
|
||||
#include <errno.h>
|
||||
#include <linux/input-event-codes.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -23,6 +24,9 @@
|
||||
fprintf(stderr, __VA_ARGS__); \
|
||||
exit(1)
|
||||
|
||||
/* array size */
|
||||
#define countof(x) (sizeof(x) / sizeof(*x))
|
||||
|
||||
/* client state */
|
||||
static const char *namespace = "wlroots";
|
||||
static struct wl_display *display;
|
||||
@ -123,7 +127,7 @@ static void layer_surface_configure(void *data,
|
||||
uint32_t serial, uint32_t w, uint32_t h);
|
||||
static void layer_surface_closed(void *data,
|
||||
struct zwlr_layer_surface_v1 *surface);
|
||||
static void resize();
|
||||
static void flip_landscape();
|
||||
|
||||
/* event handlers */
|
||||
static const struct wl_pointer_listener pointer_listener = {
|
||||
@ -338,14 +342,22 @@ void
|
||||
wl_surface_enter(void *data, struct wl_surface *wl_surface,
|
||||
struct wl_output *wl_output)
|
||||
{
|
||||
for (int i = 0; i < WL_OUTPUTS_LIMIT; i += 1) {
|
||||
struct Output *old_output = current_output;
|
||||
for (int i = 0; i < wl_outputs_size; i += 1) {
|
||||
if (wl_outputs[i].data == wl_output) {
|
||||
current_output = &wl_outputs[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (current_output == old_output) {
|
||||
return;
|
||||
}
|
||||
|
||||
resize();
|
||||
keyboard.preferred_scale = current_output->scale;
|
||||
|
||||
flip_landscape();
|
||||
kbd_resize(&keyboard, layouts, NumLayouts);
|
||||
drwsurf_flip(&draw_surf);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -366,7 +378,7 @@ display_handle_geometry(void *data, struct wl_output *wl_output, int x, int y,
|
||||
output->h = physical_height;
|
||||
|
||||
if (current_output == output) {
|
||||
resize();
|
||||
flip_landscape();
|
||||
};
|
||||
}
|
||||
|
||||
@ -382,7 +394,8 @@ display_handle_scale(void *data, struct wl_output *wl_output, int32_t scale)
|
||||
output->scale = scale;
|
||||
|
||||
if (current_output == output) {
|
||||
resize();
|
||||
keyboard.preferred_scale = scale;
|
||||
flip_landscape();
|
||||
};
|
||||
}
|
||||
|
||||
@ -417,7 +430,7 @@ handle_global(void *data, struct wl_registry *registry, uint32_t name,
|
||||
wl_registry_bind(registry, name, &wl_compositor_interface, 3);
|
||||
} else if (strcmp(interface, wl_shm_interface.name) == 0) {
|
||||
draw_ctx.shm = wl_registry_bind(registry, name, &wl_shm_interface, 1);
|
||||
} else if (strcmp(interface, "wl_output") == 0) {
|
||||
} else if (strcmp(interface, wl_output_interface.name) == 0) {
|
||||
if (wl_outputs_size < WL_OUTPUTS_LIMIT) {
|
||||
struct Output *output = &wl_outputs[wl_outputs_size];
|
||||
output->data =
|
||||
@ -453,10 +466,10 @@ handle_global(void *data, struct wl_registry *registry, uint32_t name,
|
||||
void
|
||||
handle_global_remove(void *data, struct wl_registry *registry, uint32_t name)
|
||||
{
|
||||
for (int i = 0; i < WL_OUTPUTS_LIMIT; i += 1) {
|
||||
for (int i = 0; i < wl_outputs_size; i += 1) {
|
||||
if (wl_outputs[i].name == name) {
|
||||
wl_output_destroy(wl_outputs[i].data);
|
||||
for (; i < WL_OUTPUTS_LIMIT - 1; i += 1) {
|
||||
for (; i < wl_outputs_size - 1; i += 1) {
|
||||
wl_outputs[i] = wl_outputs[i + 1];
|
||||
}
|
||||
wl_outputs_size -= 1;
|
||||
@ -481,9 +494,6 @@ static void
|
||||
xdg_popup_configure(void *data, struct xdg_popup *xdg_popup, int32_t x,
|
||||
int32_t y, int32_t width, int32_t height)
|
||||
{
|
||||
kbd_resize(&keyboard, layouts, NumLayouts);
|
||||
|
||||
drwsurf_flip(&draw_surf);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -497,20 +507,20 @@ static const struct xdg_popup_listener xdg_popup_listener = {
|
||||
};
|
||||
|
||||
static void
|
||||
wp_fractional_scale_prefered_scale(
|
||||
wp_fractional_scale_preferred_scale(
|
||||
void *data, struct wp_fractional_scale_v1 *wp_fractional_scale_v1,
|
||||
uint32_t scale)
|
||||
{
|
||||
keyboard.pending_scale = (double)scale / 120;
|
||||
keyboard.preferred_fractional_scale = (double)scale / 120;
|
||||
}
|
||||
|
||||
static const struct wp_fractional_scale_v1_listener
|
||||
wp_fractional_scale_listener = {
|
||||
.preferred_scale = wp_fractional_scale_prefered_scale,
|
||||
.preferred_scale = wp_fractional_scale_preferred_scale,
|
||||
};
|
||||
|
||||
void
|
||||
resize()
|
||||
flip_landscape()
|
||||
{
|
||||
keyboard.landscape = current_output->w > current_output->h;
|
||||
|
||||
@ -529,10 +539,6 @@ resize()
|
||||
keyboard.last_abc_layout = keyboard.layout;
|
||||
keyboard.last_abc_index = 0;
|
||||
|
||||
if (!wfs_mgr || !viewporter) {
|
||||
keyboard.pending_scale = current_output->scale;
|
||||
}
|
||||
|
||||
if (layer_surface) {
|
||||
zwlr_layer_surface_v1_set_size(layer_surface, 0, height);
|
||||
zwlr_layer_surface_v1_set_exclusive_zone(layer_surface, height);
|
||||
@ -544,24 +550,20 @@ void
|
||||
layer_surface_configure(void *data, struct zwlr_layer_surface_v1 *surface,
|
||||
uint32_t serial, uint32_t w, uint32_t h)
|
||||
{
|
||||
if (keyboard.w != w || keyboard.h != h ||
|
||||
keyboard.scale != keyboard.pending_scale) {
|
||||
double scale = keyboard.preferred_scale;
|
||||
if (keyboard.preferred_fractional_scale) {
|
||||
scale = keyboard.preferred_fractional_scale;
|
||||
}
|
||||
|
||||
if (keyboard.w != w || keyboard.h != h || keyboard.scale != scale ||
|
||||
hidden) {
|
||||
|
||||
keyboard.w = w;
|
||||
keyboard.h = h;
|
||||
keyboard.scale = keyboard.pending_scale;
|
||||
keyboard.scale = scale;
|
||||
hidden = false;
|
||||
|
||||
if (wfs_mgr && viewporter) {
|
||||
if (!wfs_draw_surf) {
|
||||
wfs_draw_surf =
|
||||
wp_fractional_scale_manager_v1_get_fractional_scale(
|
||||
wfs_mgr, draw_surf.surf);
|
||||
wp_fractional_scale_v1_add_listener(
|
||||
wfs_draw_surf, &wp_fractional_scale_listener, NULL);
|
||||
}
|
||||
if (!draw_surf_viewport) {
|
||||
draw_surf_viewport =
|
||||
wp_viewporter_get_viewport(viewporter, draw_surf.surf);
|
||||
}
|
||||
wp_viewport_set_destination(draw_surf_viewport, keyboard.w,
|
||||
keyboard.h);
|
||||
} else {
|
||||
@ -603,9 +605,13 @@ layer_surface_configure(void *data, struct zwlr_layer_surface_v1 *surface,
|
||||
}
|
||||
|
||||
wl_surface_commit(popup_draw_surf.surf);
|
||||
}
|
||||
|
||||
zwlr_layer_surface_v1_ack_configure(surface, serial);
|
||||
zwlr_layer_surface_v1_ack_configure(surface, serial);
|
||||
kbd_resize(&keyboard, layouts, NumLayouts);
|
||||
drwsurf_flip(&draw_surf);
|
||||
} else {
|
||||
zwlr_layer_surface_v1_ack_configure(surface, serial);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -673,6 +679,15 @@ hide()
|
||||
return;
|
||||
}
|
||||
|
||||
if(wfs_draw_surf) {
|
||||
wp_fractional_scale_v1_destroy(wfs_draw_surf);
|
||||
wfs_draw_surf = NULL;
|
||||
}
|
||||
if(draw_surf_viewport) {
|
||||
wp_viewport_destroy(draw_surf_viewport);
|
||||
draw_surf_viewport = NULL;
|
||||
}
|
||||
|
||||
zwlr_layer_surface_v1_destroy(layer_surface);
|
||||
wl_surface_destroy(draw_surf.surf);
|
||||
layer_surface = NULL;
|
||||
@ -690,6 +705,15 @@ show()
|
||||
|
||||
draw_surf.surf = wl_compositor_create_surface(compositor);
|
||||
wl_surface_add_listener(draw_surf.surf, &surface_listener, NULL);
|
||||
if (wfs_mgr && viewporter) {
|
||||
wfs_draw_surf = wp_fractional_scale_manager_v1_get_fractional_scale(
|
||||
wfs_mgr, draw_surf.surf);
|
||||
wp_fractional_scale_v1_add_listener(
|
||||
wfs_draw_surf, &wp_fractional_scale_listener, NULL);
|
||||
draw_surf_viewport =
|
||||
wp_viewporter_get_viewport(viewporter, draw_surf.surf);
|
||||
}
|
||||
|
||||
layer_surface = zwlr_layer_shell_v1_get_layer_surface(
|
||||
layer_shell, draw_surf.surf, NULL, layer, namespace);
|
||||
|
||||
@ -700,8 +724,6 @@ show()
|
||||
zwlr_layer_surface_v1_add_listener(layer_surface, &layer_surface_listener,
|
||||
NULL);
|
||||
wl_surface_commit(draw_surf.surf);
|
||||
|
||||
hidden = false;
|
||||
}
|
||||
|
||||
void
|
||||
@ -744,7 +766,7 @@ main(int argc, char **argv)
|
||||
{
|
||||
/* parse command line arguments */
|
||||
char *layer_names_list = NULL, *landscape_layer_names_list = NULL;
|
||||
const char *fc_font_pattern = NULL;
|
||||
char *fc_font_pattern = NULL;
|
||||
height = normal_height = KBD_PIXEL_HEIGHT;
|
||||
landscape_height = KBD_PIXEL_LANDSCAPE_HEIGHT;
|
||||
|
||||
@ -761,10 +783,10 @@ main(int argc, char **argv)
|
||||
/* keyboard settings */
|
||||
keyboard.layers = (enum layout_id *)&layers;
|
||||
keyboard.landscape_layers = (enum layout_id *)&landscape_layers;
|
||||
keyboard.scheme = scheme;
|
||||
keyboard.schemes = schemes;
|
||||
keyboard.layer_index = 0;
|
||||
keyboard.scheme1 = scheme1;
|
||||
keyboard.pending_scale = 1;
|
||||
keyboard.preferred_scale = 1;
|
||||
keyboard.preferred_fractional_scale = 0;
|
||||
|
||||
uint8_t alpha = 0;
|
||||
bool alpha_defined = false;
|
||||
@ -799,7 +821,7 @@ main(int argc, char **argv)
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
set_kbd_colors(keyboard.scheme.bg.bgra, argv[++i]);
|
||||
set_kbd_colors(keyboard.schemes[0].bg.bgra, argv[++i]);
|
||||
} else if ((!strcmp(argv[i], "-alpha")) ||
|
||||
(!strcmp(argv[i], "--alpha"))) {
|
||||
if (i >= argc - 1) {
|
||||
@ -813,56 +835,56 @@ main(int argc, char **argv)
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
set_kbd_colors(keyboard.scheme.fg.bgra, argv[++i]);
|
||||
set_kbd_colors(keyboard.schemes[0].fg.bgra, argv[++i]);
|
||||
} else if ((!strcmp(argv[i], "-fg-sp")) ||
|
||||
(!strcmp(argv[i], "--fg-sp"))) {
|
||||
if (i >= argc - 1) {
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
set_kbd_colors(keyboard.scheme1.fg.bgra, argv[++i]);
|
||||
set_kbd_colors(keyboard.schemes[1].fg.bgra, argv[++i]);
|
||||
} else if ((!strcmp(argv[i], "-press")) ||
|
||||
(!strcmp(argv[i], "--press"))) {
|
||||
if (i >= argc - 1) {
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
set_kbd_colors(keyboard.scheme.high.bgra, argv[++i]);
|
||||
set_kbd_colors(keyboard.schemes[0].high.bgra, argv[++i]);
|
||||
} else if ((!strcmp(argv[i], "-press-sp")) ||
|
||||
(!strcmp(argv[i], "--press-sp"))) {
|
||||
if (i >= argc - 1) {
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
set_kbd_colors(keyboard.scheme1.high.bgra, argv[++i]);
|
||||
set_kbd_colors(keyboard.schemes[1].high.bgra, argv[++i]);
|
||||
} else if ((!strcmp(argv[i], "-swipe")) ||
|
||||
(!strcmp(argv[i], "--swipe"))) {
|
||||
if (i >= argc - 1) {
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
set_kbd_colors(keyboard.scheme.swipe.bgra, argv[++i]);
|
||||
set_kbd_colors(keyboard.schemes[0].swipe.bgra, argv[++i]);
|
||||
} else if ((!strcmp(argv[i], "-swipe-sp")) ||
|
||||
(!strcmp(argv[i], "--swipe-sp"))) {
|
||||
if (i >= argc - 1) {
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
set_kbd_colors(keyboard.scheme1.swipe.bgra, argv[++i]);
|
||||
set_kbd_colors(keyboard.schemes[1].swipe.bgra, argv[++i]);
|
||||
} else if ((!strcmp(argv[i], "-text")) ||
|
||||
(!strcmp(argv[i], "--text"))) {
|
||||
if (i >= argc - 1) {
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
set_kbd_colors(keyboard.scheme.text.bgra, argv[++i]);
|
||||
set_kbd_colors(keyboard.schemes[0].text.bgra, argv[++i]);
|
||||
} else if ((!strcmp(argv[i], "-text-sp")) ||
|
||||
(!strcmp(argv[i], "--text-sp"))) {
|
||||
if (i >= argc - 1) {
|
||||
usage(argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
set_kbd_colors(keyboard.scheme1.text.bgra, argv[++i]);
|
||||
set_kbd_colors(keyboard.schemes[1].text.bgra, argv[++i]);
|
||||
} else if (!strcmp(argv[i], "-H")) {
|
||||
if (i >= argc - 1) {
|
||||
usage(argv[0]);
|
||||
@ -902,16 +924,17 @@ main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (alpha_defined) {
|
||||
keyboard.scheme.bg.bgra[3] = alpha;
|
||||
keyboard.scheme.fg.bgra[3] = alpha;
|
||||
keyboard.scheme.high.bgra[3] = alpha;
|
||||
keyboard.scheme1.bg.bgra[3] = alpha;
|
||||
keyboard.scheme1.fg.bgra[3] = alpha;
|
||||
keyboard.scheme1.high.bgra[3] = alpha;
|
||||
keyboard.schemes[0].bg.bgra[3] = alpha;
|
||||
keyboard.schemes[0].fg.bgra[3] = alpha;
|
||||
keyboard.schemes[0].high.bgra[3] = alpha;
|
||||
keyboard.schemes[1].bg.bgra[3] = alpha;
|
||||
keyboard.schemes[1].fg.bgra[3] = alpha;
|
||||
keyboard.schemes[1].high.bgra[3] = alpha;
|
||||
}
|
||||
|
||||
if (!fc_font_pattern) {
|
||||
fc_font_pattern = default_font;
|
||||
if (fc_font_pattern) {
|
||||
for (i = 0; i < countof(schemes); i++)
|
||||
schemes[i].font = fc_font_pattern;
|
||||
}
|
||||
|
||||
display = wl_display_connect(NULL);
|
||||
@ -956,8 +979,10 @@ main(int argc, char **argv)
|
||||
kbd_init(&keyboard, (struct layout *)&layouts, layer_names_list,
|
||||
landscape_layer_names_list);
|
||||
|
||||
draw_ctx.font_description =
|
||||
pango_font_description_from_string(fc_font_pattern);
|
||||
for (i = 0; i < countof(schemes); i++) {
|
||||
schemes[i].font_description =
|
||||
pango_font_description_from_string(schemes[i].font);
|
||||
}
|
||||
|
||||
if (!hidden)
|
||||
show();
|
||||
@ -1011,8 +1036,10 @@ main(int argc, char **argv)
|
||||
}
|
||||
}
|
||||
|
||||
if (fc_font_pattern != default_font) {
|
||||
if (fc_font_pattern) {
|
||||
free((void *)fc_font_pattern);
|
||||
for (i = 0; i < countof(schemes); i++)
|
||||
schemes[i].font = NULL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user