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

[GTK4] Migrate deprecated FontChooser to FontDialog #1583

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ptziegler
Copy link
Contributor

This moves all native FontChooser bindings from the shared GTK to the GTK3 component and also defines new GTK4 bindings for the FontDialog API.

Note: The FontDialog doesn't seem to remember the initial font that is passed as an argument. This looks like a bug within GTK, given that the same behavior also happens for the FontDialogButton[1].

[1] - https://gitlab.gnome.org/GNOME/gtk/-/issues/6892

@ptziegler
Copy link
Contributor Author

ptziegler commented Nov 9, 2024

In terms of appearance, both dialogs are pretty much identical, though I think the old one looks better...

GTK3:
image

GTK4:
image

Note that this PR currently depends on #1582 because I'm using the new AsyncReadyCallback class.

Copy link
Contributor

github-actions bot commented Nov 9, 2024

Test Results

   483 files  ±0     483 suites  ±0   8m 58s ⏱️ -56s
 4 095 tests ±0   4 085 ✅ ±0   7 💤 ±0  3 ❌ ±0 
16 173 runs  ±0  16 080 ✅ ±0  90 💤 ±0  3 ❌ ±0 

For more details on these failures, see this check.

Results for commit a20a58e. ± Comparison against base commit 2cc00b7.

♻️ This comment has been updated with latest results.

@akurtakov
Copy link
Member

This PR should be kept strictly to FontChooser->FontDialog change and the async helper code change together with adopting existing code should go into #1582

@ptziegler
Copy link
Contributor Author

This PR should be kept strictly to FontChooser->FontDialog change and the async helper code change together with adopting existing code should go into #1582

Of course, that's why this is still marked as "draft" :)

The plan was to wait for the other refactoring to be merged, do a rebase and then the offending commit should disappear on its own. I just didn't want to use the "old" approach when refactoring it anyway.

@laeubi
Copy link
Contributor

laeubi commented Nov 27, 2024

@ptziegler we have now GTK4 build enabled, so if you rebase your PR it will at last check that compilation has no issues!

@akurtakov
Copy link
Member

Please continue with this one.
Note that starting with https://download.eclipse.org/eclipse/downloads/drops4/I20241127-1240/ builds for gtk4 are provided and can be started passing SWT_GTK4=1 env variable.

This moves all native FontChooser bindings from the shared GTK to the
GTK3 component and also defines new GTK4 bindings for the FontDialog
API.

Note: The FontDialog doesn't seem to remember the initial font that is
passed as an argument. This looks like a bug within GTK, given that the
same behavior also happens for the FontDialogButton[1].

[1] - https://gitlab.gnome.org/GNOME/gtk/-/issues/6892
@ptziegler ptziegler marked this pull request as ready for review November 27, 2024 20:38
public void async(long callback) {
// The font dialog ignores the given font and simply picks the first installed font
// See https://gitlab.gnome.org/GNOME/gtk/-/issues/6892
GTK4.gtk_font_dialog_choose_font(handle, shellHandle, font.handle, 0, callback, 0);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As described in the linked issue: What exactly is the procedure for dealing with actual bugs in GTK? As far as I can tell, there is no way to work around this problem inside of SWT.

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

Successfully merging this pull request may close these issues.

3 participants