qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PULL 0/4] Ui 20200904 patches
@ 2020-09-04  7:01 Gerd Hoffmann
  2020-09-04  7:01 ` [PULL 1/4] ui/gtk-gl-area: Plug memleak in gd_gl_area_create_context() Gerd Hoffmann
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2020-09-04  7:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

The following changes since commit 67a7bfe560a1bba59efab085cb3430f45176d382:

  Merge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2020-09=
-03' into staging (2020-09-03 16:58:25 +0100)

are available in the Git repository at:

  git://git.kraxel.org/qemu tags/ui-20200904-pull-request

for you to fetch changes up to dc26435edb469ebdadf298dc3945b95d08f743d4:

  ui/gtk: Update refresh interval after widget is realized (2020-09-04 07:32:=
28 +0200)

----------------------------------------------------------------
ui: memleak fixes.
gtk: refresh interval fix.
spice: add mouse buttons.

----------------------------------------------------------------

Frediano Ziglio (1):
  ui: Add more mouse buttons to SPICE

Pan Nengyuan (2):
  ui/gtk-gl-area: Plug memleak in gd_gl_area_create_context()
  vnc-auth-sasl: Plug memleak in vnc_socket_ip_addr_string

Philippe Mathieu-Daud=C3=A9 (1):
  ui/gtk: Update refresh interval after widget is realized

 ui/gtk-gl-area.c   | 11 ++++++++++
 ui/gtk.c           | 52 +++++++++++++++++++++++-----------------------
 ui/spice-input.c   |  2 ++
 ui/vnc-auth-sasl.c |  1 +
 4 files changed, 40 insertions(+), 26 deletions(-)

--=20
2.27.0




^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PULL 1/4] ui/gtk-gl-area: Plug memleak in gd_gl_area_create_context()
  2020-09-04  7:01 [PULL 0/4] Ui 20200904 patches Gerd Hoffmann
@ 2020-09-04  7:01 ` Gerd Hoffmann
  2020-09-04  7:01 ` [PULL 2/4] vnc-auth-sasl: Plug memleak in vnc_socket_ip_addr_string Gerd Hoffmann
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2020-09-04  7:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: Pan Nengyuan, Gerd Hoffmann, Euler Robot

From: Pan Nengyuan <pannengyuan@huawei.com>

Receiving error in local variable err, and forgot to free it.
This patch check the return value of 'gdk_window_create_gl_context'
and 'gdk_gl_context_realize', then free err to fix it.

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
Message-Id: <20200831134315.1221-6-pannengyuan@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/gtk-gl-area.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/ui/gtk-gl-area.c b/ui/gtk-gl-area.c
index 85f9d14c51f1..98c22d23f501 100644
--- a/ui/gtk-gl-area.c
+++ b/ui/gtk-gl-area.c
@@ -147,10 +147,21 @@ QEMUGLContext gd_gl_area_create_context(DisplayChangeListener *dcl,
     gtk_gl_area_make_current(GTK_GL_AREA(vc->gfx.drawing_area));
     window = gtk_widget_get_window(vc->gfx.drawing_area);
     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,
                                         params->major_ver,
                                         params->minor_ver);
     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;
 }
 
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PULL 2/4] vnc-auth-sasl: Plug memleak in vnc_socket_ip_addr_string
  2020-09-04  7:01 [PULL 0/4] Ui 20200904 patches Gerd Hoffmann
  2020-09-04  7:01 ` [PULL 1/4] ui/gtk-gl-area: Plug memleak in gd_gl_area_create_context() Gerd Hoffmann
@ 2020-09-04  7:01 ` Gerd Hoffmann
  2020-09-04  7:01 ` [PULL 3/4] ui: Add more mouse buttons to SPICE Gerd Hoffmann
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2020-09-04  7:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: Li Qiang, Pan Nengyuan, Gerd Hoffmann, Euler Robot

From: Pan Nengyuan <pannengyuan@huawei.com>

'addr' is forgot to free in vnc_socket_ip_addr_string error path. Fix that.

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Pan Nengyuan <pannengyuan@huawei.com>
Reviewed-by: Li Qiang <liq3ea@gmail.com>
Message-Id: <20200831134315.1221-11-pannengyuan@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/vnc-auth-sasl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ui/vnc-auth-sasl.c b/ui/vnc-auth-sasl.c
index 7b2b09f24276..0517b2ead9ce 100644
--- a/ui/vnc-auth-sasl.c
+++ b/ui/vnc-auth-sasl.c
@@ -522,6 +522,7 @@ vnc_socket_ip_addr_string(QIOChannelSocket *ioc,
 
     if (addr->type != SOCKET_ADDRESS_TYPE_INET) {
         error_setg(errp, "Not an inet socket type");
+        qapi_free_SocketAddress(addr);
         return NULL;
     }
     ret = g_strdup_printf("%s;%s", addr->u.inet.host, addr->u.inet.port);
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PULL 3/4] ui: Add more mouse buttons to SPICE
  2020-09-04  7:01 [PULL 0/4] Ui 20200904 patches Gerd Hoffmann
  2020-09-04  7:01 ` [PULL 1/4] ui/gtk-gl-area: Plug memleak in gd_gl_area_create_context() Gerd Hoffmann
  2020-09-04  7:01 ` [PULL 2/4] vnc-auth-sasl: Plug memleak in vnc_socket_ip_addr_string Gerd Hoffmann
@ 2020-09-04  7:01 ` Gerd Hoffmann
  2020-09-04  7:01 ` [PULL 4/4] ui/gtk: Update refresh interval after widget is realized Gerd Hoffmann
  2020-09-06 18:00 ` [PULL 0/4] Ui 20200904 patches Peter Maydell
  4 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2020-09-04  7:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, Frediano Ziglio

From: Frediano Ziglio <freddy77@gmail.com>

Add support for SIDE and EXTRA buttons.

The constants for buttons in both SPICE and QEMU are defined as
  LEFT
  MIDDLE
  RIGHT
  UP
  DOWN
  SIDE
  EXTRA
(same order).

"button_mask" contains for each bit the state of a button. Qemu currently
uses bits 0, 1, 2 respectively as LEFT, RIGHT, MIDDLE; also add bits 4
and 5 as UP and DOWN (using wheel movements). SPICE protocol uses
a bitmask based on the order above where LEFT is bit 0, MIDDLE is
bit 1 and so on till EXTRA being bit 6. To avoid clash with Qemu usage
SPICE bitmask from SIDE are move a bit more resulting respectively
in 0x40 and 0x80 values.

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Message-id: 20200820145851.50846-1-fziglio@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/spice-input.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/ui/spice-input.c b/ui/spice-input.c
index cd4bb0043fd9..d5bba231c95c 100644
--- a/ui/spice-input.c
+++ b/ui/spice-input.c
@@ -123,6 +123,8 @@ static void spice_update_buttons(QemuSpicePointer *pointer,
         [INPUT_BUTTON_RIGHT]       = 0x02,
         [INPUT_BUTTON_WHEEL_UP]    = 0x10,
         [INPUT_BUTTON_WHEEL_DOWN]  = 0x20,
+        [INPUT_BUTTON_SIDE]        = 0x40,
+        [INPUT_BUTTON_EXTRA]       = 0x80,
     };
 
     if (wheel < 0) {
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PULL 4/4] ui/gtk: Update refresh interval after widget is realized
  2020-09-04  7:01 [PULL 0/4] Ui 20200904 patches Gerd Hoffmann
                   ` (2 preceding siblings ...)
  2020-09-04  7:01 ` [PULL 3/4] ui: Add more mouse buttons to SPICE Gerd Hoffmann
@ 2020-09-04  7:01 ` Gerd Hoffmann
  2020-09-06 18:00 ` [PULL 0/4] Ui 20200904 patches Peter Maydell
  4 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2020-09-04  7:01 UTC (permalink / raw)
  To: qemu-devel; +Cc: Philippe Mathieu-Daudé, Gerd Hoffmann, Nikola Pavlica

From: Philippe Mathieu-Daudé <philmd@redhat.com>

Nikola reported on Windows when gd_vc_gfx_init() is called, the
window is not yet realized, so we run gd_refresh_rate_millihz(NULL)
which returns 0 milli-Hertz.
When a Widget is realized, it fires a 'realized' event. We already
have the gd_draw_event() handler registered for this even, so simply
move the gd_refresh_rate_millihz() there. When the event fires, the
window is known to exist.
This completes commit c4c00922cc original intention.

Reported-by: Nikola Pavlica <pavlica.nikola@gmail.com>
Tested-by: Nikola Pavlica <pavlica.nikola@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20200817172331.598255-1-philmd@redhat.com
Suggested-by: Nikola Pavlica <pavlica.nikola@gmail.com>
Tested-by: Nikola Pavlica <pavlica.nikola@gmail.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/gtk.c | 52 ++++++++++++++++++++++++++--------------------------
 1 file changed, 26 insertions(+), 26 deletions(-)

diff --git a/ui/gtk.c b/ui/gtk.c
index b0cc08ad6da7..7a717ce8e5e4 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -744,6 +744,25 @@ static void gd_resize_event(GtkGLArea *area,
 
 #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)
 {
     VirtualConsole *vc = opaque;
@@ -751,6 +770,7 @@ static gboolean gd_draw_event(GtkWidget *widget, cairo_t *cr, void *opaque)
     int mx, my;
     int ww, wh;
     int fbw, fbh;
+    int refresh_rate_millihz;
 
 #if defined(CONFIG_OPENGL)
     if (vc->gfx.gls) {
@@ -771,6 +791,12 @@ static gboolean gd_draw_event(GtkWidget *widget, cairo_t *cr, void *opaque)
         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);
     fbh = surface_height(vc->gfx.ds);
 
@@ -1949,31 +1975,11 @@ static GtkWidget *gd_create_menu_machine(GtkDisplayState *s)
     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,
                               QemuConsole *con, int idx,
                               GSList *group, GtkWidget *view_menu)
 {
     bool zoom_to_fit = false;
-    int refresh_rate_millihz;
 
     vc->label = qemu_console_get_label(con);
     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.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);
 
     gd_connect_vc_gfx_signals(vc);
-- 
2.27.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PULL 0/4] Ui 20200904 patches
  2020-09-04  7:01 [PULL 0/4] Ui 20200904 patches Gerd Hoffmann
                   ` (3 preceding siblings ...)
  2020-09-04  7:01 ` [PULL 4/4] ui/gtk: Update refresh interval after widget is realized Gerd Hoffmann
@ 2020-09-06 18:00 ` Peter Maydell
  4 siblings, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2020-09-06 18:00 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: QEMU Developers

On Fri, 4 Sep 2020 at 08:04, Gerd Hoffmann <kraxel@redhat.com> wrote:
>
> The following changes since commit 67a7bfe560a1bba59efab085cb3430f45176d382:
>
>   Merge remote-tracking branch 'remotes/huth-gitlab/tags/pull-request-2020-09=
> -03' into staging (2020-09-03 16:58:25 +0100)
>
> are available in the Git repository at:
>
>   git://git.kraxel.org/qemu tags/ui-20200904-pull-request
>
> for you to fetch changes up to dc26435edb469ebdadf298dc3945b95d08f743d4:
>
>   ui/gtk: Update refresh interval after widget is realized (2020-09-04 07:32:=
> 28 +0200)
>
> ----------------------------------------------------------------
> ui: memleak fixes.
> gtk: refresh interval fix.
> spice: add mouse buttons.
>


Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/5.2
for any user-visible changes.

-- PMM


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-09-06 18:01 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-04  7:01 [PULL 0/4] Ui 20200904 patches Gerd Hoffmann
2020-09-04  7:01 ` [PULL 1/4] ui/gtk-gl-area: Plug memleak in gd_gl_area_create_context() Gerd Hoffmann
2020-09-04  7:01 ` [PULL 2/4] vnc-auth-sasl: Plug memleak in vnc_socket_ip_addr_string Gerd Hoffmann
2020-09-04  7:01 ` [PULL 3/4] ui: Add more mouse buttons to SPICE Gerd Hoffmann
2020-09-04  7:01 ` [PULL 4/4] ui/gtk: Update refresh interval after widget is realized Gerd Hoffmann
2020-09-06 18:00 ` [PULL 0/4] Ui 20200904 patches Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).