Re: [Spice-devel] [PATCH v3 1/2] Do endian swapping.

2017-01-13 Thread Michal Suchánek
On Fri, 13 Jan 2017 06:52:17 -0500 (EST)
Frediano Ziglio  wrote:

> >  case VD_AGENT_FILE_XFER_STATUS:
> >  case VD_AGENT_FILE_XFER_DATA:
> > +if (message_header->size <
> > sizeof(VDAgentFileXferStartMessage))
> > +goto size_error;
> > +*id = GUINT32_FROM_LE(*id);
> > +id++; /* size/status */
> > +switch (message_header->type) {
> > +case VD_AGENT_FILE_XFER_DATA:
> > +   if (message_header->size <
> > sizeof(VDAgentFileXferDataMessage))
> > +   goto size_error;
> > +   *((uint64_t *)id) = le64toh(*((uint64_t *)id)); /* size
> > */  
> 
> Why not GUINT64_FROM_LE ?

Missed the 64bit functions when changing to glib macros.

> There could be portability issues if id is not 64-bit aligned here.
> Would be better to use VDAgentFileXferDataMessage structure which
> has the right attributes to support misalignment.

yes, that might be better option.

Thanks

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


[Spice-devel] R: virt-viewer 5.0 binary for windows error in win 8.1

2017-01-13 Thread sella gianpietro
Hi,
It is strange, now works again (no change made in windows).
If the problem return I try to do a dump although I do not know if in
windows it is possible.
Best regards, Gianpietro.
 
  _  

Da: Frediano Ziglio [mailto:fzig...@redhat.com] 
Inviato: venerdì 13 gennaio 2017 13.44
A: gianpietro sella
Cc: spice-devel@lists.freedesktop.org
Oggetto: Re: [Spice-devel] virt-viewer 5.0 binary for windows error in win
8.1
 
 
 
Hi,
 
a month ago I installed virt-viewer binary for win 8.1 system:
 

https://virt-manager.org/download/sources/virt-viewer/virt-viewer-x64-5.0.ms
i
it worked up to a week ago.
Then I did an stardard update of system (the automatic microsoft periodic
update).
Now the program does not work.
When I open the program remote-viewer the GUI is not shown and program is
closed.
In the event viewer of windows I see the next error (sorry but the system is
installed with italian language, in brackets the english traduction),
someone has an idea:
 
 
 
Nome dell'applicazione che ha generato l'errore (Name of the application
that generated the error): remote-viewer.exe,
versione (version): 0.0.0.0, 
timestamp: 0x5836f66c 
Nome del modulo che ha generato l'errore: libgdk-3-0.dll, 
versione (version):3.22.2.0, 
timestamp: 0x000a91a8
Codice eccezione (exception code): 0xc005
Offset errore (error offset) 0x00032311
ID processo che ha generato l'errore (ID process that generated the error):
0xfec 
Ora di avvio dell'applicazione che ha generato l'errore (start time of the
application that generated the error): 0x01d269ac0f8a1726 
Percorso dell'applicazione che ha generato l'errore (path of the application
that generated the error): c:\Program Files\VirtViewer
v5.0-256\bin\remote-viewer.exe 
Percorso del modulo che ha generato l'errore (The module path that generated
the error): c:\Program Files\VirtViewer v5.0-256\bin\libgdk-3-0.dll 
ID segnalazione (ID signaling): 4d5a66f1-d59f-11e6-829f-6451064d871b
 
 
 
- System
 
   - Provider
 
[ Name]  Application Error
 
   - EventID 1000
 
[ Qualifiers]  0
 
Level 2
 
Task 100
 
Keywords 0x80
 
   - TimeCreated
 
[ SystemTime]  2017-01-08T12:38:06.0Z
 
EventRecordID 49294
 
Channel Application
 
Computer sella
 
Security
 
 
- EventData
 
remote-viewer.exe
0.0.0.0
5836f66c
libgdk-3-0.dll
3.22.2.0
000a91a8
c005
00032311
fec
01d269ac0f8a1726
c:\Program Files\VirtViewer v5.0-256\bin\remote-viewer.exe
c:\Program Files\VirtViewer v5.0-256\bin\libgdk-3-0.dll
4d5a66f1-d59f-11e6-829f-6451064d871b 
 
 
Bets regards,
Gianpietro.
It's hard to say with such few information.
Do you have a mini dump ?
 
Frediano
 
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH spice-gtk] widget: Set cursor in constructor

2017-01-13 Thread Marc-André Lureau
Hi

- Original Message -
> On Fri, 2017-01-13 at 09:17 -0500, Marc-André Lureau wrote:
> > Hi
> > 
> > - Original Message -
> > > Hi,
> > > 
> > > On Fri, 2017-01-13 at 09:01 -0500, Marc-André Lureau wrote:
> > > > Hi
> > > > 
> > > > - Original Message -
> > > > > In a multimonitor environment can easily happen that a cursor
> > > > > is
> > > > > set
> > > > > before some of the SpiceDisplays are created. IOW the first
> > > > > created
> > > > > SpiceDisplay has the cursor but others don't.
> > > > > 
> > > > > To avoid the issue cache the information about the last set
> > > > > cursor
> > > > > in
> > > > > the SpiceGtkSession and set the cursor shape in the
> > > > > SpiceDisplay
> > > > > constructor.
> > > > > 
> > > > > Resolves:
> > > > > https://bugzilla.redhat.com/show_bug.cgi?id=1411380
> > > > 
> > > > Isn't that a server bug? In this situation, each display channel
> > > > has
> > > > its own independant cursor channel. I don't think we should mix
> > > > all
> > > > cursor channels in the same session, else what the point in
> > > > having
> > > > different display/cursor channels? Better be solved at the
> > > > server
> > > > side imho
> > > 
> > > Sorry, I forgot to mention that it is for multimonitor linux
> > > guests
> > > where is 1 display channel.
> > 
> > Ok, that wasn't clear. Same idea though, better not have a shared
> > cursor in session when we actually have display/cursor channel pairs
> > by protocol design.
> > 
> > We may want to have a "cursor" boxed/struct property with associated
> > notify on the cursor channel, instead of "cursor-set" signal (to be
> > kept for compatibility). Not sure why it wasn't done that way,
> > probably for historical reasons (one of the first commits).
> 
> ok, originally I wanted to avoid a new api, but it sounds reasonable.
> tbh I didn't think about the situation where displays have different
> cursors.
> 

Although silly, in theory the protocol permits it. Who knows how the protocol 
is being used, we have been surprised in the past (for ex export several VMs in 
the same session for?)

> Pavel
> 
> > 
> > 
> > > Pavel
> > > 
> > > > 
> > > > > ---
> > > > >  src/spice-gtk-session-priv.h |  3 +++
> > > > >  src/spice-gtk-session.c  | 43
> > > > >  +++
> > > > >  src/spice-widget.c   | 14 +-
> > > > >  3 files changed, 59 insertions(+), 1 deletion(-)
> > > > > 
> > > > > diff --git a/src/spice-gtk-session-priv.h b/src/spice-gtk-
> > > > > session-
> > > > > priv.h
> > > > > index d7fe313..454013c 100644
> > > > > --- a/src/spice-gtk-session-priv.h
> > > > > +++ b/src/spice-gtk-session-priv.h
> > > > > @@ -45,6 +45,9 @@ void
> > > > > spice_gtk_session_set_keyboard_has_focus(SpiceGtkSession
> > > > > *self,
> > > > > gboolean ke
> > > > >  void spice_gtk_session_set_mouse_has_pointer(SpiceGtkSession
> > > > > *self, gboolean
> > > > >  mouse_has_pointer);
> > > > >  gboolean
> > > > > spice_gtk_session_get_keyboard_has_focus(SpiceGtkSession
> > > > > *self);
> > > > >  gboolean
> > > > > spice_gtk_session_get_mouse_has_pointer(SpiceGtkSession
> > > > > *self);
> > > > > +gboolean spice_gtk_session_get_last_cursor(SpiceGtkSession
> > > > > *self,
> > > > > +   gint *width, gint
> > > > > *height,
> > > > > +   gpointer *rgba);
> > > > >  
> > > > >  G_END_DECLS
> > > > >  
> > > > > diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
> > > > > index a3a2e90..75ee300 100644
> > > > > --- a/src/spice-gtk-session.c
> > > > > +++ b/src/spice-gtk-session.c
> > > > > @@ -47,6 +47,12 @@
> > > > >  
> > > > >  #define CLIPBOARD_LAST
> > > > > (VD_AGENT_CLIPBOARD_SELECTION_SECONDARY +
> > > > > 1)
> > > > >  
> > > > > +typedef struct session_cursor {
> > > > > +gint width;
> > > > > +gint height;
> > > > > +gpointer rgba;
> > > > > +} session_cursor;
> > > > > +
> > > > >  struct _SpiceGtkSessionPrivate {
> > > > >  SpiceSession*session;
> > > > >  /* Clipboard related */
> > > > > @@ -66,6 +72,7 @@ struct _SpiceGtkSessionPrivate {
> > > > >  gbooleankeyboard_has_focus;
> > > > >  gbooleanmouse_has_pointer;
> > > > >  gbooleansync_modifiers;
> > > > > +session_cursor  last_cursor;
> > > > >  };
> > > > >  
> > > > >  /**
> > > > > @@ -316,6 +323,8 @@ static void
> > > > > spice_gtk_session_finalize(GObject
> > > > > *gobject)
> > > > >  g_clear_pointer(>clip_targets[i], g_free);
> > > > >  }
> > > > >  
> > > > > +g_clear_pointer(>last_cursor.rgba, g_free);
> > > > > +
> > > > >  /* Chain up to the parent class */
> > > > >  if (G_OBJECT_CLASS(spice_gtk_session_parent_class)-
> > > > > >finalize)
> > > > >  G_OBJECT_CLASS(spice_gtk_session_parent_class)-
> > > > > > finalize(gobject);
> > > > > 
> > > > > @@ -1094,6 +1103,21 @@ static void

Re: [Spice-devel] [PATCH spice-gtk] widget: Set cursor in constructor

2017-01-13 Thread Pavel Grunt
On Fri, 2017-01-13 at 09:17 -0500, Marc-André Lureau wrote:
> Hi
> 
> - Original Message -
> > Hi,
> > 
> > On Fri, 2017-01-13 at 09:01 -0500, Marc-André Lureau wrote:
> > > Hi
> > > 
> > > - Original Message -
> > > > In a multimonitor environment can easily happen that a cursor
> > > > is
> > > > set
> > > > before some of the SpiceDisplays are created. IOW the first
> > > > created
> > > > SpiceDisplay has the cursor but others don't.
> > > > 
> > > > To avoid the issue cache the information about the last set
> > > > cursor
> > > > in
> > > > the SpiceGtkSession and set the cursor shape in the
> > > > SpiceDisplay
> > > > constructor.
> > > > 
> > > > Resolves:
> > > > https://bugzilla.redhat.com/show_bug.cgi?id=1411380
> > > 
> > > Isn't that a server bug? In this situation, each display channel
> > > has
> > > its own independant cursor channel. I don't think we should mix
> > > all
> > > cursor channels in the same session, else what the point in
> > > having
> > > different display/cursor channels? Better be solved at the
> > > server
> > > side imho
> > 
> > Sorry, I forgot to mention that it is for multimonitor linux
> > guests
> > where is 1 display channel.
> 
> Ok, that wasn't clear. Same idea though, better not have a shared
> cursor in session when we actually have display/cursor channel pairs
> by protocol design.
> 
> We may want to have a "cursor" boxed/struct property with associated
> notify on the cursor channel, instead of "cursor-set" signal (to be
> kept for compatibility). Not sure why it wasn't done that way,
> probably for historical reasons (one of the first commits).

ok, originally I wanted to avoid a new api, but it sounds reasonable.
tbh I didn't think about the situation where displays have different
cursors.

Pavel

> 
> 
> > Pavel
> > 
> > > 
> > > > ---
> > > >  src/spice-gtk-session-priv.h |  3 +++
> > > >  src/spice-gtk-session.c  | 43
> > > >  +++
> > > >  src/spice-widget.c   | 14 +-
> > > >  3 files changed, 59 insertions(+), 1 deletion(-)
> > > > 
> > > > diff --git a/src/spice-gtk-session-priv.h b/src/spice-gtk-
> > > > session-
> > > > priv.h
> > > > index d7fe313..454013c 100644
> > > > --- a/src/spice-gtk-session-priv.h
> > > > +++ b/src/spice-gtk-session-priv.h
> > > > @@ -45,6 +45,9 @@ void
> > > > spice_gtk_session_set_keyboard_has_focus(SpiceGtkSession
> > > > *self,
> > > > gboolean ke
> > > >  void spice_gtk_session_set_mouse_has_pointer(SpiceGtkSession
> > > > *self, gboolean
> > > >  mouse_has_pointer);
> > > >  gboolean
> > > > spice_gtk_session_get_keyboard_has_focus(SpiceGtkSession
> > > > *self);
> > > >  gboolean
> > > > spice_gtk_session_get_mouse_has_pointer(SpiceGtkSession
> > > > *self);
> > > > +gboolean spice_gtk_session_get_last_cursor(SpiceGtkSession
> > > > *self,
> > > > +   gint *width, gint
> > > > *height,
> > > > +   gpointer *rgba);
> > > >  
> > > >  G_END_DECLS
> > > >  
> > > > diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
> > > > index a3a2e90..75ee300 100644
> > > > --- a/src/spice-gtk-session.c
> > > > +++ b/src/spice-gtk-session.c
> > > > @@ -47,6 +47,12 @@
> > > >  
> > > >  #define CLIPBOARD_LAST
> > > > (VD_AGENT_CLIPBOARD_SELECTION_SECONDARY +
> > > > 1)
> > > >  
> > > > +typedef struct session_cursor {
> > > > +gint width;
> > > > +gint height;
> > > > +gpointer rgba;
> > > > +} session_cursor;
> > > > +
> > > >  struct _SpiceGtkSessionPrivate {
> > > >  SpiceSession*session;
> > > >  /* Clipboard related */
> > > > @@ -66,6 +72,7 @@ struct _SpiceGtkSessionPrivate {
> > > >  gbooleankeyboard_has_focus;
> > > >  gbooleanmouse_has_pointer;
> > > >  gbooleansync_modifiers;
> > > > +session_cursor  last_cursor;
> > > >  };
> > > >  
> > > >  /**
> > > > @@ -316,6 +323,8 @@ static void
> > > > spice_gtk_session_finalize(GObject
> > > > *gobject)
> > > >  g_clear_pointer(>clip_targets[i], g_free);
> > > >  }
> > > >  
> > > > +g_clear_pointer(>last_cursor.rgba, g_free);
> > > > +
> > > >  /* Chain up to the parent class */
> > > >  if (G_OBJECT_CLASS(spice_gtk_session_parent_class)-
> > > > >finalize)
> > > >  G_OBJECT_CLASS(spice_gtk_session_parent_class)-
> > > > > finalize(gobject);
> > > > 
> > > > @@ -1094,6 +1103,21 @@ static void
> > > > clipboard_release(SpiceMainChannel *main,
> > > > guint selection,
> > > >  s->clipboard_by_guest[selection] = FALSE;
> > > >  }
> > > >  
> > > > +static void cursor_set(SpiceCursorChannel *channel,
> > > > +   gint width, gint height,
> > > > +   gint hot_x G_GNUC_UNUSED, gint hot_y
> > > > G_GNUC_UNUSED,
> > > > +   gpointer rgba, gpointer data)
> > > > +{
> > > > +SpiceGtkSession *self = data;
> > > > +

Re: [Spice-devel] [PATCH spice-gtk] widget: Set cursor in constructor

2017-01-13 Thread Marc-André Lureau
Hi

- Original Message -
> Hi,
> 
> On Fri, 2017-01-13 at 09:01 -0500, Marc-André Lureau wrote:
> > Hi
> > 
> > - Original Message -
> > > In a multimonitor environment can easily happen that a cursor is
> > > set
> > > before some of the SpiceDisplays are created. IOW the first
> > > created
> > > SpiceDisplay has the cursor but others don't.
> > > 
> > > To avoid the issue cache the information about the last set cursor
> > > in
> > > the SpiceGtkSession and set the cursor shape in the SpiceDisplay
> > > constructor.
> > > 
> > > Resolves:
> > > https://bugzilla.redhat.com/show_bug.cgi?id=1411380
> > 
> > Isn't that a server bug? In this situation, each display channel has
> > its own independant cursor channel. I don't think we should mix all
> > cursor channels in the same session, else what the point in having
> > different display/cursor channels? Better be solved at the server
> > side imho
> 
> Sorry, I forgot to mention that it is for multimonitor linux guests
> where is 1 display channel.

Ok, that wasn't clear. Same idea though, better not have a shared cursor in 
session when we actually have display/cursor channel pairs by protocol design.

We may want to have a "cursor" boxed/struct property with associated notify on 
the cursor channel, instead of "cursor-set" signal (to be kept for 
compatibility). Not sure why it wasn't done that way, probably for historical 
reasons (one of the first commits).


> Pavel
> 
> > 
> > > ---
> > >  src/spice-gtk-session-priv.h |  3 +++
> > >  src/spice-gtk-session.c  | 43
> > >  +++
> > >  src/spice-widget.c   | 14 +-
> > >  3 files changed, 59 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/src/spice-gtk-session-priv.h b/src/spice-gtk-session-
> > > priv.h
> > > index d7fe313..454013c 100644
> > > --- a/src/spice-gtk-session-priv.h
> > > +++ b/src/spice-gtk-session-priv.h
> > > @@ -45,6 +45,9 @@ void
> > > spice_gtk_session_set_keyboard_has_focus(SpiceGtkSession *self,
> > > gboolean ke
> > >  void spice_gtk_session_set_mouse_has_pointer(SpiceGtkSession
> > > *self, gboolean
> > >  mouse_has_pointer);
> > >  gboolean spice_gtk_session_get_keyboard_has_focus(SpiceGtkSession
> > > *self);
> > >  gboolean spice_gtk_session_get_mouse_has_pointer(SpiceGtkSession
> > > *self);
> > > +gboolean spice_gtk_session_get_last_cursor(SpiceGtkSession *self,
> > > +   gint *width, gint
> > > *height,
> > > +   gpointer *rgba);
> > >  
> > >  G_END_DECLS
> > >  
> > > diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
> > > index a3a2e90..75ee300 100644
> > > --- a/src/spice-gtk-session.c
> > > +++ b/src/spice-gtk-session.c
> > > @@ -47,6 +47,12 @@
> > >  
> > >  #define CLIPBOARD_LAST (VD_AGENT_CLIPBOARD_SELECTION_SECONDARY +
> > > 1)
> > >  
> > > +typedef struct session_cursor {
> > > +gint width;
> > > +gint height;
> > > +gpointer rgba;
> > > +} session_cursor;
> > > +
> > >  struct _SpiceGtkSessionPrivate {
> > >  SpiceSession*session;
> > >  /* Clipboard related */
> > > @@ -66,6 +72,7 @@ struct _SpiceGtkSessionPrivate {
> > >  gbooleankeyboard_has_focus;
> > >  gbooleanmouse_has_pointer;
> > >  gbooleansync_modifiers;
> > > +session_cursor  last_cursor;
> > >  };
> > >  
> > >  /**
> > > @@ -316,6 +323,8 @@ static void spice_gtk_session_finalize(GObject
> > > *gobject)
> > >  g_clear_pointer(>clip_targets[i], g_free);
> > >  }
> > >  
> > > +g_clear_pointer(>last_cursor.rgba, g_free);
> > > +
> > >  /* Chain up to the parent class */
> > >  if (G_OBJECT_CLASS(spice_gtk_session_parent_class)->finalize)
> > >  G_OBJECT_CLASS(spice_gtk_session_parent_class)-
> > > >finalize(gobject);
> > > @@ -1094,6 +1103,21 @@ static void
> > > clipboard_release(SpiceMainChannel *main,
> > > guint selection,
> > >  s->clipboard_by_guest[selection] = FALSE;
> > >  }
> > >  
> > > +static void cursor_set(SpiceCursorChannel *channel,
> > > +   gint width, gint height,
> > > +   gint hot_x G_GNUC_UNUSED, gint hot_y
> > > G_GNUC_UNUSED,
> > > +   gpointer rgba, gpointer data)
> > > +{
> > > +SpiceGtkSession *self = data;
> > > +SpiceGtkSessionPrivate *s = self->priv;
> > > +if (s->last_cursor.rgba != NULL) {
> > > +g_free(s->last_cursor.rgba);
> > > +}
> > > +s->last_cursor.width = width;
> > > +s->last_cursor.height = height;
> > > +s->last_cursor.rgba = g_memdup(rgba, width * height * 4);
> > > +}
> > > +
> > >  static void channel_new(SpiceSession *session, SpiceChannel
> > > *channel,
> > >  gpointer user_data)
> > >  {
> > > @@ -1117,6 +1141,11 @@ static void channel_new(SpiceSession
> > > *session,
> > > SpiceChannel *channel,
> > > 

Re: [Spice-devel] [PATCH spice-gtk] widget: Set cursor in constructor

2017-01-13 Thread Pavel Grunt
Hi,

On Fri, 2017-01-13 at 09:01 -0500, Marc-André Lureau wrote:
> Hi
> 
> - Original Message -
> > In a multimonitor environment can easily happen that a cursor is
> > set
> > before some of the SpiceDisplays are created. IOW the first
> > created
> > SpiceDisplay has the cursor but others don't.
> > 
> > To avoid the issue cache the information about the last set cursor
> > in
> > the SpiceGtkSession and set the cursor shape in the SpiceDisplay
> > constructor.
> > 
> > Resolves:
> > https://bugzilla.redhat.com/show_bug.cgi?id=1411380
> 
> Isn't that a server bug? In this situation, each display channel has
> its own independant cursor channel. I don't think we should mix all
> cursor channels in the same session, else what the point in having
> different display/cursor channels? Better be solved at the server
> side imho

Sorry, I forgot to mention that it is for multimonitor linux guests
where is 1 display channel.

Pavel

> 
> > ---
> >  src/spice-gtk-session-priv.h |  3 +++
> >  src/spice-gtk-session.c  | 43
> >  +++
> >  src/spice-widget.c   | 14 +-
> >  3 files changed, 59 insertions(+), 1 deletion(-)
> > 
> > diff --git a/src/spice-gtk-session-priv.h b/src/spice-gtk-session-
> > priv.h
> > index d7fe313..454013c 100644
> > --- a/src/spice-gtk-session-priv.h
> > +++ b/src/spice-gtk-session-priv.h
> > @@ -45,6 +45,9 @@ void
> > spice_gtk_session_set_keyboard_has_focus(SpiceGtkSession *self,
> > gboolean ke
> >  void spice_gtk_session_set_mouse_has_pointer(SpiceGtkSession
> > *self, gboolean
> >  mouse_has_pointer);
> >  gboolean spice_gtk_session_get_keyboard_has_focus(SpiceGtkSession
> > *self);
> >  gboolean spice_gtk_session_get_mouse_has_pointer(SpiceGtkSession
> > *self);
> > +gboolean spice_gtk_session_get_last_cursor(SpiceGtkSession *self,
> > +   gint *width, gint
> > *height,
> > +   gpointer *rgba);
> >  
> >  G_END_DECLS
> >  
> > diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
> > index a3a2e90..75ee300 100644
> > --- a/src/spice-gtk-session.c
> > +++ b/src/spice-gtk-session.c
> > @@ -47,6 +47,12 @@
> >  
> >  #define CLIPBOARD_LAST (VD_AGENT_CLIPBOARD_SELECTION_SECONDARY +
> > 1)
> >  
> > +typedef struct session_cursor {
> > +gint width;
> > +gint height;
> > +gpointer rgba;
> > +} session_cursor;
> > +
> >  struct _SpiceGtkSessionPrivate {
> >  SpiceSession*session;
> >  /* Clipboard related */
> > @@ -66,6 +72,7 @@ struct _SpiceGtkSessionPrivate {
> >  gbooleankeyboard_has_focus;
> >  gbooleanmouse_has_pointer;
> >  gbooleansync_modifiers;
> > +session_cursor  last_cursor;
> >  };
> >  
> >  /**
> > @@ -316,6 +323,8 @@ static void spice_gtk_session_finalize(GObject
> > *gobject)
> >  g_clear_pointer(>clip_targets[i], g_free);
> >  }
> >  
> > +g_clear_pointer(>last_cursor.rgba, g_free);
> > +
> >  /* Chain up to the parent class */
> >  if (G_OBJECT_CLASS(spice_gtk_session_parent_class)->finalize)
> >  G_OBJECT_CLASS(spice_gtk_session_parent_class)-
> > >finalize(gobject);
> > @@ -1094,6 +1103,21 @@ static void
> > clipboard_release(SpiceMainChannel *main,
> > guint selection,
> >  s->clipboard_by_guest[selection] = FALSE;
> >  }
> >  
> > +static void cursor_set(SpiceCursorChannel *channel,
> > +   gint width, gint height,
> > +   gint hot_x G_GNUC_UNUSED, gint hot_y
> > G_GNUC_UNUSED,
> > +   gpointer rgba, gpointer data)
> > +{
> > +SpiceGtkSession *self = data;
> > +SpiceGtkSessionPrivate *s = self->priv;
> > +if (s->last_cursor.rgba != NULL) {
> > +g_free(s->last_cursor.rgba);
> > +}
> > +s->last_cursor.width = width;
> > +s->last_cursor.height = height;
> > +s->last_cursor.rgba = g_memdup(rgba, width * height * 4);
> > +}
> > +
> >  static void channel_new(SpiceSession *session, SpiceChannel
> > *channel,
> >  gpointer user_data)
> >  {
> > @@ -1117,6 +1141,11 @@ static void channel_new(SpiceSession
> > *session,
> > SpiceChannel *channel,
> >    G_CALLBACK(guest_modifiers_
> > changed),
> >    self, 0);
> >  spice_gtk_session_sync_keyboard_modifiers_for_channel(sel
> > f,
> >  SPICE_INPUTS_CHANNEL(channel), TRUE);
> >  }
> > +if (SPICE_IS_CURSOR_CHANNEL(channel)) {
> > +spice_g_signal_connect_object(channel, "cursor-set",
> > +  G_CALLBACK(cursor_set),
> > self, 0);
> > +return;
> > +}
> >  }
> >  
> >  static void channel_destroy(SpiceSession *session, SpiceChannel
> > *channel,
> > @@ -1338,3 +1367,17 @@ gboolean
> > spice_gtk_session_get_mouse_has_pointer(SpiceGtkSession *self)
> >  
> >  return 

Re: [Spice-devel] [PATCH spice-gtk] widget: Set cursor in constructor

2017-01-13 Thread Marc-André Lureau
Hi

- Original Message -
> In a multimonitor environment can easily happen that a cursor is set
> before some of the SpiceDisplays are created. IOW the first created
> SpiceDisplay has the cursor but others don't.
> 
> To avoid the issue cache the information about the last set cursor in
> the SpiceGtkSession and set the cursor shape in the SpiceDisplay
> constructor.
> 
> Resolves:
> https://bugzilla.redhat.com/show_bug.cgi?id=1411380

Isn't that a server bug? In this situation, each display channel has its own 
independant cursor channel. I don't think we should mix all cursor channels in 
the same session, else what the point in having different display/cursor 
channels? Better be solved at the server side imho

> ---
>  src/spice-gtk-session-priv.h |  3 +++
>  src/spice-gtk-session.c  | 43
>  +++
>  src/spice-widget.c   | 14 +-
>  3 files changed, 59 insertions(+), 1 deletion(-)
> 
> diff --git a/src/spice-gtk-session-priv.h b/src/spice-gtk-session-priv.h
> index d7fe313..454013c 100644
> --- a/src/spice-gtk-session-priv.h
> +++ b/src/spice-gtk-session-priv.h
> @@ -45,6 +45,9 @@ void
> spice_gtk_session_set_keyboard_has_focus(SpiceGtkSession *self, gboolean ke
>  void spice_gtk_session_set_mouse_has_pointer(SpiceGtkSession *self, gboolean
>  mouse_has_pointer);
>  gboolean spice_gtk_session_get_keyboard_has_focus(SpiceGtkSession *self);
>  gboolean spice_gtk_session_get_mouse_has_pointer(SpiceGtkSession *self);
> +gboolean spice_gtk_session_get_last_cursor(SpiceGtkSession *self,
> +   gint *width, gint *height,
> +   gpointer *rgba);
>  
>  G_END_DECLS
>  
> diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
> index a3a2e90..75ee300 100644
> --- a/src/spice-gtk-session.c
> +++ b/src/spice-gtk-session.c
> @@ -47,6 +47,12 @@
>  
>  #define CLIPBOARD_LAST (VD_AGENT_CLIPBOARD_SELECTION_SECONDARY + 1)
>  
> +typedef struct session_cursor {
> +gint width;
> +gint height;
> +gpointer rgba;
> +} session_cursor;
> +
>  struct _SpiceGtkSessionPrivate {
>  SpiceSession*session;
>  /* Clipboard related */
> @@ -66,6 +72,7 @@ struct _SpiceGtkSessionPrivate {
>  gbooleankeyboard_has_focus;
>  gbooleanmouse_has_pointer;
>  gbooleansync_modifiers;
> +session_cursor  last_cursor;
>  };
>  
>  /**
> @@ -316,6 +323,8 @@ static void spice_gtk_session_finalize(GObject *gobject)
>  g_clear_pointer(>clip_targets[i], g_free);
>  }
>  
> +g_clear_pointer(>last_cursor.rgba, g_free);
> +
>  /* Chain up to the parent class */
>  if (G_OBJECT_CLASS(spice_gtk_session_parent_class)->finalize)
>  G_OBJECT_CLASS(spice_gtk_session_parent_class)->finalize(gobject);
> @@ -1094,6 +1103,21 @@ static void clipboard_release(SpiceMainChannel *main,
> guint selection,
>  s->clipboard_by_guest[selection] = FALSE;
>  }
>  
> +static void cursor_set(SpiceCursorChannel *channel,
> +   gint width, gint height,
> +   gint hot_x G_GNUC_UNUSED, gint hot_y G_GNUC_UNUSED,
> +   gpointer rgba, gpointer data)
> +{
> +SpiceGtkSession *self = data;
> +SpiceGtkSessionPrivate *s = self->priv;
> +if (s->last_cursor.rgba != NULL) {
> +g_free(s->last_cursor.rgba);
> +}
> +s->last_cursor.width = width;
> +s->last_cursor.height = height;
> +s->last_cursor.rgba = g_memdup(rgba, width * height * 4);
> +}
> +
>  static void channel_new(SpiceSession *session, SpiceChannel *channel,
>  gpointer user_data)
>  {
> @@ -1117,6 +1141,11 @@ static void channel_new(SpiceSession *session,
> SpiceChannel *channel,
>G_CALLBACK(guest_modifiers_changed),
>self, 0);
>  spice_gtk_session_sync_keyboard_modifiers_for_channel(self,
>  SPICE_INPUTS_CHANNEL(channel), TRUE);
>  }
> +if (SPICE_IS_CURSOR_CHANNEL(channel)) {
> +spice_g_signal_connect_object(channel, "cursor-set",
> +  G_CALLBACK(cursor_set), self, 0);
> +return;
> +}
>  }
>  
>  static void channel_destroy(SpiceSession *session, SpiceChannel *channel,
> @@ -1338,3 +1367,17 @@ gboolean
> spice_gtk_session_get_mouse_has_pointer(SpiceGtkSession *self)
>  
>  return self->priv->mouse_has_pointer;
>  }
> +
> +G_GNUC_INTERNAL
> +gboolean spice_gtk_session_get_last_cursor(SpiceGtkSession *self,
> +   gint *width, gint *height,
> +   gpointer *rgba)
> +{
> +g_return_val_if_fail(SPICE_IS_GTK_SESSION(self), FALSE);
> +
> +*width = self->priv->last_cursor.width;
> +*height = self->priv->last_cursor.height;
> +*rgba = self->priv->last_cursor.rgba;
> +
> +return 

[Spice-devel] [PATCH spice-gtk] widget: Set cursor in constructor

2017-01-13 Thread Pavel Grunt
In a multimonitor environment can easily happen that a cursor is set
before some of the SpiceDisplays are created. IOW the first created
SpiceDisplay has the cursor but others don't.

To avoid the issue cache the information about the last set cursor in
the SpiceGtkSession and set the cursor shape in the SpiceDisplay
constructor.

Resolves:
https://bugzilla.redhat.com/show_bug.cgi?id=1411380
---
 src/spice-gtk-session-priv.h |  3 +++
 src/spice-gtk-session.c  | 43 +++
 src/spice-widget.c   | 14 +-
 3 files changed, 59 insertions(+), 1 deletion(-)

diff --git a/src/spice-gtk-session-priv.h b/src/spice-gtk-session-priv.h
index d7fe313..454013c 100644
--- a/src/spice-gtk-session-priv.h
+++ b/src/spice-gtk-session-priv.h
@@ -45,6 +45,9 @@ void spice_gtk_session_set_keyboard_has_focus(SpiceGtkSession 
*self, gboolean ke
 void spice_gtk_session_set_mouse_has_pointer(SpiceGtkSession *self, gboolean  
mouse_has_pointer);
 gboolean spice_gtk_session_get_keyboard_has_focus(SpiceGtkSession *self);
 gboolean spice_gtk_session_get_mouse_has_pointer(SpiceGtkSession *self);
+gboolean spice_gtk_session_get_last_cursor(SpiceGtkSession *self,
+   gint *width, gint *height,
+   gpointer *rgba);
 
 G_END_DECLS
 
diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
index a3a2e90..75ee300 100644
--- a/src/spice-gtk-session.c
+++ b/src/spice-gtk-session.c
@@ -47,6 +47,12 @@
 
 #define CLIPBOARD_LAST (VD_AGENT_CLIPBOARD_SELECTION_SECONDARY + 1)
 
+typedef struct session_cursor {
+gint width;
+gint height;
+gpointer rgba;
+} session_cursor;
+
 struct _SpiceGtkSessionPrivate {
 SpiceSession*session;
 /* Clipboard related */
@@ -66,6 +72,7 @@ struct _SpiceGtkSessionPrivate {
 gbooleankeyboard_has_focus;
 gbooleanmouse_has_pointer;
 gbooleansync_modifiers;
+session_cursor  last_cursor;
 };
 
 /**
@@ -316,6 +323,8 @@ static void spice_gtk_session_finalize(GObject *gobject)
 g_clear_pointer(>clip_targets[i], g_free);
 }
 
+g_clear_pointer(>last_cursor.rgba, g_free);
+
 /* Chain up to the parent class */
 if (G_OBJECT_CLASS(spice_gtk_session_parent_class)->finalize)
 G_OBJECT_CLASS(spice_gtk_session_parent_class)->finalize(gobject);
@@ -1094,6 +1103,21 @@ static void clipboard_release(SpiceMainChannel *main, 
guint selection,
 s->clipboard_by_guest[selection] = FALSE;
 }
 
+static void cursor_set(SpiceCursorChannel *channel,
+   gint width, gint height,
+   gint hot_x G_GNUC_UNUSED, gint hot_y G_GNUC_UNUSED,
+   gpointer rgba, gpointer data)
+{
+SpiceGtkSession *self = data;
+SpiceGtkSessionPrivate *s = self->priv;
+if (s->last_cursor.rgba != NULL) {
+g_free(s->last_cursor.rgba);
+}
+s->last_cursor.width = width;
+s->last_cursor.height = height;
+s->last_cursor.rgba = g_memdup(rgba, width * height * 4);
+}
+
 static void channel_new(SpiceSession *session, SpiceChannel *channel,
 gpointer user_data)
 {
@@ -1117,6 +1141,11 @@ static void channel_new(SpiceSession *session, 
SpiceChannel *channel,
   G_CALLBACK(guest_modifiers_changed), 
self, 0);
 spice_gtk_session_sync_keyboard_modifiers_for_channel(self, 
SPICE_INPUTS_CHANNEL(channel), TRUE);
 }
+if (SPICE_IS_CURSOR_CHANNEL(channel)) {
+spice_g_signal_connect_object(channel, "cursor-set",
+  G_CALLBACK(cursor_set), self, 0);
+return;
+}
 }
 
 static void channel_destroy(SpiceSession *session, SpiceChannel *channel,
@@ -1338,3 +1367,17 @@ gboolean 
spice_gtk_session_get_mouse_has_pointer(SpiceGtkSession *self)
 
 return self->priv->mouse_has_pointer;
 }
+
+G_GNUC_INTERNAL
+gboolean spice_gtk_session_get_last_cursor(SpiceGtkSession *self,
+   gint *width, gint *height,
+   gpointer *rgba)
+{
+g_return_val_if_fail(SPICE_IS_GTK_SESSION(self), FALSE);
+
+*width = self->priv->last_cursor.width;
+*height = self->priv->last_cursor.height;
+*rgba = self->priv->last_cursor.rgba;
+
+return (*rgba != NULL);
+}
diff --git a/src/spice-widget.c b/src/spice-widget.c
index 72fbbc8..d3af7ac 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -119,6 +119,9 @@ static void release_keys(SpiceDisplay *display);
 static void size_allocate(GtkWidget *widget, GtkAllocation *conf, gpointer 
data);
 static gboolean draw_event(GtkWidget *widget, cairo_t *cr, gpointer data);
 static void update_size_request(SpiceDisplay *display);
+static void cursor_set(SpiceCursorChannel *channel,
+   gint width, gint height, gint hot_x, gint hot_y,
+   gpointer rgba, 

Re: [Spice-devel] [PATCH spice v2 1/2] build-sys: Warn on usage of unavailable glib functions

2017-01-13 Thread Frediano Ziglio
> 
> Warnings are printed when glib2 >= 2.32 is present
> ---
>  configure.ac | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/configure.ac b/configure.ac
> index a78b4ece..50135b5e 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -147,7 +147,10 @@ PKG_CHECK_MODULES([SPICE_PROTOCOL], [spice-protocol >=
> $SPICE_PROTOCOL_MIN_VER])
>  AC_SUBST([SPICE_PROTOCOL_MIN_VER])
>  
>  GLIB2_REQUIRED=2.28
> +GLIB2_ENCODED_VERSION="GLIB_VERSION_2_28"
>  PKG_CHECK_MODULES([GLIB2], [glib-2.0 >= $GLIB2_REQUIRED gio-2.0 >=
>  $GLIB2_REQUIRED])
> +GLIB2_CFLAGS="$GLIB2_CFLAGS
> -DGLIB_VERSION_MIN_REQUIRED=$GLIB2_ENCODED_VERSION \
> +  -DGLIB_VERSION_MAX_ALLOWED=$GLIB2_ENCODED_VERSION"
>  AS_VAR_APPEND([SPICE_REQUIRES], [" glib-2.0 >= $GLIB2_REQUIRED gio-2.0 >=
>  $GLIB2_REQUIRED"])
>  
>  PKG_CHECK_MODULES([GOBJECT2], [gobject-2.0 >= $GLIB2_REQUIRED])

Acked-by: Frediano Ziglio 

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


[Spice-devel] [PATCH spice v2 1/2] build-sys: Warn on usage of unavailable glib functions

2017-01-13 Thread Pavel Grunt
Warnings are printed when glib2 >= 2.32 is present
---
 configure.ac | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/configure.ac b/configure.ac
index a78b4ece..50135b5e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -147,7 +147,10 @@ PKG_CHECK_MODULES([SPICE_PROTOCOL], [spice-protocol >= 
$SPICE_PROTOCOL_MIN_VER])
 AC_SUBST([SPICE_PROTOCOL_MIN_VER])
 
 GLIB2_REQUIRED=2.28
+GLIB2_ENCODED_VERSION="GLIB_VERSION_2_28"
 PKG_CHECK_MODULES([GLIB2], [glib-2.0 >= $GLIB2_REQUIRED gio-2.0 >= 
$GLIB2_REQUIRED])
+GLIB2_CFLAGS="$GLIB2_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=$GLIB2_ENCODED_VERSION 
\
+  -DGLIB_VERSION_MAX_ALLOWED=$GLIB2_ENCODED_VERSION"
 AS_VAR_APPEND([SPICE_REQUIRES], [" glib-2.0 >= $GLIB2_REQUIRED gio-2.0 >= 
$GLIB2_REQUIRED"])
 
 PKG_CHECK_MODULES([GOBJECT2], [gobject-2.0 >= $GLIB2_REQUIRED])
-- 
2.11.0

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


Re: [Spice-devel] [spice-server 08/17] sound: Implement snd_channel_config_socket

2017-01-13 Thread Christophe Fergeau
On Wed, Jan 11, 2017 at 06:28:06AM -0500, Frediano Ziglio wrote:
> > @@ -1004,24 +964,68 @@ static SndChannelClient *__new_channel(SndChannel
> > *channel, int size, uint32_t c
> >  client->cleanup = cleanup;
> >  
> >  client->channel_client =
> > -dummy_channel_client_create(RED_CHANNEL(channel), red_client,
> > +dummy_channel_client_create(RED_CHANNEL(channel), red_client,
> > stream,
> >  num_common_caps, common_caps, num_caps,
> >  caps);
> >  if (!client->channel_client) {
> >  goto error2;
> >  }
> > +snd_channel_config_socket(RED_CHANNEL_CLIENT(client->channel_client));
> > +
> 
> This assumes the function never fails.

Ah right, I've changed it to:
+if 
(!snd_channel_config_socket(RED_CHANNEL_CLIENT(client->channel_client))) {
+goto error2;
+}

However, there is no easy way to handle the error in
"sound: Turn {Playback,Record}ChannelClient into GObjects" as the call
to snd_channel_config_socket() is now done in a 'constructed' vfunc.
In this commit, I've chosen to just have
if (!snd_channel_config_socket(RED_CHANNEL_CLIENT(client->channel_client))) 
{
g_warning("failed to set sound channel socket parameters");
}
as the next commit removes direct calls to snd_channel_config_socket()
anyway, and let the generic RedChannel/RedChannelClient code take care
of it.


Christophe


signature.asc
Description: PGP signature
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


Re: [Spice-devel] [PATCH spice] Avoid a 'missing braces around initializer' warning.

2017-01-13 Thread Jeremy White
On 01/13/2017 04:48 AM, Frediano Ziglio wrote:
>>
>> Signed-off-by: Jeremy White 
>> ---
>>  server/tests/replay.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/server/tests/replay.c b/server/tests/replay.c
>> index 8ec65d6..1f3ebb1 100644
>> --- a/server/tests/replay.c
>> +++ b/server/tests/replay.c
>> @@ -44,7 +44,7 @@ static SpiceServer *server;
>>  static SpiceReplay *replay;
>>  static QXLWorker *qxl_worker = NULL;
>>  static gboolean started = FALSE;
>> -static QXLInstance display_sin = { 0, };
>> +static QXLInstance display_sin = { { 0 }, 0, NULL };
>>  static gint slow = 0;
>>  static gint skip = 0;
>>  static gboolean print_count = FALSE;
> 
> Works.
> 
> Why you have this warning turned on?
> Which environment were you using?

This is in Debian stable; I haven't customized anything in particular
afacit:
  gcc (Debian 4.9.2-10) 4.9.2

Cheers,

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


Re: [Spice-devel] virt-viewer 5.0 binary for windows error in win 8.1

2017-01-13 Thread Frediano Ziglio
> Hi,

> a month ago I installed virt-viewer binary for win 8.1 system:

> https://virt-manager.org/download/sources/virt-viewer/virt-viewer-x64-5.0.msi

> it worked up to a week ago .

> Then I did an stardard update of system (the automatic microsoft periodic
> update).

> Now the program does not work .

> When I open the program remote-viewer the GUI is not shown and program is
> closed.

> In the event viewer of windows I see the next error (sorry but the system is
> installed with italian language, in brackets the english traduction),
> someone has an idea :

> Nome dell'applicazione che ha generato l'errore ( Name of the application
> that generated the error ) : remote-viewer.exe ,

> versione (version): 0.0.0.0,

> timestamp : 0x5836f66c

> Nome del modulo che ha generato l'errore: libgdk-3-0.dll ,

> versione (version):3.22.2.0,

> timestamp : 0x000a91a8

> Codice eccezione ( exception code ) : 0xc005

> Offset errore (error offset) 0x00032311

> ID processo che ha generato l'errore ( ID process that generated the error )
> : 0xfec

> Ora di avvio dell'applicazione che ha generato l'errore ( start time of the
> application that generated the error) : 0x01d269ac0f8a1726

> Percorso dell'applicazione che ha generato l'errore ( path of the application
> that generated the error ) : c : \Program Files\VirtViewer
> v5.0-256\bin\remote-viewer.exe

> Percorso del modulo che ha generato l'errore ( The module path that generated
> the error ) : c : \Program Files\VirtViewer v5.0-256\bin\libgdk-3-0.dll

> ID segnalazione (ID signaling): 4d5a66f1-d59f-11e6-829f-6451064d871b

> - System

> - Provider

> [ Name ] Application Error

> - EventID 1000

> [ Qualifiers ] 0

> Level 2

> Task 100

> Keywords 0x80

> - TimeCreated

> [ SystemTime ] 2017-01-08T12:38:06.0Z

> EventRecordID 49294

> Channel Application

> Computer sella

> Security

> - EventData

> remote-viewer.exe

> 0.0.0.0

> 5836f66c

> libgdk-3-0.dll

> 3.22.2.0

> 000a91a8

> c005

> 00032311

> fec

> 01d269ac0f8a1726

> c:\Program Files\VirtViewer v5.0-256\bin\remote-viewer.exe

> c:\Program Files\VirtViewer v5.0-256\bin\libgdk-3-0.dll

> 4d5a66f1-d59f-11e6-829f-6451064d871b

> Bets regards,

> Gianpietro.

It's hard to say with such few information. 
Do you have a mini dump ? 

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


Re: [Spice-devel] [PATCH v3 1/2] Do endian swapping.

2017-01-13 Thread Frediano Ziglio
>
> This allows running big endian and little endian guest side by side using
> cut & paste between them.
> 
> There is a general design idea that swapping should come as close to
> virtio_read/virtio_write as possible. In particular, the protocol
> between vdagent and vdagentd is guest-specific and in native endian.
> With muliple layers of headers this is a bit tricky. A few message types
> have to be swapped fully before passing through vdagentd.
> 
> Signed-off-by: Michal Suchanek 
> 
> ---
> v2:
>  - introduce helper functions to swap (a portion of) a message wholesale
>  - pollute fewer places with swapping sometimes at the cost of slightly
>more verbose code
> v3:
>  - use glib byteswap macros in place of endian.h byteswap macros
>  - move variable declaration out of case statement
>  - reuse more of existing clipboard code
> ---
>  src/vdagentd/vdagentd.c| 89
>  +++---
>  src/vdagentd/virtio-port.c | 36 ---
>  2 files changed, 100 insertions(+), 25 deletions(-)
> 
> diff --git a/src/vdagentd/vdagentd.c b/src/vdagentd/vdagentd.c
> index a1faf23..4cac473 100644
> --- a/src/vdagentd/vdagentd.c
> +++ b/src/vdagentd/vdagentd.c
> @@ -78,6 +78,34 @@ static int client_connected = 0;
>  static int max_clipboard = -1;
>  
>  /* utility functions */
> +static void virtio_msg_uint32_to_le(uint8_t *_msg, uint32_t size, uint32_t
> offset)
> +{
> +uint32_t i, *msg = (uint32_t *)(_msg + offset);
> +
> +/* offset - size % 4 should be 0 */
> +for (i = 0; i < (size - offset) / 4; i++)
> +msg[i] = GUINT32_TO_LE(msg[i]);
> +}
> +
> +static void virtio_msg_uint32_from_le(uint8_t *_msg, uint32_t size, uint32_t
> offset)
> +{
> +uint32_t i, *msg = (uint32_t *)(_msg + offset);
> +
> +/* offset - size % 4 should be 0 */
> +for (i = 0; i < (size - offset) / 4; i++)
> +msg[i] = GUINT32_FROM_LE(msg[i]);
> +}
> +
> +static void virtio_msg_uint16_from_le(uint8_t *_msg, uint32_t size, uint32_t
> offset)
> +{
> +uint32_t i;
> +uint16_t *msg = (uint16_t *)(_msg + offset);
> +
> +/* offset - size % 2 should be 0 */
> +for (i = 0; i < (size - offset) / 2; i++)
> +msg[i] = GUINT16_FROM_LE(msg[i]);
> +}
> +
>  /* vdagentd <-> spice-client communication handling */
>  static void send_capabilities(struct vdagent_virtio_port *vport,
>  uint32_t request)
> @@ -102,6 +130,7 @@ static void send_capabilities(struct vdagent_virtio_port
> *vport,
>  VD_AGENT_SET_CAPABILITY(caps->caps, VD_AGENT_CAP_GUEST_LINEEND_LF);
>  VD_AGENT_SET_CAPABILITY(caps->caps, VD_AGENT_CAP_MAX_CLIPBOARD);
>  VD_AGENT_SET_CAPABILITY(caps->caps, VD_AGENT_CAP_AUDIO_VOLUME_SYNC);
> +virtio_msg_uint32_to_le((uint8_t *)caps, size, 0);
>  
>  vdagent_virtio_port_write(vport, VDP_CLIENT_PORT,
>VD_AGENT_ANNOUNCE_CAPABILITIES, 0,
> @@ -151,8 +180,8 @@ static void do_client_monitors(struct vdagent_virtio_port
> *vport, int port_nr,
>  (uint8_t *)mon_config, size);
>  
>  /* Acknowledge reception of monitors config to spice server / client */
> -reply.type  = VD_AGENT_MONITORS_CONFIG;
> -reply.error = VD_AGENT_SUCCESS;
> +reply.type  = GUINT32_TO_LE(VD_AGENT_MONITORS_CONFIG);
> +reply.error = GUINT32_TO_LE(VD_AGENT_SUCCESS);
>  vdagent_virtio_port_write(vport, port_nr, VD_AGENT_REPLY, 0,
>(uint8_t *), sizeof(reply));
>  }
> @@ -255,8 +284,8 @@ static void send_file_xfer_status(struct
> vdagent_virtio_port *vport,
>const char *msg, uint32_t id, uint32_t
>xfer_status)
>  {
>  VDAgentFileXferStatusMessage status = {
> -.id = id,
> -.result = xfer_status,
> +.id = GUINT32_TO_LE(id),
> +.result = GUINT32_TO_LE(xfer_status),
>  };
>  syslog(LOG_WARNING, msg, id);
>  if (vport)
> @@ -323,6 +352,8 @@ static int virtio_port_read_complete(
>  uint8_t *data)
>  {
>  uint32_t min_size = 0;
> +uint32_t *data_type = (uint32_t *)data;
> +uint32_t *id = (uint32_t *)data;
>  
>  if (message_header->protocol != VD_AGENT_PROTOCOL) {
>  syslog(LOG_ERR, "message with wrong protocol version ignoring");
> @@ -333,6 +364,7 @@ static int virtio_port_read_complete(
>  case VD_AGENT_MOUSE_STATE:
>  if (message_header->size != sizeof(VDAgentMouseState))
>  goto size_error;
> +virtio_msg_uint32_from_le(data, message_header->size, 0);
>  vdagentd_uinput_do_mouse(, (VDAgentMouseState *)data);
>  if (!uinput) {
>  /* Try to re-open the tablet */
> @@ -356,12 +388,14 @@ static int virtio_port_read_complete(
>  case VD_AGENT_MONITORS_CONFIG:
>  if (message_header->size < sizeof(VDAgentMonitorsConfig))
>  goto size_error;
> +virtio_msg_uint32_from_le(data, message_header->size, 0);
>  

Re: [Spice-devel] [PATCH spice 1/2] build-sys: Warn on usage of unavailable glib functions

2017-01-13 Thread Pavel Grunt
On Fri, 2017-01-13 at 06:09 -0500, Frediano Ziglio wrote:
> > 
> > It works only with glib2 >= 2.32
> > ---
> >  configure.ac | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/configure.ac b/configure.ac
> > index a78b4ece..50135b5e 100644
> > --- a/configure.ac
> > +++ b/configure.ac
> > @@ -147,7 +147,10 @@ PKG_CHECK_MODULES([SPICE_PROTOCOL], [spice-
> > protocol >=
> > $SPICE_PROTOCOL_MIN_VER])
> >  AC_SUBST([SPICE_PROTOCOL_MIN_VER])
> >  
> >  GLIB2_REQUIRED=2.28
> > +GLIB2_ENCODED_VERSION="GLIB_VERSION_2_28"
> >  PKG_CHECK_MODULES([GLIB2], [glib-2.0 >= $GLIB2_REQUIRED gio-2.0
> > >=
> >  $GLIB2_REQUIRED])
> > +GLIB2_CFLAGS="$GLIB2_CFLAGS
> > -DGLIB_VERSION_MIN_REQUIRED=$GLIB2_ENCODED_VERSION \
> > +  -DGLIB_VERSION_MAX_ALLOWED=$GLIB2_ENCODED_VERSION"
> >  AS_VAR_APPEND([SPICE_REQUIRES], [" glib-2.0 >= $GLIB2_REQUIRED
> > gio-2.0 >=
> >  $GLIB2_REQUIRED"])
> >  
> >  PKG_CHECK_MODULES([GOBJECT2], [gobject-2.0 >= $GLIB2_REQUIRED])
> 
> Works on both rhel6 and Fedora 25 however the check is for 2.28
> while
> the comment refers to 2.32.

Because macros using these defines where introduced in Glib 2.32.
Spice still requires the 2.28 (the latest available in el6)

With GLib < 2.32 it does nothing - eg if you have glib 2.30 on your
system and use a function from it, you will not get the warning.

Pavel

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


[Spice-devel] [spice-common] ssl: Use ASN1_STRING_get0_data instead of ASN1_STRING_data

2017-01-13 Thread Christophe Fergeau
From: Sebastian Andrzej Siewior 

The latter is deprecated, so might be removed at  some point in the
future. This also adds a compatibility wrapper for OpenSSL < 1.1.0.

Signed-off-by: Sebastian Andrzej Siewior 
---
 common/ssl_verify.c | 20 ++--
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/common/ssl_verify.c b/common/ssl_verify.c
index 601252e..b6a96a7 100644
--- a/common/ssl_verify.c
+++ b/common/ssl_verify.c
@@ -33,6 +33,14 @@
 #include 
 #include 
 
+#if OPENSSL_VERSION_NUMBER < 0x1010
+
+static const unsigned char *ASN1_STRING_get0_data(const ASN1_STRING *asn1)
+{
+return M_ASN1_STRING_data(asn1);
+}
+#endif
+
 static int verify_pubkey(X509* cert, const char *key, size_t key_size)
 {
 EVP_PKEY* cert_pubkey = NULL;
@@ -182,10 +190,10 @@ static int verify_hostname(X509* cert, const char 
*hostname)
 const GENERAL_NAME* name = 
sk_GENERAL_NAME_value(subject_alt_names, i);
 if (name->type == GEN_DNS) {
 found_dns_name = 1;
-if (_gnutls_hostname_compare((char 
*)ASN1_STRING_data(name->d.dNSName),
+if (_gnutls_hostname_compare((const char 
*)ASN1_STRING_get0_data(name->d.dNSName),
  
ASN1_STRING_length(name->d.dNSName),
  hostname)) {
-spice_debug("alt name match=%s", 
ASN1_STRING_data(name->d.dNSName));
+spice_debug("alt name match=%s", 
ASN1_STRING_get0_data(name->d.dNSName));
 GENERAL_NAMES_free(subject_alt_names);
 return 1;
 }
@@ -208,11 +216,11 @@ static int verify_hostname(X509* cert, const char 
*hostname)
 alt_ip_len = ASN1_STRING_length(name->d.iPAddress);
 
 if ((ip_len == alt_ip_len) &&
-   (memcmp(ASN1_STRING_data(name->d.iPAddress), ip_binary, 
ip_len)) == 0) {
+   (memcmp(ASN1_STRING_get0_data(name->d.iPAddress), 
ip_binary, ip_len)) == 0) {
 GInetAddress * alt_ip = NULL;
 gchar * alt_ip_string = NULL;
 
-alt_ip = 
g_inet_address_new_from_bytes(ASN1_STRING_data(name->d.iPAddress),
+alt_ip = 
g_inet_address_new_from_bytes(ASN1_STRING_get0_data(name->d.iPAddress),

g_inet_address_get_family(ip));
 alt_ip_string = g_inet_address_to_string(alt_ip);
 spice_debug("alt name IP match=%s", alt_ip_string);
@@ -253,10 +261,10 @@ static int verify_hostname(X509* cert, const char 
*hostname)
 continue;
 }
 
-if (_gnutls_hostname_compare((char*)ASN1_STRING_data(cn_asn1),
+if (_gnutls_hostname_compare((const 
char*)ASN1_STRING_get0_data(cn_asn1),
  ASN1_STRING_length(cn_asn1),
  hostname)) {
-spice_debug("common name match=%s", 
(char*)ASN1_STRING_data(cn_asn1));
+spice_debug("common name match=%s", 
(char*)ASN1_STRING_get0_data(cn_asn1));
 cn_match = 1;
 break;
 }
-- 
2.9.3

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


Re: [Spice-devel] [PATCH spice 2/2] Include compat header for g_clear_pointer

2017-01-13 Thread Frediano Ziglio
> 
> ---
>  server/reds.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/server/reds.c b/server/reds.c
> index e061e4d1..29485a8b 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -75,6 +75,7 @@
>  #include "red-channel-client.h"
>  #include "main-channel-client.h"
>  #include "red-client.h"
> +#include "glib-compat.h"
>  
>  #define REDS_MAX_STAT_NODES 100
>  

Acked-by: Frediano Ziglio 

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


Re: [Spice-devel] [PATCH spice 1/2] build-sys: Warn on usage of unavailable glib functions

2017-01-13 Thread Frediano Ziglio
> 
> It works only with glib2 >= 2.32
> ---
>  configure.ac | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/configure.ac b/configure.ac
> index a78b4ece..50135b5e 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -147,7 +147,10 @@ PKG_CHECK_MODULES([SPICE_PROTOCOL], [spice-protocol >=
> $SPICE_PROTOCOL_MIN_VER])
>  AC_SUBST([SPICE_PROTOCOL_MIN_VER])
>  
>  GLIB2_REQUIRED=2.28
> +GLIB2_ENCODED_VERSION="GLIB_VERSION_2_28"
>  PKG_CHECK_MODULES([GLIB2], [glib-2.0 >= $GLIB2_REQUIRED gio-2.0 >=
>  $GLIB2_REQUIRED])
> +GLIB2_CFLAGS="$GLIB2_CFLAGS
> -DGLIB_VERSION_MIN_REQUIRED=$GLIB2_ENCODED_VERSION \
> +  -DGLIB_VERSION_MAX_ALLOWED=$GLIB2_ENCODED_VERSION"
>  AS_VAR_APPEND([SPICE_REQUIRES], [" glib-2.0 >= $GLIB2_REQUIRED gio-2.0 >=
>  $GLIB2_REQUIRED"])
>  
>  PKG_CHECK_MODULES([GOBJECT2], [gobject-2.0 >= $GLIB2_REQUIRED])

Works on both rhel6 and Fedora 25 however the check is for 2.28 while
the comment refers to 2.32.

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


Re: [Spice-devel] [PATCH spice] Avoid a 'missing braces around initializer' warning.

2017-01-13 Thread Frediano Ziglio
> 
> Signed-off-by: Jeremy White 
> ---
>  server/tests/replay.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/server/tests/replay.c b/server/tests/replay.c
> index 8ec65d6..1f3ebb1 100644
> --- a/server/tests/replay.c
> +++ b/server/tests/replay.c
> @@ -44,7 +44,7 @@ static SpiceServer *server;
>  static SpiceReplay *replay;
>  static QXLWorker *qxl_worker = NULL;
>  static gboolean started = FALSE;
> -static QXLInstance display_sin = { 0, };
> +static QXLInstance display_sin = { { 0 }, 0, NULL };
>  static gint slow = 0;
>  static gint skip = 0;
>  static gboolean print_count = FALSE;

Works.

Why you have this warning turned on?
Which environment were you using?

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


Re: [Spice-devel] [spice-server 11/17] sound: Prefer snd_set_command() over snd_*_send_*()

2017-01-13 Thread Frediano Ziglio
> 
> On Wed, Jan 11, 2017 at 09:43:48AM -0500, Frediano Ziglio wrote:
> > > 
> > > snd_set_command()/snd_send() are higher level methods which take care of
> > > scheduling calls to the corresponding snd_*_send_*() methods when
> > > appropriate. This commit switches a few direct snd_*_send_*() calls to
> > > snd_set_command()/snd_send().
> > > 
> > > Based on a patch from Frediano Ziglio 
> > > 
> > > Signed-off-by: Christophe Fergeau 
> > > ---
> > >  server/sound.c | 12 
> > >  1 file changed, 4 insertions(+), 8 deletions(-)
> > > 
> > > diff --git a/server/sound.c b/server/sound.c
> > > index d45e4b9..b0a1367 100644
> > > --- a/server/sound.c
> > > +++ b/server/sound.c
> > > @@ -1094,7 +1094,6 @@ SPICE_GNUC_VISIBLE void
> > > spice_server_playback_set_volume(SpicePlaybackInstance *
> > >  {
> > >  SpiceVolumeState *st = >st->channel.volume;
> > >  SndChannelClient *client = sin->st->channel.connection;
> > > -PlaybackChannelClient *playback_client = SPICE_CONTAINEROF(client,
> > > PlaybackChannelClient, base);
> > >  
> > >  st->volume_nchannels = nchannels;
> > >  free(st->volume);
> > > @@ -1103,21 +1102,20 @@ SPICE_GNUC_VISIBLE void
> > > spice_server_playback_set_volume(SpicePlaybackInstance *
> > >  if (!client || nchannels == 0)
> > >  return;
> > >  
> > > -snd_playback_send_volume(playback_client);
> > > +snd_set_command(client, SND_VOLUME_MASK);
> > >  }
> > >  
> > >  SPICE_GNUC_VISIBLE void
> > >  spice_server_playback_set_mute(SpicePlaybackInstance
> > >  *sin, uint8_t mute)
> > >  {
> > >  SpiceVolumeState *st = >st->channel.volume;
> > >  SndChannelClient *client = sin->st->channel.connection;
> > > -PlaybackChannelClient *playback_client = SPICE_CONTAINEROF(client,
> > > PlaybackChannelClient, base);
> > >  
> > >  st->mute = mute;
> > >  
> > >  if (!client)
> > >  return;
> > >  
> > > -snd_playback_send_mute(playback_client);
> > > +snd_set_command(client, SND_MUTE_MASK);
> > 
> > For compatibility you need to send both MUTE and VOLUME so
> > SND_VOLUME_MUTE_MASK.
> 
> Are you sure? snd_playback_send_mute() is/was directly marshalling a
> 'mute' message, it was not going through the VOLUME check which was
> setting both 'volume' and 'mute' messages. So just setting the MUTE
> flag seems ok to me?
> 
> Christophe
> 

You are right. Surprisingly if the network queue was full the old code
just ignored the request not sending/setting any command.
After your code you don't schedule a send any volume/mute changes.
Maybe nothing change as will be send after/before next audio frame.
Maybe this patch should be partially merged to "sound: Use RedChannelClient
to receive/send data" ?
Maybe in the loop volume/mute flags should be checked before the frames?

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


Re: [Spice-devel] [spice-server 11/17] sound: Prefer snd_set_command() over snd_*_send_*()

2017-01-13 Thread Christophe Fergeau
On Wed, Jan 11, 2017 at 09:43:48AM -0500, Frediano Ziglio wrote:
> > 
> > snd_set_command()/snd_send() are higher level methods which take care of
> > scheduling calls to the corresponding snd_*_send_*() methods when
> > appropriate. This commit switches a few direct snd_*_send_*() calls to
> > snd_set_command()/snd_send().
> > 
> > Based on a patch from Frediano Ziglio 
> > 
> > Signed-off-by: Christophe Fergeau 
> > ---
> >  server/sound.c | 12 
> >  1 file changed, 4 insertions(+), 8 deletions(-)
> > 
> > diff --git a/server/sound.c b/server/sound.c
> > index d45e4b9..b0a1367 100644
> > --- a/server/sound.c
> > +++ b/server/sound.c
> > @@ -1094,7 +1094,6 @@ SPICE_GNUC_VISIBLE void
> > spice_server_playback_set_volume(SpicePlaybackInstance *
> >  {
> >  SpiceVolumeState *st = >st->channel.volume;
> >  SndChannelClient *client = sin->st->channel.connection;
> > -PlaybackChannelClient *playback_client = SPICE_CONTAINEROF(client,
> > PlaybackChannelClient, base);
> >  
> >  st->volume_nchannels = nchannels;
> >  free(st->volume);
> > @@ -1103,21 +1102,20 @@ SPICE_GNUC_VISIBLE void
> > spice_server_playback_set_volume(SpicePlaybackInstance *
> >  if (!client || nchannels == 0)
> >  return;
> >  
> > -snd_playback_send_volume(playback_client);
> > +snd_set_command(client, SND_VOLUME_MASK);
> >  }
> >  
> >  SPICE_GNUC_VISIBLE void 
> > spice_server_playback_set_mute(SpicePlaybackInstance
> >  *sin, uint8_t mute)
> >  {
> >  SpiceVolumeState *st = >st->channel.volume;
> >  SndChannelClient *client = sin->st->channel.connection;
> > -PlaybackChannelClient *playback_client = SPICE_CONTAINEROF(client,
> > PlaybackChannelClient, base);
> >  
> >  st->mute = mute;
> >  
> >  if (!client)
> >  return;
> >  
> > -snd_playback_send_mute(playback_client);
> > +snd_set_command(client, SND_MUTE_MASK);
> 
> For compatibility you need to send both MUTE and VOLUME so 
> SND_VOLUME_MUTE_MASK.

Are you sure? snd_playback_send_mute() is/was directly marshalling a
'mute' message, it was not going through the VOLUME check which was
setting both 'volume' and 'mute' messages. So just setting the MUTE
flag seems ok to me?

Christophe


signature.asc
Description: PGP signature
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


[Spice-devel] [PATCH spice 1/2] build-sys: Warn on usage of unavailable glib functions

2017-01-13 Thread Pavel Grunt
It works only with glib2 >= 2.32
---
 configure.ac | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/configure.ac b/configure.ac
index a78b4ece..50135b5e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -147,7 +147,10 @@ PKG_CHECK_MODULES([SPICE_PROTOCOL], [spice-protocol >= 
$SPICE_PROTOCOL_MIN_VER])
 AC_SUBST([SPICE_PROTOCOL_MIN_VER])
 
 GLIB2_REQUIRED=2.28
+GLIB2_ENCODED_VERSION="GLIB_VERSION_2_28"
 PKG_CHECK_MODULES([GLIB2], [glib-2.0 >= $GLIB2_REQUIRED gio-2.0 >= 
$GLIB2_REQUIRED])
+GLIB2_CFLAGS="$GLIB2_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=$GLIB2_ENCODED_VERSION 
\
+  -DGLIB_VERSION_MAX_ALLOWED=$GLIB2_ENCODED_VERSION"
 AS_VAR_APPEND([SPICE_REQUIRES], [" glib-2.0 >= $GLIB2_REQUIRED gio-2.0 >= 
$GLIB2_REQUIRED"])
 
 PKG_CHECK_MODULES([GOBJECT2], [gobject-2.0 >= $GLIB2_REQUIRED])
-- 
2.11.0

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


[Spice-devel] [PATCH spice 2/2] Include compat header for g_clear_pointer

2017-01-13 Thread Pavel Grunt
---
 server/reds.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/server/reds.c b/server/reds.c
index e061e4d1..29485a8b 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -75,6 +75,7 @@
 #include "red-channel-client.h"
 #include "main-channel-client.h"
 #include "red-client.h"
+#include "glib-compat.h"
 
 #define REDS_MAX_STAT_NODES 100
 
-- 
2.11.0

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