Skip to content
Snippets Groups Projects
Commit c9a3f95e authored by deuce's avatar deuce
Browse files

Constantly watch vstat.scaling for changes in both SDL and X11 output modes.

parent 4d15f969
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
......
......@@ -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) */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment