fix scaling problem from "support multiple outputs"

This commit is contained in:
Maarten van Gompel 2023-08-27 12:05:30 +02:00
parent 79797fc837
commit b6ec34fe3a
3 changed files with 7 additions and 6 deletions

View File

@ -478,10 +478,10 @@ void
kbd_resize(struct kbd *kb, struct layout *layouts, uint8_t layoutcount) {
struct drwsurf *d = kb->surf;
fprintf(stderr, "Resize %dx%d %d, %d layouts\n", kb->w, kb->h, kb->s,
fprintf(stderr, "Resize %dx%d %d, %d layouts\n", kb->w, kb->h, kb->scale,
layoutcount);
drwsurf_resize(d, kb->w, kb->h, kb->s);
drwsurf_resize(d, kb->w, kb->h, kb->scale);
for (int i = 0; i < layoutcount; i++) {
kbd_init_layout(&layouts[i], kb->w, kb->h);
}

View File

@ -93,7 +93,7 @@ struct kbd {
bool print;
bool print_intersect;
uint32_t w, h, s;
uint32_t w, h, scale;
bool landscape;
uint8_t mods;
uint8_t compose;

7
main.c
View File

@ -270,7 +270,7 @@ 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) {
if(wl_outputs[i].data == wl_output) {
keyboard.s = wl_outputs[i].scale;
keyboard.scale = wl_outputs[i].scale;
return;
}
}
@ -316,7 +316,8 @@ display_handle_done(void *data, struct wl_output *wl_output) {}
static void
display_handle_scale(void *data, struct wl_output *wl_output, int32_t scale) {
((struct Output*)data)->scale = scale;
((struct Output*)data)->scale = scale;
keyboard.scale = scale;
}
static void
@ -525,7 +526,7 @@ main(int argc, char **argv) {
keyboard.scheme = scheme;
keyboard.layer_index = 0;
keyboard.scheme1 = scheme1;
keyboard.s = 1;
keyboard.scale = 1;
int i;
for (i = 1; argv[i]; i++) {