Re: [Spice-devel] [PATCH] vdservice: set process handle for vdagent launched on session>0

2012-12-09 Thread Uri Lublin

On 11/25/2012 05:14 PM, Arnon Gilboa wrote:

The problem on XP was failing to terminate agent running on session>0,
since during agent process creation, a handle was not set, so it was NULL.
Therefore, the new agent created (at the session we switched to) was unable
to open vitio-serial which was still used by the other running agent instance.

rhbz#868254
---
  vdservice/vdservice.cpp |7 +++
  1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/vdservice/vdservice.cpp b/vdservice/vdservice.cpp
index b2448e7..a2cf67d 100644
--- a/vdservice/vdservice.cpp
+++ b/vdservice/vdservice.cpp
@@ -640,6 +640,13 @@ BOOL create_session_process_as_user(IN DWORD session_id, 
IN BOOL use_default_tok
  ret = proc_ret.ret_value;
  if (ret) {
  *process_information = proc_ret.process_information;
+if (process_information->hProcess == 0) {
+process_information->hProcess = OpenProcess(SYNCHRONIZE | 
PROCESS_TERMINATE, FALSE,
+
process_information->dwProcessId);
+if (!process_information->hProcess) {
+vd_printf("OpenProcess() failed %lu", GetLastError());
+}
+}
  } else {
  SetLastError(proc_ret.last_error);
  }


Ack.
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH] vdagent: when SetClipboardData fails, set clipboard control event to stop wait

2012-12-09 Thread Uri Lublin

On 11/27/2012 11:16 AM, Arnon Gilboa wrote:

Currently, a SetClipboardData failure is followed by useless wait for timeout
(VD_CLIPBOARD_TIMEOUT_MS)
---
  vdagent/vdagent.cpp |   30 --
  1 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/vdagent/vdagent.cpp b/vdagent/vdagent.cpp
index 3f1053d..2bb466d 100644
--- a/vdagent/vdagent.cpp
+++ b/vdagent/vdagent.cpp
@@ -643,12 +643,10 @@ bool VDAgent::handle_clipboard(VDAgentClipboard* 
clipboard, uint32_t size)

  if (_clipboard_owner != owner_client) {
  vd_printf("Received clipboard data from client while clipboard is not 
owned by client");
-set_control_event(CONTROL_CLIPBOARD);
-return false;
+goto fin;
  }
  if (clipboard->type == VD_AGENT_CLIPBOARD_NONE) {
-set_control_event(CONTROL_CLIPBOARD);
-return false;
+goto fin;
  }
  switch (clipboard->type) {
  case VD_AGENT_CLIPBOARD_UTF8_TEXT:
@@ -664,20 +662,24 @@ bool VDAgent::handle_clipboard(VDAgentClipboard* 
clipboard, uint32_t size)
  }
  default:
  vd_printf("Unsupported clipboard type %u", clipboard->type);
-return true;
+goto fin;
  }
  format = get_clipboard_format(clipboard->type);
-if (SetClipboardData(format, clip_data)) {
-set_control_event(CONTROL_CLIPBOARD);
-return true;
-}
-// We retry clipboard open-empty-set-close only when there is a timeout in 
on_clipboard_request()
-if (!OpenClipboard(_hwnd)) {
-return false;
+if (format == 0) {
+vd_printf("Unknown clipboard format, type %u", clipboard->type);
+goto fin;
  }
-EmptyClipboard();
  ret = !!SetClipboardData(format, clip_data);
-CloseClipboard();
+if (!ret) {
+DWORD err = GetLastError();
+if (err == ERROR_NOT_ENOUGH_MEMORY) {
+vd_printf("Not enough memory to set clipboard data, size %u 
bytes", size);
+} else {
+vd_printf("SetClipboardData failed: %u", err);
+}
+}
+fin:
+set_control_event(CONTROL_CLIPBOARD);
  return ret;
  }



Ack.

Two comments:
- Only the 'default' case changed (set event + return false), other 
cases are

  logically the same (but it's a nice cleanup for them too).
- retry clipboard open-empty-set-close was removed.
  would be nice to add it to the log message (or as a separate patch).

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH] build-sys: remove *vdi_port* from Makefile.am

2012-12-09 Thread Arnon Gilboa
---
 Makefile.am |6 --
 1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 9b73def..3bd66aa 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -31,13 +31,7 @@ vdagent_SOURCES =\
vdagent/desktop_layout.h\
vdagent/display_setting.cpp \
vdagent/display_setting.h   \
-   vdagent/pci_vdi_port.cpp\
-   vdagent/pci_vdi_port.h  \
vdagent/vdagent.cpp \
-   vdagent/vdi_port.cpp\
-   vdagent/vdi_port.h  \
-   vdagent/virtio_vdi_port.cpp \
-   vdagent/virtio_vdi_port.h   \
$(NULL)
 
 vdagent_rc.$(OBJEXT): vdagent/vdagent.rc
-- 
1.7.4.1

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH] build-sys: remove *vdi_port* from Makefile.am

2012-12-09 Thread Uri Lublin

On 12/09/2012 11:42 AM, Arnon Gilboa wrote:

---
  Makefile.am |6 --
  1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 9b73def..3bd66aa 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -31,13 +31,7 @@ vdagent_SOURCES =\
vdagent/desktop_layout.h\
vdagent/display_setting.cpp \
vdagent/display_setting.h   \
-   vdagent/pci_vdi_port.cpp\
-   vdagent/pci_vdi_port.h  \
vdagent/vdagent.cpp \
-   vdagent/vdi_port.cpp\
-   vdagent/vdi_port.h  \
-   vdagent/virtio_vdi_port.cpp \
-   vdagent/virtio_vdi_port.h   \
$(NULL)

  vdagent_rc.$(OBJEXT): vdagent/vdagent.rc


Ack.
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH] spicy: port_data: check write return value

2012-12-09 Thread Uri Lublin
Fixes the following build warning (but does not really check write return 
value):
spicy.c: In function ‘port_data’:
spicy.c:1711:10: error: ignoring return value of ‘write’, declared with 
attribute warn_unused_result [-Werror=unused-result]

Reported by Yaniv Kaul 
---

Alternatively, if we really care about writing port data to stdout:

-write(fileno(stdout), data, size);
+if (write(fileno(stdout), data, size) != size)
+g_warning("Failed to write %d bytes to stdout", size);


---
 gtk/spicy.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/gtk/spicy.c b/gtk/spicy.c
index dd8c970..077ef52 100644
--- a/gtk/spicy.c
+++ b/gtk/spicy.c
@@ -1708,7 +1708,7 @@ static void port_data(SpicePortChannel *port,
 if (port != stdin_port)
 return;
 
-write(fileno(stdout), data, size);
+size = write(fileno(stdout), data, size);
 }
 
 static void channel_new(SpiceSession *s, SpiceChannel *channel, gpointer data)
-- 
1.7.1

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] Translating the Spice protocol using spice-client-glib

2012-12-09 Thread Michael Jumper
Hello,

I am looking to use spice-client-glib (which seems to be the only
low-level client library available) to implement a plugin for guacd
which translates between the Spice protocol and the Guacamole
protocol, thus adding Spice support to Guacamole (an HTML5 remote
desktop gateway).

At the surface, implementation using spice-client-glib seems
straightforward, but I'm worried about information lost in the
reduction from graphical updates supported by Spice (including cached
updates) to a simple rect passed to a client implementation via the
"display-invalidate" signal from the display channel. I've gone over
the public API of spice-client-glib, as well as the code that drives
it, and while I can find code that handles cached updates, I don't see
any way this is exposed to a client implementation driven by
spice-client-glib.

Information regarding whether a graphical change is the result of a
cached drawing operation, as well as information regarding what image
data was cached, is necessary for a client implementation to take
advantage of similar caching capabilities of the destination device or
protocol, in this case the Guacamole protocol. Lacking this, my
choices seem to be limited to modifying spice-client-glib to add the
necessary meta-information to the "display-invalidate" signal, or
writing my own client implementation from scratch.

Any advice? Am I missing something?

Thanks,

- Mike Jumper
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] Windows Guest Tools 0.2

2012-12-09 Thread Klaus Hochlehnert
Hi Christophe,

just found a small issue...

When upgrading from spice-guest-tools-0.1 without uninstalling them first I got 
an error that the vdagent can't be copied.
The vdagent service was still running.
Maybe you could add stopping the service at the beginning of the installation 
procedure.

Thanks and great work,
Klaus

-Ursprüngliche Nachricht-
Von: spice-devel-bounces+mailings=kh-dev...@lists.freedesktop.org 
[mailto:spice-devel-bounces+mailings=kh-dev...@lists.freedesktop.org] Im 
Auftrag von Christophe Fergeau
Gesendet: Freitag, 16. November 2012 10:24
An: spice-devel@lists.freedesktop.org
Betreff: [Spice-devel] Windows Guest Tools 0.2

Hey everyone,

I've just pushed a new release of the SPICE Guest Tools for Windows. This 
includes the virtio-win 0.1-30 drivers [1], a git snapshot of the Windows agent 
built with mingw (git SHA1: b264830), and a newer version of the QXL driver 
which has arbitrary resolution support.
You can download it from
http://spice-space.org/download/binaries/spice-guest-tools/spice-guest-tools-0.2.exe

Enjoy, and feel free to report any issues with it!

Christophe

[1] 
https://alt.fedoraproject.org/pub/alt/virtio-win/latest/images/bin/virtio-win-0.1-30.iso
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH vdagent 1/2] vdagent-x11-randr: Fix building warning

2012-12-09 Thread Christophe Fergeau
Hey,

On Wed, Dec 05, 2012 at 04:01:58PM +0800, Dunrong Huang wrote:
> This patch can be safely applied since it just deletes unused variables.
> 
> Signed-off-by: Dunrong Huang 
> ---
>  src/vdagent-x11-randr.c | 8 +---
>  1 file changed, 1 insertion(+), 7 deletions(-)
> 
> diff --git a/src/vdagent-x11-randr.c b/src/vdagent-x11-randr.c
> index 2c1819a..e171e7a 100644
> --- a/src/vdagent-x11-randr.c
> +++ b/src/vdagent-x11-randr.c
> @@ -204,9 +204,6 @@ static void delete_mode(struct vdagent_x11 *x11, int 
> output_index, const char* n
>  int m;
>  XRRModeInfo *mode;
>  XRROutputInfo *output_info;
> -XRRCrtcInfo *crtc_info;
> -RRCrtc crtc;
> -int current_mode = -1;
>  
>  output_info = x11->randr.outputs[output_index];
>  if (output_info->ncrtc != 1) {
> @@ -214,9 +211,6 @@ static void delete_mode(struct vdagent_x11 *x11, int 
> output_index, const char* n
> "failed to delete mode", output_info->ncrtc);
>  return;
>  }
> -crtc_info = crtc_from_id(x11, output_info->crtcs[0]);
> -current_mode = crtc_info->mode;
> -crtc = output_info->crtc;
>  for (m = 0 ; m < x11->randr.res->nmode; ++m) {
>  mode = &x11->randr.res->modes[m];
>  if (strcmp(mode->name, name) == 0)
> @@ -689,7 +683,7 @@ void vdagent_x11_set_monitor_config(struct vdagent_x11 
> *x11,
>  if (!xrandr_add_and_set(x11, i, x, y, width, height) &&
>  mon_config->num_of_monitors == 1) {
>  set_screen_to_best_size(x11, width, height,
> -&primary_w, &primary_h);
> +(int *)&primary_w, (int *)&primary_h);

I'm not a big fan of this change as this will cause issues if sizeof(int)
!= sizeof(uint32_t). However, in the first half of
vdagent_x11_set_monitor_config, primary_w is used with unsigned variables
while in the second half, it's used with signed variables, so I'm not sure
what is the best way to solve this here. I assume you were getting a
warning before this cast?

Christophe


pgpg1aypo54Cf.pgp
Description: PGP signature
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH vdagent 2/2] vdagentd: Fix building warning

2012-12-09 Thread Christophe Fergeau
This one looks good, ACK.

Christophe

On Wed, Dec 05, 2012 at 04:01:59PM +0800, Dunrong Huang wrote:
> Move some variable declarations to right place.
> 
> Signed-off-by: Dunrong Huang 
> ---
>  src/vdagentd.c | 12 
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/src/vdagentd.c b/src/vdagentd.c
> index 7006d80..a51ac4c 100644
> --- a/src/vdagentd.c
> +++ b/src/vdagentd.c
> @@ -510,10 +510,9 @@ void release_clipboards(void)
>  
>  void update_active_session_connection(void)
>  {
> -struct udscs_connection *new_conn = NULL;
> -int n;
> -
>  #ifdef HAVE_SESSION_INFO
> +int n;
> +struct udscs_connection *new_conn = NULL;
>  if (!active_session)
>  active_session = session_info_get_active_session(session_info);
>  
> @@ -541,7 +540,9 @@ void update_active_session_connection(void)
>  
>  void agent_connect(struct udscs_connection *conn)
>  {
> +#ifdef HAVE_SESSION_INFO
>  uint32_t pid;
> +#endif
>  struct agent_data *agent_data;
>  
>  agent_data = calloc(1, sizeof(*agent_data));
> @@ -707,7 +708,10 @@ void daemonize(void)
>  void main_loop(void)
>  {
>  fd_set readfds, writefds;
> -int n, nfds, ck_fd = 0;
> +int n, nfds;
> +#ifdef HAVE_SESSION_INFO
> +int ck_fd = 0;
> +#endif
>  
>  while (!quit) {
>  FD_ZERO(&readfds);
> -- 
> 1.8.0
> 
> ___
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel


pgpsmAsAOrECm.pgp
Description: PGP signature
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/spice-devel