[Spice-devel] [PATCH] Add SpiceMainChannel::monitors-config-requested signal
Marc-André Lureau
mlureau at redhat.com
Sat Oct 26 17:31:42 CEST 2013
Hi,
----- Original Message -----
> In some circumstances, when one display is in fullscreen but others are not,
> the
> display regions can sometimes overlap (rhbz #1002156). There are other cases
> where the auto-align code lines up monitors in the wrong order because they
> are
> moved after they've been resized. In general, the root cause for all of
> these
> problems is that the SpiceMainChannel object doesn't know the exact size and
> position of all displays at the time when it is aligning monitors and sending
> down a new configuration. To solve this issue, introduce a new signal
> ('monitors-config-requested') that is emitted by the main channel immediately
> before it sends down a new configuration. Displays can listen to this signal
> and then update their current state within the signal handler so that the
> main
> channel has up-to-date information to use for configuring the monitors.
Instead of adding more hooks, have you thought if clients who wants to overwrite monitor positioning could disable spice-gtk auto-align code at all, and instead handle the align configuration themselves? Wouldn't that be more flexible since the spice-gtk code is not satisfying and hard to generalize correctly?
> ---
>
> Note that this is a (partial) alternative proposal since my earlier
> workaround
> (https://www.redhat.com/archives/virt-tools-list/2013-October/msg00010.html)
> was
> rejected. A full fix will also require a small patch to virt-viewer.
>
> gtk/channel-main.c | 29 ++++++++++++++++++++++++++++-
> 1 file changed, 28 insertions(+), 1 deletion(-)
>
> diff --git a/gtk/channel-main.c b/gtk/channel-main.c
> index c449e86..9f3f2b5 100644
> --- a/gtk/channel-main.c
> +++ b/gtk/channel-main.c
> @@ -152,6 +152,7 @@ enum {
> SPICE_MAIN_CLIPBOARD_SELECTION_REQUEST,
> SPICE_MAIN_CLIPBOARD_SELECTION_RELEASE,
> SPICE_MIGRATION_STARTED,
> + SPICE_MAIN_MONITORS_CONFIG_REQUESTED,
> SPICE_MAIN_LAST_SIGNAL,
> };
>
> @@ -707,6 +708,26 @@ static void
> spice_main_channel_class_init(SpiceMainChannelClass *klass)
> G_TYPE_UINT);
>
> /**
> + * SpiceMainChannel::monitors-config-requested:
> + * @main: the #SpiceMainChannel that emitted the signal
> + *
> + * Inform all displays that we're about to send a monitors config
> message
> + * down to the agent. This gives clients a chance to update their
> current
> + * size and position before the displays are reconfigured
> + *
> + * Since: 0.22
> + **/
> + signals[SPICE_MAIN_MONITORS_CONFIG_REQUESTED] =
> + g_signal_new("monitors-config-requested",
> + G_OBJECT_CLASS_TYPE(gobject_class),
> + G_SIGNAL_RUN_LAST,
> + 0,
> + NULL, NULL,
> + g_cclosure_marshal_VOID__VOID,
> + G_TYPE_NONE,
> + 0);
> +
> + /**
> * SpiceMainChannel::migration-started:
> * @main: the #SpiceMainChannel that emitted the signal
> * @session: a migration #SpiceSession
> @@ -790,7 +811,8 @@ static void do_emit_main_context(GObject *object, int
> signum, gpointer params)
> switch (signum) {
> case SPICE_MAIN_CLIPBOARD_RELEASE:
> case SPICE_MAIN_AGENT_UPDATE:
> - case SPICE_MAIN_MOUSE_UPDATE: {
> + case SPICE_MAIN_MOUSE_UPDATE:
> + case SPICE_MAIN_MONITORS_CONFIG_REQUESTED: {
> g_signal_emit(object, signals[signum], 0);
> break;
> }
> @@ -1065,6 +1087,11 @@ gboolean
> spice_main_send_monitor_config(SpiceMainChannel *channel)
> size_t size;
>
> g_return_val_if_fail(SPICE_IS_MAIN_CHANNEL(channel), FALSE);
> +
> + /* give all displays a chance to update their current position and size
> + * before we send the configuration down */
> + g_signal_emit(channel, signals[SPICE_MAIN_MONITORS_CONFIG_REQUESTED],
> 0);
> +
> c = channel->priv;
> g_return_val_if_fail(c->agent_connected, FALSE);
>
> --
> 1.8.3.1
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
>
More information about the Spice-devel
mailing list