xpra icon
Bug tracker and wiki

Opened 11 days ago

Closed 7 days ago

#2141 closed defect (fixed)

Small improvements to window position on client

Reported by: Mark Harkin Owned by: Mark Harkin
Priority: minor Milestone: 2.5
Component: client Version: 2.4.x
Keywords: Cc:

Description

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

Attachments (2)

MainWindow.java (623 bytes) - added by Antoine Martin 8 days ago.
awt test case based on the example from #1975
firefox_dropdown.png (5.5 KB) - added by Mark Harkin 7 days ago.

Download all attachments as: .zip

Change History (7)

Changed 8 days ago by Antoine Martin

Attachment: MainWindow.java added

awt test case based on the example from #1975

comment:1 Changed 8 days ago by Antoine Martin

Owner: changed from Antoine Martin to Mark Harkin

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:

  • add environment variable to disable this behaviour: XPRA_AWT_RECENTER
  • refactor the existing AWT window detection code, and only apply the workaround to AWT windows
  • move position adjustment to a method we can re-use from both setup_window and adjusted_position
  • be more defensive and don't assume screens and monitors are always present, only recenter if there is more than one monitor

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

comment:2 Changed 8 days ago by 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.

Changed 7 days ago by Mark Harkin

Attachment: firefox_dropdown.png added

comment:3 Changed 7 days ago by 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

comment:4 Changed 7 days ago by Antoine Martin

  • the drop down in Firefox is fixed more properly in trunk with r21631 (this was caused by r13669 + r13670 for #1284) - I'll try to come up with something more suitable for backporting to v2.4.x
  • making the "close" menu entry an option was merged in r21632.
  • as for the icon size, the more correct fix is in r21636.

@mjharkin: can I close this ticket?

comment:5 Changed 7 days ago by Mark Harkin

Resolution: fixed
Status: newclosed

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

Note: See TracTickets for help on using tickets.