All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL v2 00/17] ui patch queue
@ 2016-05-13 12:32 Gerd Hoffmann
  2016-05-13 12:32 ` [Qemu-devel] [PULL v2 01/17] ui: gtk: fix crash when terminal inner-border is NULL Gerd Hoffmann
                   ` (17 more replies)
  0 siblings, 18 replies; 20+ messages in thread
From: Gerd Hoffmann @ 2016-05-13 12:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

  Hi,

Second try for the ui patch queue.  This time the mingw test builds done
with -Werror.  Warnings fixed.  A few more fixes picked up.

please pull,
  Gerd

The following changes since commit 860a3b34854d8abe9af9f1eb584691de926ce897:

  Update version for v2.6.0-rc5 release (2016-05-09 14:08:12 +0100)

are available in the git repository at:

  git://git.kraxel.org/qemu tags/pull-ui-20160513-1

for you to fetch changes up to 6978dc4adcdf27722aa6f9e13f88a903b30a3f8d:

  gtk: don't leak the GtkBorder with VTE 0.36 (2016-05-13 12:40:12 +0200)

----------------------------------------------------------------
gtk/sdl build tweaks
fix gtk 3.20 warnings
gtk clipboard support
spice-gl monitor config support
fix coverity warnings

----------------------------------------------------------------
Alberto Garcia (1):
      gtk: don't leak the GtkBorder with VTE 0.36

Cole Robinson (10):
      ui: gtk: fix crash when terminal inner-border is NULL
      ui: sdl2: Release grab before opening console window
      configure: build SDL if only SDL2 available
      configure: error on unknown --with-sdlabi value
      configure: add echo_version helper
      configure: report GTK version
      configure: report SDL version
      configure: support vte-2.91
      ui: gtk: Fix a runtime warning on vte >= 0.37
      ui: gtk: Fix some deprecation warnings

Gerd Hoffmann (2):
      spice/gl: add & use qemu_spice_gl_monitor_config
      gtk: update grab code for gtk 3.20

Gonglei (2):
      egl-helpers: fix possible resource leak
      spice: fix coverity complains

Md Haris Iqbal (1):
      Changed malloc to g_malloc, free to g_free in ui/shader.c

Michael S. Tsirkin (1):
      ui/gtk: copy to clipboard support

 configure                  |  62 +++++++++++++++---------
 include/ui/spice-display.h |   1 +
 ui/egl-helpers.c           |   9 ++--
 ui/gtk.c                   | 115 +++++++++++++++++++++++++++++++++++++--------
 ui/sdl2.c                  |   4 ++
 ui/shader.c                |   8 ++--
 ui/spice-display.c         |  34 ++++++++++++--
 7 files changed, 178 insertions(+), 55 deletions(-)

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

* [Qemu-devel] [PULL v2 01/17] ui: gtk: fix crash when terminal inner-border is NULL
  2016-05-13 12:32 [Qemu-devel] [PULL v2 00/17] ui patch queue Gerd Hoffmann
@ 2016-05-13 12:32 ` Gerd Hoffmann
  2016-05-13 12:32 ` [Qemu-devel] [PULL v2 02/17] ui: sdl2: Release grab before opening console window Gerd Hoffmann
                   ` (16 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Gerd Hoffmann @ 2016-05-13 12:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: Cole Robinson, Gerd Hoffmann

From: Cole Robinson <crobinso@redhat.com>

VTE terminal inner-border can be NULL. The vte-0.36 (API 2.90)
code checks for the condition too so I assume it's not just a bug

Fixes a crash on Fedora 24 with gtk 3.20

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Message-id: 2b2e85d403e8760ea53afd735a170500d5c17716.1462557436.git.crobinso@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/gtk.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/ui/gtk.c b/ui/gtk.c
index f372a6d..9876d89 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -340,10 +340,12 @@ static void gd_update_geometry_hints(VirtualConsole *vc)
         geo.min_height = geo.height_inc * VC_TERM_Y_MIN;
         mask |= GDK_HINT_MIN_SIZE;
         gtk_widget_style_get(vc->vte.terminal, "inner-border", &ib, NULL);
-        geo.base_width  += ib->left + ib->right;
-        geo.base_height += ib->top + ib->bottom;
-        geo.min_width   += ib->left + ib->right;
-        geo.min_height  += ib->top + ib->bottom;
+        if (ib) {
+            geo.base_width  += ib->left + ib->right;
+            geo.base_height += ib->top + ib->bottom;
+            geo.min_width   += ib->left + ib->right;
+            geo.min_height  += ib->top + ib->bottom;
+        }
         geo_widget = vc->vte.terminal;
 #endif
     }
-- 
1.8.3.1

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

* [Qemu-devel] [PULL v2 02/17] ui: sdl2: Release grab before opening console window
  2016-05-13 12:32 [Qemu-devel] [PULL v2 00/17] ui patch queue Gerd Hoffmann
  2016-05-13 12:32 ` [Qemu-devel] [PULL v2 01/17] ui: gtk: fix crash when terminal inner-border is NULL Gerd Hoffmann
@ 2016-05-13 12:32 ` Gerd Hoffmann
  2016-05-13 12:32 ` [Qemu-devel] [PULL v2 03/17] configure: build SDL if only SDL2 available Gerd Hoffmann
                   ` (15 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Gerd Hoffmann @ 2016-05-13 12:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: Cole Robinson, Gerd Hoffmann

From: Cole Robinson <crobinso@redhat.com>

sdl 2.0.4 currently has a bug which causes our UI shortcuts to fire
rapidly in succession:

  https://bugzilla.libsdl.org/show_bug.cgi?id=3287

It's a toss up whether ctrl+alt+f or ctrl+alt+2 will fire an
odd or even number of times, thus determining whether the action
succeeds or fails.

Opening monitor/serial windows is doubly broken, since it will often
lock the UI trying to grab the pointer:

  0x00007fffef3720a5 in SDL_Delay_REAL () at /lib64/libSDL2-2.0.so.0
  0x00007fffef3688ba in X11_SetWindowGrab () at /lib64/libSDL2-2.0.so.0
  0x00007fffef2f2da7 in SDL_SendWindowEvent () at /lib64/libSDL2-2.0.so.0
  0x00007fffef2f080b in SDL_SetKeyboardFocus () at /lib64/libSDL2-2.0.so.0
  0x00007fffef35d784 in X11_DispatchFocusIn.isra.8 () at /lib64/libSDL2-2.0.so.0
  0x00007fffef35dbce in X11_DispatchEvent () at /lib64/libSDL2-2.0.so.0
  0x00007fffef35ee4a in X11_PumpEvents () at /lib64/libSDL2-2.0.so.0
  0x00007fffef2eea6a in SDL_PumpEvents_REAL () at /lib64/libSDL2-2.0.so.0
  0x00007fffef2eeab5 in SDL_WaitEventTimeout_REAL () at /lib64/libSDL2-2.0.so.0
  0x000055555597eed0 in sdl2_poll_events (scon=0x55555876f928) at ui/sdl2.c:593

We can work around that hang by ungrabbing the pointer before launching
a new window. This roughly matches what our sdl1 code does

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Message-id: 31c9ab6540b031f7a614c59edcecea9877685612.1462557436.git.crobinso@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/sdl2.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ui/sdl2.c b/ui/sdl2.c
index d042442..909038f 100644
--- a/ui/sdl2.c
+++ b/ui/sdl2.c
@@ -357,6 +357,10 @@ static void handle_keydown(SDL_Event *ev)
         case SDL_SCANCODE_7:
         case SDL_SCANCODE_8:
         case SDL_SCANCODE_9:
+            if (gui_grab) {
+                sdl_grab_end(scon);
+            }
+
             win = ev->key.keysym.scancode - SDL_SCANCODE_1;
             if (win < sdl2_num_outputs) {
                 sdl2_console[win].hidden = !sdl2_console[win].hidden;
-- 
1.8.3.1

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

* [Qemu-devel] [PULL v2 03/17] configure: build SDL if only SDL2 available
  2016-05-13 12:32 [Qemu-devel] [PULL v2 00/17] ui patch queue Gerd Hoffmann
  2016-05-13 12:32 ` [Qemu-devel] [PULL v2 01/17] ui: gtk: fix crash when terminal inner-border is NULL Gerd Hoffmann
  2016-05-13 12:32 ` [Qemu-devel] [PULL v2 02/17] ui: sdl2: Release grab before opening console window Gerd Hoffmann
@ 2016-05-13 12:32 ` Gerd Hoffmann
  2016-05-13 12:32 ` [Qemu-devel] [PULL v2 04/17] configure: error on unknown --with-sdlabi value Gerd Hoffmann
                   ` (14 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Gerd Hoffmann @ 2016-05-13 12:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: Cole Robinson, Gerd Hoffmann

From: Cole Robinson <crobinso@redhat.com>

Right now if SDL2 is installed but not SDL1, default configure will
entirely disable SDL. Check upfront for SDL2 using pkg-config, but
still prefer SDL1 if both versions are installed.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Message-id: c9e570b5964d128a3595efe3170129a3da459776.1462557436.git.crobinso@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 configure | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index c37fc5f..0b53fac 100755
--- a/configure
+++ b/configure
@@ -207,7 +207,7 @@ fdt=""
 netmap="no"
 pixman=""
 sdl=""
-sdlabi="1.2"
+sdlabi=""
 virtfs=""
 vnc="yes"
 sparse="no"
@@ -2420,6 +2420,16 @@ fi
 # Look for sdl configuration program (pkg-config or sdl-config).  Try
 # sdl-config even without cross prefix, and favour pkg-config over sdl-config.
 
+if test "$sdlabi" = ""; then
+    if $pkg_config --exists "sdl"; then
+        sdlabi=1.2
+    elif $pkg_config --exists "sdl2"; then
+        sdlabi=2.0
+    else
+        sdlabi=1.2
+    fi
+fi
+
 if test $sdlabi = "2.0"; then
     sdl_config=$sdl2_config
     sdlname=sdl2
-- 
1.8.3.1

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

* [Qemu-devel] [PULL v2 04/17] configure: error on unknown --with-sdlabi value
  2016-05-13 12:32 [Qemu-devel] [PULL v2 00/17] ui patch queue Gerd Hoffmann
                   ` (2 preceding siblings ...)
  2016-05-13 12:32 ` [Qemu-devel] [PULL v2 03/17] configure: build SDL if only SDL2 available Gerd Hoffmann
@ 2016-05-13 12:32 ` Gerd Hoffmann
  2016-05-13 12:32 ` [Qemu-devel] [PULL v2 05/17] configure: add echo_version helper Gerd Hoffmann
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Gerd Hoffmann @ 2016-05-13 12:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: Cole Robinson, Gerd Hoffmann

From: Cole Robinson <crobinso@redhat.com>

I accidentally tried --with-sdlabi="1.0", and it failed much later in
a weird way. Instead, throw an error if the value isn't in our
whitelist.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Message-id: 60e4822e17697d257a914df03bdb9fff4b4c0490.1462557436.git.crobinso@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 configure | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 0b53fac..8e25a24 100755
--- a/configure
+++ b/configure
@@ -2434,9 +2434,11 @@ if test $sdlabi = "2.0"; then
     sdl_config=$sdl2_config
     sdlname=sdl2
     sdlconfigname=sdl2_config
-else
+elif test $sdlabi = "1.2"; then
     sdlname=sdl
     sdlconfigname=sdl_config
+else
+    error_exit "Unknown sdlabi $sdlabi, must be 1.2 or 2.0"
 fi
 
 if test "`basename $sdl_config`" != $sdlconfigname && ! has ${sdl_config}; then
-- 
1.8.3.1

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

* [Qemu-devel] [PULL v2 05/17] configure: add echo_version helper
  2016-05-13 12:32 [Qemu-devel] [PULL v2 00/17] ui patch queue Gerd Hoffmann
                   ` (3 preceding siblings ...)
  2016-05-13 12:32 ` [Qemu-devel] [PULL v2 04/17] configure: error on unknown --with-sdlabi value Gerd Hoffmann
@ 2016-05-13 12:32 ` Gerd Hoffmann
  2016-05-13 12:32 ` [Qemu-devel] [PULL v2 06/17] configure: report GTK version Gerd Hoffmann
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Gerd Hoffmann @ 2016-05-13 12:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: Cole Robinson, Gerd Hoffmann

From: Cole Robinson <crobinso@redhat.com>

Simplifies printing library versions, dependent on if the library
was even found

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Message-id: 3c9ab16123e06bb4109771ef6ee8acd82d449ba0.1462557436.git.crobinso@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 configure | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/configure b/configure
index 8e25a24..76600f4 100755
--- a/configure
+++ b/configure
@@ -4730,6 +4730,12 @@ EOF
   fi
 fi
 
+echo_version() {
+    if test "$1" = "yes" ; then
+        echo "($2)"
+    fi
+}
+
 # prepend pixman and ftd flags after all config tests are done
 QEMU_CFLAGS="$pixman_cflags $fdt_cflags $QEMU_CFLAGS"
 libs_softmmu="$pixman_libs $libs_softmmu"
@@ -4787,11 +4793,7 @@ echo "GNUTLS hash       $gnutls_hash"
 echo "GNUTLS rnd        $gnutls_rnd"
 echo "libgcrypt         $gcrypt"
 echo "libgcrypt kdf     $gcrypt_kdf"
-if test "$nettle" = "yes"; then
-    echo "nettle            $nettle ($nettle_version)"
-else
-    echo "nettle            $nettle"
-fi
+echo "nettle            $nettle `echo_version $nettle $nettle_version`"
 echo "nettle kdf        $nettle_kdf"
 echo "libtasn1          $tasn1"
 echo "VTE support       $vte"
@@ -4843,11 +4845,7 @@ echo "Trace backends    $trace_backends"
 if have_backend "simple"; then
 echo "Trace output file $trace_file-<pid>"
 fi
-if test "$spice" = "yes"; then
-echo "spice support     $spice ($spice_protocol_version/$spice_server_version)"
-else
-echo "spice support     $spice"
-fi
+echo "spice support     $spice `echo_version $spice $spice_protocol_version/$spice_server_version`"
 echo "rbd support       $rbd"
 echo "xfsctl support    $xfs"
 echo "smartcard support $smartcard"
-- 
1.8.3.1

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

* [Qemu-devel] [PULL v2 06/17] configure: report GTK version
  2016-05-13 12:32 [Qemu-devel] [PULL v2 00/17] ui patch queue Gerd Hoffmann
                   ` (4 preceding siblings ...)
  2016-05-13 12:32 ` [Qemu-devel] [PULL v2 05/17] configure: add echo_version helper Gerd Hoffmann
@ 2016-05-13 12:32 ` Gerd Hoffmann
  2016-05-13 12:32 ` [Qemu-devel] [PULL v2 07/17] configure: report SDL version Gerd Hoffmann
                   ` (11 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Gerd Hoffmann @ 2016-05-13 12:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: Cole Robinson, Gerd Hoffmann

From: Cole Robinson <crobinso@redhat.com>

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Message-id: 4c464e20d69fdcf21927ceed31a8d749b4af0c49.1462557436.git.crobinso@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 configure | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/configure b/configure
index 76600f4..55bd354 100755
--- a/configure
+++ b/configure
@@ -2157,6 +2157,7 @@ if test "$gtk" != "no"; then
     if $pkg_config --exists "$gtkpackage >= $gtkversion"; then
         gtk_cflags=`$pkg_config --cflags $gtkpackage`
         gtk_libs=`$pkg_config --libs $gtkpackage`
+        gtk_version=`$pkg_config --modversion $gtkpackage`
         if $pkg_config --exists "$gtkx11package >= $gtkversion"; then
             gtk_cflags="$gtk_cflags $x11_cflags"
             gtk_libs="$gtk_libs $x11_libs"
@@ -4786,7 +4787,7 @@ if test "$darwin" = "yes" ; then
 fi
 echo "pixman            $pixman"
 echo "SDL support       $sdl"
-echo "GTK support       $gtk"
+echo "GTK support       $gtk `echo_version $gtk $gtk_version`"
 echo "GTK GL support    $gtk_gl"
 echo "GNUTLS support    $gnutls"
 echo "GNUTLS hash       $gnutls_hash"
-- 
1.8.3.1

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

* [Qemu-devel] [PULL v2 07/17] configure: report SDL version
  2016-05-13 12:32 [Qemu-devel] [PULL v2 00/17] ui patch queue Gerd Hoffmann
                   ` (5 preceding siblings ...)
  2016-05-13 12:32 ` [Qemu-devel] [PULL v2 06/17] configure: report GTK version Gerd Hoffmann
@ 2016-05-13 12:32 ` Gerd Hoffmann
  2016-05-13 12:32 ` [Qemu-devel] [PULL v2 08/17] configure: support vte-2.91 Gerd Hoffmann
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Gerd Hoffmann @ 2016-05-13 12:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: Cole Robinson, Gerd Hoffmann

From: Cole Robinson <crobinso@redhat.com>

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Message-id: 98e4a3b98dc824bfaff96db43b172272c780c15f.1462557436.git.crobinso@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 configure | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/configure b/configure
index 55bd354..22cf55c 100755
--- a/configure
+++ b/configure
@@ -2448,10 +2448,10 @@ fi
 
 if $pkg_config $sdlname --exists; then
   sdlconfig="$pkg_config $sdlname"
-  _sdlversion=`$sdlconfig --modversion 2>/dev/null | sed 's/[^0-9]//g'`
+  sdlversion=`$sdlconfig --modversion 2>/dev/null`
 elif has ${sdl_config}; then
   sdlconfig="$sdl_config"
-  _sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
+  sdlversion=`$sdlconfig --version`
 else
   if test "$sdl" = "yes" ; then
     feature_not_found "sdl" "Install SDL devel"
@@ -2476,7 +2476,7 @@ EOF
     sdl_libs=`$sdlconfig --libs 2> /dev/null`
   fi
   if compile_prog "$sdl_cflags" "$sdl_libs" ; then
-    if test "$_sdlversion" -lt 121 ; then
+    if test `echo $sdlversion | sed 's/[^0-9]//g'` -lt 121 ; then
       sdl_too_old=yes
     else
       sdl=yes
@@ -4786,7 +4786,7 @@ if test "$darwin" = "yes" ; then
     echo "Cocoa support     $cocoa"
 fi
 echo "pixman            $pixman"
-echo "SDL support       $sdl"
+echo "SDL support       $sdl `echo_version $sdl $sdlversion`"
 echo "GTK support       $gtk `echo_version $gtk $gtk_version`"
 echo "GTK GL support    $gtk_gl"
 echo "GNUTLS support    $gnutls"
-- 
1.8.3.1

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

* [Qemu-devel] [PULL v2 08/17] configure: support vte-2.91
  2016-05-13 12:32 [Qemu-devel] [PULL v2 00/17] ui patch queue Gerd Hoffmann
                   ` (6 preceding siblings ...)
  2016-05-13 12:32 ` [Qemu-devel] [PULL v2 07/17] configure: report SDL version Gerd Hoffmann
@ 2016-05-13 12:32 ` Gerd Hoffmann
  2016-05-13 12:32 ` [Qemu-devel] [PULL v2 09/17] ui: gtk: Fix a runtime warning on vte >= 0.37 Gerd Hoffmann
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Gerd Hoffmann @ 2016-05-13 12:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: Cole Robinson, Gerd Hoffmann

From: Cole Robinson <crobinso@redhat.com>

vte >= 0.37 expores API version 2.91, which is where all the active
development is. qemu builds and runs fine with that version, so use it
if it's available.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Message-id: b4f0375647f7b368d3dbd3834aee58cb0253566a.1462557436.git.crobinso@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 configure | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/configure b/configure
index 22cf55c..bbf9005 100755
--- a/configure
+++ b/configure
@@ -2393,20 +2393,25 @@ fi
 
 if test "$vte" != "no"; then
     if test "$gtkabi" = "3.0"; then
-      vtepackage="vte-2.90"
-      vteversion="0.32.0"
+      vteminversion="0.32.0"
+      if $pkg_config --exists "vte-2.91"; then
+        vtepackage="vte-2.91"
+      else
+        vtepackage="vte-2.90"
+      fi
     else
       vtepackage="vte"
-      vteversion="0.24.0"
+      vteminversion="0.24.0"
     fi
-    if $pkg_config --exists "$vtepackage >= $vteversion"; then
+    if $pkg_config --exists "$vtepackage >= $vteminversion"; then
         vte_cflags=`$pkg_config --cflags $vtepackage`
         vte_libs=`$pkg_config --libs $vtepackage`
+        vteversion=`$pkg_config --modversion $vtepackage`
         libs_softmmu="$vte_libs $libs_softmmu"
         vte="yes"
     elif test "$vte" = "yes"; then
         if test "$gtkabi" = "3.0"; then
-            feature_not_found "vte" "Install libvte-2.90 devel"
+            feature_not_found "vte" "Install libvte-2.90/2.91 devel"
         else
             feature_not_found "vte" "Install libvte devel"
         fi
@@ -4789,6 +4794,7 @@ echo "pixman            $pixman"
 echo "SDL support       $sdl `echo_version $sdl $sdlversion`"
 echo "GTK support       $gtk `echo_version $gtk $gtk_version`"
 echo "GTK GL support    $gtk_gl"
+echo "VTE support       $vte `echo_version $vte $vteversion`"
 echo "GNUTLS support    $gnutls"
 echo "GNUTLS hash       $gnutls_hash"
 echo "GNUTLS rnd        $gnutls_rnd"
@@ -4797,7 +4803,6 @@ echo "libgcrypt kdf     $gcrypt_kdf"
 echo "nettle            $nettle `echo_version $nettle $nettle_version`"
 echo "nettle kdf        $nettle_kdf"
 echo "libtasn1          $tasn1"
-echo "VTE support       $vte"
 echo "curses support    $curses"
 echo "virgl support     $virglrenderer"
 echo "curl support      $curl"
-- 
1.8.3.1

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

* [Qemu-devel] [PULL v2 09/17] ui: gtk: Fix a runtime warning on vte >= 0.37
  2016-05-13 12:32 [Qemu-devel] [PULL v2 00/17] ui patch queue Gerd Hoffmann
                   ` (7 preceding siblings ...)
  2016-05-13 12:32 ` [Qemu-devel] [PULL v2 08/17] configure: support vte-2.91 Gerd Hoffmann
@ 2016-05-13 12:32 ` Gerd Hoffmann
  2016-05-13 12:32 ` [Qemu-devel] [PULL v2 10/17] ui: gtk: Fix some deprecation warnings Gerd Hoffmann
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Gerd Hoffmann @ 2016-05-13 12:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: Cole Robinson, Gerd Hoffmann

From: Cole Robinson <crobinso@redhat.com>

inner-border was dropped in vte API 2.91, in favor of the standard
padding style

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Message-id: 60a6cdc337d611d902f53907e66a8f37ea374d65.1462557436.git.crobinso@redhat.com

[ kraxel: Fix warning with old vte version. ]

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/gtk.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/ui/gtk.c b/ui/gtk.c
index 9876d89..28e7d28 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -330,6 +330,17 @@ static void gd_update_geometry_hints(VirtualConsole *vc)
         VteTerminal *term = VTE_TERMINAL(vc->vte.terminal);
         GtkBorder *ib;
 
+#if VTE_CHECK_VERSION(0, 37, 0)
+        GtkBorder padding;
+        gtk_style_context_get_padding(
+                gtk_widget_get_style_context(vc->vte.terminal),
+                gtk_widget_get_state_flags(vc->vte.terminal),
+                &padding);
+        ib = &padding;
+#else
+        gtk_widget_style_get(vc->vte.terminal, "inner-border", &ib, NULL);
+#endif
+
         geo.width_inc  = vte_terminal_get_char_width(term);
         geo.height_inc = vte_terminal_get_char_height(term);
         mask |= GDK_HINT_RESIZE_INC;
@@ -339,7 +350,7 @@ static void gd_update_geometry_hints(VirtualConsole *vc)
         geo.min_width  = geo.width_inc * VC_TERM_X_MIN;
         geo.min_height = geo.height_inc * VC_TERM_Y_MIN;
         mask |= GDK_HINT_MIN_SIZE;
-        gtk_widget_style_get(vc->vte.terminal, "inner-border", &ib, NULL);
+
         if (ib) {
             geo.base_width  += ib->left + ib->right;
             geo.base_height += ib->top + ib->bottom;
-- 
1.8.3.1

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

* [Qemu-devel] [PULL v2 10/17] ui: gtk: Fix some deprecation warnings
  2016-05-13 12:32 [Qemu-devel] [PULL v2 00/17] ui patch queue Gerd Hoffmann
                   ` (8 preceding siblings ...)
  2016-05-13 12:32 ` [Qemu-devel] [PULL v2 09/17] ui: gtk: Fix a runtime warning on vte >= 0.37 Gerd Hoffmann
@ 2016-05-13 12:32 ` Gerd Hoffmann
  2016-05-13 12:32 ` [Qemu-devel] [PULL v2 11/17] ui/gtk: copy to clipboard support Gerd Hoffmann
                   ` (7 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Gerd Hoffmann @ 2016-05-13 12:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: Cole Robinson, Gerd Hoffmann

From: Cole Robinson <crobinso@redhat.com>

All device manager APIs are deprecated now. Much of our usage is
just to get the current pointer, so centralize that logic and use
the new seat APIs

Signed-off-by: Cole Robinson <crobinso@redhat.com>
Message-id: d6dec24220a4e1449a0172119c10c48e145c0f6f.1462557436.git.crobinso@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/gtk.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/ui/gtk.c b/ui/gtk.c
index 28e7d28..2e360e3 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -476,12 +476,21 @@ static void gd_refresh(DisplayChangeListener *dcl)
 }
 
 #if GTK_CHECK_VERSION(3, 0, 0)
+static GdkDevice *gd_get_pointer(GdkDisplay *dpy)
+{
+#if GTK_CHECK_VERSION(3, 20, 0)
+    return gdk_seat_get_pointer(gdk_display_get_default_seat(dpy));
+#else
+    return gdk_device_manager_get_client_pointer(
+        gdk_display_get_device_manager(dpy));
+#endif
+}
+
 static void gd_mouse_set(DisplayChangeListener *dcl,
                          int x, int y, int visible)
 {
     VirtualConsole *vc = container_of(dcl, VirtualConsole, gfx.dcl);
     GdkDisplay *dpy;
-    GdkDeviceManager *mgr;
     gint x_root, y_root;
 
     if (qemu_input_is_absolute()) {
@@ -489,10 +498,9 @@ static void gd_mouse_set(DisplayChangeListener *dcl,
     }
 
     dpy = gtk_widget_get_display(vc->gfx.drawing_area);
-    mgr = gdk_display_get_device_manager(dpy);
     gdk_window_get_root_coords(gtk_widget_get_window(vc->gfx.drawing_area),
                                x, y, &x_root, &y_root);
-    gdk_device_warp(gdk_device_manager_get_client_pointer(mgr),
+    gdk_device_warp(gd_get_pointer(dpy),
                     gtk_widget_get_screen(vc->gfx.drawing_area),
                     x_root, y_root);
     vc->s->last_x = x;
@@ -1402,7 +1410,6 @@ static void gd_grab_pointer(VirtualConsole *vc, const char *reason)
     }
 
 #if GTK_CHECK_VERSION(3, 0, 0)
-    GdkDeviceManager *mgr = gdk_display_get_device_manager(display);
     gd_grab_devices(vc, true, GDK_SOURCE_MOUSE,
                     GDK_POINTER_MOTION_MASK |
                     GDK_BUTTON_PRESS_MASK |
@@ -1410,7 +1417,7 @@ static void gd_grab_pointer(VirtualConsole *vc, const char *reason)
                     GDK_BUTTON_MOTION_MASK |
                     GDK_SCROLL_MASK,
                     vc->s->null_cursor);
-    gdk_device_get_position(gdk_device_manager_get_client_pointer(mgr),
+    gdk_device_get_position(gd_get_pointer(display),
                             NULL, &vc->s->grab_x_root, &vc->s->grab_y_root);
 #else
     gdk_pointer_grab(gtk_widget_get_window(vc->gfx.drawing_area),
@@ -1442,9 +1449,8 @@ static void gd_ungrab_pointer(GtkDisplayState *s)
 
     GdkDisplay *display = gtk_widget_get_display(vc->gfx.drawing_area);
 #if GTK_CHECK_VERSION(3, 0, 0)
-    GdkDeviceManager *mgr = gdk_display_get_device_manager(display);
     gd_grab_devices(vc, false, GDK_SOURCE_MOUSE, 0, NULL);
-    gdk_device_warp(gdk_device_manager_get_client_pointer(mgr),
+    gdk_device_warp(gd_get_pointer(display),
                     gtk_widget_get_screen(vc->gfx.drawing_area),
                     vc->s->grab_x_root, vc->s->grab_y_root);
 #else
-- 
1.8.3.1

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

* [Qemu-devel] [PULL v2 11/17] ui/gtk: copy to clipboard support
  2016-05-13 12:32 [Qemu-devel] [PULL v2 00/17] ui patch queue Gerd Hoffmann
                   ` (9 preceding siblings ...)
  2016-05-13 12:32 ` [Qemu-devel] [PULL v2 10/17] ui: gtk: Fix some deprecation warnings Gerd Hoffmann
@ 2016-05-13 12:32 ` Gerd Hoffmann
  2016-05-13 12:32 ` [Qemu-devel] [PULL v2 12/17] spice/gl: add & use qemu_spice_gl_monitor_config Gerd Hoffmann
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Gerd Hoffmann @ 2016-05-13 12:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: Michael S. Tsirkin, Gerd Hoffmann

From: "Michael S. Tsirkin" <mst@redhat.com>

This adds a menu item to copy current selection to clipboard.
Seems handy for copying out guest error messages.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-id: 1460924740-24513-1-git-send-email-mst@redhat.com

[ kraxel: fix build with CONFIG_VTE=n ]
[ kraxel: fix build with CONFIG_VTE=n, now for real ]

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/gtk.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/ui/gtk.c b/ui/gtk.c
index 2e360e3..2c0f20b 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -139,6 +139,7 @@ struct GtkDisplayState {
     GtkWidget *view_menu_item;
     GtkWidget *view_menu;
     GtkWidget *full_screen_item;
+    GtkWidget *copy_item;
     GtkWidget *zoom_in_item;
     GtkWidget *zoom_out_item;
     GtkWidget *zoom_fixed_item;
@@ -1589,6 +1590,14 @@ static GSList *gd_vc_menu_init(GtkDisplayState *s, VirtualConsole *vc,
 }
 
 #if defined(CONFIG_VTE)
+static void gd_menu_copy(GtkMenuItem *item, void *opaque)
+{
+    GtkDisplayState *s = opaque;
+    VirtualConsole *vc = gd_vc_find_current(s);
+
+    vte_terminal_copy_clipboard(VTE_TERMINAL(vc->vte.terminal));
+}
+
 static void gd_vc_adjustment_changed(GtkAdjustment *adjustment, void *opaque)
 {
     VirtualConsole *vc = opaque;
@@ -1825,6 +1834,10 @@ static void gd_connect_signals(GtkDisplayState *s)
                      G_CALLBACK(gd_menu_powerdown), s);
     g_signal_connect(s->quit_item, "activate",
                      G_CALLBACK(gd_menu_quit), s);
+#if defined(CONFIG_VTE)
+    g_signal_connect(s->copy_item, "activate",
+                     G_CALLBACK(gd_menu_copy), s);
+#endif
     g_signal_connect(s->full_screen_item, "activate",
                      G_CALLBACK(gd_menu_full_screen), s);
     g_signal_connect(s->zoom_in_item, "activate",
@@ -1958,6 +1971,11 @@ static GtkWidget *gd_create_menu_view(GtkDisplayState *s)
 
     s->full_screen_item = gtk_menu_item_new_with_mnemonic(_("_Fullscreen"));
 
+#if defined(CONFIG_VTE)
+    s->copy_item = gtk_menu_item_new_with_mnemonic(_("_Copy"));
+    gtk_menu_shell_append(GTK_MENU_SHELL(view_menu), s->copy_item);
+#endif
+
     gtk_accel_group_connect(s->accel_group, GDK_KEY_f, HOTKEY_MODIFIERS, 0,
             g_cclosure_new_swap(G_CALLBACK(gd_accel_full_screen), s, NULL));
 #if GTK_CHECK_VERSION(3, 8, 0)
-- 
1.8.3.1

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

* [Qemu-devel] [PULL v2 12/17] spice/gl: add & use qemu_spice_gl_monitor_config
  2016-05-13 12:32 [Qemu-devel] [PULL v2 00/17] ui patch queue Gerd Hoffmann
                   ` (10 preceding siblings ...)
  2016-05-13 12:32 ` [Qemu-devel] [PULL v2 11/17] ui/gtk: copy to clipboard support Gerd Hoffmann
@ 2016-05-13 12:32 ` Gerd Hoffmann
  2016-05-13 12:32 ` [Qemu-devel] [PULL v2 13/17] Changed malloc to g_malloc, free to g_free in ui/shader.c Gerd Hoffmann
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Gerd Hoffmann @ 2016-05-13 12:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, qemu-stable

Cc: qemu-stable@nongnu.org
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 include/ui/spice-display.h |  1 +
 ui/spice-display.c         | 30 ++++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/include/ui/spice-display.h b/include/ui/spice-display.h
index 30ccfe3..568b64a 100644
--- a/include/ui/spice-display.h
+++ b/include/ui/spice-display.h
@@ -71,6 +71,7 @@ typedef struct QXLCookie {
             QXLRect area;
             int redraw;
         } render;
+        void *data;
     } u;
 } QXLCookie;
 
diff --git a/ui/spice-display.c b/ui/spice-display.c
index 242ab5f..2a77a54 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -660,6 +660,11 @@ static void interface_async_complete(QXLInstance *sin, uint64_t cookie_token)
         qemu_bh_schedule(ssd->gl_unblock_bh);
         break;
     }
+    case QXL_COOKIE_TYPE_IO:
+        if (cookie->io == QXL_IO_MONITORS_CONFIG_ASYNC) {
+            g_free(cookie->u.data);
+        }
+        break;
 #endif
     default:
         /* should never be called, used in qxl native mode only */
@@ -795,6 +800,29 @@ static const DisplayChangeListenerOps display_listener_ops = {
 
 #ifdef HAVE_SPICE_GL
 
+static void qemu_spice_gl_monitor_config(SimpleSpiceDisplay *ssd,
+                                         int x, int y, int w, int h)
+{
+    QXLMonitorsConfig *config;
+    QXLCookie *cookie;
+
+    config = g_malloc0(sizeof(QXLMonitorsConfig) + sizeof(QXLHead));
+    config->count = 1;
+    config->max_allowed = 1;
+    config->heads[0].x = x;
+    config->heads[0].y = y;
+    config->heads[0].width = w;
+    config->heads[0].height = h;
+    cookie = qxl_cookie_new(QXL_COOKIE_TYPE_IO,
+                            QXL_IO_MONITORS_CONFIG_ASYNC);
+    cookie->u.data = config;
+
+    spice_qxl_monitors_config_async(&ssd->qxl,
+                                    (uintptr_t)config,
+                                    MEMSLOT_GROUP_HOST,
+                                    (uintptr_t)cookie);
+}
+
 static void qemu_spice_gl_block(SimpleSpiceDisplay *ssd, bool block)
 {
     uint64_t timeout;
@@ -858,6 +886,8 @@ static void qemu_spice_gl_scanout(DisplayChangeListener *dcl,
                          surface_width(ssd->ds),
                          surface_height(ssd->ds),
                          stride, fourcc, y_0_top);
+
+    qemu_spice_gl_monitor_config(ssd, x, y, w, h);
 }
 
 static void qemu_spice_gl_update(DisplayChangeListener *dcl,
-- 
1.8.3.1

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

* [Qemu-devel] [PULL v2 13/17] Changed malloc to g_malloc, free to g_free in ui/shader.c
  2016-05-13 12:32 [Qemu-devel] [PULL v2 00/17] ui patch queue Gerd Hoffmann
                   ` (11 preceding siblings ...)
  2016-05-13 12:32 ` [Qemu-devel] [PULL v2 12/17] spice/gl: add & use qemu_spice_gl_monitor_config Gerd Hoffmann
@ 2016-05-13 12:32 ` Gerd Hoffmann
  2016-05-13 12:32 ` [Qemu-devel] [PULL v2 14/17] egl-helpers: fix possible resource leak Gerd Hoffmann
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Gerd Hoffmann @ 2016-05-13 12:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: Md Haris Iqbal, Gerd Hoffmann

From: Md Haris Iqbal <haris.phnx@gmail.com>

Signed-off-by: Md Haris Iqbal <haris.phnx@gmail.com>
Message-id: 1459862499-4768-1-git-send-email-haris.phnx@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/shader.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/ui/shader.c b/ui/shader.c
index 9264009..1ffddbe 100644
--- a/ui/shader.c
+++ b/ui/shader.c
@@ -83,12 +83,12 @@ GLuint qemu_gl_create_compile_shader(GLenum type, const GLchar *src)
     glGetShaderiv(shader, GL_COMPILE_STATUS, &status);
     if (!status) {
         glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &length);
-        errmsg = malloc(length);
+        errmsg = g_malloc(length);
         glGetShaderInfoLog(shader, length, &length, errmsg);
         fprintf(stderr, "%s: compile %s error\n%s\n", __func__,
                 (type == GL_VERTEX_SHADER) ? "vertex" : "fragment",
                 errmsg);
-        free(errmsg);
+        g_free(errmsg);
         return 0;
     }
     return shader;
@@ -108,10 +108,10 @@ GLuint qemu_gl_create_link_program(GLuint vert, GLuint frag)
     glGetProgramiv(program, GL_LINK_STATUS, &status);
     if (!status) {
         glGetProgramiv(program, GL_INFO_LOG_LENGTH, &length);
-        errmsg = malloc(length);
+        errmsg = g_malloc(length);
         glGetProgramInfoLog(program, length, &length, errmsg);
         fprintf(stderr, "%s: link program: %s\n", __func__, errmsg);
-        free(errmsg);
+        g_free(errmsg);
         return 0;
     }
     return program;
-- 
1.8.3.1

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

* [Qemu-devel] [PULL v2 14/17] egl-helpers: fix possible resource leak
  2016-05-13 12:32 [Qemu-devel] [PULL v2 00/17] ui patch queue Gerd Hoffmann
                   ` (12 preceding siblings ...)
  2016-05-13 12:32 ` [Qemu-devel] [PULL v2 13/17] Changed malloc to g_malloc, free to g_free in ui/shader.c Gerd Hoffmann
@ 2016-05-13 12:32 ` Gerd Hoffmann
  2016-05-13 12:32 ` [Qemu-devel] [PULL v2 15/17] spice: fix coverity complains Gerd Hoffmann
                   ` (3 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Gerd Hoffmann @ 2016-05-13 12:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gonglei, Gerd Hoffmann

From: Gonglei <arei.gonglei@huawei.com>

CID 1352419, using g_strdup_printf instead of asprintf.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1463047028-123868-2-git-send-email-arei.gonglei@huawei.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/egl-helpers.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/ui/egl-helpers.c b/ui/egl-helpers.c
index 558edfd..22835c0 100644
--- a/ui/egl-helpers.c
+++ b/ui/egl-helpers.c
@@ -49,18 +49,15 @@ int qemu_egl_rendernode_open(void)
             continue;
         }
 
-        r = asprintf(&p, "/dev/dri/%s", e->d_name);
-        if (r < 0) {
-            return -1;
-        }
+        p = g_strdup_printf("/dev/dri/%s", e->d_name);
 
         r = open(p, O_RDWR | O_CLOEXEC | O_NOCTTY | O_NONBLOCK);
         if (r < 0) {
-            free(p);
+            g_free(p);
             continue;
         }
         fd = r;
-        free(p);
+        g_free(p);
         break;
     }
 
-- 
1.8.3.1

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

* [Qemu-devel] [PULL v2 15/17] spice: fix coverity complains
  2016-05-13 12:32 [Qemu-devel] [PULL v2 00/17] ui patch queue Gerd Hoffmann
                   ` (13 preceding siblings ...)
  2016-05-13 12:32 ` [Qemu-devel] [PULL v2 14/17] egl-helpers: fix possible resource leak Gerd Hoffmann
@ 2016-05-13 12:32 ` Gerd Hoffmann
  2016-05-13 12:32 ` [Qemu-devel] [PULL v2 16/17] gtk: update grab code for gtk 3.20 Gerd Hoffmann
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 20+ messages in thread
From: Gerd Hoffmann @ 2016-05-13 12:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gonglei, Gerd Hoffmann

From: Gonglei <arei.gonglei@huawei.com>

Remove the unnecessary NULL check.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1463047028-123868-3-git-send-email-arei.gonglei@huawei.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/spice-display.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/ui/spice-display.c b/ui/spice-display.c
index 2a77a54..0553c5e 100644
--- a/ui/spice-display.c
+++ b/ui/spice-display.c
@@ -774,9 +774,7 @@ static void display_mouse_define(DisplayChangeListener *dcl,
     SimpleSpiceDisplay *ssd = container_of(dcl, SimpleSpiceDisplay, dcl);
 
     qemu_mutex_lock(&ssd->lock);
-    if (c) {
-        cursor_get(c);
-    }
+    cursor_get(c);
     cursor_put(ssd->cursor);
     ssd->cursor = c;
     ssd->hot_x = c->hot_x;
-- 
1.8.3.1

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

* [Qemu-devel] [PULL v2 16/17] gtk: update grab code for gtk 3.20
  2016-05-13 12:32 [Qemu-devel] [PULL v2 00/17] ui patch queue Gerd Hoffmann
                   ` (14 preceding siblings ...)
  2016-05-13 12:32 ` [Qemu-devel] [PULL v2 15/17] spice: fix coverity complains Gerd Hoffmann
@ 2016-05-13 12:32 ` Gerd Hoffmann
  2016-05-20  7:55   ` Paolo Bonzini
  2016-05-13 12:32 ` [Qemu-devel] [PULL v2 17/17] gtk: don't leak the GtkBorder with VTE 0.36 Gerd Hoffmann
  2016-05-13 14:39 ` [Qemu-devel] [PULL v2 00/17] ui patch queue Peter Maydell
  17 siblings, 1 reply; 20+ messages in thread
From: Gerd Hoffmann @ 2016-05-13 12:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

Fixes the remaining gtk 3.20 warnings.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
Tested-by: Cole Robinson <crobinso@redhat.com>
Message-id: 1463038146-13939-1-git-send-email-kraxel@redhat.com
---
 ui/gtk.c | 49 +++++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 43 insertions(+), 6 deletions(-)

diff --git a/ui/gtk.c b/ui/gtk.c
index 2c0f20b..a7d8a8b 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -1329,7 +1329,31 @@ static void gd_menu_zoom_fit(GtkMenuItem *item, void *opaque)
     gd_update_full_redraw(vc);
 }
 
-#if GTK_CHECK_VERSION(3, 0, 0)
+#if GTK_CHECK_VERSION(3, 20, 0)
+static void gd_grab_update(VirtualConsole *vc, bool kbd, bool ptr)
+{
+    GdkDisplay *display = gtk_widget_get_display(vc->gfx.drawing_area);
+    GdkSeat *seat = gdk_display_get_default_seat(display);
+    GdkWindow *window = gtk_widget_get_window(vc->gfx.drawing_area);
+    GdkSeatCapabilities caps = 0;
+    GdkCursor *cursor = NULL;
+
+    if (kbd) {
+        caps |= GDK_SEAT_CAPABILITY_KEYBOARD;
+    }
+    if (ptr) {
+        caps |= GDK_SEAT_CAPABILITY_ALL_POINTING;
+        cursor = vc->s->null_cursor;
+    }
+
+    if (caps) {
+        gdk_seat_grab(seat, window, caps, false, cursor,
+                      NULL, NULL, NULL);
+    } else {
+        gdk_seat_ungrab(seat);
+    }
+}
+#elif GTK_CHECK_VERSION(3, 0, 0)
 static void gd_grab_devices(VirtualConsole *vc, bool grab,
                             GdkInputSource source, GdkEventMask mask,
                             GdkCursor *cursor)
@@ -1366,7 +1390,9 @@ static void gd_grab_keyboard(VirtualConsole *vc, const char *reason)
         }
     }
 
-#if GTK_CHECK_VERSION(3, 0, 0)
+#if GTK_CHECK_VERSION(3, 20, 0)
+    gd_grab_update(vc, true, vc->s->ptr_owner == vc);
+#elif GTK_CHECK_VERSION(3, 0, 0)
     gd_grab_devices(vc, true, GDK_SOURCE_KEYBOARD,
                    GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK,
                    NULL);
@@ -1389,7 +1415,9 @@ static void gd_ungrab_keyboard(GtkDisplayState *s)
     }
     s->kbd_owner = NULL;
 
-#if GTK_CHECK_VERSION(3, 0, 0)
+#if GTK_CHECK_VERSION(3, 20, 0)
+    gd_grab_update(vc, false, vc->s->ptr_owner == vc);
+#elif GTK_CHECK_VERSION(3, 0, 0)
     gd_grab_devices(vc, false, GDK_SOURCE_KEYBOARD, 0, NULL);
 #else
     gdk_keyboard_ungrab(GDK_CURRENT_TIME);
@@ -1410,7 +1438,11 @@ static void gd_grab_pointer(VirtualConsole *vc, const char *reason)
         }
     }
 
-#if GTK_CHECK_VERSION(3, 0, 0)
+#if GTK_CHECK_VERSION(3, 20, 0)
+    gd_grab_update(vc, vc->s->kbd_owner == vc, true);
+    gdk_device_get_position(gd_get_pointer(display),
+                            NULL, &vc->s->grab_x_root, &vc->s->grab_y_root);
+#elif GTK_CHECK_VERSION(3, 0, 0)
     gd_grab_devices(vc, true, GDK_SOURCE_MOUSE,
                     GDK_POINTER_MOTION_MASK |
                     GDK_BUTTON_PRESS_MASK |
@@ -1442,14 +1474,19 @@ static void gd_grab_pointer(VirtualConsole *vc, const char *reason)
 static void gd_ungrab_pointer(GtkDisplayState *s)
 {
     VirtualConsole *vc = s->ptr_owner;
+    GdkDisplay *display = gtk_widget_get_display(vc->gfx.drawing_area);
 
     if (vc == NULL) {
         return;
     }
     s->ptr_owner = NULL;
 
-    GdkDisplay *display = gtk_widget_get_display(vc->gfx.drawing_area);
-#if GTK_CHECK_VERSION(3, 0, 0)
+#if GTK_CHECK_VERSION(3, 20, 0)
+    gd_grab_update(vc, vc->s->kbd_owner == vc, false);
+    gdk_device_warp(gd_get_pointer(display),
+                    gtk_widget_get_screen(vc->gfx.drawing_area),
+                    vc->s->grab_x_root, vc->s->grab_y_root);
+#elif GTK_CHECK_VERSION(3, 0, 0)
     gd_grab_devices(vc, false, GDK_SOURCE_MOUSE, 0, NULL);
     gdk_device_warp(gd_get_pointer(display),
                     gtk_widget_get_screen(vc->gfx.drawing_area),
-- 
1.8.3.1

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

* [Qemu-devel] [PULL v2 17/17] gtk: don't leak the GtkBorder with VTE 0.36
  2016-05-13 12:32 [Qemu-devel] [PULL v2 00/17] ui patch queue Gerd Hoffmann
                   ` (15 preceding siblings ...)
  2016-05-13 12:32 ` [Qemu-devel] [PULL v2 16/17] gtk: update grab code for gtk 3.20 Gerd Hoffmann
@ 2016-05-13 12:32 ` Gerd Hoffmann
  2016-05-13 14:39 ` [Qemu-devel] [PULL v2 00/17] ui patch queue Peter Maydell
  17 siblings, 0 replies; 20+ messages in thread
From: Gerd Hoffmann @ 2016-05-13 12:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: Alberto Garcia, Cole Robinson, Gerd Hoffmann

From: Alberto Garcia <berto@igalia.com>

When gtk_widget_style_get() is used to get the "inner-border" style
property, it returns a copy of the GtkBorder which must be freed by
the caller.

This patch also fixes a warning about the unused 'padding' structure
with VTE 0.36.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Message-id: 1463127654-5171-1-git-send-email-berto@igalia.com
Cc: Cole Robinson <crobinso@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>

[ kraxel: adapted to changes in ui patch queue ]

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/gtk.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/ui/gtk.c b/ui/gtk.c
index a7d8a8b..7572cec 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -329,17 +329,22 @@ static void gd_update_geometry_hints(VirtualConsole *vc)
 #if defined(CONFIG_VTE)
     } else if (vc->type == GD_VC_VTE) {
         VteTerminal *term = VTE_TERMINAL(vc->vte.terminal);
-        GtkBorder *ib;
+        GtkBorder padding = { 0 };
 
 #if VTE_CHECK_VERSION(0, 37, 0)
-        GtkBorder padding;
         gtk_style_context_get_padding(
                 gtk_widget_get_style_context(vc->vte.terminal),
                 gtk_widget_get_state_flags(vc->vte.terminal),
                 &padding);
-        ib = &padding;
 #else
-        gtk_widget_style_get(vc->vte.terminal, "inner-border", &ib, NULL);
+        {
+            GtkBorder *ib = NULL;
+            gtk_widget_style_get(vc->vte.terminal, "inner-border", &ib, NULL);
+            if (ib) {
+                padding = *ib;
+                gtk_border_free(ib);
+            }
+        }
 #endif
 
         geo.width_inc  = vte_terminal_get_char_width(term);
@@ -352,12 +357,10 @@ static void gd_update_geometry_hints(VirtualConsole *vc)
         geo.min_height = geo.height_inc * VC_TERM_Y_MIN;
         mask |= GDK_HINT_MIN_SIZE;
 
-        if (ib) {
-            geo.base_width  += ib->left + ib->right;
-            geo.base_height += ib->top + ib->bottom;
-            geo.min_width   += ib->left + ib->right;
-            geo.min_height  += ib->top + ib->bottom;
-        }
+        geo.base_width  += padding.left + padding.right;
+        geo.base_height += padding.top + padding.bottom;
+        geo.min_width   += padding.left + padding.right;
+        geo.min_height  += padding.top + padding.bottom;
         geo_widget = vc->vte.terminal;
 #endif
     }
-- 
1.8.3.1

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

* Re: [Qemu-devel] [PULL v2 00/17] ui patch queue
  2016-05-13 12:32 [Qemu-devel] [PULL v2 00/17] ui patch queue Gerd Hoffmann
                   ` (16 preceding siblings ...)
  2016-05-13 12:32 ` [Qemu-devel] [PULL v2 17/17] gtk: don't leak the GtkBorder with VTE 0.36 Gerd Hoffmann
@ 2016-05-13 14:39 ` Peter Maydell
  17 siblings, 0 replies; 20+ messages in thread
From: Peter Maydell @ 2016-05-13 14:39 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: QEMU Developers

On 13 May 2016 at 13:32, Gerd Hoffmann <kraxel@redhat.com> wrote:
>   Hi,
>
> Second try for the ui patch queue.  This time the mingw test builds done
> with -Werror.  Warnings fixed.  A few more fixes picked up.
>
> please pull,
>   Gerd
>
> The following changes since commit 860a3b34854d8abe9af9f1eb584691de926ce897:
>
>   Update version for v2.6.0-rc5 release (2016-05-09 14:08:12 +0100)
>
> are available in the git repository at:
>
>   git://git.kraxel.org/qemu tags/pull-ui-20160513-1
>
> for you to fetch changes up to 6978dc4adcdf27722aa6f9e13f88a903b30a3f8d:
>
>   gtk: don't leak the GtkBorder with VTE 0.36 (2016-05-13 12:40:12 +0200)
>
> ----------------------------------------------------------------
> gtk/sdl build tweaks
> fix gtk 3.20 warnings
> gtk clipboard support
> spice-gl monitor config support
> fix coverity warnings
>
> ----------------------------------------------------------------

Applied, thanks.

-- PMM

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

* Re: [Qemu-devel] [PULL v2 16/17] gtk: update grab code for gtk 3.20
  2016-05-13 12:32 ` [Qemu-devel] [PULL v2 16/17] gtk: update grab code for gtk 3.20 Gerd Hoffmann
@ 2016-05-20  7:55   ` Paolo Bonzini
  0 siblings, 0 replies; 20+ messages in thread
From: Paolo Bonzini @ 2016-05-20  7:55 UTC (permalink / raw)
  To: Gerd Hoffmann, qemu-devel



On 13/05/2016 14:32, Gerd Hoffmann wrote:
> @@ -1442,14 +1474,19 @@ static void gd_grab_pointer(VirtualConsole *vc, const char *reason)
>  static void gd_ungrab_pointer(GtkDisplayState *s)
>  {
>      VirtualConsole *vc = s->ptr_owner;
> +    GdkDisplay *display = gtk_widget_get_display(vc->gfx.drawing_area);
>  
>      if (vc == NULL) {
>          return;
>      }

Unnecessary vc == NULL check, or possible NULL pointer dereference in
the assignment to display?  (Spotted by Coverity).

Thanks,

Paolo

>      s->ptr_owner = NULL;
>  
> -    GdkDisplay *display = gtk_widget_get_display(vc->gfx.drawing_area);

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

end of thread, other threads:[~2016-05-20  7:55 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-13 12:32 [Qemu-devel] [PULL v2 00/17] ui patch queue Gerd Hoffmann
2016-05-13 12:32 ` [Qemu-devel] [PULL v2 01/17] ui: gtk: fix crash when terminal inner-border is NULL Gerd Hoffmann
2016-05-13 12:32 ` [Qemu-devel] [PULL v2 02/17] ui: sdl2: Release grab before opening console window Gerd Hoffmann
2016-05-13 12:32 ` [Qemu-devel] [PULL v2 03/17] configure: build SDL if only SDL2 available Gerd Hoffmann
2016-05-13 12:32 ` [Qemu-devel] [PULL v2 04/17] configure: error on unknown --with-sdlabi value Gerd Hoffmann
2016-05-13 12:32 ` [Qemu-devel] [PULL v2 05/17] configure: add echo_version helper Gerd Hoffmann
2016-05-13 12:32 ` [Qemu-devel] [PULL v2 06/17] configure: report GTK version Gerd Hoffmann
2016-05-13 12:32 ` [Qemu-devel] [PULL v2 07/17] configure: report SDL version Gerd Hoffmann
2016-05-13 12:32 ` [Qemu-devel] [PULL v2 08/17] configure: support vte-2.91 Gerd Hoffmann
2016-05-13 12:32 ` [Qemu-devel] [PULL v2 09/17] ui: gtk: Fix a runtime warning on vte >= 0.37 Gerd Hoffmann
2016-05-13 12:32 ` [Qemu-devel] [PULL v2 10/17] ui: gtk: Fix some deprecation warnings Gerd Hoffmann
2016-05-13 12:32 ` [Qemu-devel] [PULL v2 11/17] ui/gtk: copy to clipboard support Gerd Hoffmann
2016-05-13 12:32 ` [Qemu-devel] [PULL v2 12/17] spice/gl: add & use qemu_spice_gl_monitor_config Gerd Hoffmann
2016-05-13 12:32 ` [Qemu-devel] [PULL v2 13/17] Changed malloc to g_malloc, free to g_free in ui/shader.c Gerd Hoffmann
2016-05-13 12:32 ` [Qemu-devel] [PULL v2 14/17] egl-helpers: fix possible resource leak Gerd Hoffmann
2016-05-13 12:32 ` [Qemu-devel] [PULL v2 15/17] spice: fix coverity complains Gerd Hoffmann
2016-05-13 12:32 ` [Qemu-devel] [PULL v2 16/17] gtk: update grab code for gtk 3.20 Gerd Hoffmann
2016-05-20  7:55   ` Paolo Bonzini
2016-05-13 12:32 ` [Qemu-devel] [PULL v2 17/17] gtk: don't leak the GtkBorder with VTE 0.36 Gerd Hoffmann
2016-05-13 14:39 ` [Qemu-devel] [PULL v2 00/17] ui patch queue Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.