[Spice-commits] 2 commits - configure.ac Makefile.am spice-vdagent.wxs.in vdagent/vdagent.cpp

Marc-André Lureau elmarco at kemper.freedesktop.org
Mon Jul 7 07:29:56 PDT 2014


 Makefile.am          |   23 ++++++++++++++-
 configure.ac         |   30 +++++++++++++++++++
 spice-vdagent.wxs.in |   78 +++++++++++++++++++++++++++++++++++++++++++++++++++
 vdagent/vdagent.cpp  |   11 ++++++-
 4 files changed, 140 insertions(+), 2 deletions(-)

New commits:
commit 6d1c038a8c8127206cfa17970a23ed6b3fe047cc
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Thu Jun 19 19:15:37 2014 +0200

    Don't refresh displays config when updating
    
    wnd_proc() is called during ChangeDisplaySettings(), when handling
    monitors config. However, calling get_displays() will overwrite the
    desired config.
    
    So, while updating from 1 to 4 enabled monitors, when the 2nd monitor
    config is enabled, the current config is read, and overwrite the rest of
    the config, so first time only 2nd monitor is enabled, second time, 3rd
    monitor etc.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1111144

diff --git a/vdagent/vdagent.cpp b/vdagent/vdagent.cpp
index 15216d9..aa44383 100644
--- a/vdagent/vdagent.cpp
+++ b/vdagent/vdagent.cpp
@@ -148,6 +148,7 @@ private:
     bool _running;
     bool _desktop_switch;
     DesktopLayout* _desktop_layout;
+    bool _updating_display_config;
     DisplaySetting _display_setting;
     FileXfer _file_xfer;
     HANDLE _vio_serial;
@@ -615,11 +616,14 @@ bool VDAgent::handle_mouse_event(VDAgentMouseState* state)
 
 bool VDAgent::handle_mon_config(VDAgentMonitorsConfig* mon_config, uint32_t port)
 {
+    VDAgent* a = _singleton;
     VDIChunk* reply_chunk;
     VDAgentMessage* reply_msg;
     VDAgentReply* reply;
     size_t display_count;
 
+    a->_updating_display_config = true;
+
     display_count = _desktop_layout->get_display_count();
     for (uint32_t i = 0; i < display_count; i++) {
         DisplayMode* mode = _desktop_layout->get_display(i);
@@ -649,6 +653,10 @@ bool VDAgent::handle_mon_config(VDAgentMonitorsConfig* mon_config, uint32_t port
         _desktop_layout->set_displays();
     }
 
+    a->_updating_display_config = false;
+    /* refresh again, in case something else changed */
+    a->_desktop_layout->get_displays();
+
     DWORD msg_size = VD_MESSAGE_HEADER_SIZE + sizeof(VDAgentReply);
     reply_chunk = new_chunk(msg_size);
     if (!reply_chunk) {
@@ -1439,7 +1447,8 @@ LRESULT CALLBACK VDAgent::wnd_proc(HWND hwnd, UINT message, WPARAM wparam, LPARA
         vd_printf("Display change");
         // the desktop layout needs to be updated for the mouse
         // position to be scaled correctly
-        a->_desktop_layout->get_displays();
+        if (!a->_updating_display_config)
+            a->_desktop_layout->get_displays();
         break;
     case WM_TIMER:
         a->send_input();
commit 8588daa1e0530fd6517fd0b8edb01018c7b77805
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Mon Feb 17 13:00:14 2014 +0100

    Learn to build spice-vdagent MSI installer

diff --git a/Makefile.am b/Makefile.am
index 749ef56..9fa9f14 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,5 @@
 NULL =
+EXTRA_DIST =
 MAINTAINERCLEANFILES =
 
 DIST_SUBDIRS = spice-protocol
@@ -61,8 +62,28 @@ vdservice_rc.$(OBJEXT): vdservice/vdservice.rc
 
 MAINTAINERCLEANFILES += vdservice_rc.$(OBJEXT)
 
+deps.txt:
+	$(AM_V_GEN)rpm -qa | grep $(host_os) | sort | unix2dos > $@
 
-EXTRA_DIST =			\
+MANUFACTURER = The Spice Project
+
+EXTRA_DIST += spice-vdagent.wxs.in
+CONFIG_STATUS_DEPENDENCIES = spice-vdagent.wxs.in
+
+spice-vdagent-$(WIXL_ARCH)-$(VERSION)$(BUILDID).msi: spice-vdagent.wxs deps.txt all
+	$(AM_V_GEN)DESTDIR=`mktemp -d`&&				\
+	make -C $(top_builddir) install DESTDIR=$$DESTDIR >/dev/null &&	\
+	MANUFACTURER="$(MANUFACTURER)" wixl -D SourceDir=$(prefix)	\
+	  -D DESTDIR=$$DESTDIR$(prefix)					\
+	  --arch $(WIXL_ARCH)  -o $@ $<
+
+msi: spice-vdagent-$(WIXL_ARCH)-$(VERSION)$(BUILDID).msi
+
+CLEANFILES = spice-vdagent-$(WIXL_ARCH)-$(VERSION)$(BUILDID).msi
+
+.PHONY: msi
+
+EXTRA_DIST +=			\
 	$(top_srcdir)/.version	\
 	tests/clipboard.py	\
 	vdagent.sln		\
diff --git a/configure.ac b/configure.ac
index 12329b4..7f6511d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -9,11 +9,30 @@ AC_CONFIG_SRCDIR([vdagent])
 AC_CONFIG_HEADERS([config.h])
 AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_AUX_DIR([build-aux])
+AC_CANONICAL_HOST
 
 AM_INIT_AUTOMAKE([1.11 foreign subdir-objects no-dist-gzip dist-xz tar-ustar])
 
 AM_SILENT_RULES([yes])
 
+AC_ARG_WITH([buildid],
+AS_HELP_STRING([--with-buildid=id], [Set additional build version details]))
+AC_DEFINE_UNQUOTED([BUILDID], "$with_buildid", [Build version details])
+if test "x$with_buildid" != x; then
+  AC_SUBST([BUILDID], "-$with_buildid")
+fi
+
+major=`echo $PACKAGE_VERSION | cut -d. -f1`
+minor=`echo $PACKAGE_VERSION | cut -d. -f2`
+micro=`echo $PACKAGE_VERSION | cut -d. -f3`
+buildid=`echo $with_buildid | cut -d. -f1`
+if test "x$buildid" = x; then
+  buildid=0
+fi
+build=`expr $micro \* 256 + $buildid`
+WINDOWS_PRODUCTVERSION="$major.$minor.$build"
+AC_SUBST([WINDOWS_PRODUCTVERSION])
+
 # Check for programs
 AC_PROG_CC
 AC_PROG_CXX
@@ -21,6 +40,16 @@ AM_PROG_CC_C_O
 AC_PROG_INSTALL
 AC_CHECK_TOOL(WINDRES, [windres])
 
+case "$host" in
+amd64*|x86_64*)
+  WIXL_ARCH="x64"
+;;
+*)
+  WIXL_ARCH="x86"
+;;
+esac
+AC_SUBST(WIXL_ARCH)
+
 AC_ARG_ENABLE([debug],
     AS_HELP_STRING([--enable-debug], [Enable debugging]))
 
@@ -75,6 +104,7 @@ AC_CONFIG_SUBDIRS([spice-protocol])
 AC_CONFIG_FILES([
 Makefile
 mingw-spice-vdagent.spec
+spice-vdagent.wxs
 ])
 AC_OUTPUT
 
diff --git a/spice-vdagent.wxs.in b/spice-vdagent.wxs.in
new file mode 100644
index 0000000..060f33d
--- /dev/null
+++ b/spice-vdagent.wxs.in
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
+
+  <?define Version = "@WINDOWS_PRODUCTVERSION@"?>
+  <?define UpgradeCode = "7eb9b146-db04-42d7-a8ba-71fc8ced7eed"?>
+  <?define Arch = "@WIXL_ARCH@"?>
+  <?if $(var.Arch) = "x64"?>
+      <?define ArchString = "64-bit"?>
+      <?define ArchProgramFilesFolder = "ProgramFiles64Folder"?>
+      <?define Win64 = "yes"?>
+  <?else?>
+      <?define ArchString = "32-bit"?>
+      <?define ArchProgramFilesFolder = "ProgramFilesFolder"?>
+      <?define Win64 = "no"?>
+  <?endif?>
+
+  <Product Id="*" Name="Spice agent @VERSION@@BUILDID@ ($(var.ArchString))"
+           Manufacturer="$(env.MANUFACTURER)"
+           Version="$(var.Version)" UpgradeCode="$(var.UpgradeCode)"
+           Language="1033">
+
+    <Package InstallerVersion="200" Compressed="yes" Comments="comments"/>
+    <Media Id="1" Cabinet="cabinet.cab" EmbedCab="yes"/>
+
+    <Property Id="ARPHELPLINK" Value="http://www.spice-space.org"/>
+    <Property Id="ARPNOMODIFY" Value="1"/>
+    <Property Id="ARPNOREPAIR" Value="1"/>
+    <Upgrade Id="$(var.UpgradeCode)">
+      <UpgradeVersion Minimum="$(var.Version)" OnlyDetect="yes" Property="NEWERVERSIONDETECTED"/>
+      <UpgradeVersion Minimum="0.0.0" Maximum="$(var.Version)" IncludeMinimum="yes" IncludeMaximum="no" Property="OLDERVERSIONBEINGUPGRADED"/>
+    </Upgrade>
+    <Condition Message="Product already installed.">NOT NEWERVERSIONDETECTED</Condition>
+    <InstallExecuteSequence>
+      <RemoveExistingProducts After="InstallFinalize"/>
+    </InstallExecuteSequence>
+
+    <Directory Id="TARGETDIR" Name="SourceDir">
+      <Directory Id="$(var.ArchProgramFilesFolder)">
+        <Directory Id="INSTALLDIR" Name="SPICE agent">
+          <Directory Id="Dbindir" Name="bin">
+            <Component Id="CSpiceAgent" Guid="*">
+              <File Id='spiceagent' Name='vdagent.exe' DiskId='1' Source='$(var.DESTDIR)/bin/vdagent.exe' KeyPath='yes'/>
+            </Component>
+            <Component Id="CSpiceService" Guid="*">
+              <File Id='spiceservice' Name='vdservice.exe' DiskId='1' Source='$(var.DESTDIR)/bin/vdservice.exe' KeyPath='yes'/>
+              <ServiceInstall Id="ServiceInstall"
+                            Name="spice-agent"
+                            DisplayName="Spice agent"
+                            Description="The Spice guest agent"
+                            Type="ownProcess"
+                            Start="auto"
+                            Account="[SERVICEACCOUNT]"
+                            Password="[SERVICEPASSWORD]"
+                            ErrorControl="normal"/>
+              <ServiceControl Id="StartService"
+                            Name="spice-agent"
+                            Start="install"
+                            Stop="both"
+                            Remove="uninstall"
+                            Wait="yes"/>
+            </Component>
+          </Directory>
+          <Component Id="CDepsTxt" Guid="*">
+            <File Id='depstxt' Name='deps.txt' DiskId='1' Source='deps.txt' KeyPath='yes'/>
+          </Component>
+        </Directory>
+      </Directory>
+    </Directory>
+
+    <Feature Id="Complete"  Level="1">
+      <ComponentRef Id="CSpiceAgent"/>
+      <ComponentRef Id="CSpiceService"/>
+      <ComponentRef Id="CDepsTxt"/>
+    </Feature>
+
+  </Product>
+</Wix>


More information about the Spice-commits mailing list