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

Various minor adjustments to the code and preparation for GTK+ 3 #11

Merged
merged 9 commits into from
Jan 2, 2024

Conversation

markuspg
Copy link
Contributor

This pull request makes various minor adjustments all around the codebase and prepares the trivially adjustable tests for a port to GTK+ 3.

I don't know how far your considerations/coding in direction of porting to SDL went. I would have continued with GTK since it should be readily available on most Linux systems anyhow.

If I don't overlook anything the port to GTK+ 3 and beyond should mostly concern the drawing, which would need to be ported to Cairo. I realized this with this pull request, only the test cases containing text are more difficult (I know neither Cairo nor Pango).

I considered porting to GTK 4 directly, but I prefer to maintain a good deal of backwards compatibility. So I'd aim at GTK+ 3 first and then make optional adjustments to GTK 4.

@markuspg
Copy link
Contributor Author

markuspg commented Dec 29, 2023

You can ignore this pull request for now. To free my mind from the burden of code formatting I conducted my changes on top of markuspg/format. Unfortunately I cannot base this pull request in the official screentest repository against this branch in mine. So the actual changes are hidden beyond the formatting ones now. So let's first get the formatting out of the way and then I'll rebase this pull request.

Solved by the merge of #10.

This ensures that only header files allowed to be used with GTK+ 3 are
being included.
This ensure that _screentest_ does not utilize implementation details
which will become private with GTK 3.
This ensures that _screentest_ does not utilize GTK+ symbols being
removed by GTK+ 3.
README.md Show resolved Hide resolved
@@ -231,3 +231,15 @@ G_MODULE_EXPORT void on_bg_color_activate(G_GNUC_UNUSED GtkMenuItem *menuitem,
}
gtk_widget_hide(GTK_WIDGET(bg_color_selector));
}

void set_color_bg(cairo_t *cr) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These functions exist for no other purpose than saving typing elsewhere.

callbacks.h Show resolved Hide resolved
main.h Show resolved Hide resolved
@@ -49,6 +50,7 @@ screentest_srcs = [
executable(
meson.project_name(),
'main.c',
c_args: '-DGSEAL_ENABLE -DGTK_DISABLE_DEPRECATED -DGTK_DISABLE_SINGLE_INCLUDES',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

When switching to GTK+ 3 I'd drop these again. They only serve to highlight the progress of the migration.

@@ -9,6 +9,7 @@ project(

i18n = import('i18n')

cairo_dep = dependency('cairo', version: '>= 1.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.

I'm a bit in two minds if it's worth having this. Generally GTK+ should pull in a much more recent version, so I guess it just adds unnecessary verbosity.

test_grid.c Show resolved Hide resolved
@markuspg
Copy link
Contributor Author

Out of interest I conducted some performance measurement of the drawing of the LCD alignment test. The reported expired time with Cairo is greater than the one with GdkGC, but the drawing on the screen is much quicker on my hardware (Core i7-12700H).

@TobiX
Copy link
Owner

TobiX commented Jan 2, 2024

I don't know how far your considerations/coding in direction of porting to SDL went.

Not very far. It was just an idea since toolkit-use in this program is very minimal (1 menu & some color pickers) and looking at the porting guides for newer GTK versions I figured I had to rewrite all the tests anyway (as you probably realized when writing this PR 😄), so switching to something "lighter" might have been a worthwhile idea...

@TobiX TobiX merged commit 075f1e4 into TobiX:main Jan 2, 2024
3 checks passed
@markuspg markuspg deleted the markuspg/gtk_3 branch January 15, 2024 20:21
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.

2 participants