mirror of https://github.com/proxmox/mirror_qemu
ui: gtk vc fix, adaptive sdl refresh.
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAABAgAGBQJWsKm/AAoJEEy22O7T6HE4M84QALZhTgKfJ2OtuSYbB9jACulW C6ghU4/iWsH9+If9iAIUCE6a2Hdh2jS9oY/Ox33/0ml2z+4RPQug+mZZfiuPsViK cSENnfFSpHfjJyPpFHK5TozKSM/MBTNsTMfmGMmGWRIkWRHZF8JJnwVOYAW/wt7u BD/wJtSOR00XC1hjj8a7q5E21GxjFNcguwwEjuHBiCzzr0GDB9zwR76e5glpUpLu sC/OGsw5m5lmk4WCu3pZkwIsPOcgeYbgOVS+lUVQC8sG9vLwy1KOfXBAgCH3uZdt JCHb9qFlP6kXh+CLJnSC4olLUePTu6GFYaRw+ikf7paOJY2ZwwSi8Zvq3lLyp5tk epi/o5K8JI1xaWYUgTC35EKJsthyDfim/CcWCY0GJCFaIVNr7HP+7Tku2nbwYiLV PQydLzIboWyAG8WAqc8XRdM/miSM6XSLHS2QzUxjGtfndVX8o7YajRJQalK4euDU j6/d69JTpuQFNc4aPkEmCXfkEd4eYbprbR1pwDpYGcI/Lt0PiQ3Tu22420N1pL/f zjlJ4SM8yCFwOrunfK5QBRe/XIyl+cnAu7hrYv0iMTyss2n58V2bsnkTwYcZ4e4P ZrKluoj4IGG6unF2388h+qAhlva9T4Lw0khDsj9Bn8OUV6JvKZdWUb3x72esJUHa enhMeCxuPXJV6QuwtmFO =vCQV -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/kraxel/tags/pull-ui-20160202-1' into staging ui: gtk vc fix, adaptive sdl refresh. # gpg: Signature made Tue 02 Feb 2016 13:06:07 GMT using RSA key ID D3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" * remotes/kraxel/tags/pull-ui-20160202-1: sdl: shorten the GUI refresh interval when mouse or keyboard is active gtk: use qemu_chr_alloc() to allocate CharDriverState Signed-off-by: Peter Maydell <peter.maydell@linaro.org>master
commit
baa3f63827
|
@ -19,6 +19,7 @@ struct sdl2_console {
|
|||
int hidden;
|
||||
int opengl;
|
||||
int updates;
|
||||
int idle_counter;
|
||||
SDL_GLContext winctx;
|
||||
#ifdef CONFIG_OPENGL
|
||||
ConsoleGLState *gls;
|
||||
|
|
9
ui/gtk.c
9
ui/gtk.c
|
@ -1598,11 +1598,16 @@ static void gd_vc_chr_set_echo(CharDriverState *chr, bool echo)
|
|||
static int nb_vcs;
|
||||
static CharDriverState *vcs[MAX_VCS];
|
||||
|
||||
static CharDriverState *gd_vc_handler(ChardevVC *unused, Error **errp)
|
||||
static CharDriverState *gd_vc_handler(ChardevVC *vc, Error **errp)
|
||||
{
|
||||
ChardevCommon *common = qapi_ChardevVC_base(vc);
|
||||
CharDriverState *chr;
|
||||
|
||||
chr = g_malloc0(sizeof(*chr));
|
||||
chr = qemu_chr_alloc(common, errp);
|
||||
if (!chr) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
chr->chr_write = gd_vc_chr_write;
|
||||
chr->chr_set_echo = gd_vc_chr_set_echo;
|
||||
|
||||
|
|
22
ui/sdl.c
22
ui/sdl.c
|
@ -60,6 +60,11 @@ static SDL_Cursor *guest_sprite = NULL;
|
|||
static SDL_PixelFormat host_format;
|
||||
static int scaling_active = 0;
|
||||
static Notifier mouse_mode_notifier;
|
||||
static int idle_counter;
|
||||
|
||||
#define SDL_REFRESH_INTERVAL_BUSY 10
|
||||
#define SDL_MAX_IDLE_COUNT (2 * GUI_REFRESH_INTERVAL_DEFAULT \
|
||||
/ SDL_REFRESH_INTERVAL_BUSY + 1)
|
||||
|
||||
#if 0
|
||||
#define DEBUG_SDL
|
||||
|
@ -802,6 +807,7 @@ static void handle_activation(SDL_Event *ev)
|
|||
static void sdl_refresh(DisplayChangeListener *dcl)
|
||||
{
|
||||
SDL_Event ev1, *ev = &ev1;
|
||||
int idle = 1;
|
||||
|
||||
if (last_vm_running != runstate_is_running()) {
|
||||
last_vm_running = runstate_is_running();
|
||||
|
@ -817,9 +823,11 @@ static void sdl_refresh(DisplayChangeListener *dcl)
|
|||
sdl_update(dcl, 0, 0, real_screen->w, real_screen->h);
|
||||
break;
|
||||
case SDL_KEYDOWN:
|
||||
idle = 0;
|
||||
handle_keydown(ev);
|
||||
break;
|
||||
case SDL_KEYUP:
|
||||
idle = 0;
|
||||
handle_keyup(ev);
|
||||
break;
|
||||
case SDL_QUIT:
|
||||
|
@ -829,10 +837,12 @@ static void sdl_refresh(DisplayChangeListener *dcl)
|
|||
}
|
||||
break;
|
||||
case SDL_MOUSEMOTION:
|
||||
idle = 0;
|
||||
handle_mousemotion(ev);
|
||||
break;
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
case SDL_MOUSEBUTTONUP:
|
||||
idle = 0;
|
||||
handle_mousebutton(ev);
|
||||
break;
|
||||
case SDL_ACTIVEEVENT:
|
||||
|
@ -847,6 +857,18 @@ static void sdl_refresh(DisplayChangeListener *dcl)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (idle) {
|
||||
if (idle_counter < SDL_MAX_IDLE_COUNT) {
|
||||
idle_counter++;
|
||||
if (idle_counter >= SDL_MAX_IDLE_COUNT) {
|
||||
dcl->update_interval = GUI_REFRESH_INTERVAL_DEFAULT;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
idle_counter = 0;
|
||||
dcl->update_interval = SDL_REFRESH_INTERVAL_BUSY;
|
||||
}
|
||||
}
|
||||
|
||||
static void sdl_mouse_warp(DisplayChangeListener *dcl,
|
||||
|
|
23
ui/sdl2.c
23
ui/sdl2.c
|
@ -49,6 +49,10 @@ static int guest_x, guest_y;
|
|||
static SDL_Cursor *guest_sprite;
|
||||
static Notifier mouse_mode_notifier;
|
||||
|
||||
#define SDL2_REFRESH_INTERVAL_BUSY 10
|
||||
#define SDL2_MAX_IDLE_COUNT (2 * GUI_REFRESH_INTERVAL_DEFAULT \
|
||||
/ SDL2_REFRESH_INTERVAL_BUSY + 1)
|
||||
|
||||
static void sdl_update_caption(struct sdl2_console *scon);
|
||||
|
||||
static struct sdl2_console *get_scon_from_window(uint32_t window_id)
|
||||
|
@ -578,6 +582,7 @@ static void handle_windowevent(SDL_Event *ev)
|
|||
void sdl2_poll_events(struct sdl2_console *scon)
|
||||
{
|
||||
SDL_Event ev1, *ev = &ev1;
|
||||
int idle = 1;
|
||||
|
||||
if (scon->last_vm_running != runstate_is_running()) {
|
||||
scon->last_vm_running = runstate_is_running();
|
||||
|
@ -587,12 +592,15 @@ void sdl2_poll_events(struct sdl2_console *scon)
|
|||
while (SDL_PollEvent(ev)) {
|
||||
switch (ev->type) {
|
||||
case SDL_KEYDOWN:
|
||||
idle = 0;
|
||||
handle_keydown(ev);
|
||||
break;
|
||||
case SDL_KEYUP:
|
||||
idle = 0;
|
||||
handle_keyup(ev);
|
||||
break;
|
||||
case SDL_TEXTINPUT:
|
||||
idle = 0;
|
||||
handle_textinput(ev);
|
||||
break;
|
||||
case SDL_QUIT:
|
||||
|
@ -602,13 +610,16 @@ void sdl2_poll_events(struct sdl2_console *scon)
|
|||
}
|
||||
break;
|
||||
case SDL_MOUSEMOTION:
|
||||
idle = 0;
|
||||
handle_mousemotion(ev);
|
||||
break;
|
||||
case SDL_MOUSEBUTTONDOWN:
|
||||
case SDL_MOUSEBUTTONUP:
|
||||
idle = 0;
|
||||
handle_mousebutton(ev);
|
||||
break;
|
||||
case SDL_MOUSEWHEEL:
|
||||
idle = 0;
|
||||
handle_mousewheel(ev);
|
||||
break;
|
||||
case SDL_WINDOWEVENT:
|
||||
|
@ -618,6 +629,18 @@ void sdl2_poll_events(struct sdl2_console *scon)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (idle) {
|
||||
if (scon->idle_counter < SDL2_MAX_IDLE_COUNT) {
|
||||
scon->idle_counter++;
|
||||
if (scon->idle_counter >= SDL2_MAX_IDLE_COUNT) {
|
||||
scon->dcl.update_interval = GUI_REFRESH_INTERVAL_DEFAULT;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
scon->idle_counter = 0;
|
||||
scon->dcl.update_interval = SDL2_REFRESH_INTERVAL_BUSY;
|
||||
}
|
||||
}
|
||||
|
||||
static void sdl_mouse_warp(DisplayChangeListener *dcl,
|
||||
|
|
Loading…
Reference in New Issue