Xpra: Ticket #2141: Small improvements to window position on client

These are less PR's and more pointers for fixing the underlying issues.

Java AWT is very old and assumes 1 screen per 1 monitor. However, Xpra uses 1 screen across multiple monitors, while this is valid it doesn't play nice with Java AWT Toolkit which centers windows on the screen and not the monitors. The case I have fixed this for is a window centering across 2 side-by-side monitors. The window is repositioned to the center of the 1st monitor when centered across the screen (with a magic number margin of error of 10px). Maybe this could be implemented better, only for java awt windows and with an environment variable flag to have it off by default? https://github.com/mjharkin/Xpra/commit/e583d6c858f1e5bf3c20d2763a028b65247a7538

When I had a frameless java window that could be moved by dragging it, it was jumping uncontrollably (#1941). Windows would sometimes jump with the title bar above the screen out of view. I don't think this is/should be allowed by any OS. I haven't yet considered a monitor above yet but my hack to fix this was: https://github.com/mjharkin/Xpra/commit/b4d71a34d6a1ce428552f7ee16200c0a59d9b705



Sun, 10 Feb 2019 15:33:11 GMT - Antoine Martin: attachment set

awt test case based on the example from #1975


Sun, 10 Feb 2019 15:42:15 GMT - Antoine Martin: owner changed

Java clearly ignores the xinerama data (#496), just like it does with DPI, so we need to fixup the window position instead. r21614 merges your patch after making some small changes:

@mjharkin: does that work for you? I've used the example Java class above and got it to center on the first monitor.


Sun, 10 Feb 2019 15:51:39 GMT - Antoine Martin:

As for the second issue, r21616 prevents that, but it is only enabled by default on macos and mswindows for now. Many X11 window managers will let you move windows as long as you can see an edge of it.


Mon, 11 Feb 2019 09:56:44 GMT - Mark Harkin: attachment set


Mon, 11 Feb 2019 10:09:56 GMT - Mark Harkin:

That's great thanks, r21614 and r21616 work as expected.

2 more changes I've made (and I think the only remaining changes for the python client are):

1: an issue with the Options drop down in Firefox while maximized is causing it to be pushed to the next screen. Attached screenshot of the menu when not maximized shows it overshooting the window. Since this is in the transparent area I just hacked the code to allow monitor width +1 https://github.com/mjharkin/Xpra/commit/0c84f8153c76ca122399273673ec46de94bd7807 Not sure how or if you want to handle this one.

2: small updates to the tray menu. Allowing SHOW_CLOSE as env variable and reducing icon size in the start submenu to same as the rest of the tray menu. https://github.com/mjharkin/Xpra/commit/cfda409210ba945070b048eab65c1c5634082fb3


Mon, 11 Feb 2019 14:07:30 GMT - Antoine Martin:

@mjharkin: can I close this ticket?


Mon, 11 Feb 2019 19:43:42 GMT - Mark Harkin: status changed; resolution set

Yes, all 3 fixes are now working as expected. Thanks.


Thu, 21 Feb 2019 11:39:25 GMT - Mark Harkin: status changed; resolution deleted

Originally tested r21616 with the env variable set, but should default correctly so reopening. gtk_client_window_base.py

WINDOW_OVERFLOW_TOP = envbool("XPRA_WINDOW_OVERFLOW_TOP", not (WIN32 and OSX))

I think this should be:

WINDOW_OVERFLOW_TOP = envbool("XPRA_WINDOW_OVERFLOW_TOP", not (WIN32 or OSX))

Thu, 21 Feb 2019 11:53:31 GMT - Antoine Martin: status changed; resolution set

oops, sorry about that. r21785 enables it everywhere by default since most Linux DEs seem to no longer allow windows to be moved using the frame.


Sat, 23 Jan 2021 05:43:18 GMT - migration script:

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