xpra icon
Bug tracker and wiki

This bug tracker and wiki are being discontinued
please use https://github.com/Xpra-org/xpra instead.


Opened 9 years ago

Closed 9 years ago

Last modified 6 months ago

#170 closed enhancement (fixed)

preserve workspace mapping

Reported by: Antoine Martin Owned by: Antoine Martin
Priority: minor Milestone: 0.5
Component: core Version: trunk
Keywords: Cc:

Description (last modified by Antoine Martin)

It would be nice if we could preserve the workspace that windows are shown on when we disconnect, so that when we re-connect they re-appear at the same coordinates (we're not far off at the moment) and on the same workspace.

This should be do-able by keeping the value of _NET_CURRENT_DESKTOP for the window shown on the client. Which means having the ability to store properties on the server. This value would not actually be used by the xpra server, just kept for the client.

Or more simply, by using gtk's gtk.Window.get_screen().get_number()

Attachments (2)

xpra-saveworkspace2.patch (11.8 KB) - added by Antoine Martin 9 years ago.
this patch preserves workspace, and potentially other properties that clients can set
preserve-workspace.patch (7.0 KB) - added by Antoine Martin 9 years ago.
much safer and simpler code - which works ok so far

Download all attachments as: .zip

Change History (13)

comment:1 Changed 9 years ago by Antoine Martin

Description: modified (diff)
Status: newaccepted

Changed 9 years ago by Antoine Martin

Attachment: xpra-saveworkspace2.patch added

this patch preserves workspace, and potentially other properties that clients can set

comment:2 Changed 9 years ago by Antoine Martin

The patch above works, but now that we have multi-client support (see #41), how is this meant to work?

Options:

  • ignore the problem and hope for the best: leave the patch as it is and use one property set for all clients - not keen on that
  • clients could provide a uuid and we would only send the properties back to the same client

???

Comments welcome.

comment:3 Changed 9 years ago by Antoine Martin

workspace mapping is preserved as of r1429.
Notes about this code:

  • _NET_WM_DESKTOP freedesktop spec
  • we end up having to override the do_realize method of gtk.Widget, just so we can insert our bit of code in the middle of it - which is a bit nasty.
  • Should we want to change the workspace *after* the window is created, there is some Xlib code to do that too.

Still TODO:

  • make the properties per-client later (using something like: machine uuid + user id)
  • preserve position (why isn't it?)
Version 1, edited 9 years ago by Antoine Martin (previous) (next) (diff)

comment:4 Changed 9 years ago by Antoine Martin

Resolution: fixed
Status: acceptedclosed
  • r1438 *tries* to keep client properties separate by using a (client supplied) uuid
  • r1440 adds *all* the gtk initialization code to the realize() method so we do restore the position again.

There is still a few pixels difference between where we want the window to show up and where it actually shows up.. I think that's because of window decorations and such, not going to bother with it for now.

comment:5 in reply to:  4 Changed 9 years ago by Norman Rasmussen

Replying to antoine:

The patch above works, but now that we have multi-client support (see #41), how is this meant to work?

even without multi-client support, how do we handle disconnecting and reconnecting from a different client?

Replying to antoine:

  • r1438 *tries* to keep client properties separate by using a (client supplied) uuid

/var/lib/dbus/machine-id will change when the client is rebooted, this seems sub-optimal. What about using /etc/hostname (which returns fqdn is present) or gethostid(3) (which seems to return primary ip address)

comment:6 Changed 9 years ago by Antoine Martin

If you are re-connecting from a different client, then the workspace (and any other "client properties" against a window) won't be preserved. This is by design. (although this can be changed, I didn't think it would make sense)

AFAIK, the machine-id files are not re-generated after installation:

The /etc/machine-id file contains the unique machine id of the local system that is set during installation.

comment:7 Changed 9 years ago by Norman Rasmussen

debian & ubuntu doesn't seem to have /etc/machine-id. not a biggie.

comment:8 Changed 9 years ago by Antoine Martin

On debian & ubuntu, the dbus machine-id will be used, this is also meant to be unique (not re-generated).

I've just found out that a number of window managers (or in some cases, versions of the same WM, and probably also different configurations of the same WM..) do not use workspaces but viewports.. And although we can get some sort of information on where the window is (by looking up _NET_DESKTOP_VIEWPORT on the root window), there is *nothing* we can do to request which viewport the window will be shown on when we create it! (according to the spec, we can switch to that viewport, but not request it for a window...)

comment:9 Changed 9 years ago by Antoine Martin

Also, this was causing all sorts of bugs, so I've disabled it for now.

Changed 9 years ago by Antoine Martin

Attachment: preserve-workspace.patch added

much safer and simpler code - which works ok so far

comment:10 Changed 9 years ago by Antoine Martin

done in r2106 - now works reliably, without any side effects - only a slight flicker as the window is first shown on the current desktop before being moved to the correct one... I have tried sending the message when the window is realized and not yet mapped, but that does not work :(

Note: it would be nice if we could restore it exactly where it was, but we don't do that yet as we do not take into account the window manager's borders... so the window moves down and to the right a little bit each time.

comment:11 Changed 6 months ago by migration script

this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/170

Note: See TracTickets for help on using tickets.