[Spice-commits] 10 commits - doc/reference meson.build meson_options.txt src/meson.build src/spice-widget.c src/spice-widget-egl.c src/spice-widget-priv.h subprojects/keycodemapdb tests/meson.build vapi/meson.build

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jan 23 09:54:37 UTC 2023


 doc/reference/meson.build |    8 ++++----
 meson.build               |   26 +++++++++++---------------
 meson_options.txt         |    4 ++++
 src/meson.build           |   15 +--------------
 src/spice-widget-egl.c    |   14 +++++++++++---
 src/spice-widget-priv.h   |    4 ++--
 src/spice-widget.c        |   26 +++++++++++++-------------
 subprojects/keycodemapdb  |    2 +-
 tests/meson.build         |    2 +-
 vapi/meson.build          |    2 +-
 10 files changed, 49 insertions(+), 54 deletions(-)

New commits:
commit adddbb39769a01e3be3a31ce5c7276af4f2854df
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Mon Jan 23 12:03:17 2023 +0400

    meson: bump meson req to 0.56
    
    It's from Oct 2020, and widely available on various distro or backports.
    
    Fix related meson warnings.
    
    Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>

diff --git a/doc/reference/meson.build b/doc/reference/meson.build
index 24e722a..763ead6 100644
--- a/doc/reference/meson.build
+++ b/doc/reference/meson.build
@@ -34,9 +34,9 @@ ignore_headers = [
 
 spice_gtk_doc_dep = declare_dependency(link_with : [spice_client_gtk_lib, spice_client_glib_lib])
 
-glib_prefix = dependency('glib-2.0').get_pkgconfig_variable('prefix')
+glib_prefix = dependency('glib-2.0').get_variable(pkgconfig: 'prefix')
 glib_docpath = glib_prefix / 'share' / 'gtk-doc' / 'html'
-gtk_prefix = dependency('gtk+-3.0').get_pkgconfig_variable('prefix')
+gtk_prefix = dependency('gtk+-3.0').get_variable(pkgconfig: 'prefix')
 gtk_docpath = gtk_prefix / 'share' / 'gtk-doc' / 'html'
 docpath = spice_gtk_datadir / 'gtk-doc' / 'html'
 
@@ -51,9 +51,9 @@ gnome.gtkdoc(meson.project_name(),
                '--deprecated-guards="SPICE_DISABLE_DEPRECATED"',
                '--ignore-decorators="G_GNUC_INTERNAL"',
                '--rebuild-types',
-               meson.build_root() / 'src' / 'spice-version.h'
+               meson.project_build_root() / 'src' / 'spice-version.h'
              ],
-             src_dir : meson.source_root() / 'src',
+             src_dir : meson.project_source_root() / 'src',
              fixxref_args: [
                '--html-dir=@0@'.format(docpath),
                '--extra-dir=@0@'.format(glib_docpath / 'glib'),
diff --git a/meson.build b/meson.build
index 5287029..341f5fb 100644
--- a/meson.build
+++ b/meson.build
@@ -2,13 +2,13 @@
 # project definition
 #
 project('spice-gtk', 'c',
-         version : run_command('build-aux/git-version-gen', '@0@/.tarball-version'.format(meson.source_root()), check : true).stdout().strip(),
+         version : run_command('build-aux/git-version-gen', '@0@/.tarball-version'.format(meson.project_source_root()), check : true).stdout().strip(),
          license : 'LGPLv2.1',
-         meson_version : '>= 0.53',
+         meson_version : '>= 0.56',
          default_options : ['buildtype=debugoptimized',
                             'warning_level=2'])
 
-meson.add_dist_script('build-aux/meson-dist', meson.project_version(), meson.source_root())
+meson.add_dist_script('build-aux/meson-dist', meson.project_version(), meson.project_source_root())
 summary_info = {}
 
 #
@@ -170,9 +170,9 @@ if host_machine.system() != 'windows' and spice_gtk_has_gtk and compiler.has_hea
   summary_info += {'wayland-protocols': d.found()}
   if d.found()
     spice_gtk_config_data.set('HAVE_WAYLAND_PROTOCOLS', '1')
-    dir_wp_base = d.get_pkgconfig_variable('pkgdatadir')
+    dir_wp_base = d.get_variable(pkgconfig: 'pkgdatadir')
     dep_scanner = dependency('wayland-scanner', native: true)
-    prog_scanner = find_program(dep_scanner.get_pkgconfig_variable('wayland_scanner'))
+    prog_scanner = find_program(dep_scanner.get_variable(pkgconfig: 'wayland_scanner'))
 
     wayland_libs_version_required = '1.17.0'
     spice_wayland_deps += dependency('wayland-server', version : '>= @0@'.format(wayland_libs_version_required))
@@ -252,7 +252,7 @@ spice_gtk_has_polkit = false
 d = dependency('polkit-gobject-1', version : '>= 0.101', required : get_option('polkit'))
 summary_info += {'polkit': d.found()}
 if d.found()
-  spice_gtk_policy_dir = d.get_pkgconfig_variable('policydir')
+  spice_gtk_policy_dir = d.get_variable(pkgconfig: 'policydir')
 
   # TODO:  With 'auto', we should just disable polkit support if this is missing.
   if not compiler.has_function('acl_get_file')
@@ -293,7 +293,7 @@ spice_gtk_usb_ids_path = get_option('usb-ids-path')
 if spice_gtk_usb_ids_path.strip() == ''
   usbutils = dependency('usbutils', required : false)
   if usbutils.found()
-    spice_gtk_usb_ids_path = usbutils.get_pkgconfig_variable('usbids')
+    spice_gtk_usb_ids_path = usbutils.get_variable(pkgconfig: 'usbids')
   endif
 endif
 summary_info += {'usb-ids-path': spice_gtk_usb_ids_path}
diff --git a/vapi/meson.build b/vapi/meson.build
index aab2f5a..0542856 100644
--- a/vapi/meson.build
+++ b/vapi/meson.build
@@ -8,7 +8,7 @@ if spice_gtk_has_vala
     gnome.generate_vapi('spice-client-gtk-3.0',
                         install : true,
                         packages : ['gtk+-3.0', 'gstreamer-1.0', spice_glib_vapi],
-                        gir_dirs : meson.build_root() / 'src',
+                        gir_dirs : meson.project_build_root() / 'src',
                         vapi_dirs : meson.current_build_dir(),
                         sources : spice_client_gtk_gir[0])
   endif
commit 795318c8fad0288d86bd6a392c0f82be60d4b9da
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Mon Jan 23 11:38:43 2023 +0400

    meson: fix keymap-gen exec on msys
    
    meson wraps python scripts already on win32:
    
    "C:/msys64/mingw64/bin/meson" "--internal" "exe" "--capture" "src/vncdisplaykeymap_xorgevdev2xtkbd.h" "--" "C:/msys64/mingw64/bin/python.exe" "python" "C:/msys64/home/marca/src/spice-gtk/subprojects/keycodemapdb/tools/keymap-gen" "code-m
    ap" "--lang" "glib2" "--varname" "keymap_xorgevdev2xtkbd" "../subprojects/keycodemapdb/data/keymaps.csv" "xorgevdev" "xtkbd"
    --- stderr ---
    C:/msys64/mingw64/bin/python.exe: can't open file 'C:\\msys64\\home\\marca\\src\\spice-gtk\\build\\python': [Errno 2] No such file or directory
    
    Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>

diff --git a/src/meson.build b/src/meson.build
index 25d379a..9811c65 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -300,7 +300,6 @@ if spice_gtk_has_gtk
   endif
 
   # keymaps
-  python = import('python').find_installation()
   keymaps = ['xorgevdev',
              'xorgkbd',
              'xorgxquartz',
@@ -312,7 +311,7 @@ if spice_gtk_has_gtk
   foreach keymap : keymaps
     varname = 'keymap_ at 0@2xtkbd'.format(keymap)
     target = 'vncdisplay at 0@.h'.format(varname)
-    cmd = [python, keymapgen, 'code-map', '--lang', 'glib2', '--varname', varname, keymapcsv, keymap, 'xtkbd']
+    cmd = [keymapgen, 'code-map', '--lang', 'glib2', '--varname', varname, keymapcsv, keymap, 'xtkbd']
     spice_client_gtk_sources += custom_target(target,
                                               output : target,
                                               capture : true,
diff --git a/subprojects/keycodemapdb b/subprojects/keycodemapdb
index e15649b..14cdba2 160000
--- a/subprojects/keycodemapdb
+++ b/subprojects/keycodemapdb
@@ -1 +1 @@
-Subproject commit e15649b83a78f89f57205927022115536d2c1698
+Subproject commit 14cdba29ecd7448310fe4ff890e67830b1a40f64
commit 57733fe6ef55d29c487d0b103c755e463a076416
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Mon Jan 23 11:53:25 2023 +0400

    meson: drop needless comments about unused protocols
    
    Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>

diff --git a/src/meson.build b/src/meson.build
index c742fde..25d379a 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -328,18 +328,6 @@ if spice_gtk_has_gtk
     generated_protocols = [
       [ 'pointer-constraints', 'v1' ],
       [ 'relative-pointer', 'v1' ],
-     #[ 'input-method', 'v1' ],
-     #[ 'input-timestamps', 'v1' ],
-     #[ 'fullscreen-shell', 'v1' ],
-     #[ 'linux-dmabuf', 'v1' ],
-     #[ 'linux-explicit-synchronization', 'v1' ],
-     #[ 'presentation-time', 'stable' ],
-     #[ 'tablet', 'v2' ],
-     #[ 'text-input', 'v1' ],
-     #[ 'viewporter', 'stable' ],
-     #[ 'xdg-output', 'v1' ],
-     #[ 'xdg-shell', 'v6' ],
-     #[ 'xdg-shell', 'stable' ],
     ]
 
     foreach proto: generated_protocols
commit a936bec84d92f0c6e572c77bb3a15fad2bf5813f
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Mon Jan 23 11:25:27 2023 +0400

    meson: fix some lib check warnings on win32
    
    WARNING: find_library('libws2_32') starting in "lib" only works by accident and is not portable
    Library libws2_32 found: YES
    WARNING: find_library('libgdi32') starting in "lib" only works by accident and is not portable
    Library libgdi32 found: YES
    WARNING: find_library('libcomctl32') starting in "lib" only works by accident and is not portable
    Library libcomctl32 found: YES
    
    Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>

diff --git a/meson.build b/meson.build
index 3be1dac..5287029 100644
--- a/meson.build
+++ b/meson.build
@@ -119,7 +119,7 @@ endforeach
 
 deps = []
 if host_machine.system() == 'windows'
-  deps += ['libws2_32', 'libgdi32', 'libcomctl32']
+  deps += ['ws2_32', 'gdi32', 'comctl32']
 endif
 
 foreach dep : deps
commit 89208ee729e6d0311b89f46930edd960d54516a8
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Mon Jan 23 11:22:40 2023 +0400

    meson: fix a warning
    
    WARNING: extract_all_objects called without setting recursive
    
    Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>

diff --git a/tests/meson.build b/tests/meson.build
index 8dccb42..3613ae6 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -24,7 +24,7 @@ endif
 # create a static library from a shared one extracting all objects
 # this allows to rewrite part of it if necessary for mocking
 test_lib = static_library('test-lib',
-                          objects : spice_client_glib_lib.extract_all_objects())
+                          objects : spice_client_glib_lib.extract_all_objects(recursive: true))
 
 foreach src : tests_sources
   name = 'test- at 0@'.format(src).split('.')[0]
commit 245c325a85bc0391cc8232c3e0075e833ec0f396
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Mon Jan 23 11:07:24 2023 +0400

    Fix compilation on win32 when EGL is enabled
    
    ../src/spice-widget-egl.c:204:17: error: unused variable 'gdk_dpy' [-Werror=unused-variable]
      204 |     GdkDisplay *gdk_dpy = gdk_display_get_default();
    
    Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>

diff --git a/src/spice-widget-egl.c b/src/spice-widget-egl.c
index 177ef59..b069ec1 100644
--- a/src/spice-widget-egl.c
+++ b/src/spice-widget-egl.c
@@ -32,6 +32,9 @@
 #ifdef GDK_WINDOWING_WAYLAND
 #include <gdk/gdkwayland.h>
 #endif
+#ifdef GDK_WINDOWING_WIN32
+#include <gdk/gdkwin32.h>
+#endif
 
 #define VERTS_ARRAY_SIZE (sizeof(GLfloat) * 4 * 4)
 #define TEX_ARRAY_SIZE (sizeof(GLfloat) * 4 * 2)
@@ -216,6 +219,11 @@ gboolean spice_egl_init(SpiceDisplay *display, GError **err)
         dpy = (EGLNativeDisplayType)gdk_x11_display_get_xdisplay(gdk_dpy);
     }
 #endif
+#ifdef GDK_WINDOWING_WIN32
+    if (GDK_IS_WIN32_DISPLAY(gdk_dpy)) {
+        dpy = (EGLNativeDisplayType)EGL_DEFAULT_DISPLAY; /* or perhaps wglGetCurrentDC? */
+    }
+#endif
 
     d->egl.display = eglGetDisplay(dpy);
     if (d->egl.display == EGL_NO_DISPLAY) {
commit e8adfacbfc48b7de7624535df17e5c57216b0db1
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Mon Jan 23 10:52:02 2023 +0400

    meson: fix compilation on win32 when egl is available
    
    When EGL is enabled (thanks to epoxy/angle), spice-gtk fails to link
    against epoxy. Link with it when EGL is enabled.
    
    Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>

diff --git a/meson.build b/meson.build
index 802ed7d..3be1dac 100644
--- a/meson.build
+++ b/meson.build
@@ -147,8 +147,8 @@ d = dependency('gtk+-3.0', version : '>= @0@'.format(gtk_version_required),
 summary_info += {'gtk': d.found()}
 if d.found()
   spice_gtk_deps += d
+  spice_gtk_deps += dependency('epoxy', required: spice_gtk_has_egl)
   if host_machine.system() != 'windows'
-    spice_gtk_deps += dependency('epoxy')
     d = dependency('x11', required: false)
     if d.found()
       spice_gtk_deps += d
commit 1cec1c6b67a94d07a347e8168c0c7cf39ab2bbbf
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Mon Jan 23 10:42:55 2023 +0400

    meson: add an `egl` option
    
    Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>

diff --git a/meson.build b/meson.build
index 58ebf6f..802ed7d 100644
--- a/meson.build
+++ b/meson.build
@@ -74,8 +74,7 @@ foreach header : headers
   endif
 endforeach
 
-# FIXME: Add a config option to validate spice-widget-egl being built or not
-spice_gtk_has_egl = compiler.has_header('epoxy/egl.h')
+spice_gtk_has_egl = compiler.has_header('epoxy/egl.h', required: get_option('egl'))
 spice_gtk_config_data.set('HAVE_EGL', spice_gtk_has_egl)
 
 #
diff --git a/meson_options.txt b/meson_options.txt
index 5acfc9a..f31d5ce 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -77,6 +77,10 @@ option('smartcard',
     type : 'feature',
     description : 'Enable smartcard support')
 
+option('egl',
+    type : 'feature',
+    description: 'EGL support')
+
 option('gtk_doc',
        type : 'feature',
        description : 'Generate API documentation with gtk-doc')
commit a0f7d49fa47c07cb321d05054a6495223e2bee79
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Mon Jan 23 10:34:20 2023 +0400

    meson: update EGL option
    
    Adjust `#ifdef` statements to use the single define.
    
    Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>

diff --git a/meson.build b/meson.build
index 596f33f..58ebf6f 100644
--- a/meson.build
+++ b/meson.build
@@ -76,10 +76,7 @@ endforeach
 
 # FIXME: Add a config option to validate spice-widget-egl being built or not
 spice_gtk_has_egl = compiler.has_header('epoxy/egl.h')
-if spice_gtk_has_egl
-    spice_gtk_config_data.set('HAVE_EPOXY_EGL_H', '1')
-    spice_gtk_config_data.set('HAVE_EGL', '1') # FIXME: Use single define?
-endif
+spice_gtk_config_data.set('HAVE_EGL', spice_gtk_has_egl)
 
 #
 # check for system functions
diff --git a/src/spice-widget-priv.h b/src/spice-widget-priv.h
index 2c68716..b15714e 100644
--- a/src/spice-widget-priv.h
+++ b/src/spice-widget-priv.h
@@ -22,7 +22,7 @@
 #include <windows.h>
 #endif
 
-#ifdef HAVE_EPOXY_EGL_H
+#ifdef HAVE_EGL
 #include <epoxy/egl.h>
 #endif
 
@@ -133,7 +133,7 @@ struct _SpiceDisplayPrivate {
     int                     x11_accel_denominator;
     int                     x11_threshold;
 #endif
-#if HAVE_EGL
+#ifdef HAVE_EGL
     struct {
         gboolean            context_ready;
         gboolean            enabled;
diff --git a/src/spice-widget.c b/src/spice-widget.c
index 7b5b5c1..6311115 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -260,7 +260,7 @@ static gint get_display_id(SpiceDisplay *display)
 
 static bool egl_enabled(SpiceDisplayPrivate *d)
 {
-#if HAVE_EGL
+#ifdef HAVE_EGL
     return d->egl.enabled;
 #else
     return false;
@@ -602,7 +602,7 @@ static void grab_notify(SpiceDisplay *display, gboolean was_grabbed)
         release_keys(display);
 }
 
-#if HAVE_EGL
+#ifdef HAVE_EGL
 static gboolean
 gl_area_render(GtkGLArea *area, GdkGLContext *context, gpointer user_data)
 {
@@ -668,7 +668,7 @@ static void spice_display_init(SpiceDisplay *display)
     gtk_stack_add_named(d->stack, area, "draw-area");
     gtk_stack_set_visible_child(d->stack, area);
 
-#if HAVE_EGL
+#ifdef HAVE_EGL
     area = gtk_gl_area_new();
     gtk_gl_area_set_required_version(GTK_GL_AREA(area), 3, 2);
     gtk_gl_area_set_auto_render(GTK_GL_AREA(area), false);
@@ -1456,7 +1456,7 @@ static gboolean do_color_convert(SpiceDisplay *display, GdkRectangle *r)
     return true;
 }
 
-#if HAVE_EGL
+#ifdef HAVE_EGL
 static void set_egl_enabled(SpiceDisplay *display, bool enabled)
 {
     SpiceDisplayPrivate *d = display->priv;
@@ -1495,7 +1495,7 @@ static gboolean draw_event(GtkWidget *widget, cairo_t *cr, gpointer data)
     SpiceDisplayPrivate *d = display->priv;
     g_return_val_if_fail(d != NULL, false);
 
-#if HAVE_EGL
+#ifdef HAVE_EGL
     if (egl_enabled(d) &&
         g_str_equal(gtk_stack_get_visible_child_name(d->stack), "draw-area")) {
         spice_egl_update_display(display);
@@ -2302,7 +2302,7 @@ static void size_allocate(GtkWidget *widget, GtkAllocation *conf, gpointer data)
         d->ww = conf->width;
         d->wh = conf->height;
         recalc_geometry(widget);
-#if HAVE_EGL
+#ifdef HAVE_EGL
         if (egl_enabled(d)) {
             gint scale_factor = gtk_widget_get_scale_factor(widget);
             spice_egl_resize_display(display, conf->width * scale_factor, conf->height * scale_factor);
@@ -2351,7 +2351,7 @@ static void unrealize(GtkWidget *widget)
     SpiceDisplay *display = SPICE_DISPLAY(widget);
 
     spice_cairo_image_destroy(display);
-#if HAVE_EGL
+#ifdef HAVE_EGL
     if (display->priv->egl.context_ready) {
         spice_egl_unrealize_display(display);
     }
@@ -2702,7 +2702,7 @@ static void update_area(SpiceDisplay *display,
         .height = height
     };
 
-#if HAVE_EGL
+#ifdef HAVE_EGL
     if (egl_enabled(d)) {
         const SpiceGlScanout *so =
             spice_display_channel_get_gl_scanout(d->display);
@@ -2949,7 +2949,7 @@ static void invalidate(SpiceChannel *channel,
         .height = h
     };
 
-#if HAVE_EGL
+#ifdef HAVE_EGL
     set_egl_enabled(display, false);
 #endif
 
@@ -3106,7 +3106,7 @@ static void update_mouse_cursor(SpiceDisplay *display)
                                          hotspot_x,
                                          hotspot_y);
 
-#if HAVE_EGL
+#ifdef HAVE_EGL
     if (egl_enabled(d))
         spice_egl_cursor_set(display);
 #endif
@@ -3287,7 +3287,7 @@ static void inputs_channel_event(SpiceChannel *channel, SpiceChannelEvent event,
     spice_display_set_keypress_delay(display, delay);
 }
 
-#if HAVE_EGL
+#ifdef HAVE_EGL
 G_GNUC_INTERNAL
 void spice_display_widget_gl_scanout(SpiceDisplay *display)
 {
@@ -3417,7 +3417,7 @@ static void channel_new(SpiceSession *s, SpiceChannel *channel, SpiceDisplay *di
         if (spice_display_channel_get_gl_scanout(d->display)) {
             spice_display_widget_gl_scanout(display);
         }
-#if HAVE_EGL
+#ifdef HAVE_EGL
         spice_g_signal_connect_object(channel, "gl-draw",
                                       G_CALLBACK(gl_draw), display, G_CONNECT_SWAPPED);
 #endif
@@ -3593,7 +3593,7 @@ GdkPixbuf *spice_display_get_pixbuf(SpiceDisplay *display)
     g_return_val_if_fail(d != NULL, NULL);
     g_return_val_if_fail(d->display != NULL, NULL);
 
-#if HAVE_EGL
+#ifdef HAVE_EGL
     if (egl_enabled(d)) {
         GdkPixbuf *tmp;
 
commit 53a7a4019070e577b19e893531c18686d67d87ca
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Mon Jan 23 10:20:03 2023 +0400

    Rename `near` and `far`, reserved keywords on win32
    
    Win32 has #define for those.
    
    Change variable names `near` and `far` to `_near` and `_far`.
    
    Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>

diff --git a/src/spice-widget-egl.c b/src/spice-widget-egl.c
index b40bebf..177ef59 100644
--- a/src/spice-widget-egl.c
+++ b/src/spice-widget-egl.c
@@ -67,16 +67,16 @@ static const char *spice_egl_fragment_src =     \
 ";
 
 static void apply_ortho(guint mproj, float left, float right,
-                        float bottom, float top, float near, float far)
+                        float bottom, float top, float _near, float _far)
 
 {
     float a = 2.0f / (right - left);
     float b = 2.0f / (top - bottom);
-    float c = -2.0f / (far - near);
+    float c = -2.0f / (_far - _near);
 
     float tx = - (right + left) / (right - left);
     float ty = - (top + bottom) / (top - bottom);
-    float tz = - (far + near) / (far - near);
+    float tz = - (_far + _near) / (_far - _near);
 
     float ortho[16] = {
         a, 0, 0, 0,


More information about the Spice-commits mailing list