diff --git a/src/conio/sdl_con.c b/src/conio/sdl_con.c index 4bab1c1f2a36c86c89316b1eb53984be154a1472..5829c1990bb5704a181ace8978135be5c6576fa2 100644 --- a/src/conio/sdl_con.c +++ b/src/conio/sdl_con.c @@ -1460,6 +1460,8 @@ int sdl_video_event_thread(void *data) { SDL_Event ev; int new_scaling = -1; + int old_scaling = vstat.scaling; +fprintf(stderr, "At start, scaling is %d\n", old_scaling); if(!init_sdl_video()) { char driver[16]; @@ -1482,7 +1484,9 @@ int sdl_video_event_thread(void *data) while(1) { if(sdl.PollEvent(&ev)!=1) { - if (new_scaling != -1) { + if (new_scaling != -1 || vstat.scaling != old_scaling) { + if (new_scaling == -1) + new_scaling = vstat.scaling; if (pthread_mutex_trylock(&vstatlock) == 0) { vstat.scaling=new_scaling; new_scaling = -1; @@ -1491,6 +1495,7 @@ int sdl_video_event_thread(void *data) pthread_mutex_unlock(&vstatlock); setup_surfaces(); } + old_scaling = vstat.scaling; } SLEEP(1); } diff --git a/src/conio/x_events.c b/src/conio/x_events.c index ff7850476f8b2352b7014f00241d5a9991dde3c2..a986128dd5a03fa64e01d6aed01a7d4af072e3f0 100644 --- a/src/conio/x_events.c +++ b/src/conio/x_events.c @@ -65,6 +65,8 @@ static unsigned long black; static unsigned long white; static int bitmap_width=0; static int bitmap_height=0; +static int old_scaling = 0; + /* Array of Graphics Contexts */ static GC gca[sizeof(dac_default)/sizeof(struct dac_colors)]; @@ -428,6 +430,7 @@ static void handle_resize_event(int width, int height) vstat.scaling=newFSH; else vstat.scaling=newFSW; + old_scaling = vstat.scaling; if(vstat.scaling > 16) vstat.scaling=16; /* @@ -814,6 +817,14 @@ static int x11_event(XEvent *ev) return(0); } +void check_scaling(void) +{ + if (old_scaling != vstat.scaling) { + resize_window(); + old_scaling = vstat.scaling; + } +} + void x11_event_thread(void *args) { int x; @@ -836,6 +847,8 @@ void x11_event_thread(void *args) high_fd=xfd; for (;;) { + check_scaling(); + tv.tv_sec=0; tv.tv_usec=54925; /* was 54925 (was also 10) */