[Spice-devel] [vdagent-linux v2] randr: handle XRRScreenChangeNotifyEvent

2014-08-27 Thread Marc-André Lureau
From: Marc-Andre Lureau 

Make sure vdagent follows the current monitor configuration.  This
solves a number of issue where the pointer input is off, because the
uinput tablet isn't reconfigured.

https://bugzilla.redhat.com/show_bug.cgi?id=1086657
---
 src/vdagent-x11-priv.h  |  4 +++-
 src/vdagent-x11-randr.c | 34 +-
 src/vdagent-x11.c   |  4 +++-
 3 files changed, 39 insertions(+), 3 deletions(-)

diff --git a/src/vdagent-x11-priv.h b/src/vdagent-x11-priv.h
index 38f852e..d60cc07 100644
--- a/src/vdagent-x11-priv.h
+++ b/src/vdagent-x11-priv.h
@@ -95,6 +95,7 @@ struct vdagent_x11 {
 int height[MAX_SCREENS];
 int has_xfixes;
 int xfixes_event_base;
+int xrandr_event_base;
 int max_prop_size;
 int expected_targets_notifies[256];
 int clipboard_owner[256];
@@ -145,7 +146,8 @@ void vdagent_x11_send_daemon_guest_xorg_res(struct 
vdagent_x11 *x11,
 int update);
 void vdagent_x11_randr_handle_root_size_change(struct vdagent_x11 *x11,
 int screen, int width, int height);
-
+int vdagent_x11_randr_handle_event(struct vdagent_x11 *x11,
+XEvent event);
 void vdagent_x11_set_error_handler(struct vdagent_x11 *x11,
 int (*handler)(Display *, XErrorEvent *));
 int vdagent_x11_restore_error_handler(struct vdagent_x11 *x11);
diff --git a/src/vdagent-x11-randr.c b/src/vdagent-x11-randr.c
index 5faaee6..c6f790e 100644
--- a/src/vdagent-x11-randr.c
+++ b/src/vdagent-x11-randr.c
@@ -132,12 +132,15 @@ void vdagent_x11_randr_init(struct vdagent_x11 *x11)
 return;
 }
 
-if (XRRQueryExtension(x11->display, &i, &i)) {
+if (XRRQueryExtension(x11->display, &x11->xrandr_event_base, &i)) {
 XRRQueryVersion(x11->display, &x11->xrandr_major, &x11->xrandr_minor);
 if (x11->xrandr_major == 1 && x11->xrandr_minor >= 3)
 x11->has_xrandr = 1;
 }
 
+XRRSelectInput(x11->display, x11->root_window[0],
+RRScreenChangeNotifyMask | RRCrtcChangeNotifyMask);
+
 if (x11->has_xrandr) {
 update_randr_res(x11, 0);
 } else {
@@ -466,6 +469,8 @@ static int set_screen_to_best_size(struct vdagent_x11 *x11, 
int width, int heigh
 void vdagent_x11_randr_handle_root_size_change(struct vdagent_x11 *x11,
 int screen, int width, int height)
 {
+update_randr_res(x11, 0);
+
 if (width == x11->width[screen] && height == x11->height[screen]) {
 return;
 }
@@ -481,6 +486,33 @@ void vdagent_x11_randr_handle_root_size_change(struct 
vdagent_x11 *x11,
 }
 }
 
+int vdagent_x11_randr_handle_event(struct vdagent_x11 *x11,
+XEvent event)
+{
+int handled = TRUE;
+
+switch (event.type - x11->xrandr_event_base) {
+case RRScreenChangeNotify: {
+XRRScreenChangeNotifyEvent *sce =
+(XRRScreenChangeNotifyEvent *) &event;
+vdagent_x11_randr_handle_root_size_change(x11, 0,
+sce->width, sce->height);
+break;
+}
+case RRNotify: {
+update_randr_res(x11, 0);
+if (!x11->dont_send_guest_xorg_res)
+vdagent_x11_send_daemon_guest_xorg_res(x11, 1);
+break;
+}
+default:
+handled = FALSE;
+break;
+}
+
+return handled;
+}
+
 static int min_int(int x, int y)
 {
 return x > y ? y : x;
diff --git a/src/vdagent-x11.c b/src/vdagent-x11.c
index 752b337..9619dc5 100644
--- a/src/vdagent-x11.c
+++ b/src/vdagent-x11.c
@@ -503,9 +503,11 @@ static void vdagent_x11_handle_event(struct vdagent_x11 
*x11, XEvent event)
 return;
 }
 
+if (vdagent_x11_randr_handle_event(x11, event))
+return;
+
 switch (event.type) {
 case ConfigureNotify:
-// TODO: handle CrtcConfigureNotify, OutputConfigureNotify can be 
ignored.
 for (i = 0; i < x11->screen_count; i++)
 if (event.xconfigure.window == x11->root_window[i])
 break;
-- 
1.9.3

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


Re: [Spice-devel] [vdagent-linux 2/2] randr: handle XRRScreenChangeNotifyEvent

2014-08-27 Thread Marc-André Lureau
self-nack, I am sending a better version of this patch


On Wed, Aug 27, 2014 at 7:22 PM, Marc-André Lureau <
marcandre.lur...@redhat.com> wrote:

> From: Marc-Andre Lureau 
>
> Make sure vdagent follows the current monitor configuration.  This
> solves a number of issue where the pointer input is off, because the
> uinput tablet isn't reconfigured.
>
> https://bugzilla.redhat.com/show_bug.cgi?id=1086657
> ---
>  src/vdagent-x11-priv.h  | 1 +
>  src/vdagent-x11-randr.c | 6 +-
>  src/vdagent-x11.c   | 9 -
>  3 files changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/src/vdagent-x11-priv.h b/src/vdagent-x11-priv.h
> index 38f852e..197f891 100644
> --- a/src/vdagent-x11-priv.h
> +++ b/src/vdagent-x11-priv.h
> @@ -95,6 +95,7 @@ struct vdagent_x11 {
>  int height[MAX_SCREENS];
>  int has_xfixes;
>  int xfixes_event_base;
> +int xrandr_event_base;
>  int max_prop_size;
>  int expected_targets_notifies[256];
>  int clipboard_owner[256];
> diff --git a/src/vdagent-x11-randr.c b/src/vdagent-x11-randr.c
> index 5faaee6..f7c1248 100644
> --- a/src/vdagent-x11-randr.c
> +++ b/src/vdagent-x11-randr.c
> @@ -132,12 +132,14 @@ void vdagent_x11_randr_init(struct vdagent_x11 *x11)
>  return;
>  }
>
> -if (XRRQueryExtension(x11->display, &i, &i)) {
> +if (XRRQueryExtension(x11->display, &x11->xrandr_event_base, &i)) {
>  XRRQueryVersion(x11->display, &x11->xrandr_major,
> &x11->xrandr_minor);
>  if (x11->xrandr_major == 1 && x11->xrandr_minor >= 3)
>  x11->has_xrandr = 1;
>  }
>
> +XRRSelectInput (x11->display, x11->root_window[0],
> RRScreenChangeNotifyMask);
> +
>  if (x11->has_xrandr) {
>  update_randr_res(x11, 0);
>  } else {
> @@ -466,6 +468,8 @@ static int set_screen_to_best_size(struct vdagent_x11
> *x11, int width, int heigh
>  void vdagent_x11_randr_handle_root_size_change(struct vdagent_x11 *x11,
>  int screen, int width, int height)
>  {
> +update_randr_res(x11, 0);
> +
>  if (width == x11->width[screen] && height == x11->height[screen]) {
>  return;
>  }
> diff --git a/src/vdagent-x11.c b/src/vdagent-x11.c
> index 752b337..c5c0176 100644
> --- a/src/vdagent-x11.c
> +++ b/src/vdagent-x11.c
> @@ -503,9 +503,16 @@ static void vdagent_x11_handle_event(struct
> vdagent_x11 *x11, XEvent event)
>  return;
>  }
>
> +if (event.type == x11->xrandr_event_base) {
> +XRRScreenChangeNotifyEvent *sce = (XRRScreenChangeNotifyEvent *)
> &event;
> +
> +vdagent_x11_randr_handle_root_size_change(x11, 0,
> +sce->width, sce->height);
> +return;
> +}
> +
>  switch (event.type) {
>  case ConfigureNotify:
> -// TODO: handle CrtcConfigureNotify, OutputConfigureNotify can be
> ignored.
>  for (i = 0; i < x11->screen_count; i++)
>  if (event.xconfigure.window == x11->root_window[i])
>  break;
> --
> 1.9.3
>
> ___
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
>



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


[Spice-devel] [vdagent-linux 1/2] randr: remove monitors.xml on auto-configuration

2014-08-27 Thread Marc-André Lureau
From: Marc-Andre Lureau 

GNOME will restore monitors.xml configuration whenever the timestamp
"config > change". The "change" timestamp is the last user applied
configuration, whereas the "config" timestamp is updated when
the screen is updated or ouput/crtc modes are added/removed.

These condition are triggered by vdagent during monitor config. Since we
can't control the timestamps (playing with delay will be inherently
event more racy), the only sane way I can think of is to disable gsd
behaviour. This can be achieved by deleting the ~/.config/monitors.xml,
which is the intended configuration to restore, so vdagent will override
whatever configuration was saved previously.

Somehow, if vdagent would be better integrated with gnome2, it would use
the gnome-rr and/or org.gnome.SettingsDaemon.XRANDR dbus
API. Thanksfully, in gnome3, the monitor auto-configuration has been
merged in.

https://bugzilla.redhat.com/show_bug.cgi?id=1086657
---
 src/vdagent-x11-randr.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/src/vdagent-x11-randr.c b/src/vdagent-x11-randr.c
index 46367bc..5faaee6 100644
--- a/src/vdagent-x11-randr.c
+++ b/src/vdagent-x11-randr.c
@@ -21,6 +21,7 @@
 along with this program.  If not, see .
 */
 
+#include 
 #include 
 #include 
 #include 
@@ -745,6 +746,10 @@ void vdagent_x11_set_monitor_config(struct vdagent_x11 
*x11,
 goto exit;
 }
 
+gchar *config = g_build_filename (g_get_user_config_dir (), 
"monitors.xml", NULL);
+g_unlink(config);
+g_free(config);
+
 for (i = mon_config->num_of_monitors; i < x11->randr.res->noutput; i++)
 xrandr_disable_output(x11, i);
 
-- 
1.9.3

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


[Spice-devel] [vdagent-linux 2/2] randr: handle XRRScreenChangeNotifyEvent

2014-08-27 Thread Marc-André Lureau
From: Marc-Andre Lureau 

Make sure vdagent follows the current monitor configuration.  This
solves a number of issue where the pointer input is off, because the
uinput tablet isn't reconfigured.

https://bugzilla.redhat.com/show_bug.cgi?id=1086657
---
 src/vdagent-x11-priv.h  | 1 +
 src/vdagent-x11-randr.c | 6 +-
 src/vdagent-x11.c   | 9 -
 3 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/vdagent-x11-priv.h b/src/vdagent-x11-priv.h
index 38f852e..197f891 100644
--- a/src/vdagent-x11-priv.h
+++ b/src/vdagent-x11-priv.h
@@ -95,6 +95,7 @@ struct vdagent_x11 {
 int height[MAX_SCREENS];
 int has_xfixes;
 int xfixes_event_base;
+int xrandr_event_base;
 int max_prop_size;
 int expected_targets_notifies[256];
 int clipboard_owner[256];
diff --git a/src/vdagent-x11-randr.c b/src/vdagent-x11-randr.c
index 5faaee6..f7c1248 100644
--- a/src/vdagent-x11-randr.c
+++ b/src/vdagent-x11-randr.c
@@ -132,12 +132,14 @@ void vdagent_x11_randr_init(struct vdagent_x11 *x11)
 return;
 }
 
-if (XRRQueryExtension(x11->display, &i, &i)) {
+if (XRRQueryExtension(x11->display, &x11->xrandr_event_base, &i)) {
 XRRQueryVersion(x11->display, &x11->xrandr_major, &x11->xrandr_minor);
 if (x11->xrandr_major == 1 && x11->xrandr_minor >= 3)
 x11->has_xrandr = 1;
 }
 
+XRRSelectInput (x11->display, x11->root_window[0], 
RRScreenChangeNotifyMask);
+
 if (x11->has_xrandr) {
 update_randr_res(x11, 0);
 } else {
@@ -466,6 +468,8 @@ static int set_screen_to_best_size(struct vdagent_x11 *x11, 
int width, int heigh
 void vdagent_x11_randr_handle_root_size_change(struct vdagent_x11 *x11,
 int screen, int width, int height)
 {
+update_randr_res(x11, 0);
+
 if (width == x11->width[screen] && height == x11->height[screen]) {
 return;
 }
diff --git a/src/vdagent-x11.c b/src/vdagent-x11.c
index 752b337..c5c0176 100644
--- a/src/vdagent-x11.c
+++ b/src/vdagent-x11.c
@@ -503,9 +503,16 @@ static void vdagent_x11_handle_event(struct vdagent_x11 
*x11, XEvent event)
 return;
 }
 
+if (event.type == x11->xrandr_event_base) {
+XRRScreenChangeNotifyEvent *sce = (XRRScreenChangeNotifyEvent *) 
&event;
+
+vdagent_x11_randr_handle_root_size_change(x11, 0,
+sce->width, sce->height);
+return;
+}
+
 switch (event.type) {
 case ConfigureNotify:
-// TODO: handle CrtcConfigureNotify, OutputConfigureNotify can be 
ignored.
 for (i = 0; i < x11->screen_count; i++)
 if (event.xconfigure.window == x11->root_window[i])
 break;
-- 
1.9.3

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


Re: [Spice-devel] problems with intermediate certificates

2014-08-27 Thread Christophe Fergeau
On Mon, Aug 25, 2014 at 04:09:56PM +, Dietmar Maurer wrote:
> > To make sure I understand, you start with a Root CA which I assume you
> > generated yourself and is self-signed? 
> 
> We use official certs from "StartCom Certification Authority" using  
> " StartCom Class 2 Primary Intermediate Server CA" intermediate CA.
> 
> But we just observed that the same setup works for some users
> when using  GeoTrust with "RapidSSL CA" intermediate CAs.
> 
> I have no idea why one setup works and one fails.

By any chance, are these SPICE instance public? No need for a login or
anything, I just need to be able to try to connect using SPICE.

Christophe


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


Re: [Spice-devel] gstreamer0.10 still needed for building?

2014-08-27 Thread Christophe Fergeau
Hey,

On Wed, Aug 27, 2014 at 11:11:09AM +, Torben Andresen wrote:
> is gstreamer0.10 still needed? In configure.ac is
> [PKG_CHECK_MODULES(GST, gstreamer-0.10 gstreamer-base-0.10
> gstreamer-app-0.10 gstreamer-audio-0.10, [have_gst=yes], [have_gst=no])]
> stated. Is with "GST" gstreamer1.x meant?

0.10 is meant, it hasn't been ported to gstreamer 1.0 yet. Back in the
days, I came up with the attached patch to get it to compile with gst
1.0, but there was no longer any sound output with it, and I never
debugged it.

Christophe
From 363f5ac24c06069c782e82587c30e5a98a92a1f8 Mon Sep 17 00:00:00 2001
From: Christophe Fergeau 
Date: Tue, 9 Oct 2012 12:10:23 +0200
Subject: [spice-gtk] Add GStreamer 1.0 support

This commit adds GStreamer 1.0 support. As the changes compared to
GStreamer 0.10 are minor (only 2 functions to modify), I've kept support
for both versions. GStreamer 1.0 support can be enabled using
--with-audio=gstreamer1
---
 configure.ac | 17 ++---
 gtk/spice-audio.c|  4 ++--
 gtk/spice-gstaudio.c | 43 ++-
 3 files changed, 58 insertions(+), 6 deletions(-)

diff --git a/configure.ac b/configure.ac
index f47ee20..91633e4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -288,7 +288,7 @@ AS_IF([test "x$have_phodav" = "xyes"],
AC_DEFINE(USE_PHODAV, [1], [Define if supporting phodav]))
 
 AC_ARG_WITH([audio],
-  AS_HELP_STRING([--with-audio=@<:@gstreamer/pulse/auto/no@:>@], [Select audio 
backend @<:@default=auto@:>@]),
+  AS_HELP_STRING([--with-audio=@<:@gstreamer/gstreamer1/pulse/auto/no@:>@], 
[Select audio backend @<:@default=auto@:>@]),
   [],
   [with_audio="auto"])
 
@@ -297,7 +297,7 @@ AS_IF([test "x$with_audio" = "xauto"], [
 ])
 
 case "$with_audio" in
-  gstreamer|pulse|no*)
+  gstreamer|gstreamer1|pulse|no*)
 ;;
   *) AC_MSG_ERROR(Unsupported audio backend)
 esac
@@ -326,7 +326,18 @@ AS_IF([test "x$have_gst" = "xyes"],
  [AC_MSG_ERROR([GStreamer requested but not found])
   ])
 ])
-AM_CONDITIONAL([WITH_GSTAUDIO], [test "x$have_gst" = "xyes"])
+
+AS_IF([test "x$with_audio" = "xgstreamer1"],
+  [PKG_CHECK_MODULES(GST, gstreamer-1.0 gstreamer-base-1.0 
gstreamer-app-1.0 gstreamer-audio-1.0, [have_gst1=yes], [have_gst1=no])],
+  [have_gst1=no])
+
+AS_IF([test "x$have_gst1" = "xyes"],
+  [AC_DEFINE([WITH_GST1AUDIO], 1, [Have GStreamer 1.0?])],
+  [AS_IF([test "x$with_audio" = "xgstreamer1"],
+ [AC_MSG_ERROR([GStreamer 1.0 requested but not found])
+  ])
+])
+AM_CONDITIONAL([WITH_GSTAUDIO], [test "x$have_gst" = "xyes" -o "x$have_gst1" = 
"xyes"])
 AC_SUBST(GST_CFLAGS)
 AC_SUBST(GST_LIBS)
 
diff --git a/gtk/spice-audio.c b/gtk/spice-audio.c
index dbd3a8b..34c1b69 100644
--- a/gtk/spice-audio.c
+++ b/gtk/spice-audio.c
@@ -47,7 +47,7 @@
 #ifdef WITH_PULSE
 #include "spice-pulse.h"
 #endif
-#ifdef WITH_GSTAUDIO
+#if defined(WITH_GSTAUDIO) || defined(WITH_GST1AUDIO)
 #include "spice-gstaudio.h"
 #endif
 
@@ -219,7 +219,7 @@ SpiceAudio *spice_audio_new(SpiceSession *session, 
GMainContext *context,
 #ifdef WITH_PULSE
 self = SPICE_AUDIO(spice_pulse_new(session, context, name));
 #endif
-#ifdef WITH_GSTAUDIO
+#if defined(WITH_GSTAUDIO) || defined(WITH_GST1AUDIO)
 self = SPICE_AUDIO(spice_gstaudio_new(session, context, name));
 #endif
 if (!self)
diff --git a/gtk/spice-gstaudio.c b/gtk/spice-gstaudio.c
index faa0c74..fb76dfb 100644
--- a/gtk/spice-gstaudio.c
+++ b/gtk/spice-gstaudio.c
@@ -21,9 +21,13 @@
 
 #include 
 #include 
-#include 
 #include 
+#ifdef WITH_GST1AUDIO
+#include 
+#else
+#include 
 #include 
+#endif
 
 #include "spice-gstaudio.h"
 #include "spice-common.h"
@@ -155,6 +159,38 @@ static gboolean record_bus_cb(GstBus *bus, GstMessage 
*msg, gpointer data)
 g_return_val_if_fail(p != NULL, FALSE);
 
 switch (GST_MESSAGE_TYPE(msg)) {
+#ifdef WITH_GST1AUDIO
+case GST_MESSAGE_APPLICATION: {
+GstSample *s;
+GstBuffer *buffer;
+GstMapInfo mapping;
+
+s = gst_app_sink_pull_sample(GST_APP_SINK(p->record.sink));
+if (!s) {
+if (!gst_app_sink_is_eos(GST_APP_SINK(p->record.sink)))
+g_warning("eos not reached, but can't pull new sample");
+return TRUE;
+}
+
+buffer = gst_sample_get_buffer(s);
+if (!buffer) {
+if (!gst_app_sink_is_eos(GST_APP_SINK(p->record.sink)))
+g_warning("eos not reached, but can't pull new buffer");
+return TRUE;
+}
+if (!gst_buffer_map(buffer, &mapping, GST_MAP_READ)) {
+return TRUE;
+}
+
+spice_record_send_data(SPICE_RECORD_CHANNEL(p->rchannel),
+   /* FIXME: server side doesn't care about ts?
+  what is the unit? ms apparently */
+   mapping.data, mapping.size, 0);
+gst_buffer_unmap(buffer, &mapping);
+gst_sample_unref(s);
+break;
+}

[Spice-devel] gstreamer0.10 still needed for building?

2014-08-27 Thread Torben Andresen

Hi,

is gstreamer0.10 still needed? In configure.ac is
[PKG_CHECK_MODULES(GST, gstreamer-0.10 gstreamer-base-0.10  
gstreamer-app-0.10 gstreamer-audio-0.10, [have_gst=yes], [have_gst=no])]

stated. Is with "GST" gstreamer1.x meant?

Thanks.

Kind regards

Torben


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