Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small improvements to window position on client #2141

Closed
totaam opened this issue Feb 7, 2019 · 9 comments
Closed

Small improvements to window position on client #2141

totaam opened this issue Feb 7, 2019 · 9 comments
Labels

Comments

@totaam
Copy link
Collaborator

totaam commented Feb 7, 2019

Issue migrated from trac ticket # 2141

component: client | priority: minor | resolution: fixed

2019-02-07 20:13:37: mjharkin created the issue


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?
mjharkin/Xpra@e583d6c

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:
mjharkin/Xpra@b4d71a3

@totaam
Copy link
Collaborator Author

totaam commented Feb 10, 2019

2019-02-10 15:33:12: antoine uploaded file MainWindow.java (0.6 KiB)

awt test case based on the example from #1975

@totaam
Copy link
Collaborator Author

totaam commented Feb 10, 2019

2019-02-10 15:42:15: antoine commented


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.

@totaam
Copy link
Collaborator Author

totaam commented Feb 10, 2019

2019-02-10 15:51:40: antoine commented


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.

@totaam
Copy link
Collaborator Author

totaam commented Feb 11, 2019

2019-02-11 09:56:44: mjharkin uploaded file firefox_dropdown.png (5.5 KiB)

firefox_dropdown.png

@totaam
Copy link
Collaborator Author

totaam commented Feb 11, 2019

2019-02-11 10:09:57: mjharkin commented


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
mjharkin/Xpra@0c84f81
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.
mjharkin/Xpra@cfda409

@totaam
Copy link
Collaborator Author

totaam commented Feb 11, 2019

2019-02-11 14:07:31: antoine commented


@mjharkin: can I close this ticket?

@totaam
Copy link
Collaborator Author

totaam commented Feb 11, 2019

2019-02-11 19:43:42: mjharkin commented


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

@totaam
Copy link
Collaborator Author

totaam commented Feb 21, 2019

2019-02-21 11:39:25: mjharkin commented


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))

@totaam
Copy link
Collaborator Author

totaam commented Feb 21, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant