diff --git a/src/conio/x_cio.c b/src/conio/x_cio.c index 68753f37ab46129137819e7c14552e96a42dea46..104f04af61b04b255de28105a2f755e6f0ea300a 100644 --- a/src/conio/x_cio.c +++ b/src/conio/x_cio.c @@ -554,7 +554,7 @@ void x_setscaling(double newval) double x_getscaling(void) { - int ret; + double ret; pthread_mutex_lock(&vstatlock); ret = vstat.scaling; diff --git a/src/conio/x_events.c b/src/conio/x_events.c index 85a14b5d9f99d2092826acb66b494f2bcd122de4..e3b28794316ca5626d72c66528060c90f30be5df 100644 --- a/src/conio/x_events.c +++ b/src/conio/x_events.c @@ -481,14 +481,16 @@ static void resize_window() pthread_mutex_lock(&vstatlock); bitmap_get_scaled_win_size(x_cvstat.scaling, &width, &height, 0, 0); if (width == vstat.winwidth && height == vstat.winheight) { - vstat.scaling = x_cvstat.scaling = bitmap_double_mult_inside(width, height); + x_cvstat.scaling = bitmap_double_mult_inside(width, height); + vstat.scaling = x_cvstat.scaling; pthread_mutex_unlock(&vstatlock); resize_xim(); return; } x_cvstat.winwidth = vstat.winwidth; x_cvstat.winheight = vstat.winheight; - vstat.scaling = x_cvstat.scaling = bitmap_double_mult_inside(width, height); + x_cvstat.scaling = bitmap_double_mult_inside(width, height); + vstat.scaling = x_cvstat.scaling; pthread_mutex_unlock(&vstatlock); x11.XResizeWindow(dpy, win, width, height); resize_xim(); @@ -859,16 +861,21 @@ static int x11_event(XEvent *ev) case ConfigureNotify: { bool resize = false; - if (x11_window_xpos != ev->xconfigure.x || x11_window_ypos != ev->xconfigure.y) { - x11_window_xpos=ev->xconfigure.x; - x11_window_ypos=ev->xconfigure.y; + if (ev->xconfigure.window == win) { + if (x11_window_xpos != ev->xconfigure.x || x11_window_ypos != ev->xconfigure.y) { + x11_window_xpos=ev->xconfigure.x; + x11_window_ypos=ev->xconfigure.y; + } + pthread_mutex_lock(&vstatlock); + if (ev->xconfigure.width != vstat.winwidth || ev->xconfigure.height != vstat.winheight) { + // XWayland on ChromeOS appears to send a 1x1 resize event early on for unknown reasons... inore it. + if (ev->xconfigure.width != 1 && ev->xconfigure.height != 1) + resize = true; + } + pthread_mutex_unlock(&vstatlock); + if (resize) + handle_resize_event(ev->xconfigure.width, ev->xconfigure.height); } - pthread_mutex_lock(&vstatlock); - if (ev->xconfigure.width != vstat.winwidth || ev->xconfigure.height != vstat.winheight) - resize = true; - pthread_mutex_unlock(&vstatlock); - if (resize) - handle_resize_event(ev->xconfigure.width, ev->xconfigure.height); break; } case NoExpose: diff --git a/src/syncterm/syncterm.c b/src/syncterm/syncterm.c index a2ca900a7d3fa313f8e2b2b51392f6d5126b0bea..1218342084a507d0e1e2cf7874cf6380773ed57a 100644 --- a/src/syncterm/syncterm.c +++ b/src/syncterm/syncterm.c @@ -1938,7 +1938,7 @@ main(int argc, char **argv) if ((txtinfo.currmode == screen_to_ciolib(settings.startup_mode)) || ((settings.startup_mode == SCREEN_MODE_CURRENT) && (txtinfo.currmode == C80))) { sf = getscaling(); - if (((sf > 0) && (sf != settings.scaling_factor))) { + if (((sf > 0.0) && (sf != settings.scaling_factor))) { char inipath[MAX_PATH + 1]; FILE *inifile; str_list_t inicontents; @@ -1951,8 +1951,9 @@ main(int argc, char **argv) else { inicontents = strListInit(); } - if ((sf > 0) && (sf != settings.scaling_factor)) + if ((sf > 0.0) && (sf != settings.scaling_factor)) { iniSetFloat(&inicontents, "SyncTERM", "ScalingFactor", sf, &ini_style); + } if ((inifile = fopen(inipath, "w")) != NULL) { iniWriteFile(inifile, inicontents); fclose(inifile);