aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--console.h1
-rw-r--r--sdl.c9
-rw-r--r--vl.c6
3 files changed, 15 insertions, 1 deletions
diff --git a/console.h b/console.h
index b8a5c6d22..1e69ffd0b 100644
--- a/console.h
+++ b/console.h
@@ -71,6 +71,7 @@ struct DisplayState {
int height;
void *opaque;
struct QEMUTimer *gui_timer;
+ uint64_t gui_timer_interval;
void (*dpy_update)(struct DisplayState *s, int x, int y, int w, int h);
void (*dpy_resize)(struct DisplayState *s, int w, int h);
diff --git a/sdl.c b/sdl.c
index 05a394c78..431e52711 100644
--- a/sdl.c
+++ b/sdl.c
@@ -510,6 +510,15 @@ static void sdl_refresh(DisplayState *ds)
!ev->active.gain && !gui_fullscreen_initial_grab) {
sdl_grab_end();
}
+ if (ev->active.state & SDL_APPACTIVE) {
+ if (ev->active.gain) {
+ /* Back to default interval */
+ ds->gui_timer_interval = 0;
+ } else {
+ /* Sleeping interval */
+ ds->gui_timer_interval = 500;
+ }
+ }
break;
default:
break;
diff --git a/vl.c b/vl.c
index 5b9e4ce7a..2019f9f02 100644
--- a/vl.c
+++ b/vl.c
@@ -7208,7 +7208,11 @@ static void gui_update(void *opaque)
{
DisplayState *ds = opaque;
ds->dpy_refresh(ds);
- qemu_mod_timer(ds->gui_timer, GUI_REFRESH_INTERVAL + qemu_get_clock(rt_clock));
+ qemu_mod_timer(ds->gui_timer,
+ (ds->gui_timer_interval ?
+ ds->gui_timer_interval :
+ GUI_REFRESH_INTERVAL)
+ + qemu_get_clock(rt_clock));
}
struct vm_change_state_entry {