-
Notifications
You must be signed in to change notification settings - Fork 187
GTK4: Fix GTK4 shell location test. #2523
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
GTK4: Fix GTK4 shell location test. #2523
Conversation
|
@iloveeclipse please add GTK4 label. |
Test Results 88 files - 30 88 suites - 30 6m 26s ⏱️ - 2m 21s For more details on these failures, see this check. Results for commit b938577. ± Comparison against base commit 79e69bb. This pull request removes 37 tests.♻️ This comment has been updated with latest results. |
|
So if one sets location via API and user moves the shell returned location will be not where it was moved but rather what was initially set via the API?!? This looks like totally broken logic. |
|
If I remember right, GTK4 provides only relative coordinates, so can we record the diff to absolute coordinates set by user, and apply the diff on next get to the value reported by GTK4? |
One might want to attach a move listener to fix that, but one should also note that not all shells are movable and it is better than having no location reporting at all, so not optimal but a first step maybe... |
I should start with the fact that absolute coordinates set by user will have zero effect when running on gtk3+Wayland(https://docs.gtk.org/gdk3/method.Window.move.html) or gtk4 ( eclipse.platform.swt/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java Line 1092 in 2edab10
|
|
https://discourse.gnome.org/t/how-to-center-gtkwindows-in-gtk4/3112/11 and the whole thread is worth reading on the topic from one of the main gtk developers. |
|
After some tries and readings.. I conclude that it is not possible to know Location of the Top Level Window. |
40d0d06 to
f9d6ffc
Compare
| @Test | ||
| public void test_getLocation() { | ||
| //Setting location for Windows is not supported in GTK4 | ||
| if (GTK.GTK4) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you run the test on Windows/Mac - class GTK will not be available and ClassNotFoundException will be thrown.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, then how to disable these tests for GTK4 ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any test parameter or maven configuration ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's best to use the osgi.ws system property equals to gtk, combined with org.eclipse.swt.internal.gtk.version system property startsWith("4"). That way test for gtk 3.x will still execute and only gtk 4.x will be disabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's best to use the osgi.ws system property equals to gtk, combined with org.eclipse.swt.internal.gtk.version system property startsWith("4"). That way test for gtk 3.x will still execute and only gtk 4.x will be disabled.
Thank you.. It works well.. I have fixed it now..
We cannot set/determine the location of the shell using Window Handle on GTK4. So fix the test not to test the set and get location on GTK4. see eclipse-platform#2498
f9d6ffc to
b938577
Compare
|
@raghucssit , @akurtakov : I think we should update Javadoc on affected SWT methods (get/set) to add a note about this GTK4 limitation? Beside this: wdyt about adding some logging callback from IDE to SWT, so that it could be used to report errors in the IDE log if some unexpected (not critical) SWT error appears? So far SWT can only throw exceptions or print to sysout, but I would prefer also to log missing functionality like here to IDE error log without breaking callers. WDYT? |
I will do this with this PR.
I don't know how to do this.. May be we can do it with different PR because improving logging mechanism altogether seems some enhancement. |
Sure, I was interesting to hear your opinion. |
Already API doc has the needed warning for wayland windowing system. I think it's enough. Can we say it as may be GTK4 limitation ? |
|
Shell test has only 1 fail now. So this PR has effect.. Rest everything is ok. Good to merge. |
|
Technically it's Gtk 4.x design decision in order to fix security concern so it's not a limitation but rather a deliberate decision. |
We cannot set/determine the location of the shell using Window Handle on
GTK4. So fix the test not to test the set and get location on GTK4.
see #2498