ui: memleak fixes.
gtk: refresh interval fix. spice: add mouse buttons. -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) iQIcBAABCgAGBQJfUeYnAAoJEEy22O7T6HE4NbkP/1jTXWNh/D9niG4eW2x2Oasc /hUtW70sKfRaIvsnrY5avSMS9PmligvuBi0OlqUx1mSmq6bicnKsengvZCmx8kja w7yetoaElngm7Ycho9dED0uXi9Czk33Do3UZycxz6WwsacSKnh4SFM11wOjKjm5n 6XmgobBmDe4DPlmiW84I9yYnpWH3DeMZyCg6lkODT0k0/fIF6h7r8gbwKLznyO9X JSVaAPNQ2m4CJYWRvOcIylnyD7e2GnZn+4EGZt7vpmdSvhy0sFSNQQFFd1pvCTig pyYtETunq5xaMSrJCuUQoejvaPbuTnlmUh7SjcfPcxe0SZKj9gOFUGRM89Ghn4O2 f2TYFKVJLXLVpbKzsHPhbX5OBdiC3+kT2b/eHARRmzRH6/74982esrC+bHe3dWkY hjfNY/dQ6vWMg09NFmR9SOuZ9yvRRX2znnYb1FE/QQ6qDLaQwryiVhTB654jztEK IGhPjh+3Is8iqYp25Ls1CWODu9Hd5AgGFTvc/rQ95rpHqJu3GXRK+4zfzat0eUKi Ahx1vraJjjCFIhzetkKHVtdQd4c+f0m96hwcqEUF9rN/o6dQr/rsJ6IruxK1lRPE 6m8XPKBK6K2jbUdHTrDSHPLcy1iXRukNPS7gdxgJzjl/FG6GXyCfrapJBkpDmWyK daB6kvPtKj9s4JBhuOp5 =7Z4z -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/kraxel/tags/ui-20200904-pull-request' into staging ui: memleak fixes. gtk: refresh interval fix. spice: add mouse buttons. # gpg: Signature made Fri 04 Sep 2020 08:00:55 BST # gpg: using RSA key 4CB6D8EED3E87138 # gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full] # gpg: aka "Gerd Hoffmann <gerd@kraxel.org>" [full] # gpg: aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full] # Primary key fingerprint: A032 8CFF B93A 17A7 9901 FE7D 4CB6 D8EE D3E8 7138 * remotes/kraxel/tags/ui-20200904-pull-request: ui/gtk: Update refresh interval after widget is realized ui: Add more mouse buttons to SPICE vnc-auth-sasl: Plug memleak in vnc_socket_ip_addr_string ui/gtk-gl-area: Plug memleak in gd_gl_area_create_context() Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
7c37270b3f
|
@ -147,10 +147,21 @@ QEMUGLContext gd_gl_area_create_context(DisplayChangeListener *dcl,
|
||||||
gtk_gl_area_make_current(GTK_GL_AREA(vc->gfx.drawing_area));
|
gtk_gl_area_make_current(GTK_GL_AREA(vc->gfx.drawing_area));
|
||||||
window = gtk_widget_get_window(vc->gfx.drawing_area);
|
window = gtk_widget_get_window(vc->gfx.drawing_area);
|
||||||
ctx = gdk_window_create_gl_context(window, &err);
|
ctx = gdk_window_create_gl_context(window, &err);
|
||||||
|
if (err) {
|
||||||
|
g_printerr("Create gdk gl context failed: %s\n", err->message);
|
||||||
|
g_error_free(err);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
gdk_gl_context_set_required_version(ctx,
|
gdk_gl_context_set_required_version(ctx,
|
||||||
params->major_ver,
|
params->major_ver,
|
||||||
params->minor_ver);
|
params->minor_ver);
|
||||||
gdk_gl_context_realize(ctx, &err);
|
gdk_gl_context_realize(ctx, &err);
|
||||||
|
if (err) {
|
||||||
|
g_printerr("Realize gdk gl context failed: %s\n", err->message);
|
||||||
|
g_error_free(err);
|
||||||
|
g_clear_object(&ctx);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
return ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
52
ui/gtk.c
52
ui/gtk.c
|
@ -744,6 +744,25 @@ static void gd_resize_event(GtkGLArea *area,
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If available, return the refresh rate of the display in milli-Hertz,
|
||||||
|
* else return 0.
|
||||||
|
*/
|
||||||
|
static int gd_refresh_rate_millihz(GtkWidget *window)
|
||||||
|
{
|
||||||
|
#ifdef GDK_VERSION_3_22
|
||||||
|
GdkWindow *win = gtk_widget_get_window(window);
|
||||||
|
|
||||||
|
if (win) {
|
||||||
|
GdkDisplay *dpy = gtk_widget_get_display(window);
|
||||||
|
GdkMonitor *monitor = gdk_display_get_monitor_at_window(dpy, win);
|
||||||
|
|
||||||
|
return gdk_monitor_get_refresh_rate(monitor);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static gboolean gd_draw_event(GtkWidget *widget, cairo_t *cr, void *opaque)
|
static gboolean gd_draw_event(GtkWidget *widget, cairo_t *cr, void *opaque)
|
||||||
{
|
{
|
||||||
VirtualConsole *vc = opaque;
|
VirtualConsole *vc = opaque;
|
||||||
|
@ -751,6 +770,7 @@ static gboolean gd_draw_event(GtkWidget *widget, cairo_t *cr, void *opaque)
|
||||||
int mx, my;
|
int mx, my;
|
||||||
int ww, wh;
|
int ww, wh;
|
||||||
int fbw, fbh;
|
int fbw, fbh;
|
||||||
|
int refresh_rate_millihz;
|
||||||
|
|
||||||
#if defined(CONFIG_OPENGL)
|
#if defined(CONFIG_OPENGL)
|
||||||
if (vc->gfx.gls) {
|
if (vc->gfx.gls) {
|
||||||
|
@ -771,6 +791,12 @@ static gboolean gd_draw_event(GtkWidget *widget, cairo_t *cr, void *opaque)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
refresh_rate_millihz = gd_refresh_rate_millihz(vc->window ?
|
||||||
|
vc->window : s->window);
|
||||||
|
if (refresh_rate_millihz) {
|
||||||
|
vc->gfx.dcl.update_interval = MILLISEC_PER_SEC / refresh_rate_millihz;
|
||||||
|
}
|
||||||
|
|
||||||
fbw = surface_width(vc->gfx.ds);
|
fbw = surface_width(vc->gfx.ds);
|
||||||
fbh = surface_height(vc->gfx.ds);
|
fbh = surface_height(vc->gfx.ds);
|
||||||
|
|
||||||
|
@ -1949,31 +1975,11 @@ static GtkWidget *gd_create_menu_machine(GtkDisplayState *s)
|
||||||
return machine_menu;
|
return machine_menu;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* If available, return the refresh rate of the display in milli-Hertz,
|
|
||||||
* else return 0.
|
|
||||||
*/
|
|
||||||
static int gd_refresh_rate_millihz(GtkWidget *window)
|
|
||||||
{
|
|
||||||
#ifdef GDK_VERSION_3_22
|
|
||||||
GdkWindow *win = gtk_widget_get_window(window);
|
|
||||||
|
|
||||||
if (win) {
|
|
||||||
GdkDisplay *dpy = gtk_widget_get_display(window);
|
|
||||||
GdkMonitor *monitor = gdk_display_get_monitor_at_window(dpy, win);
|
|
||||||
|
|
||||||
return gdk_monitor_get_refresh_rate(monitor);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static GSList *gd_vc_gfx_init(GtkDisplayState *s, VirtualConsole *vc,
|
static GSList *gd_vc_gfx_init(GtkDisplayState *s, VirtualConsole *vc,
|
||||||
QemuConsole *con, int idx,
|
QemuConsole *con, int idx,
|
||||||
GSList *group, GtkWidget *view_menu)
|
GSList *group, GtkWidget *view_menu)
|
||||||
{
|
{
|
||||||
bool zoom_to_fit = false;
|
bool zoom_to_fit = false;
|
||||||
int refresh_rate_millihz;
|
|
||||||
|
|
||||||
vc->label = qemu_console_get_label(con);
|
vc->label = qemu_console_get_label(con);
|
||||||
vc->s = s;
|
vc->s = s;
|
||||||
|
@ -2031,12 +2037,6 @@ static GSList *gd_vc_gfx_init(GtkDisplayState *s, VirtualConsole *vc,
|
||||||
vc->gfx.kbd = qkbd_state_init(con);
|
vc->gfx.kbd = qkbd_state_init(con);
|
||||||
vc->gfx.dcl.con = con;
|
vc->gfx.dcl.con = con;
|
||||||
|
|
||||||
refresh_rate_millihz = gd_refresh_rate_millihz(vc->window ?
|
|
||||||
vc->window : s->window);
|
|
||||||
if (refresh_rate_millihz) {
|
|
||||||
vc->gfx.dcl.update_interval = MILLISEC_PER_SEC / refresh_rate_millihz;
|
|
||||||
}
|
|
||||||
|
|
||||||
register_displaychangelistener(&vc->gfx.dcl);
|
register_displaychangelistener(&vc->gfx.dcl);
|
||||||
|
|
||||||
gd_connect_vc_gfx_signals(vc);
|
gd_connect_vc_gfx_signals(vc);
|
||||||
|
|
|
@ -123,6 +123,8 @@ static void spice_update_buttons(QemuSpicePointer *pointer,
|
||||||
[INPUT_BUTTON_RIGHT] = 0x02,
|
[INPUT_BUTTON_RIGHT] = 0x02,
|
||||||
[INPUT_BUTTON_WHEEL_UP] = 0x10,
|
[INPUT_BUTTON_WHEEL_UP] = 0x10,
|
||||||
[INPUT_BUTTON_WHEEL_DOWN] = 0x20,
|
[INPUT_BUTTON_WHEEL_DOWN] = 0x20,
|
||||||
|
[INPUT_BUTTON_SIDE] = 0x40,
|
||||||
|
[INPUT_BUTTON_EXTRA] = 0x80,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (wheel < 0) {
|
if (wheel < 0) {
|
||||||
|
|
|
@ -522,6 +522,7 @@ vnc_socket_ip_addr_string(QIOChannelSocket *ioc,
|
||||||
|
|
||||||
if (addr->type != SOCKET_ADDRESS_TYPE_INET) {
|
if (addr->type != SOCKET_ADDRESS_TYPE_INET) {
|
||||||
error_setg(errp, "Not an inet socket type");
|
error_setg(errp, "Not an inet socket type");
|
||||||
|
qapi_free_SocketAddress(addr);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
ret = g_strdup_printf("%s;%s", addr->u.inet.host, addr->u.inet.port);
|
ret = g_strdup_printf("%s;%s", addr->u.inet.host, addr->u.inet.port);
|
||||||
|
|
Loading…
Reference in a new issue