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 ColorChooser to ColorDialog #1629

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

Conversation

ptziegler
Copy link
Contributor

The Color Chooser has been moved to the GTK3 class and all references inside the GTK4 blocks have been updated to use the new API.

Note that the GTK4 API doesn't provide the means to set a custom palette, meaning that the colors specified with setRGBS(RGB[]) are effectively ignored.

@ptziegler
Copy link
Contributor Author

GTK3:

ColorDialog_gtk3

GTK4:

ColorDialog_gtk4

Comment on lines +142 to +149
// TODO The color dialog isn't opened a non-modal window. However, the
// "same" API is used for e.g. the Font Dialog, where everything works.
// So this looks like a bug within GTK...
// Error:
// g_object_new_valist: invalid object type 'SwtFixed' for value type 'GtkWindow'
// GtkDialog mapped without a transient parent. This is discouraged.
GTK4.gtk_color_dialog_set_modal(handle, true);
GTK4.gtk_color_dialog_set_title(handle, buffer);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The "SwtFixed" is obviously something that comes from SWT, but I don't really understand how it works or why it's needed. And given that this doesn't cause issues for the Font Dialog, where I use same shell, I fail to see why it works in one but not the other...

Comment on lines +163 to +167
// TODO The ColorDialog API doesn't support setting a custom palette
// See https://gitlab.gnome.org/GNOME/gtk/-/issues/5936
// > The new GtkColorDialog api doesn't have this feature atm. We might
// > want to bring it back, but judging from application use of color
// > choosers, setting custom palettes is not very popular.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is probably really bad. But as mentioned in the linked issue, as well as the documentation, there is simply no way to customize the palette.

Meaning this is probably something that would first have to be implemented, but I don't think my GTK knowledge is sufficient to do so. :/

Copy link
Contributor

github-actions bot commented Nov 28, 2024

Test Results

   383 files   -   100     383 suites   - 100   4m 44s ⏱️ - 3m 2s
 4 095 tests ±    0   4 088 ✅ +    3   7 💤 ±0  0 ❌  - 3 
12 147 runs   - 4 026  12 064 ✅  - 4 016  83 💤  - 7  0 ❌  - 3 

Results for commit c5f57d4. ± Comparison against base commit 7300cb4.

♻️ This comment has been updated with latest results.

The Color Chooser has been moved to the GTK3 class and all references
inside the GTK4 blocks have been updated to use the new API.

Note that the GTK4 API doesn't provide the means to set a custom
palette, meaning that the colors specified with setRGBS(RGB[]) are
effectively ignored.
@ptziegler ptziegler marked this pull request as draft December 8, 2024 10:06
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.

1 participant