From 62abefbb4a0dcfb690fdbaf2f739f3ee098e077a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Fri, 10 Jun 2011 21:09:52 +0200 Subject: [PATCH] gtk/controller: build win32 controller pipe name --- gtk/controller/controller.vala | 5 +++++ gtk/controller/custom.vapi | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/gtk/controller/controller.vala b/gtk/controller/controller.vala index 6913244..508eee6 100644 --- a/gtk/controller/controller.vala +++ b/gtk/controller/controller.vala @@ -15,6 +15,7 @@ using GLib; using Custom; +using Win32; using Spice; using SpiceProtocol; @@ -217,7 +218,11 @@ public class SpiceController: Object { public async void listen (string? addr = null) throws GLib.Error, ControllerError { if (addr == null) +#if WIN32 + addr = (string*)"\\\\.\\pipe\\SpiceController-%lu".printf (GetCurrentProcessId ()); +#else addr = (string*)"%s".printf (Environment.get_variable ("SPICE_XPI_SOCKET")); // FIXME vala... +#endif if (addr == null) throw new ControllerError.VALUE ("Missing SPICE_XPI_SOCKET"); FileUtils.unlink (addr); diff --git a/gtk/controller/custom.vapi b/gtk/controller/custom.vapi index 6505d35..b3eeb4e 100644 --- a/gtk/controller/custom.vapi +++ b/gtk/controller/custom.vapi @@ -24,3 +24,8 @@ namespace Spice { public void add_named_pipe (NamedPipe namedpipe); } } + +namespace Win32 { + [CCode (cheader_filename = "windows.h", cname = "GetCurrentProcessId")] + public uint32 GetCurrentProcessId (); +}