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 migration #1978

Draft
wants to merge 131 commits into
base: main
Choose a base branch
from
Draft

Conversation

MuhammadMuradG
Copy link
Contributor

@MuhammadMuradG MuhammadMuradG commented Jun 12, 2023

Describe your changes in detail

This PR migrates from Gtk3 to Gtk4, from3to4, and taking also into consideration Gtk5, from4to5.

Note the following:

  • This changes required GTK4 v4.10 at least (Primary, because we use Gtk.AlertDialog to implement Toga Dialog. Otherwise, we either rebuild it from scratch using Gtk.Window or using deprecated Gtk API).
  • Layout mechanism has been completely refactored.
  • Applying styles on widgets has been changed.
  • Tree widget needs a refactoring by one of the new Gtk4 widgets instead of removed Gtk3 widget (Gtk.TreeModel).
  • Menus and Commands will be addressed in HIG-compliant for GTK menus #1931
  • Fixes some bugs.

Audit checklist:

  • app
  • fonts
  • icons
  • images
  • keys
  • paths
  • window
  • activityindicator
  • base
  • box
  • button
  • canvas
  • dateinput
  • detailedlist
  • divider
  • imageview
  • label
  • multilinetextinput
  • numberinput
  • optioncontainer
  • paswordinput
  • progressbar
  • scrollcontainer
  • selection
  • slider
  • splitcontainer
  • switch
  • table
  • textinput
  • timeinput
  • tree
  • webview

What problem does this change solve?

This PR migrate from Gtk3 (have a lot of deprecated functions and old UI) to Gtk4 and does not violate what will be in Gtk5.

Related issues:

Refs #1931
Refs #1935

PR Checklist:

  • All new features have been tested
  • All new features have been documented
  • I have read the CONTRIBUTING.md file
  • I will abide by the code of conduct

@freakboy3742
Copy link
Member

Wow - this is a big chunk of work :-) Thanks for taking on this project.

As I indicated in #1935, we're in the middle of a widget audit right now, so there's a lot of churn happening with widget implementations - but we're also building GUI test cases for all widgets. Those tests (and the test probes in the gtk/tests_backends folder) will be a key part of acceptance testing for this PR.

At present, this PR is failing CI because of basic formatting (towncrier and pre-commit failures) - I'd strongly recommend setting up your development environment as described in the Toga docs to avoid these issues. Once those problems are resolved, you're going to hit a bunch of problems with the testbed app - this is the test harness we're using to validate GUI backends. That testbed will require modifications to run GTK4 code, as will the GTK probes (defined in the gtk/tests_backend folder) that allow the GTK backend to be tested. Procedurally, I'm unlikely to take a deep dive into this code until those tests pass.

@MuhammadMuradG MuhammadMuradG marked this pull request as draft June 12, 2023 08:45
MuhammadMuradG and others added 30 commits January 3, 2024 03:58
A weak ref must be set to the widget window to avoid memory leaks.
This commit is a workaround solution to handle coverage tests in cases where backends don't implementing window as image.
Instead of the existing extensible set, GTK now only supports normal and large icons.
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