[Spice-devel] [PATCH spice-gtk 2/4] Add a desktop-integration helper class

Marc-André Lureau marcandre.lureau at gmail.com
Sat Jun 23 17:07:33 PDT 2012


Hi

On Sun, Jun 24, 2012 at 1:39 AM, Hans de Goede <hdegoede at redhat.com> wrote:
>> it can be simplified, resulting in simpler API and less code.
>
> No it cannot, using a hidden window for this is just plain wrong! One is
> supposed to use real toplevel windows with the inhibit API.
>

Well, in fact that toplevel_xid is optionnal, and is used for
eventually taking application screenshots (only if possible).

gnome-session/gsm-inhibit-dialog.c
        xid = gsm_inhibitor_peek_toplevel_xid (inhibitor);
        g_debug ("GsmInhibitDialog: inhibitor has XID %u", xid);
        if (xid > 0 && dialog->priv->have_xrender) {
                pixbuf = get_pixbuf_for_window (gdkdisplay, xid,
DEFAULT_SNAPSHOT_SIZE, DEFAULT_SNAPSHOT_SIZE);
                if (pixbuf == NULL) {
                        g_debug ("GsmInhibitDialog: unable to read
pixbuf from %u", xid);
                }


You may just pass XID 0:

gdbus call --session --dest org.gnome.SessionManager --object-path
/org/gnome/SessionManager --method org.gnome.SessionManager.Inhibit
gnome-boxes 0 foobar 1

The toplevel window of a spice-gtk widget may change, so there is no
reliable way to keep an Inhibitor with a valid XID, except by creating
a private one, which is not useful, since the XID isn't even
necessary.

Let's just use 0 there

-- 
Marc-André Lureau


More information about the Spice-devel mailing list