Compare commits

...

246 Commits

Author SHA1 Message Date
Matthias Clasen
8064b1b52c ci: Set up XDG_RUNTIME_DIR differently 2023-05-13 08:31:35 -04:00
Matthias Clasen
48d5b36b32 ci: Use mutter headless for tests 2023-05-13 08:31:35 -04:00
Matthias Clasen
ba64e5588d Add a little wait to focus tests
I don't know exactly why, but this seems
to help the tests not fail on X11.
2023-05-11 22:24:10 -04:00
Matthias Clasen
fcdcdb7e78 Merge branch 'matthiasc/for-main' into 'main'
ci: Use the same options for the scan-build job

See merge request GNOME/gtk!5953
2023-05-12 02:08:37 +00:00
Matthias Clasen
3d5789a66e Merge branch 'validate-uris' into 'main'
urilauncher: Validate the uri

Closes #5829

See merge request GNOME/gtk!5952
2023-05-12 00:19:07 +00:00
Matthias Clasen
59343e4efb gtk-demo: Rename the new Settings demo
"v2" does not look great in the sidebar.
Lets call this "Alternative Settings".
2023-05-11 20:14:58 -04:00
Matthias Clasen
41219ae489 gtk-demo: Fix a typo 2023-05-11 19:53:42 -04:00
Matthias Clasen
7055250692 ci: Stop special-casing broadway
We are not running the broadway tests anymore,
so no need to special-case them in the run-test.sh
script either.
2023-05-11 19:53:03 -04:00
Matthias Clasen
98f63d09c0 ci: Use the same options for the scan-build job
In particular, not building the tests should
help cutting down on time spent linking.
2023-05-11 19:53:03 -04:00
Matthias Clasen
85b9a6f1b0 urilauncher: Validate the uri
We don't want to send nonsense to the portal.

Fixes: #5829
2023-05-11 18:34:26 -04:00
Matthias Clasen
3353eac289 Merge branch 'fix-focus-tests' into 'main'
spinbutton: Update baseline child

See merge request GNOME/gtk!5950
2023-05-11 22:28:46 +00:00
Matthias Clasen
cdc135f11d Merge branch 'shortcuts-focus' into 'main'
theme: Show focus in shortcuts windows

See merge request GNOME/gtk!5951
2023-05-11 20:16:07 +00:00
Matthias Clasen
069ce48ac5 theme: Show focus in shortcuts windows
The individual items are now focusable,
so we need to show a focus ring, otherwise
this is just confusing.
2023-05-11 15:58:15 -04:00
Matthias Clasen
625c7c3d26 widgetfocus: Sort children better for TAB
When tabbing in a box, we really want to sort
children just along the main axis. Make it so.
2023-05-11 15:35:27 -04:00
Matthias Clasen
4ea2aac561 spinbutton: Update baseline child
When the orientation changes, the entry changes
position, so we need to update baseline-child to match.
2023-05-11 15:34:44 -04:00
Matthias Clasen
e88e31dde2 Merge branch 'balance-ci-jobs' into 'main'
ci: Balance the work between jobs

See merge request GNOME/gtk!5949
2023-05-11 13:47:56 +00:00
Matthias Clasen
fb2e67638d testsuite: Simplify shader test
Simplify the shader to something GLES
will successfully compile.
2023-05-11 09:20:25 -04:00
Matthias Clasen
f11dd83ab5 Merge branch 'matthiasc/for-main' into 'main'
gsk: Dispose the driver when the display is closed

See merge request GNOME/gtk!5948
2023-05-11 13:11:56 +00:00
Matthias Clasen
92804b5b55 Drop the duplicate x11 testsuite run
We currently run the testsuite against x11 in both
the debug and release builds. Once ought to
be enough.
2023-05-11 08:52:48 -04:00
Matthias Clasen
87e7ea6080 ci: Balance the work between jobs
The fedora-x86-64 build does not only build with debug,
it also does the hello build, and it runs the testsuite
multiple times.

Move the hello build to the fedora release build. The idea
is that this lets us do more work in parallel, and spend
less time waiting for the longest-running ci job.
2023-05-11 08:39:38 -04:00
Matthias Clasen
b1945b38e8 ci: Drop the broadway test run
We are ignoring failures here, and nobody is working
on fixing them. And the failures end up at the end
of the log, adding annoyance to finding the actual
failures.
2023-05-11 08:34:14 -04:00
Matthias Clasen
13ca3187f2 testsuite: fix another surface unref warning 2023-05-11 06:40:57 -04:00
Matthias Clasen
18fd506360 build: Cosmetics 2023-05-11 06:13:42 -04:00
Matthias Clasen
9faf1a0377 gsk: Comment out some debug code
The calls of these functions are #ifdef'ed out,
so no point in compiling these functions.
2023-05-11 06:13:42 -04:00
Matthias Clasen
1a9c03449e gtk: Don't drop too many references
We only have one reference to the surface,
and it is dropped by gdk_surface_destroy.

All the users of surfaces in gtk had the same
bug: they were all stealing an extra reference
to drop - the one that the renderer was leaking
until recently.
2023-05-11 06:13:03 -04:00
Matthias Clasen
aee214b09d gsk: Fix some renderer gotchas
unrealize() needs to clean up the surface that was set
in realize(), and both need to emit property change
notification.
2023-05-10 20:21:54 -04:00
Matthias Clasen
dc3003bc4d gsk: Improve test coverage
Add more tests for gsk transforms, render node
and renderer apis.
2023-05-10 20:21:31 -04:00
Matthias Clasen
845f4b1536 gsk: Drop an unused function 2023-05-10 20:21:12 -04:00
Matthias Clasen
abbb3a2da6 testsuite: Close displays in the gsk tests
This gives us better coverage of the dispose
codepath for a driver that has actually been
used.
2023-05-10 20:21:12 -04:00
Matthias Clasen
1a93efecf3 gsk: Dispose the driver when the display is closed
This was the intention, but the object data by itself
does not achieve that: We do run dispose on the display
when it is closed, but object data is only cleared in
finalize. So listen to the ::closed signal and remove
the driver ourselves.

Fix up the drivers dispose implementation enough for
that to actually work.
2023-05-10 20:21:12 -04:00
Matthias Clasen
440d56a44f Use gsk_matrix_transform_point3d consistently 2023-05-10 20:21:12 -04:00
Matthias Clasen
f10603e97d Merge branch 'matthiasc/for-main' into 'main'
tests: Stop copying the tool tests

See merge request GNOME/gtk!5947
2023-05-10 10:38:07 +00:00
Matthias Clasen
9a9257d7be tests: Don't disable vertex arrays
It doesn't work, and that makes tests fail.
2023-05-09 23:02:48 -04:00
Matthias Clasen
5c10f2b4cd Improve coverage for half-float fallbacks 2023-05-09 23:02:30 -04:00
Matthias Clasen
ba6a618d44 build: Rename another option 2023-05-09 21:41:27 -04:00
Matthias Clasen
5fbeea3870 build: Deprecate an option
Rename the demos option to build-demos, to match
the other options for building optional parts.
2023-05-09 21:34:05 -04:00
Matthias Clasen
27368a418a build: Require meson 0.63
This is needed for option deprecation.
2023-05-09 21:34:05 -04:00
Matthias Clasen
676cd1e673 tests: Stop copying the tool tests
No point in doing that, and the meson feature
we are using here is deprecated.
2023-05-09 21:21:39 -04:00
Matthias Clasen
d6a4c65bfa Post-release version bump 2023-05-09 20:48:33 -04:00
Matthias Clasen
4695f583c1 4.11.2 2023-05-09 20:46:21 -04:00
Matthias Clasen
fa88d738dc Update baseline docs a bit 2023-05-09 18:59:11 -04:00
Matthias Clasen
7841248c1d Merge branch 'deprecate-align-value' into 'main'
Deprecate GTK_ALIGN_BASELINE

See merge request GNOME/gtk!5946
2023-05-09 20:53:59 +00:00
Matthias Clasen
ef5f34c985 Update tests 2023-05-09 16:36:07 -04:00
Matthias Clasen
1dfa54c117 Deprecate GTK_ALIGN_BASELINE
We can deprecated enum values now.
2023-05-09 14:28:26 -04:00
Matthias Clasen
ff920d98ec Use GTK_ALIGN_BASELINE_FILL
Replace GTK_ALIGN_BASELINE with its new name
everywhere.
2023-05-09 14:28:26 -04:00
Matthias Clasen
91ca6d0851 Merge branch 'wip/ebassi/gen-version-macros' into 'main'
Generate version and deprecation macros at build time

See merge request GNOME/gtk!5945
2023-05-09 18:23:40 +00:00
Emmanuele Bassi
cdeeb3275a build: Internal tests must set GTK_COMPILATION
Otherwise they won't be able to use the appropriate function visibility
on Windows.
2023-05-09 19:01:21 +01:00
Emmanuele Bassi
9d68bebdd1 Minimize the amount of inclusions in public headers
Public headers should mainly include gdktypes.h, which already include
the symbol visibility and versioning macros; we can also modify
gdktypes.h to include the enumerations.
2023-05-09 17:36:59 +01:00
Matthias Clasen
526ddfa866 Merge branch 'wip/otte/sections' into 'main'
Add GtkSectionModel

See merge request GNOME/gtk!5818
2023-05-09 16:36:55 +00:00
Matthias Clasen
d7b9d35c02 Use #pragma once
We switched over to using #pragma once, so lets
use it consistently, in generated headers as well.
2023-05-09 16:43:35 +01:00
Matthias Clasen
383c404792 Drop the gdk/gdkversionmacros.h header
It was just added to avoid touching too many files.
Touching them now.
2023-05-09 16:43:35 +01:00
Emmanuele Bassi
33d0cfd4f8 demos: Drop symbol visibility macros from demo types
Since the corresponding source files do not include "config.h", and are
not compiled with `GTK_COMPILATION`, they will generate the wrong symbol
exporting under Windows.
2023-05-09 16:43:35 +01:00
Emmanuele Bassi
43311f3a80 build: Minor style nitpicks 2023-05-09 16:43:35 +01:00
Emmanuele Bassi
265bc90524 build: Use Meson's gnu_symbol_visibility
Instead of injecting `-fvisibility=hidden` depending on a compiler check
ourselves, let Meson do it for us.

This also avoids us having to filter `-fvisibility=hidden` when reusing
the common compiler flags.
2023-05-09 16:43:25 +01:00
Matthias Clasen
197d921347 Add a missing file 2023-05-09 16:43:25 +01:00
Matthias Clasen
3d5529760a Fix install location 2023-05-09 16:43:25 +01:00
Matthias Clasen
3a2c4be44b Use GTK_COMPILATION throughout
It is a bit ugly that it doesn't fit the neat
namespace schema, but it is what we use everywhere.
2023-05-09 16:43:25 +01:00
Matthias Clasen
e216f469a1 Don't excessively define GDK_EXTERN
Once is enough.
2023-05-09 16:43:25 +01:00
Matthias Clasen
5ae25519a7 Make it build
Fix the circular dependency by moving the generated
headers to gdk/version/, and build that directory
first.

Misc other fixes, such as putting the custom targets
as sources, not depedencies, and using the correct
major version in the generator script.
2023-05-09 16:43:25 +01:00
Emmanuele Bassi
4d1f7a476d Generate version and deprecation macros at build time
Let's poach the same script used by GLib to avoid having to add all the
version macros by hand every time we increment the GTK version.

This is a work in progress:

- need to rename the GLIB_STATIC_COMPILATION check
- circular dependency: libgtkcss depends on gdkversionmacros.h, but libgdk
  depends on libgtkcss
2023-05-09 16:43:25 +01:00
Benjamin Otte
a959fba18a Merge branch 'wip/otte/no-vsync' into 'main'
Add GDK_DEBUG=no-vsync

See merge request GNOME/gtk!5944
2023-05-09 15:16:43 +00:00
Benjamin Otte
c88ac79437 listview: Make inertness not depend on factory
The inertness concept introduced in 62e9d1e470 assumed a listview was
inert when no factory was set. This has 2 problems:

1. columnview uses a listview without factories.

2. header factory being set but factory not being set technically makes
   the listiew inert - but should it?

So for now, make inertness only depend on visibility and root.
A side benefit is that this matches columnview semantics.
2023-05-09 17:03:35 +02:00
Benjamin Otte
ddefbfa8b5 gtk-demo: Add alternative settings demo
This one displays a long list of all settings with sections and allows
filtering the list to quickly search for keys.
2023-05-09 17:03:35 +02:00
Benjamin Otte
435a405c55 gtk-demo: Split out code from the settings demo
I want to add another demo using settings and share relevant code.
2023-05-09 17:01:20 +02:00
Benjamin Otte
e1ed9f10c6 theme: Add some random CSS for section headers 2023-05-09 17:00:40 +02:00
Benjamin Otte
46adfbef4f listitemmanager: Create header items for sections
Now, finally, listitemmanager has all the necessary support to make
section headers work.
2023-05-09 17:00:40 +02:00
Benjamin Otte
53bfcf7f0a listview: GtkListHeader and gtk_list_view_set_header_factory()
Adds infrastructure for handling factories for list headers.

For now, listitemmanager doesn't instantiate them, so they aren't used.
2023-05-09 17:00:40 +02:00
Benjamin Otte
76d601631d listitemmanager: Add GtkListItemChange
... for tracking widgets during changes.

This just pulls all the different disjointed parts into one struct with
a sensible API.
2023-05-09 17:00:40 +02:00
Benjamin Otte
38844fef4d listitemmanager: Add GtkListHeaderBase and vfuncs
This is plumbing for section handling.

The vfuncs don't do anything, this is just the infrastructure.
2023-05-09 17:00:40 +02:00
Benjamin Otte
03ac6611c1 listitembase: exit early
When update() is called but no values are changed, exit early.
2023-05-09 17:00:40 +02:00
Benjamin Otte
0ff88346cd listitemmanager: Make sections configurable
Add a gtk_list_item_manager_set_has_sections() (default: FALSE) that
requires explicit turning on for the listitemmanager to gain section
support.
2023-05-09 17:00:40 +02:00
Benjamin Otte
a73256e5c9 listitemmanager: Add/remove sections as needed
When ensuring widgets, ensure that their section is known. This will
be relevant when we use section widgets.

Also ensure that sections that don't cover any widget get destroyed.
2023-05-09 17:00:40 +02:00
Benjamin Otte
5d2605a151 testsuite: assert widgets are in matched sections
All widgets that we display should have their sections known, so assert
that that is the case.
2023-05-09 17:00:40 +02:00
Benjamin Otte
40a7ec73a9 testsuite: Add a print function for the listitemmanager
This is very useful when debugging.
2023-05-09 17:00:40 +02:00
Benjamin Otte
ccbe762103 listitemmanager: Add gtk_list_tile_get_next_skip()
... and gtk_list_tile_get_previous_skip() and use them.

Allows skipping over REMOVED and FILLER tiles which makes the code a lot
more readable.
2023-05-09 17:00:40 +02:00
Benjamin Otte
88d5c9a5e1 listitemmanager: Add gtk_list_tile_set_type() 2023-05-09 17:00:39 +02:00
Benjamin Otte
6df8eafc3a testsuite: Add verbose output to listitemmanager test 2023-05-09 17:00:39 +02:00
Benjamin Otte
8e69c5c89c listitemmanager: Properly handle sections during add/remove
We don't insert sections ourselves yet, but we handle the existing one
when items get added or removed.
2023-05-09 17:00:39 +02:00
Benjamin Otte
8bf6498265 listitemmanager: Augment header/footer info 2023-05-09 17:00:39 +02:00
Benjamin Otte
e680abc723 listitemmanager: Add section tiles
For now, we just have a HEADER at the start and a FOOTER at the end.
That's hard enough to get right.
2023-05-09 17:00:39 +02:00
Benjamin Otte
cecaede610 testsuite: Improve listitemmanager test
It now has trackers!
2023-05-09 17:00:39 +02:00
Benjamin Otte
81e7e67cef listitemmanager: Add tile types
We have a FILLER and a REMOVED type now.

Also makes gc() more sensitive to types.
2023-05-09 17:00:39 +02:00
Benjamin Otte
35543f60d9 listitemmanager: Add a type to tiles
There's only one type for now, but hey, you have to start somewhere.
2023-05-09 17:00:39 +02:00
Benjamin Otte
7856c52882 testsuite: Add tests for sections to filterlistmodel 2023-05-09 17:00:39 +02:00
Matthias Clasen
568023e6e6 Add a test for filterlistmodel sections 2023-05-09 17:00:39 +02:00
Matthias Clasen
cabb2625f5 filterlistmodel: Support sections
Propagate sections from the child model to
the filter model.
2023-05-09 17:00:39 +02:00
Benjamin Otte
5f64f1c8df sortlistmodel: add a fast path for get_section() 2023-05-09 17:00:39 +02:00
Benjamin Otte
41faddea40 testsuite: Add section tests to sortlistmodel test 2023-05-09 17:00:39 +02:00
Matthias Clasen
a09146df5a Add a test for sortlistmodel sections 2023-05-09 17:00:39 +02:00
Benjamin Otte
bd7ee3f3e1 sortlistmodel: Implement GtkSectionModel
The get_section() implementation is a slow and steady implementation
that has to be careful to not screw up when an incremental sort is only
partially sorted.
2023-05-09 17:00:39 +02:00
Benjamin Otte
ff6c5ad710 flattenlistmodel: Implement GtkSectionModel
Each child model is reported as one section.
2023-05-09 17:00:39 +02:00
Benjamin Otte
bd999c72c9 Implement GtkSectionModel for all selection models 2023-05-09 17:00:39 +02:00
Benjamin Otte
45c9e7aff4 Add GtkSectionModel
Prototyping the interface to be used for sections in listview, so people
can review and play with it.
2023-05-09 17:00:39 +02:00
Benjamin Otte
d24291db98 testsuite: Add a listitemmanager test 2023-05-09 17:00:39 +02:00
Matthias Clasen
661022f2eb Merge branch 'reftest-msvc' into 'main'
reftest-snapshot.c: Fix running reftests on Visual Studio

See merge request GNOME/gtk!5937
2023-05-09 14:48:18 +00:00
Matthias Clasen
168eb941a1 Merge branch 'inspect-a11y-bounds' into 'main'
Inspector accessibility pane improvements

See merge request GNOME/gtk!5941
2023-05-09 14:47:51 +00:00
Benjamin Otte
961a6c12ec wayland: Don't assert when requesting another frame
When GDK_DEBUG=no-vsync is on, we might have more than one outstanding
frame. Don't assert when that hapens. Just request a frame callback for
the first and skip the others.
2023-05-09 16:29:41 +02:00
Benjamin Otte
c227493c65 frameclock: Keep more history
Not all frames get timing info with GDK_DEBUG=no-vsync, so make sure
that even when we render tons of frames, the one frame that does get
timing info is still there when the timing info arrives.

I set it to 128 from 16 now.
This is roughly good enough to go to 5000fps from on a 60Hz monitor.
2023-05-09 16:29:41 +02:00
Benjamin Otte
30acf00bf8 gtk-demo: Update fps with higher priority
We want to make sure to always update it, so make sure it has a higher
priority than redraws.
2023-05-09 16:29:41 +02:00
Benjamin Otte
02e2a6f311 gdk: Add GDK_DEBUG=no-vsync
That turns off waiting and freezing in the frame clock and in
surfaces and triggers redraws asap.
2023-05-09 16:29:41 +02:00
Benjamin Otte
fa42e02a76 frameclock: Add gdk_frame_clock_idle_is_frozen()
This is in preparation for a future commit.

Also turn some macros into inline functions and pass the clock instead
of its priv pointer.
2023-05-09 16:29:37 +02:00
Matthias Clasen
c85b3a8d35 Merge branch 'fix-wgl' into 'main'
Few fixes for WGL after recent updates

Closes #5808

See merge request GNOME/gtk!5936
2023-05-09 12:51:29 +00:00
Matthias Clasen
285685044f Merge branch 'fix-gsk-crash' into 'main'
Fix a refcounting mishap in gsk

Closes #5823

See merge request GNOME/gtk!5943
2023-05-09 11:29:11 +00:00
Matthias Clasen
97bc4f77c6 gsk: Fix a refcounting mishap
This may fix #5823
2023-05-09 06:56:09 -04:00
Chun-wei Fan
0073ee29da gdkglcontext-win32-wgl.c: Always request alpha bits
...when we are using wglChoosePixelFormatARHB().  This ensures that we
hvae a HDC with a pixel format that will really support alpha bits, as
we did for the traditional ChoosePixelFormat().

Thanks to Patrick Zacharias for testing and pointing things out.
2023-05-09 18:15:23 +08:00
Benjamin Otte
e9ed5e21ef win32: Turn off multisampling
We know we draw beautiful Windows, but drawing them once is totally
enough.
2023-05-09 18:15:23 +08:00
Benjamin Otte
c37786af36 win32: Actually increase the counter
We were sending random junk to ChoosePixelFormat().

Also assert that we don't overflow the array. That might be usefu to
know if we carelessly add attributes later.
2023-05-09 18:15:23 +08:00
Chun-wei Fan
a7b09e19f1 GDK/Win32: Use dummy WGL contexts more
... for creating the actual WGL contexts, so that we can cut down on the
number of times where we need to create the base, legacy WGL contexts in
order to create the WGL contexts with attributes.  We could just use the
dummy context that we have to make it current to create the needed
WGL contexts.
2023-05-09 18:15:23 +08:00
Chun-wei Fan
50ef36d387 gdkglcontext-win32-wgl.c: Fix using wglChoosePixelFormatARB()
If we are querying the best supported pixel format for our HDC via
wglChoosePixelFormatARB() (i.e. we have the WGL_ARB_pixel_format extension),
it may return a pixel format that is different from the pixel format that we
used for the dummy context that we have setup, in order to, well, run
wglChoosePixelFormatARB(), which sadly requires a WGL context (HGLRC) to be
current in order to use it, which means the dummy HDC already has a pixel
format that has been set (notice that each HDC is only allowed to have its
pixel format to be set *once*). This is notably the case on Intel display
drivers.

Since we are emulating surfaceless GL contexts, we are using the dummy GL
context (and thus dummy HDC that is derived from the notification HWND used in
GdkWin32Display) for doing that, we would get into trouble if th actual HDC
from the GdkWin32Surface has a different pixel format set.

So, as a result, in order to fix this situation, we do the following:

* Create yet another dummy HWND in order to grab the HDC to query for the
  capabilities the GL drivers support, and to call wglChoosePixelFormatARB() as
  appropriate (or ChoosePixelFormat()) for the final pixel format that we use.
* Ditch the dummy GL context, HDC and HWND after obtaining the pixel format.
* Then set the final pixel format that we obtained onto the HDC that is derived
  from the HWND used in GdkWin32Display for notifications, which will become our
  new dummy HDC.
* Create a new dummy HGLRC for use with the new dummy HDC to emulate surfaceless
  GL support.
2023-05-09 18:15:23 +08:00
Luca Bacci
347561fa68 Merge branch 'fix-5808' into 'main'
gdkglcontext-win32-wgl.c: Fix WGL context realization on 32-bit

Closes #5808

See merge request GNOME/gtk!5942
2023-05-09 07:59:17 +00:00
Chun-wei Fan
d02ae09124 gdkglcontext-win32-wgl.c: Fix WGL context realization on 32-bit
We are currently using g_clear_pointer() on the intermediate WGL contexts
(HGLRC)'s that we need to create in the way, which means that we need to ensure
that the correct calling convention for wglDeleteContext() is being applied.

To be absolutely safe about it, use the gdk_win32_private_wglDeleteContext()
calls, which will in turn call wglDeleteContext() directly from opengl32.dll
(using the OpenGL headers from the Windows SDK) instead of going via libepoxy,
which will assure us that the correct calling convention is applied.

Fixes issue #5808.
2023-05-09 11:47:28 +08:00
Jason Francis
f3996a1a66 inspector: show GtkAccessible bounds in a11y pane 2023-05-08 21:33:04 -04:00
Jason Francis
1181ecbf0e inspector: hide a11y object path when not using AT-SPI backend 2023-05-08 21:31:21 -04:00
Benjamin Otte
d948ac62e4 Merge branch 'wip/otte/for-main' into 'main'
Revert "TEST TEST TEST"

See merge request GNOME/gtk!5940
2023-05-08 18:19:03 +00:00
Benjamin Otte
507e346ff1 Revert "TEST TEST TEST"
This reverts commit 97aff588d5.

That was a test commit for demonstrating things that shouldn't have made
it into main.

So throw it out again.
2023-05-08 19:51:08 +02:00
Emmanuele Bassi
98e6ed474f Merge branch 'new-align-value' into 'main'
filterchooser: Maintain filter combo visibility

See merge request GNOME/gtk!5939
2023-05-08 15:07:26 +00:00
Matthias Clasen
ade316eaee filterchooser: Maintain filter combo visibility
This code broke when it was ported to listmodels
since we always have a non-NULL lis model of filters.
It can just be empty.
2023-05-08 10:42:09 -04:00
Matthias Clasen
1e48843616 Merge branch 'new-align-value' into 'main'
Introduce GTK_ALIGN_BASELINE_FILL/CENTER

See merge request GNOME/gtk!5935
2023-05-08 13:28:15 +00:00
Matthias Clasen
58a5de6f5d testsuite: Handle duplicate enum values
Our notify tests would fall over if there was
a duplicate enum value (within the first 10 values).

Make it handle that, by skipping the duplicate value.
2023-05-08 07:00:34 -04:00
Chun-wei Fan
a9ca72695f reftest-snapshot.c: Fix running reftests on Visual Studio
On Visual Studio-like builds, shove a ".dll" suffix for the reftest
module so that we look for the correct DLL when running the tests.
2023-05-08 15:10:17 +08:00
Matthias Clasen
082ba6d7c8 Introduce GTK_ALIGN_BASELINE_FILL/CENTER
It turns out that the old behavior of GTK_ALIGN_BASELINE
was actually used in libadwaita, so bring it back, and
introduce a new GtkAlign value for the new behavior.
2023-05-07 21:26:09 -04:00
Matthias Clasen
61ff647f71 Merge branch 'node-editor-smarts' into 'main'
node-editor: Add some editor smarts

See merge request GNOME/gtk!5934
2023-05-07 13:59:42 +00:00
Matthias Clasen
823f56d263 Cleanup 2023-05-07 09:32:09 -04:00
Matthias Clasen
87332920d5 node-editor: Add some editor smarts
Allow control-clicks on some fields to bring up
a more specific UI. This functionality is also
available via Ctrl-E and the context menu.

At this point, it can edit colors, fonts and
files in some places, as well as a few enums.
2023-05-07 09:19:44 -04:00
Matthias Clasen
d2a358206c Fix a typo in the node format definition 2023-05-07 09:19:44 -04:00
Matthias Clasen
51ea08aa9c Merge branch 'wip/exalm/action-fixes' into 'main'
modelbutton: Fix a use after free when unsetting accel

See merge request GNOME/gtk!5933
2023-05-07 12:12:57 +00:00
Alice Mikhaylenko
380b63fede modelbutton: Fix a use after free when unsetting accel
gtk_widget_remove_controller() already destroys the controller.
2023-05-07 15:21:16 +04:00
Matthias Clasen
df93875c0c Merge branch 'matthiasc/for-main' into 'main'
rendernodeparser: Handle shader nodes better

See merge request GNOME/gtk!5930
2023-05-07 00:58:05 +00:00
Matthias Clasen
5a156e6b5f rendernodeparser: Handle shader nodes better
Avoid criticals when editing shader nodes in
the node editor.
2023-05-06 14:33:45 -04:00
Matthias Clasen
0e488b3dfe Merge branch 'headless-test-logging' into 'main'
ci: Improve headless test logging

See merge request GNOME/gtk!5929
2023-05-06 13:28:06 +00:00
Matthias Clasen
8495e0e412 Add a test for quick key events 2023-05-06 09:09:13 -04:00
Matthias Clasen
c9b0ca0de7 ci: Improve headless test logging 2023-05-06 09:02:25 -04:00
Benjamin Otte
2a950dec71 Merge branch 'wip/otte/update-texture' into 'main'
Add texture update regions

See merge request GNOME/gtk!5880
2023-05-06 00:59:25 +00:00
Matthias Clasen
d6c80d4f35 Merge branch 'tiled-states' into 'main'
Fix a corner-case in window states

Closes #5809

See merge request GNOME/gtk!5926
2023-05-05 23:58:08 +00:00
Matthias Clasen
e41cc99474 Merge branch 'wip/kabus/column-id-leak' into 'main'
gtk/columnviewcolumn: Fix id leak

See merge request GNOME/gtk!5927
2023-05-05 23:55:34 +00:00
Matthias Clasen
61fe5ac684 Handle the opposite case too
Just in case.
2023-05-05 19:40:42 -04:00
Khalid Abu Shawarib
1cf3f492b8 gtk/columnviewcolumn: Fix id leak
Add a free that was missing in commit 3e2b962a
2023-05-05 22:18:16 +00:00
Matthias Clasen
54fed96f8c Fix a corner-case in window states
Remove detailed tiled states when not tiled.

Fixes: #5809
2023-05-05 16:47:43 -04:00
Matthias Clasen
e2d659d5c2 Merge branch 'matthiasc/for-main' into 'main'
ci: Bump timeouts for headless tests

See merge request GNOME/gtk!5925
2023-05-05 20:34:39 +00:00
Matthias Clasen
8ad1189b0b ci: Bump timeouts for headless tests 2023-05-05 16:21:54 -04:00
Matthias Clasen
b5b7e1f2b4 Merge branch 'matthiasc/for-main' into 'main'
Add a masked variation to gsk tests

See merge request GNOME/gtk!5924
2023-05-05 20:12:12 +00:00
Matthias Clasen
e56a539363 Add a masked variation to gsk tests
This improves test coverage for mask nodes.
2023-05-05 15:05:08 -04:00
Matthias Clasen
5f91bb81ed Merge branch 'matthiasc/for-main' into 'main'
node-editor: Be a bit better about saving

See merge request GNOME/gtk!5923
2023-05-05 18:50:16 +00:00
Matthias Clasen
1fba59f1d1 node-editor: Be a bit better about saving
When we have a file, suggest it for saving.
This has the side benefit of giving us a test case
for gtk_file_dialog_set_initial_file.
2023-05-05 14:18:40 -04:00
Matthias Clasen
68a2ca7e85 Merge branch 'matthiasc/for-main' into 'main'
gsk: Add a few assertions

See merge request GNOME/gtk!5922
2023-05-05 17:48:14 +00:00
Matthias Clasen
93ccf08c81 ci: Bump timeouts of headless tests 2023-05-05 12:05:10 -04:00
Matthias Clasen
e9f5a3e9e2 gsk: Introduce a constant
We need this number in a couple of places,
so pull it out as a constant.
2023-05-05 12:05:10 -04:00
Matthias Clasen
2b85c49fb1 gsk: Add a few assertions
Make sure we don't overflow our fixed-size arrays.
2023-05-05 12:05:10 -04:00
Matthias Clasen
d7c3235cd0 gsk: Add some debug helpers 2023-05-05 12:05:09 -04:00
Matthias Clasen
ea94bac79e Merge branch 'better-masks' into 'main'
gsk: Avoid some offscreens

See merge request GNOME/gtk!5921
2023-05-05 15:56:16 +00:00
Matthias Clasen
63713c3b68 Merge branch 'fix-typo' into 'main'
gtkapplication-quartz: fix typo

Closes #5807

See merge request GNOME/gtk!5920
2023-05-05 15:39:46 +00:00
Matthias Clasen
81fd9741ff gsk: Better handling of offscreens
Take the scale into account for sizing the
offscreens for masks, blends and cross-fades.
2023-05-05 11:37:23 -04:00
Luca Bacci
c7523cecf1 gtkapplication-quartz: fix typo
Fixes #5807
2023-05-05 16:26:26 +02:00
Matthias Clasen
ce6569d1a6 gsk: Avoid some offscreens
We don't have to be too conservative when checking
if a rect is contained in a rounded rect, we have
a precise api for this.
2023-05-04 22:30:12 -04:00
Matthias Clasen
852f46df19 Remove a no longer building test 2023-05-04 20:53:15 -04:00
Matthias Clasen
d82f603fcb Merge branch 'smalltexture-plus-gles' into 'main'
Merge wayland_smalltexture and wayland_gles

See merge request GNOME/gtk!5917
2023-05-04 21:12:40 +00:00
Matthias Clasen
5e8e4130a5 Skip another failing gsk test with small textures 2023-05-04 15:36:57 -04:00
Matthias Clasen
f81aa14d93 Merge wayland_smalltexture and wayland_gles
We don't really need to have two full separate
test runs for these conditions, so combine them
into one test setup.
2023-05-04 15:13:09 -04:00
Matthias Clasen
81db6e9e61 Merge branch 'headless-tests' into 'main'
Get the headless monitor test to work in ci

See merge request GNOME/gtk!5915
2023-05-04 15:51:21 +00:00
Matthias Clasen
ac0311b621 ci: Mark headless monitor test as working 2023-05-04 11:39:35 -04:00
Matthias Clasen
f41e58d179 ci: Make run-docker run work
We want to have a writable volume and the same user
inside the container.
2023-05-04 11:38:55 -04:00
Matthias Clasen
d288931b45 More debug spew
Lets see what MUTTER_DEBUG=screen-cast says.
2023-05-04 11:38:55 -04:00
Matthias Clasen
03adeecfa3 Add generous waits
These tests work in the smae container locally.
Perhaps this is down to timing?
2023-05-04 11:38:55 -04:00
Matthias Clasen
5439f4596c Merge branch 'headless-tests' into 'main'
Add headless tests using mutter

See merge request GNOME/gtk!5908
2023-05-04 04:20:11 +00:00
Matthias Clasen
f98d1a6474 Mark the headless monitor test as failing
This is failing because I can't figure out
how to make wireplumber and pipewire work
in ci enough to let me add a new monitor :(

As usual, the test works fine locally.
2023-05-03 23:53:14 -04:00
Matthias Clasen
57e6aae80a Try to fix dnd tests 2023-05-03 23:27:09 -04:00
Matthias Clasen
f23eaafc85 Typo fix 2023-05-03 23:27:09 -04:00
Matthias Clasen
926b26e9fc headless tests: Add debug spew
Trying to track down what is going on with our
missing monitors.
2023-05-03 23:27:09 -04:00
Matthias Clasen
88f27c423c ci: Launch pipewire and wireplumber
The headless tests require pipewire and wireplumber
for screencast sessions to work. So launch them.
2023-05-03 23:27:09 -04:00
Matthias Clasen
30342896d0 Use python3
No /usr/bin/python in our CI image :(
2023-05-03 23:27:09 -04:00
Matthias Clasen
be8e203edc Make the headless input tests work
These needed some updates and workarounds.

They are now part of the testsuite and can
be run like this:

    meson test -Cbuild --suite headless
2023-05-03 23:27:09 -04:00
Matthias Clasen
623c93ccc8 Disable a11y for the headless tests
Otherwise, we go off activating things and end up
failing to launch systemd.
2023-05-03 23:27:09 -04:00
Matthias Clasen
34d8beaf4f Add a dnd test to the headless tests 2023-05-03 23:27:09 -04:00
Matthias Clasen
983b6ce341 Use headless mutter for input tests
Add some input tests that are using headless
mutter, and python with our in-tree gir files.

So far, test that we can roundtrip key events,
and move the pointer around.
2023-05-03 23:27:09 -04:00
Matthias Clasen
771df47820 Use headless mutter for monitor tests
Add some monitor tests that are using headless
mutter, and python with our in-tree gir files.

So far, we test that we get expected signals
when monitors are added and removed.
2023-05-03 23:27:09 -04:00
Matthias Clasen
3c218687e3 Merge branch 'ci-update-meson' into 'main'
ci: Use newer meson

See merge request GNOME/gtk!5914
2023-05-04 02:57:23 +00:00
Matthias Clasen
37fb370a5d ci: Remove the hack 2023-05-03 22:32:00 -04:00
Matthias Clasen
1cc9413383 ci: Use newer meson 2023-05-03 20:18:58 -04:00
Matthias Clasen
bfea39ab2f ci: Add meson back to the fedora image 2023-05-03 20:18:58 -04:00
Matthias Clasen
84d6f023b5 ci: Add pipewire-gstreamer too 2023-05-03 20:18:58 -04:00
Matthias Clasen
7fe04a7122 ci: Add pipewire to the image
And its buddy, wireplumber.

But we don't need gnome-desktop-testing
anymore, now that installed tests are gone.
2023-05-03 20:18:58 -04:00
Matthias Clasen
19cea99007 Merge branch 'matthiasc/for-main' into 'main'
ci: Stop running failing tests

See merge request GNOME/gtk!5913
2023-05-03 19:54:24 +00:00
Matthias Clasen
1c4ad78d52 Merge branch 'stop-running-failing-tests' into 'main'
ci: Stop running failing tests

See merge request GNOME/gtk!5912
2023-05-03 19:33:35 +00:00
Matthias Clasen
955a7e643e ci: Produce less terminal output
Pass --quiet to meson test.
Less is more, in this case.
2023-05-03 15:32:50 -04:00
Matthias Clasen
b85a137a68 Fix scan-build warning 2023-05-03 15:32:19 -04:00
Matthias Clasen
d17ca6b451 ci: Stop running the unstable test setups
This is just duplicating all our test runs,
for no discernible gain.
2023-05-03 15:11:53 -04:00
Matthias Clasen
da7040874e ci: Stop running failing tests
This makes the test output much harder to read,
and is just a waste of time.
2023-05-03 14:42:10 -04:00
Danial Behzadi
6f9c4c894d Update Persian translation
(cherry picked from commit 954011ef80)
2023-05-03 09:01:04 +00:00
Benjamin Otte
cc7a35cd30 Merge branch 'wip/otte/for-main' into 'main'
build: Use generated SPIR-V files

Closes #5798

See merge request GNOME/gtk!5910
2023-05-02 18:09:13 +00:00
Benjamin Otte
f841621348 css: Don't transition to currentColor
Transition to the color that is in use instead.

Fixes crashes because currentColor is not an RGBA color and
therefor could not be queried later.

Fixes #5798
2023-05-02 19:50:31 +02:00
Benjamin Otte
f99ecd3739 vulkan: Compute offscreen texture coords properly
Most of the time we want to compute them based on the child node we
render to the offscreen, but not always.
For blend and cross-fade nodes, they need to be computed based on the
node's bounds.

Fixes widget-factory page fade animation weirdly resizing the fading
pages.
2023-05-02 19:44:06 +02:00
Matthias Clasen
5eb7e550d1 Merge branch 'matthiasc/for-main' into 'main'
Expand gtk_init docs

Closes #5781

See merge request GNOME/gtk!5909
2023-05-02 17:42:29 +00:00
Matthias Clasen
8d33f2a511 Add a comment to pango.wrap
So we remember the next time we try to
switch to stable dependencies.
2023-05-02 13:18:49 -04:00
Matthias Clasen
27b0321dec Expand gtk_init docs
Make it clear that some aspects of GApplication
functionality happen before startup.

Fixes: #5781
2023-05-02 13:18:49 -04:00
Matthias Clasen
538605eccb Merge branch 'matthiasc/for-main' into 'main'
Don't build fribidi docs

See merge request GNOME/gtk!5906
2023-05-02 13:29:20 +00:00
Matthias Clasen
81f5967587 Make run-test.sh easier to use locally
Set a default timeout multiplier so we don't
have to rememver obscure environment variables.
2023-05-02 06:38:30 -04:00
Matthias Clasen
771437acf9 Go back to fribidi master
Fribidi 1.0.12 does not work as a subproject :(
2023-05-02 06:22:44 -04:00
Matthias Clasen
a3da58133e Don't build fribidi docs
There's no need for that. This matches what pango does.
2023-05-02 06:22:24 -04:00
Benjamin Otte
9b558b50b8 vulkan: Rebuild SPIR-V files
It's been a while since somebody last compiled them, glslc should be
somewhat newer by now.
2023-05-02 08:47:10 +02:00
Benjamin Otte
7ce2eeac47 build: Use generated SPIR-V files
We weren't looking in the build dir for generated files.

Actually make sure that we look in the build dir *first*, otherwise
glib-compile-resources will still use the wrong files.
2023-05-02 08:41:43 +02:00
Matthias Clasen
182dccb8f0 Use pango main as subproject
This is necessary to get the latest pango docs
built in ci.
2023-05-01 23:55:21 -04:00
Matthias Clasen
17d2ba94d6 stop using deprecated pango api 2023-05-01 23:49:42 -04:00
Matthias Clasen
5bac4f13a0 ci: Add mutter to the fedora image
This is in preparation for trying to use mutter --headless
in ci.
2023-05-01 21:11:01 -04:00
Benjamin Otte
97aff588d5 TEST TEST TEST
Add some random updates to the GL Area, so that funky testing can be
done with the GLArea and Gears gtk-demo.
2023-05-02 00:30:58 +02:00
Benjamin Otte
e4040adbe7 rendernode: Implement texture diffing for scale nodes 2023-05-02 00:30:58 +02:00
Benjamin Otte
6506a3bc9c texturebuilder: Add ::udpate-region and ::update-texture 2023-05-02 00:30:58 +02:00
Matthias Clasen
64f9d82506 Merge branch 'gsk-flip-tests' into 'main'
more gsk tests

See merge request GNOME/gtk!5811
2023-05-01 21:06:32 +00:00
Matthias Clasen
b83f3d871f Merge branch 'matthiasc/for-main' into 'main'
Cosmetics: Unset baseline too

See merge request GNOME/gtk!5904
2023-05-01 20:41:13 +00:00
Matthias Clasen
a235b59089 Skip some tests with small textures
When textures are too large, we will scale them down
to fit the max texture size, which will cause comparisons
to fail.
2023-05-01 16:29:45 -04:00
Benjamin Otte
1883035d34 texture: Add gdk_texture_diff()
... and use it in rendernodes.

Setting up textures for diffing is done via gdk_texture_set_diff() which
should only be used during texture construction.

Note that the pointers to next/previous are allowed to dangle if one of
the textures is finalized, but that's fine because we always check both
textures' links to each other before we consider the pointer valid.
2023-05-01 22:24:14 +02:00
Matthias Clasen
0ca6471df4 Cosmetics: Unset baseline too
We set width and height to 0 when unrealizing
a widget. No reason to let the baseline value
linger.
2023-05-01 16:15:11 -04:00
Matthias Clasen
98dde97f20 Merge branch 'better-switch-docs' into 'main'
switch: Expand the docs

See merge request GNOME/gtk!5903
2023-05-01 20:03:44 +00:00
Matthias Clasen
9bd9847b3f switch: Expand the docs
Add more text and explanation around active vs state,
since people seem easily confused by it.
2023-05-01 15:15:53 -04:00
Matthias Clasen
b79d4a3a22 gsk: Fix rendering big textures with offsets
When slicing the texture, the GL renderer was
forgetting to apply the viewport origin. This
shows up when rendering things with negative
scales, leading to negative origins.
2023-05-01 14:46:30 -04:00
Matthias Clasen
33ab588d4e Improve test coverage
Check that our two rounded rect intersection functions agree.
2023-05-01 13:58:42 -04:00
Matthias Clasen
7200a93a88 gsk: Give up on one test
The rounded-clip-in-clip-3d test fails in GL when
flipped. Given that it was already excluded from cairo,
and also fails cairo when flipped, give up on it for now.
2023-05-01 13:45:20 -04:00
Matthias Clasen
319762b908 gsk: Extract scales properly from 2D transforms
We have the code to do it properly.
2023-05-01 13:45:20 -04:00
Matthias Clasen
e453a989df Improve rounded rect intersection
Move the rounded rect/rect intersection code to
gskroundedrect.c, make it more precise, and add
tests for it.

Update the callers in the GL renderer.
2023-05-01 13:45:20 -04:00
Matthias Clasen
f56328a6cc gsk: Fix mask transform handling
We must reset the modelview transform when
offscreen, or else we end up applying
it twice.
2023-05-01 13:45:20 -04:00
Matthias Clasen
f29b24517e Add a test for rotated blend nodes 2023-05-01 13:45:20 -04:00
Matthias Clasen
552df197c4 gsk: Fix blend transform handling
We must reset the modelview transform when
rendering offscreen, or else we end up applying
it twice.
2023-05-01 13:45:20 -04:00
Matthias Clasen
f6e47b7eb0 Add a test for rotated cross-fade nodes
This one checks that we don't apply the modelview
transform twice with cross-fades.
2023-05-01 13:45:13 -04:00
Matthias Clasen
4214067d52 gsk: Fix cross-fade transform handling
We must reset the modelview transform when
rendering offscreen, or else we end up applying
it twice.
2023-05-01 13:44:55 -04:00
Matthias Clasen
d9a2b74b4a gsk: More fixes
Work towards handling negative scales and
denormalized rects everywhere.
2023-05-01 13:43:33 -04:00
Matthias Clasen
21df62f428 Add another test 2023-05-01 13:43:33 -04:00
Matthias Clasen
4e501d2d44 gsk: Transform rounded rects better 2023-05-01 13:43:33 -04:00
Matthias Clasen
5afd5cfec7 Add another gsk test 2023-05-01 13:43:33 -04:00
Matthias Clasen
ad65db901a gsk: Normalize rects in GLSL
Our coverage computation only works for well-behaved
rects and rounded rects. But our modelview transform
might flip x or y around, causing things to fail.

Add functions to normalize rects and rounded rects,
and use it whenever we transform a rounded rect in GLSL.
2023-05-01 13:43:33 -04:00
Matthias Clasen
406b1e2e03 testsuite: Fix gsk test
The repeated tests were not careful enough to produce
the correct reference image to match what the repeat
node does.

With these changes, all cairo tests pass.
2023-05-01 13:43:33 -04:00
Matthias Clasen
f1729affa8 testsuite: Add more gsk tests
Add separate suites for running the gsk compare-render
tests with the --flip, --rotate or --repeat options.
A bunch of these fail currently, and need diagnosis.
2023-05-01 13:35:35 -04:00
Matthias Clasen
3b2ba8ed99 Add more gsk tests
Add options to the gsk compare-render test for
modifying the node (and do a matching change to
the reference image).

flip: negative scale flipping things horizontally
rotate: 90 degree rotation
repeat: 2x2 grid
2023-05-01 13:35:35 -04:00
Matthias Clasen
386c3ac34f Add another transform test
Test that transforming bounds with negative scales
works as expected.
2023-05-01 13:35:22 -04:00
Matthias Clasen
d92c6406d1 Merge branch 'displaymanager-warning-fix' into 'main'
Avoid a bad warning

See merge request GNOME/gtk!5901
2023-05-01 16:56:40 +00:00
Matthias Clasen
d666f4ab7f Avoid a bad warning
This isn't what we intended, and it breaks CI for
various projects.
2023-05-01 10:40:26 -04:00
Georges Basile Stavracas Neto
5df360f436 Merge branch 'alatiera/vulkan-headers-fix' into 'main'
vulkan: Correct error enum version guards

See merge request GNOME/gtk!5900
2023-05-01 14:00:43 +00:00
Jordan Petridis
0197149ba3 vulkan: Correct error enum version guards
Vulkan 218 introduced these errors by they were marked as
the beta till version 238.

00671c64ba (diff-e222ae95c2b0d5082b94d6086fb1c24da18ee31384c1a39840df3b9152023ee6)

Followup to f9b2d3104a
2023-05-01 09:41:35 +03:00
Matthias Clasen
b310ab7304 Merge branch 'matthiasc/for-main' into 'main'
docs: Migration guide updates

See merge request GNOME/gtk!5899
2023-04-30 22:39:57 +00:00
Matthias Clasen
062e3da57d Merge branch 'emojichooser-variation-fix' into 'main'
emojichooser: Avoid extraneous variation selectors

See merge request GNOME/gtk!5898
2023-04-30 22:29:11 +00:00
Matthias Clasen
cdbd931dba docs: Migration guide updates
Mention various widget size apis going away.
2023-04-30 18:21:46 -04:00
Matthias Clasen
2f96a08b3f gsk: Plug a few memory leaks 2023-04-30 18:21:23 -04:00
Matthias Clasen
c1fc6c35cf emojichooser: Avoid extraneous variation selectors
Only add a variation selector if there isn't one already.
2023-04-30 11:56:43 -04:00
Daniel Boles
060992aeba migrating-3to4: Fix unescaped ptr * used as italic 2023-04-30 16:55:31 +01:00
Daniel Boles
2c15d563e2 gtk-demo/listbox: Fix 0 space between nick & date,
by restoring the right-alignment that gtk-3-24 has here, but we had lost
– I guess because we dropped the default child expand and pack-end props
2023-04-30 16:39:16 +01:00
Daniel Boles
2dd7ab2a50 Inscription|InfoBar: Fix small cosmetic issue@docs 2023-04-30 16:05:11 +01:00
Daniel Boles
0736fef585 Merge branch 'dboles/expander-css-nodes-doc' into 'main'
Expander: Clarify/format “CSS nodes” documentation

See merge request GNOME/gtk!5896
2023-04-30 11:37:55 +00:00
Daniel Boles
0442fc2b55 Expander: Clarify/format CSS nodes documentation
Use backticks to highlight the node names, mention the box, and clarify
that the arrow referred to in the last sentence is the `expander` node.
2023-04-30 11:56:07 +01:00
313 changed files with 8928 additions and 2326 deletions

View File

@@ -26,7 +26,8 @@ variables:
BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true"
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled -Ddemos=false -Dbuild-examples=false -Dbuild-tests=false -Dbuild-testsuite=true"
MESON_TEST_TIMEOUT_MULTIPLIER: 3
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v42"
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v46"
XDG_RUNTIME_DIR: "${CI_PROJECT_DIR}/xdg-runtime-dir"
workflow:
rules:
@@ -57,15 +58,9 @@ style-check-diff:
reports:
junit:
- "${CI_PROJECT_DIR}/_build/report-x11.xml"
- "${CI_PROJECT_DIR}/_build/report-x11_unstable.xml"
- "${CI_PROJECT_DIR}/_build/report-wayland.xml"
- "${CI_PROJECT_DIR}/_build/report-wayland_unstable.xml"
- "${CI_PROJECT_DIR}/_build/report-wayland_gles.xml"
- "${CI_PROJECT_DIR}/_build/report-wayland_gles_unstable.xml"
- "${CI_PROJECT_DIR}/_build/report-wayland_smalltexture.xml"
- "${CI_PROJECT_DIR}/_build/report-wayland_smalltexture_unstable.xml"
- "${CI_PROJECT_DIR}/_build/report-broadway.xml"
- "${CI_PROJECT_DIR}/_build/report-broadway_unstable.xml"
name: "gtk-${CI_COMMIT_REF_NAME}"
paths:
- "${CI_PROJECT_DIR}/_build/meson-logs"
@@ -76,11 +71,14 @@ style-check-diff:
- "${CI_PROJECT_DIR}/_build/testsuite/tools/output/*/*"
- "${CI_PROJECT_DIR}/_build/testsuite/gsk/compare/*/*/*.png"
- "${CI_PROJECT_DIR}/_build/testsuite/css/output/*/*.syscap"
- "${CI_PROJECT_DIR}/_build/testsuite/headless/*/*.log"
- "${CI_PROJECT_DIR}/_build_hello/meson-logs"
cache:
key: "$CI_JOB_NAME"
paths:
- _ccache/
before_script:
- mkdir -m 700 $XDG_RUNTIME_DIR
fedora-x86_64:
extends: .build-fedora-default
@@ -91,7 +89,27 @@ fedora-x86_64:
script:
- .gitlab-ci/show-info-linux.sh
- export PATH="$HOME/.local/bin:$PATH"
- pip3 install --user meson~=0.64
- meson subprojects download
- meson subprojects update --reset
- meson setup
${COMMON_MESON_FLAGS}
${EXTRA_MESON_FLAGS}
${BACKEND_FLAGS}
${FEATURE_FLAGS}
_build
- meson compile -C _build
- .gitlab-ci/run-tests.sh _build wayland
- .gitlab-ci/run-tests.sh _build wayland_gles
release-build:
extends: .build-fedora-default
stage: build
needs: []
variables:
EXTRA_MESON_FLAGS: "--buildtype=release"
script:
- .gitlab-ci/show-info-linux.sh
- export PATH="$HOME/.local/bin:$PATH"
- meson subprojects download
- meson subprojects update --reset
- mkdir _install
@@ -107,31 +125,6 @@ fedora-x86_64:
- PKG_CONFIG_PATH=${CI_PROJECT_DIR}/_install/lib64/pkgconfig:${CI_PROJECT_DIR}/_install/share/pkgconfig meson setup _build_hello examples/hello
- LD_LIBRARY_PATH=${CI_PROJECT_DIR}/_install/lib64 meson compile -C _build_hello
- .gitlab-ci/run-tests.sh _build x11
- .gitlab-ci/run-tests.sh _build wayland
- .gitlab-ci/run-tests.sh _build wayland_gles
- .gitlab-ci/run-tests.sh _build wayland_smalltexture
- .gitlab-ci/run-tests.sh _build broadway
release-build:
extends: .build-fedora-default
stage: build
needs: []
variables:
EXTRA_MESON_FLAGS: "--buildtype=release"
script:
- .gitlab-ci/show-info-linux.sh
- export PATH="$HOME/.local/bin:$PATH"
- pip3 install --user meson~=0.64
- meson subprojects download
- meson subprojects update --reset
- meson setup
${COMMON_MESON_FLAGS}
${EXTRA_MESON_FLAGS}
${BACKEND_FLAGS}
${FEATURE_FLAGS}
_build
- meson compile -C _build
- .gitlab-ci/run-tests.sh _build x11
fedora-mingw64:
extends: .build-fedora-default
@@ -152,23 +145,11 @@ fedora-mingw64:
script:
- .gitlab-ci/show-info-linux.sh
- export PATH="$HOME/.local/bin:$PATH"
- pip3 install --user meson~=0.64
- pip3 install --user meson~=1.0
- meson subprojects download
- meson subprojects update --reset
# Test that mingw64-meson still fails. If it has stopped failing, the CI
# will fail and now you should remove the hack that follows this.
- FAILED=false
- mingw64-meson --version || FAILED=true
- test $FAILED = false && echo "mingw64-meson works now, remove the hack" && exit 1
# HACK: Running mingw64-meson directly fails on the CI with:
# /usr/bin/mingw64-meson: line 92: fg: no job control
# Because rpm is not evaluating %__meson and it gets interpreted as a job
# specifier. So we fix that and run it ourselves.
- rpm --eval "%{mingw64_meson}" > mingw64-meson.sh
- sed -i -e 's/%__meson/meson/' mingw64-meson.sh
- chmod +x mingw64-meson.sh
- ./mingw64-meson.sh -Dintrospection=disabled -Dgraphene:introspection=disabled _build
- ninja -C _build
- meson -Dintrospection=disabled -Dgraphene:introspection=disabled _build
- meson compile -C _build
.mingw-defaults:
stage: build
@@ -210,7 +191,7 @@ macos:
needs: []
before_script:
- bash .gitlab-ci/show-info-osx.sh
- pip3 install --user meson~=0.64
- pip3 install --user meson~=1.0
- pip3 install --user ninja
- export PATH=/Users/gitlabrunner/Library/Python/3.7/bin:$PATH
- export MESON_FORCE_BACKTRACE=1
@@ -368,10 +349,11 @@ static-scan:
EXTRA_MESON_FLAGS: "--buildtype=debug"
script:
- export PATH="$HOME/.local/bin:$PATH"
- pip3 install --user meson~=0.64
- meson setup
${COMMON_MESON_FLAGS}
${EXTRA_MESON_FLAGS}
${BACKEND_FLAGS}
${FEATURE_FLAGS}
_scan_build
- ninja -C _scan_build scan-build
artifacts:
@@ -390,7 +372,6 @@ asan-build:
variables:
script:
- export PATH="$HOME/.local/bin:$PATH"
- pip3 install --user meson~=0.64
- CC=clang meson setup --buildtype=debugoptimized -Db_sanitize=address -Db_lundef=false -Dintrospection=disabled -Df16c=disabled _build
- ninja -C _build
- .gitlab-ci/run-tests.sh _build wayland
@@ -405,7 +386,6 @@ reference:
needs: []
script:
- export PATH="$HOME/.local/bin:$PATH"
- pip3 install --user meson~=0.64
- meson setup
${COMMON_MESON_FLAGS}
--buildtype=release

View File

@@ -32,7 +32,6 @@ RUN dnf -y install \
glib2-static \
glibc-devel \
glibc-headers \
gnome-desktop-testing \
gnupg2 \
gobject-introspection-devel \
graphene-devel \
@@ -73,10 +72,14 @@ RUN dnf -y install \
mesa-dri-drivers \
mesa-libEGL-devel \
mesa-libGLES-devel \
meson \
mutter \
ninja-build \
pango-devel \
pcre-devel \
pcre-static \
pipewire \
pipewire-gstreamer \
python3 \
python3-docutils \
python3-gobject \
@@ -84,6 +87,7 @@ RUN dnf -y install \
python3-markdown \
python3-packaging \
python3-pip \
python3-pydbus \
python3-pygments \
python3-typogrify \
python3-wheel \
@@ -95,6 +99,7 @@ RUN dnf -y install \
weston \
weston-libs \
which \
wireplumber \
xorg-x11-server-Xvfb \
&& dnf clean all

View File

@@ -138,7 +138,8 @@ if [ $run == 1 ]; then
echo -e "\e[1;32mRUNNING\e[0m: ${base} as ${TAG}"
${CMD} run \
--rm \
--volume "$(pwd)/..:/home/user/app" \
--userns=keep-id \
--volume "$(pwd)/..:/home/user/app:rw,z" \
--workdir "/home/user/app" \
--tty \
--interactive "${TAG}" \

View File

@@ -6,6 +6,7 @@ set +e
srcdir=$( pwd )
builddir=$1
backend=$2
multiplier=${MESON_TEST_TIMEOUT_MULTIPLIER:-1}
# Ignore memory leaks lower in dependencies
export LSAN_OPTIONS=suppressions=$srcdir/lsan.supp:print_suppressions=0:verbosity=1:log_threads=1
@@ -15,7 +16,8 @@ case "${backend}" in
x11)
xvfb-run -a -s "-screen 0 1024x768x24 -noreset" \
meson test -C ${builddir} \
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
--quiet \
--timeout-multiplier "${multiplier}" \
--print-errorlogs \
--setup=${backend} \
--suite=gtk \
@@ -26,41 +28,30 @@ case "${backend}" in
# Store the exit code for the CI run, but always
# generate the reports
exit_code=$?
xvfb-run -a -s "-screen 0 1024x768x24 -noreset" \
meson test -C ${builddir} \
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
--print-errorlogs \
--setup=${backend}_unstable \
--suite=flaky \
--suite=failing || true
;;
wayland*)
export XDG_RUNTIME_DIR="$(mktemp -p $(pwd) -d xdg-runtime-XXXXXX)"
dbus-run-session sh <<EOF
mutter --headless --no-x11 --wayland-display wayland-5 >&mutter.log &
weston --backend=headless-backend.so --socket=wayland-5 --idle-time=0 &
compositor=$!
export WAYLAND_DISPLAY=wayland-5
meson test -C ${builddir} \
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
--quiet \
--timeout-multiplier "${multiplier}" \
--print-errorlogs \
--setup=${backend} \
--suite=gtk \
--no-suite=failing \
--no-suite=flaky \
--no-suite=${backend}_failing \
--no-suite=gsk-compare-broadway
exit_code=$?
meson test -C ${builddir} \
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
--print-errorlogs \
--setup=${backend}_unstable \
--suite=flaky \
--suite=failing || true
kill ${compositor}
EOF
;;
broadway)
@@ -71,7 +62,8 @@ case "${backend}" in
export BROADWAY_DISPLAY=:5
meson test -C ${builddir} \
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
--quiet \
--timeout-multiplier "${multiplier}" \
--print-errorlogs \
--setup=${backend} \
--suite=gtk \
@@ -79,16 +71,6 @@ case "${backend}" in
--no-suite=flaky \
--no-suite=gsk-compare-opengl
# don't let Broadway failures fail the run, for now
exit_code=0
meson test -C ${builddir} \
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
--print-errorlogs \
--setup=${backend}_unstable \
--suite=flaky \
--suite=failing || true
kill ${server}
;;
@@ -101,20 +83,19 @@ esac
cd ${builddir}
for suffix in "" "_unstable"; do
$srcdir/.gitlab-ci/meson-junit-report.py \
$srcdir/.gitlab-ci/meson-junit-report.py \
--project-name=gtk \
--backend="${backend}${suffix}" \
--backend="${backend}" \
--job-id="${CI_JOB_NAME}" \
--output="report-${backend}${suffix}.xml" \
"meson-logs/testlog-${backend}${suffix}.json"
$srcdir/.gitlab-ci/meson-html-report.py \
--output="report-${backend}.xml" \
"meson-logs/testlog-${backend}.json"
$srcdir/.gitlab-ci/meson-html-report.py \
--project-name=gtk \
--backend="${backend}${suffix}" \
--backend="${backend}" \
--job-id="${CI_JOB_NAME}" \
--reftest-output-dir="testsuite/reftests/output/${backend}${suffix}" \
--output="report-${backend}${suffix}.html" \
"meson-logs/testlog-${backend}${suffix}.json"
done
--reftest-output-dir="testsuite/reftests/output/${backend}" \
--output="report-${backend}.html" \
"meson-logs/testlog-${backend}.json"
exit $exit_code

40
NEWS
View File

@@ -1,4 +1,7 @@
Overview of Changes in 4.11.2, xx-xx-xxxx
Overview of Changes in 4.11.3, xx-xx-xxxx
=========================================
Overview of Changes in 4.11.2, 09-05-2023
=========================================
* GtkGLArea:
@@ -7,6 +10,12 @@ Overview of Changes in 4.11.2, xx-xx-xxxx
* GtkListBox:
- Fix a problem with gtk_list_box_remove_all
* Add the GtkSectionModel interface, and implement it in most
of our list models
* GtkListView:
- Support displaying sections
* GtkCenterBox:
- Add a shrink-center-last property
@@ -23,6 +32,9 @@ Overview of Changes in 4.11.2, xx-xx-xxxx
- A few memory leak fixes
- Handle webdav in the pathbar
* GtkBox:
- Support baselines in vertical orientation with GtkBox:baseline-child
* Dialogs:
- Destroy windows promptly when the async callback finishes
- Detect absence of the OpenURI portal and fall back
@@ -33,12 +45,22 @@ Overview of Changes in 4.11.2, xx-xx-xxxx
* Accessibility:
- Fix alert dialogs in the a11y tree
- Improve accessibility of GtkShortcutsWindow
* Layout:
- Some fixes to baseline alignment
- Separate GTK_ALIGN_BASELINE_CENTER and _FILL
* CSS:
- Fix a crash with color transitions
* GSK:
- Fix problems with negative scales
- Improve scaling of offscreens for (cross-fades, masks, blends)
* GL:
- Add GdkGLTextureBuilder, a more flexible api for creating textures
- Support setting update regions for GL textures
- Ensure that we work with GLES 2
* Vulkan:
@@ -49,23 +71,37 @@ Overview of Changes in 4.11.2, xx-xx-xxxx
- Don't destroy wl_surfaces on hide
- Plug leaks of compositor-side resources
* X11:
- Fix artifacts in gnome-shell frame decorations
* Windows:
- Fix GL context initialization
* Inspector:
- Improve the action list
- Improve the accessibility pane
- Fix a crash
* Tools:
- gtk4-node-editor: Improve scaling
- gtk4-node-editor: Preserve aspect ratio of textures
- gtk4-node-editor: Add some smarter editing
- gtk4-demo: Make the stylus demo work with mice
* Deprecations:
- gtk_widget_get_allocated_width/height/baseline
- GTK_ALIGN_BASELINE
* Translation updates
Bulgarian
Chinese (China)
Friulian
Galician
Hebrew
Persian
Polish
Portuguese
Russian
`Russian
Turkish

View File

@@ -187,7 +187,7 @@
"--libdir=/app/lib",
"-Dvulkan=disabled",
"-Dbuildtype=debugoptimized",
"-Dprofile=devel"
"-Ddemo-profile=devel"
],
"sources" : [
{

View File

@@ -116,7 +116,7 @@
"--libdir=/app/lib",
"-Dvulkan=disabled",
"-Dbuildtype=debugoptimized",
"-Dprofile=devel"
"-Ddemo-profile=devel"
],
"sources" : [
{

View File

@@ -116,7 +116,7 @@
"--libdir=/app/lib",
"-Dvulkan=disabled",
"-Dbuildtype=debugoptimized",
"-Dprofile=devel"
"-Ddemo-profile=devel"
],
"sources" : [
{

View File

@@ -116,7 +116,7 @@
"--libdir=/app/lib",
"-Dvulkan=disabled",
"-Dbuildtype=debugoptimized",
"-Dprofile=devel"
"-Ddemo-profile=devel"
],
"sources" : [
{

View File

@@ -0,0 +1,201 @@
#!/usr/bin/env python3
#
# SPDX-FileCopyrightText: 2022 Collabora Inc.
# 2023 Emmanuele Bassi
#
# SPDX-License-Identifier: LGPL-2.1-or-later
#
# Original author: Xavier Claessens <xclaesse@gmail.com>
import argparse
import textwrap
from pathlib import Path
# Disable line length warnings as wrapping the C code templates would be hard
# flake8: noqa: E501
def gen_versions_macros(args, current_major_version, current_minor_version, current_micro_version):
with args.out_path.open("w", encoding="utf-8") as ofile, args.in_path.open(
"r", encoding="utf-8"
) as ifile:
for line in ifile.readlines():
if "@GDK_VERSIONS@" in line:
ofile.write(
textwrap.dedent(
f"""\
/**
* GDK_MAJOR_VERSION:
*
* The major version component of the library's version, e.g. "1" for "1.2.3".
*/
#define GDK_MAJOR_VERSION ({current_major_version})
/**
* GDK_MINOR_VERSION:
*
* The minor version component of the library's version, e.g. "2" for "1.2.3".
*/
#define GDK_MINOR_VERSION ({current_minor_version})
/**
* GDK_MICRO_VERSION:
*
* The micro version component of the library's version, e.g. "3" for "1.2.3".
*/
#define GDK_MICRO_VERSION ({current_micro_version})
"""
)
)
for minor in range(0, current_minor_version + 2, 2):
ofile.write(
textwrap.dedent(
f"""\
/**
* GDK_VERSION_{current_major_version}_{minor}:
*
* A macro that evaluates to the {current_major_version}.{minor} version of GTK, in a format
* that can be used by the C pre-processor.
*
* Since: {current_major_version}.{minor}
*/
#define GDK_VERSION_{current_major_version}_{minor} (G_ENCODE_VERSION ({current_major_version}, {minor}))
"""
)
)
else:
ofile.write(line)
def gen_visibility_macros(args, current_major_version, current_minor_version, current_micro_version):
"""
Generates a set of macros for each minor stable version of GTK
- GDK_DEPRECATED
- GDK_DEPRECATED_IN_…
- GDK_DEPRECATED_MACRO_IN_…
- GDK_DEPRECATED_ENUMERATOR_IN_…
- GDK_DEPRECATED_TYPE_IN_…
- GDK_AVAILABLE_IN_ALL
- GDK_AVAILABLE_IN_…
- GDK_AVAILABLE_STATIC_INLINE_IN_…
- GDK_AVAILABLE_MACRO_IN_…
- GDK_AVAILABLE_ENUMERATOR_IN_…
- GDK_AVAILABLE_TYPE_IN_…
- GDK_UNAVAILABLE(maj,min)
- GDK_UNAVAILABLE_STATIC_INLINE(maj,min)
"""
ns = args.namespace
with args.out_path.open("w", encoding="utf-8") as f:
f.write(
textwrap.dedent(
f"""\
#pragma once
#if (defined(_WIN32) || defined(__CYGWIN__)) && !defined({ns}_STATIC_COMPILATION)
# define _{ns}_EXPORT __declspec(dllexport)
# define _{ns}_IMPORT __declspec(dllimport)
#elif __GNUC__ >= 4
# define _{ns}_EXPORT __attribute__((visibility("default")))
# define _{ns}_IMPORT
#else
# define _{ns}_EXPORT
# define _{ns}_IMPORT
#endif
#ifdef GTK_COMPILATION
# define _{ns}_API _{ns}_EXPORT
#else
# define _{ns}_API _{ns}_IMPORT
#endif
#define _{ns}_EXTERN _{ns}_API extern
#define {ns}_VAR _{ns}_EXTERN
#define {ns}_AVAILABLE_IN_ALL _{ns}_EXTERN
#ifdef GDK_DISABLE_DEPRECATION_WARNINGS
#define {ns}_DEPRECATED _{ns}_EXTERN
#define {ns}_DEPRECATED_FOR(f) _{ns}_EXTERN
#define {ns}_UNAVAILABLE(maj,min) _{ns}_EXTERN
#define {ns}_UNAVAILABLE_STATIC_INLINE(maj,min)
#else
#define {ns}_DEPRECATED G_DEPRECATED _{ns}_EXTERN
#define {ns}_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) _{ns}_EXTERN
#define {ns}_UNAVAILABLE(maj,min) G_UNAVAILABLE(maj,min) _{ns}_EXTERN
#define {ns}_UNAVAILABLE_STATIC_INLINE(maj,min) G_UNAVAILABLE(maj,min)
#endif
"""
)
)
for minor in range(0, current_minor_version + 2, 2):
f.write(
textwrap.dedent(
f"""
#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_4_{minor}
#define {ns}_DEPRECATED_IN_{current_major_version}_{minor} {ns}_DEPRECATED
#define {ns}_DEPRECATED_IN_{current_major_version}_{minor}_FOR(f) {ns}_DEPRECATED_FOR (f)
#define {ns}_DEPRECATED_MACRO_IN_{current_major_version}_{minor} GDK_DEPRECATED_MACRO
#define {ns}_DEPRECATED_MACRO_IN_{current_major_version}_{minor}_FOR(f) GDK_DEPRECATED_MACRO_FOR (f)
#define {ns}_DEPRECATED_ENUMERATOR_IN_{current_major_version}_{minor} GDK_DEPRECATED_ENUMERATOR
#define {ns}_DEPRECATED_ENUMERATOR_IN_{current_major_version}_{minor}_FOR(f) GDK_DEPRECATED_ENUMERATOR_FOR (f)
#define {ns}_DEPRECATED_TYPE_IN_{current_major_version}_{minor} GDK_DEPRECATED_TYPE
#define {ns}_DEPRECATED_TYPE_IN_{current_major_version}_{minor}_FOR(f) GDK_DEPRECATED_TYPE_FOR (f)
#else
#define {ns}_DEPRECATED_IN_{current_major_version}_{minor} _{ns}_EXTERN
#define {ns}_DEPRECATED_IN_{current_major_version}_{minor}_FOR(f) _{ns}_EXTERN
#define {ns}_DEPRECATED_MACRO_IN_{current_major_version}_{minor}
#define {ns}_DEPRECATED_MACRO_IN_{current_major_version}_{minor}_FOR(f)
#define {ns}_DEPRECATED_ENUMERATOR_IN_{current_major_version}_{minor}
#define {ns}_DEPRECATED_ENUMERATOR_IN_{current_major_version}_{minor}_FOR(f)
#define {ns}_DEPRECATED_TYPE_IN_{current_major_version}_{minor}
#define {ns}_DEPRECATED_TYPE_IN_{current_major_version}_{minor}_FOR(f)
#endif
#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_{current_major_version}_{minor}
#define {ns}_AVAILABLE_IN_{current_major_version}_{minor} {ns}_UNAVAILABLE ({current_major_version}, {minor})
#define {ns}_AVAILABLE_STATIC_INLINE_IN_{current_major_version}_{minor} GDK_UNAVAILABLE_STATIC_INLINE ({current_major_version}, {minor})
#define {ns}_AVAILABLE_MACRO_IN_{current_major_version}_{minor} GDK_UNAVAILABLE_MACRO ({current_major_version}, {minor})
#define {ns}_AVAILABLE_ENUMERATOR_IN_{current_major_version}_{minor} GDK_UNAVAILABLE_ENUMERATOR ({current_major_version}, {minor})
#define {ns}_AVAILABLE_TYPE_IN_{current_major_version}_{minor} GDK_UNAVAILABLE_TYPE ({current_major_version}, {minor})
#else
#define {ns}_AVAILABLE_IN_{current_major_version}_{minor} _{ns}_EXTERN
#define {ns}_AVAILABLE_STATIC_INLINE_IN_{current_major_version}_{minor}
#define {ns}_AVAILABLE_MACRO_IN_{current_major_version}_{minor}
#define {ns}_AVAILABLE_ENUMERATOR_IN_{current_major_version}_{minor}
#define {ns}_AVAILABLE_TYPE_IN_{current_major_version}_{minor}
#endif
"""
)
)
def main():
parser = argparse.ArgumentParser()
parser.add_argument("gtk_version", help="Current GLib version")
subparsers = parser.add_subparsers()
versions_parser = subparsers.add_parser(
"versions-macros", help="Generate versions macros"
)
versions_parser.add_argument("in_path", help="input file", type=Path)
versions_parser.add_argument("out_path", help="output file", type=Path)
versions_parser.set_defaults(func=gen_versions_macros)
visibility_parser = subparsers.add_parser(
"visibility-macros", help="Generate visibility macros"
)
visibility_parser.add_argument("namespace", help="Macro namespace")
visibility_parser.add_argument("out_path", help="output file", type=Path)
visibility_parser.set_defaults(func=gen_visibility_macros)
args = parser.parse_args()
version = [int(i) for i in args.gtk_version.split(".")]
args.func(args, version[0], version[1], version[2])
if __name__ == "__main__":
main()

View File

@@ -116,7 +116,8 @@ effective_align (GtkAlign align,
return direction == GTK_TEXT_DIR_RTL ? GTK_ALIGN_START : GTK_ALIGN_END;
case GTK_ALIGN_FILL:
case GTK_ALIGN_CENTER:
case GTK_ALIGN_BASELINE:
case GTK_ALIGN_BASELINE_FILL:
case GTK_ALIGN_BASELINE_CENTER:
default:
return align;
}
@@ -258,7 +259,8 @@ blur_overlay_get_child_position (BlurOverlay *overlay,
case GTK_ALIGN_END:
alloc->x += width - alloc->width;
break;
case GTK_ALIGN_BASELINE:
case GTK_ALIGN_BASELINE_FILL:
case GTK_ALIGN_BASELINE_CENTER:
default:
g_assert_not_reached ();
break;
@@ -281,7 +283,8 @@ blur_overlay_get_child_position (BlurOverlay *overlay,
case GTK_ALIGN_END:
alloc->y += height - alloc->height;
break;
case GTK_ALIGN_BASELINE:
case GTK_ALIGN_BASELINE_FILL:
case GTK_ALIGN_BASELINE_CENTER:
default:
g_assert_not_reached ();
break;

View File

@@ -51,15 +51,11 @@ struct _BlurOverlayClass
GtkAllocation *allocation);
};
GDK_AVAILABLE_IN_ALL
GType blur_overlay_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GtkWidget *blur_overlay_new (void);
GDK_AVAILABLE_IN_ALL
void blur_overlay_add_overlay (BlurOverlay *overlay,
GtkWidget *widget,
double blur);
GDK_AVAILABLE_IN_ALL
void blur_overlay_set_child (BlurOverlay *overlay,
GtkWidget *widget);

View File

@@ -195,6 +195,9 @@
<gresource prefix="/listview_settings">
<file>listview_settings.ui</file>
</gresource>
<gresource prefix="/listview_settings2">
<file>listview_settings2.ui</file>
</gresource>
<gresource prefix="/listview_ucd_data/">
<file>ucdnames.data</file>
</gresource>
@@ -312,6 +315,7 @@
<file>listview_minesweeper.c</file>
<file>listview_selections.c</file>
<file>listview_settings.c</file>
<file>listview_settings2.c</file>
<file>listview_ucd.c</file>
<file>listview_weather.c</file>
<file>listview_words.c</file>

View File

@@ -1294,18 +1294,18 @@ add_axis (hb_face_t *hb_face,
axis_label = gtk_label_new (name);
gtk_widget_set_halign (axis_label, GTK_ALIGN_START);
gtk_widget_set_valign (axis_label, GTK_ALIGN_BASELINE);
gtk_widget_set_valign (axis_label, GTK_ALIGN_BASELINE_FILL);
gtk_grid_attach (GTK_GRID (demo->variations_grid), axis_label, 0, i, 1, 1);
adjustment = gtk_adjustment_new (value, ax->min_value, ax->max_value,
1.0, 10.0, 0.0);
axis_scale = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, adjustment);
gtk_scale_add_mark (GTK_SCALE (axis_scale), ax->default_value, GTK_POS_TOP, NULL);
gtk_widget_set_valign (axis_scale, GTK_ALIGN_BASELINE);
gtk_widget_set_valign (axis_scale, GTK_ALIGN_BASELINE_FILL);
gtk_widget_set_hexpand (axis_scale, TRUE);
gtk_widget_set_size_request (axis_scale, 100, -1);
gtk_grid_attach (GTK_GRID (demo->variations_grid), axis_scale, 1, i, 1, 1);
axis_entry = gtk_entry_new ();
gtk_widget_set_valign (axis_entry, GTK_ALIGN_BASELINE);
gtk_widget_set_valign (axis_entry, GTK_ALIGN_BASELINE_FILL);
gtk_editable_set_width_chars (GTK_EDITABLE (axis_entry), 4);
gtk_editable_set_max_width_chars (GTK_EDITABLE (axis_entry), 4);
gtk_widget_set_hexpand (axis_entry, FALSE);
@@ -1562,14 +1562,14 @@ update_font_variations (void)
label = gtk_label_new ("Instance");
gtk_label_set_xalign (GTK_LABEL (label), 0);
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE_FILL);
gtk_grid_attach (GTK_GRID (demo->variations_grid), label, 0, -1, 1, 1);
strings = gtk_string_list_new (NULL);
combo = gtk_drop_down_new (G_LIST_MODEL (strings), NULL);
gtk_widget_set_halign (combo, GTK_ALIGN_START);
gtk_widget_set_valign (combo, GTK_ALIGN_BASELINE);
gtk_widget_set_valign (combo, GTK_ALIGN_BASELINE_FILL);
gtk_string_list_append (strings, "");

View File

@@ -27,24 +27,17 @@ G_BEGIN_DECLS
#define GSK_TYPE_SHADER_PAINTABLE (gsk_shader_paintable_get_type ())
GDK_AVAILABLE_IN_ALL
G_DECLARE_FINAL_TYPE (GskShaderPaintable, gsk_shader_paintable, GSK, SHADER_PAINTABLE, GObject)
GDK_AVAILABLE_IN_ALL
GdkPaintable * gsk_shader_paintable_new (GskGLShader *shader,
GBytes *data);
GDK_AVAILABLE_IN_ALL
GskGLShader * gsk_shader_paintable_get_shader (GskShaderPaintable *self);
GDK_AVAILABLE_IN_ALL
void gsk_shader_paintable_set_shader (GskShaderPaintable *self,
GskGLShader *shader);
GDK_AVAILABLE_IN_ALL
GBytes * gsk_shader_paintable_get_args (GskShaderPaintable *self);
GDK_AVAILABLE_IN_ALL
void gsk_shader_paintable_set_args (GskShaderPaintable *self,
GBytes *data);
GDK_AVAILABLE_IN_ALL
void gsk_shader_paintable_update_time (GskShaderPaintable *self,
int time_idx,
gint64 frame_time);

View File

@@ -370,7 +370,7 @@ do_iconscroll (GtkWidget *do_widget)
set_widget_type (0);
label = GTK_WIDGET (gtk_builder_get_object (builder, "fps_label"));
id = g_timeout_add (500, update_fps, label);
id = g_timeout_add_full (G_PRIORITY_HIGH, 500, update_fps, label, NULL);
g_object_set_data_full (G_OBJECT (label), "timeout",
GUINT_TO_POINTER (id), remove_timeout);

View File

@@ -64,6 +64,8 @@
</child>
<child>
<object class="GtkLabel" id="short_time_label">
<property name="hexpand">1</property>
<property name="xalign">1</property>
<property name="valign">baseline</property>
<property name="label" translatable="yes">38m</property>
<style>

View File

@@ -14,138 +14,7 @@
#include <gtk/gtk.h>
#include <stdlib.h>
/* Create an object that wraps GSettingsSchemaKey because that's a boxed type */
typedef struct _SettingsKey SettingsKey;
struct _SettingsKey
{
GObject parent_instance;
GSettings *settings;
GSettingsSchemaKey *key;
};
enum {
PROP_0,
PROP_NAME,
PROP_SUMMARY,
PROP_DESCRIPTION,
PROP_VALUE,
PROP_TYPE,
PROP_DEFAULT_VALUE,
N_PROPS
};
#define SETTINGS_TYPE_KEY (settings_key_get_type ())
G_DECLARE_FINAL_TYPE (SettingsKey, settings_key, SETTINGS, KEY, GObject);
G_DEFINE_TYPE (SettingsKey, settings_key, G_TYPE_OBJECT);
static GParamSpec *properties[N_PROPS] = { NULL, };
static void
settings_key_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
SettingsKey *self = SETTINGS_KEY (object);
switch (property_id)
{
case PROP_DESCRIPTION:
g_value_set_string (value, g_settings_schema_key_get_description (self->key));
break;
case PROP_NAME:
g_value_set_string (value, g_settings_schema_key_get_name (self->key));
break;
case PROP_SUMMARY:
g_value_set_string (value, g_settings_schema_key_get_summary (self->key));
break;
case PROP_VALUE:
{
GVariant *variant = g_settings_get_value (self->settings, g_settings_schema_key_get_name (self->key));
g_value_take_string (value, g_variant_print (variant, FALSE));
g_variant_unref (variant);
}
break;
case PROP_TYPE:
{
const GVariantType *type = g_settings_schema_key_get_value_type (self->key);
g_value_set_string (value, g_variant_type_peek_string (type));
}
break;
case PROP_DEFAULT_VALUE:
{
GVariant *variant = g_settings_schema_key_get_default_value (self->key);
g_value_take_string (value, g_variant_print (variant, FALSE));
g_variant_unref (variant);
}
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
settings_key_finalize (GObject *object)
{
SettingsKey *self = SETTINGS_KEY (object);
g_object_unref (self->settings);
g_settings_schema_key_unref (self->key);
G_OBJECT_CLASS (settings_key_parent_class)->finalize (object);
}
static void
settings_key_class_init (SettingsKeyClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = settings_key_finalize;
gobject_class->get_property = settings_key_get_property;
properties[PROP_DESCRIPTION] =
g_param_spec_string ("description", NULL, NULL, NULL, G_PARAM_READABLE);
properties[PROP_NAME] =
g_param_spec_string ("name", NULL, NULL, NULL, G_PARAM_READABLE);
properties[PROP_SUMMARY] =
g_param_spec_string ("summary", NULL, NULL, NULL, G_PARAM_READABLE);
properties[PROP_VALUE] =
g_param_spec_string ("value", NULL, NULL, NULL, G_PARAM_READABLE);
properties[PROP_TYPE] =
g_param_spec_string ("type", NULL, NULL, NULL, G_PARAM_READABLE);
properties[PROP_DEFAULT_VALUE] =
g_param_spec_string ("default-value", NULL, NULL, NULL, G_PARAM_READABLE);
g_object_class_install_properties (gobject_class, N_PROPS, properties);
}
static void
settings_key_init (SettingsKey *self)
{
}
static SettingsKey *
settings_key_new (GSettings *settings,
GSettingsSchemaKey *key)
{
SettingsKey *result = g_object_new (SETTINGS_TYPE_KEY, NULL);
result->settings = g_object_ref (settings);
result->key = g_settings_schema_key_ref (key);
return result;
}
#include "settings-key.h"
static void
item_value_changed (GtkEditableLabel *label,
@@ -153,6 +22,7 @@ item_value_changed (GtkEditableLabel *label,
GtkColumnViewCell *cell)
{
SettingsKey *self;
GSettingsSchemaKey *key;
const char *text;
const GVariantType *type;
GVariant *variant;
@@ -163,9 +33,10 @@ item_value_changed (GtkEditableLabel *label,
text = gtk_editable_get_text (GTK_EDITABLE (label));
self = gtk_column_view_cell_get_item (cell);
key = settings_key_get_key (self);
type = g_settings_schema_key_get_value_type (self->key);
name = g_settings_schema_key_get_name (self->key);
type = g_settings_schema_key_get_value_type (key);
name = g_settings_schema_key_get_name (key);
variant = g_variant_parse (type, text, NULL, NULL, &error);
if (!variant)
@@ -175,13 +46,13 @@ item_value_changed (GtkEditableLabel *label,
goto revert;
}
if (!g_settings_schema_key_range_check (self->key, variant))
if (!g_settings_schema_key_range_check (key, variant))
{
g_warning ("Not a valid value for %s", name);
goto revert;
}
g_settings_set_value (self->settings, name, variant);
g_settings_set_value (settings_key_get_settings (self), name, variant);
g_variant_unref (variant);
return;

View File

@@ -0,0 +1,230 @@
/* Lists/Alternative Settings
* #Keywords: GtkListHeaderFactory, GtkSectionModel
*
* This demo shows an alternative settings viewer for GSettings.
*
* It demonstrates how to implement support for sections with GtkListView.
*
* It also shows how to quickly flatten a large tree of items into a list
* that can be filtered to find the items one is looking for.
*/
#include <gtk/gtk.h>
#include "settings-key.h"
static void
item_value_changed (GtkEditableLabel *label,
GParamSpec *pspec,
GtkColumnViewCell *cell)
{
SettingsKey *self;
GSettingsSchemaKey *key;
const char *text;
const GVariantType *type;
GVariant *variant;
GError *error = NULL;
const char *name;
char *value;
text = gtk_editable_get_text (GTK_EDITABLE (label));
self = gtk_column_view_cell_get_item (cell);
key = settings_key_get_key (self);
type = g_settings_schema_key_get_value_type (key);
name = g_settings_schema_key_get_name (key);
variant = g_variant_parse (type, text, NULL, NULL, &error);
if (!variant)
{
g_warning ("%s", error->message);
g_clear_error (&error);
goto revert;
}
if (!g_settings_schema_key_range_check (key, variant))
{
g_warning ("Not a valid value for %s", name);
goto revert;
}
g_settings_set_value (settings_key_get_settings (self), name, variant);
g_variant_unref (variant);
return;
revert:
gtk_widget_error_bell (GTK_WIDGET (label));
g_object_get (self, "value", &value, NULL);
gtk_editable_set_text (GTK_EDITABLE (label), value);
g_free (value);
}
static int
strvcmp (gconstpointer p1,
gconstpointer p2)
{
const char * const *s1 = p1;
const char * const *s2 = p2;
return strcmp (*s1, *s2);
}
static gpointer
map_settings_to_keys (gpointer item,
gpointer unused)
{
GSettings *settings = item;
GSettingsSchema *schema;
GListStore *store;
char **keys;
guint i;
g_object_get (settings, "settings-schema", &schema, NULL);
store = g_list_store_new (SETTINGS_TYPE_KEY);
keys = g_settings_schema_list_keys (schema);
for (i = 0; keys[i] != NULL; i++)
{
GSettingsSchemaKey *almost_there = g_settings_schema_get_key (schema, keys[i]);
SettingsKey *finally = settings_key_new (settings, almost_there);
g_list_store_append (store, finally);
g_object_unref (finally);
g_settings_schema_key_unref (almost_there);
}
g_strfreev (keys);
g_settings_schema_unref (schema);
g_object_unref (settings);
return store;
}
static GListModel *
create_settings_model (gpointer item,
gpointer unused)
{
GSettings *settings = item;
char **schemas;
GListStore *result;
guint i;
if (settings == NULL)
{
g_settings_schema_source_list_schemas (g_settings_schema_source_get_default (),
TRUE,
&schemas,
NULL);
}
else
{
schemas = g_settings_list_children (settings);
}
if (schemas == NULL || schemas[0] == NULL)
{
g_free (schemas);
return NULL;
}
qsort (schemas, g_strv_length (schemas), sizeof (char *), strvcmp);
result = g_list_store_new (G_TYPE_SETTINGS);
for (i = 0; schemas[i] != NULL; i++)
{
GSettings *child;
if (settings == NULL)
child = g_settings_new (schemas[i]);
else
child = g_settings_get_child (settings, schemas[i]);
g_list_store_append (result, child);
g_object_unref (child);
}
g_strfreev (schemas);
return G_LIST_MODEL (result);
}
static void
search_enabled (GtkSearchEntry *entry)
{
gtk_editable_set_text (GTK_EDITABLE (entry), "");
}
static void
stop_search (GtkSearchEntry *entry,
gpointer data)
{
gtk_editable_set_text (GTK_EDITABLE (entry), "");
}
static GtkWidget *window = NULL;
GtkWidget *
do_listview_settings2 (GtkWidget *do_widget)
{
if (window == NULL)
{
GtkListView *listview;
GListModel *model;
GtkTreeListModel *treemodel;
GtkNoSelection *selection;
GtkBuilderScope *scope;
GtkBuilder *builder;
GError *error = NULL;
GtkFilter *filter;
g_type_ensure (SETTINGS_TYPE_KEY);
scope = gtk_builder_cscope_new ();
gtk_builder_cscope_add_callback (scope, search_enabled);
gtk_builder_cscope_add_callback (scope, stop_search);
gtk_builder_cscope_add_callback (scope, settings_key_get_search_string);
gtk_builder_cscope_add_callback (scope, item_value_changed);
builder = gtk_builder_new ();
gtk_builder_set_scope (builder, scope);
g_object_unref (scope);
gtk_builder_add_from_resource (builder, "/listview_settings2/listview_settings2.ui", &error);
g_assert_no_error (error);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *) &window);
listview = GTK_LIST_VIEW (gtk_builder_get_object (builder, "listview"));
filter = GTK_FILTER (gtk_builder_get_object (builder, "filter"));
model = create_settings_model (NULL, NULL);
treemodel = gtk_tree_list_model_new (model,
TRUE,
TRUE,
create_settings_model,
NULL,
NULL);
model = G_LIST_MODEL (gtk_map_list_model_new (G_LIST_MODEL (treemodel), map_settings_to_keys, NULL, NULL));
model = G_LIST_MODEL (gtk_flatten_list_model_new (model));
model = G_LIST_MODEL (gtk_filter_list_model_new (model, g_object_ref (filter)));
selection = gtk_no_selection_new (model);
gtk_list_view_set_model (GTK_LIST_VIEW (listview), GTK_SELECTION_MODEL (selection));
g_object_unref (selection);
g_object_unref (builder);
}
if (!gtk_widget_get_visible (window))
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@@ -0,0 +1,130 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkStringFilter" id="filter">
<property name="expression">
<closure type="gchararray" function="settings_key_get_search_string" />
</property>
<property name="search" bind-source="entry" bind-property="text" />
</object>
<object class="GtkWindow" id="window">
<property name="title" translatable="yes">Settings</property>
<property name="default-width">640</property>
<property name="default-height">480</property>
<child type="titlebar">
<object class="GtkHeaderBar">
<child type="end">
<object class="GtkToggleButton" id="search_button">
<property name="icon-name">system-search-symbolic</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkSearchBar">
<property name="search-mode-enabled" bind-source="search_button" bind-property="active" bind-flags="bidirectional"/>
<signal name="notify::search-mode-enabled" handler="search_enabled" object="entry"/>
<child>
<object class="GtkSearchEntry" id="entry">
<signal name="stop-search" handler="stop_search"/>
</object>
</child>
</object>
</child>
<child>
<object class="GtkScrolledWindow">
<child>
<object class="GtkListView" id="listview">
<property name="vexpand">1</property>
<style>
<class name="rich-list"/>
</style>
<property name="factory">
<object class="GtkBuilderListItemFactory">
<property name="bytes"><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GtkListItem">
<property name="child">
<object class="GtkBox">
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel">
<property name="xalign">0</property>
<binding name="label">
<lookup name="name" type="SettingsKey">
<lookup name="item">GtkListItem</lookup>
</lookup>
</binding>
</object>
</child>
<child>
<object class="GtkLabel">
<style>
<class name="dim-label"/>
</style>
<property name="xalign">0</property>
<property name="ellipsize">end</property>
<binding name="label">
<lookup name="summary" type="SettingsKey">
<lookup name="item">GtkListItem</lookup>
</lookup>
</binding>
</object>
</child>
</object>
</child>
<child>
<object class="GtkEntry">
<property name="hexpand">1</property>
<property name="halign">end</property>
<binding name="text">
<lookup name="value" type="SettingsKey">
<lookup name="item">GtkListItem</lookup>
</lookup>
</binding>
<signal name="notify::label" handler="item_value_changed"/>
</object>
</child>
</object>
</property>
</template>
</interface>
]]></property>
</object>
</property>
<property name="header-factory">
<object class="GtkBuilderListItemFactory">
<property name="bytes"><![CDATA[
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="GtkListHeader">
<property name="child">
<object class="GtkLabel">
<property name="xalign">0</property>
<binding name="label">
<lookup name="schema" type="GSettings">
<lookup name="settings" type="SettingsKey">
<lookup name="item">GtkListHeader</lookup>
</lookup>
</lookup>
</binding>
</object>
</property>
</template>
</interface>
]]></property>
</object>
</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</interface>

View File

@@ -57,6 +57,7 @@ demos = files([
'listview_minesweeper.c',
'listview_selections.c',
'listview_settings.c',
'listview_settings2.c',
'listview_ucd.c',
'listview_weather.c',
'listview_words.c',
@@ -131,6 +132,7 @@ extra_demo_sources = files([
'demo4widget.c',
'pixbufpaintable.c',
'script-names.c',
'settings-key.c',
'unicode-names.c',
'suggestionentry.c',
'language-names.c',
@@ -233,8 +235,7 @@ endif
demo_cflags = []
foreach flag: common_cflags
if flag not in ['-Werror=missing-prototypes', '-Wmissing-prototypes',
'-Werror=missing-declarations', '-Wmissing-declarations',
'-fvisibility=hidden']
'-Werror=missing-declarations', '-Wmissing-declarations']
demo_cflags += flag
endif
endforeach

View File

@@ -0,0 +1,165 @@
#include "settings-key.h"
/* Create an object that wraps GSettingsSchemaKey because that's a boxed type */
struct _SettingsKey
{
GObject parent_instance;
GSettings *settings;
GSettingsSchemaKey *key;
};
enum {
PROP_0,
PROP_NAME,
PROP_SETTINGS,
PROP_SUMMARY,
PROP_DESCRIPTION,
PROP_VALUE,
PROP_TYPE,
PROP_DEFAULT_VALUE,
N_PROPS
};
G_DEFINE_TYPE (SettingsKey, settings_key, G_TYPE_OBJECT);
static GParamSpec *properties[N_PROPS] = { NULL, };
static void
settings_key_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
SettingsKey *self = SETTINGS_KEY (object);
switch (property_id)
{
case PROP_DESCRIPTION:
g_value_set_string (value, g_settings_schema_key_get_description (self->key));
break;
case PROP_NAME:
g_value_set_string (value, g_settings_schema_key_get_name (self->key));
break;
case PROP_SUMMARY:
g_value_set_string (value, g_settings_schema_key_get_summary (self->key));
break;
case PROP_VALUE:
{
GVariant *variant = g_settings_get_value (self->settings, g_settings_schema_key_get_name (self->key));
g_value_take_string (value, g_variant_print (variant, FALSE));
g_variant_unref (variant);
}
break;
case PROP_TYPE:
{
const GVariantType *type = g_settings_schema_key_get_value_type (self->key);
g_value_set_string (value, g_variant_type_peek_string (type));
}
break;
case PROP_DEFAULT_VALUE:
{
GVariant *variant = g_settings_schema_key_get_default_value (self->key);
g_value_take_string (value, g_variant_print (variant, FALSE));
g_variant_unref (variant);
}
break;
case PROP_SETTINGS:
g_value_set_object (value, self->settings);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
settings_key_finalize (GObject *object)
{
SettingsKey *self = SETTINGS_KEY (object);
g_object_unref (self->settings);
g_settings_schema_key_unref (self->key);
G_OBJECT_CLASS (settings_key_parent_class)->finalize (object);
}
static void
settings_key_class_init (SettingsKeyClass *klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = settings_key_finalize;
gobject_class->get_property = settings_key_get_property;
properties[PROP_DESCRIPTION] =
g_param_spec_string ("description", NULL, NULL, NULL, G_PARAM_READABLE);
properties[PROP_NAME] =
g_param_spec_string ("name", NULL, NULL, NULL, G_PARAM_READABLE);
properties[PROP_SETTINGS] =
g_param_spec_object ("settings", NULL, NULL, G_TYPE_SETTINGS, G_PARAM_READABLE);
properties[PROP_SUMMARY] =
g_param_spec_string ("summary", NULL, NULL, NULL, G_PARAM_READABLE);
properties[PROP_VALUE] =
g_param_spec_string ("value", NULL, NULL, NULL, G_PARAM_READABLE);
properties[PROP_TYPE] =
g_param_spec_string ("type", NULL, NULL, NULL, G_PARAM_READABLE);
properties[PROP_DEFAULT_VALUE] =
g_param_spec_string ("default-value", NULL, NULL, NULL, G_PARAM_READABLE);
g_object_class_install_properties (gobject_class, N_PROPS, properties);
}
static void
settings_key_init (SettingsKey *self)
{
}
SettingsKey *
settings_key_new (GSettings *settings,
GSettingsSchemaKey *key)
{
SettingsKey *result = g_object_new (SETTINGS_TYPE_KEY, NULL);
result->settings = g_object_ref (settings);
result->key = g_settings_schema_key_ref (key);
return result;
}
GSettingsSchemaKey *
settings_key_get_key (SettingsKey *self)
{
return self->key;
}
GSettings *
settings_key_get_settings (SettingsKey *self)
{
return self->settings;
}
char *
settings_key_get_search_string (SettingsKey *self)
{
char *schema, *result;
g_object_get (self->settings, "schema-id", &schema, NULL);
result = g_strconcat (g_settings_schema_key_get_name (self->key), " ",
g_settings_schema_key_get_summary (self->key), " ",
schema,
NULL);
g_free (schema);
return result;
}

View File

@@ -0,0 +1,17 @@
#pragma once
#include <gtk/gtk.h>
#include <stdlib.h>
/* Create an object that wraps GSettingsSchemaKey because that's a boxed type */
typedef struct _SettingsKey SettingsKey;
#define SETTINGS_TYPE_KEY (settings_key_get_type ())
G_DECLARE_FINAL_TYPE (SettingsKey, settings_key, SETTINGS, KEY, GObject);
SettingsKey * settings_key_new (GSettings *settings,
GSettingsSchemaKey *key);
GSettingsSchemaKey * settings_key_get_key (SettingsKey *self);
GSettings * settings_key_get_settings (SettingsKey *self);
char * settings_key_get_search_string (SettingsKey *self);

View File

@@ -28,14 +28,14 @@ add_row (GtkGrid *table,
label = gtk_label_new_with_mnemonic (label_text);
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE_FILL);
gtk_widget_set_hexpand (label, TRUE);
gtk_grid_attach (table, label, 0, row, 1, 1);
dropdown = gtk_drop_down_new_from_strings (options);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), dropdown);
gtk_widget_set_halign (dropdown, GTK_ALIGN_END);
gtk_widget_set_valign (dropdown, GTK_ALIGN_BASELINE);
gtk_widget_set_valign (dropdown, GTK_ALIGN_BASELINE_FILL);
gtk_size_group_add_widget (size_group, dropdown);
gtk_grid_attach (table, dropdown, 1, row, 1, 1);
}

View File

@@ -1,5 +1,5 @@
gen_demo_header = find_program('../build-aux/meson/gen-demo-header.py')
demo_profile = get_option('profile')
demo_profile = get_option('demo-profile')
demo_conf_h = declare_dependency(
sources: custom_target('demo-header',

View File

@@ -64,6 +64,7 @@ struct _NodeEditorWindow
GListStore *renderers;
GskRenderNode *node;
GFile *file;
GFileMonitor *file_monitor;
GArray *errors;
@@ -544,12 +545,14 @@ node_editor_window_load (NodeEditorWindow *self,
{
GError *error = NULL;
g_clear_object (&self->file);
g_clear_object (&self->file_monitor);
if (!load_file_contents (self, file))
return FALSE;
self->file_monitor = g_file_monitor_file (file, G_FILE_MONITOR_NONE, NULL, &error);
self->file = g_object_ref (file);
self->file_monitor = g_file_monitor_file (self->file, G_FILE_MONITOR_NONE, NULL, &error);
if (error)
{
@@ -586,13 +589,21 @@ static void
show_open_filechooser (NodeEditorWindow *self)
{
GtkFileDialog *dialog;
GFile *cwd;
dialog = gtk_file_dialog_new ();
gtk_file_dialog_set_title (dialog, "Open node file");
cwd = g_file_new_for_path (".");
gtk_file_dialog_set_initial_folder (dialog, cwd);
g_object_unref (cwd);
if (self->file)
{
gtk_file_dialog_set_initial_file (dialog, self->file);
}
else
{
GFile *cwd;
cwd = g_file_new_for_path (".");
gtk_file_dialog_set_initial_folder (dialog, cwd);
g_object_unref (cwd);
}
gtk_file_dialog_open (dialog, GTK_WINDOW (self),
NULL, open_response_cb, self);
g_object_unref (dialog);
@@ -650,14 +661,21 @@ save_cb (GtkWidget *button,
NodeEditorWindow *self)
{
GtkFileDialog *dialog;
GFile *cwd;
dialog = gtk_file_dialog_new ();
gtk_file_dialog_set_title (dialog, "Save node");
cwd = g_file_new_for_path (".");
gtk_file_dialog_set_initial_folder (dialog, cwd);
gtk_file_dialog_set_initial_name (dialog, "demo.node");
g_object_unref (cwd);
if (self->file)
{
gtk_file_dialog_set_initial_file (dialog, self->file);
}
else
{
GFile *cwd = g_file_new_for_path (".");
gtk_file_dialog_set_initial_folder (dialog, cwd);
gtk_file_dialog_set_initial_name (dialog, "demo.node");
g_object_unref (cwd);
}
gtk_file_dialog_save (dialog,
GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (button))),
NULL,
@@ -1091,6 +1109,8 @@ node_editor_window_finalize (GObject *object)
g_clear_pointer (&self->node, gsk_render_node_unref);
g_clear_object (&self->renderers);
g_clear_object (&self->file_monitor);
g_clear_object (&self->file);
G_OBJECT_CLASS (node_editor_window_parent_class)->finalize (object);
}
@@ -1170,11 +1190,362 @@ node_editor_window_unrealize (GtkWidget *widget)
GTK_WIDGET_CLASS (node_editor_window_parent_class)->unrealize (widget);
}
typedef struct
{
NodeEditorWindow *self;
GtkTextIter start, end;
} Selection;
static void
color_cb (GObject *source,
GAsyncResult *result,
gpointer data)
{
GtkColorDialog *dialog = GTK_COLOR_DIALOG (source);
Selection *selection = data;
NodeEditorWindow *self = selection->self;
GdkRGBA *color;
char *text;
GError *error = NULL;
GtkTextBuffer *buffer;
color = gtk_color_dialog_choose_rgba_finish (dialog, result, &error);
if (!color)
{
g_print ("%s\n", error->message);
g_error_free (error);
g_free (selection);
return;
}
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (self->text_view));
text = gdk_rgba_to_string (color);
gtk_text_buffer_delete (buffer, &selection->start, &selection->end);
gtk_text_buffer_insert (buffer, &selection->start, text, -1);
g_free (text);
gdk_rgba_free (color);
g_free (selection);
}
static void
font_cb (GObject *source,
GAsyncResult *result,
gpointer data)
{
GtkFontDialog *dialog = GTK_FONT_DIALOG (source);
Selection *selection = data;
NodeEditorWindow *self = selection->self;
GError *error = NULL;
PangoFontDescription *desc;
GtkTextBuffer *buffer;
char *text;
desc = gtk_font_dialog_choose_font_finish (dialog, result, &error);
if (!desc)
{
g_print ("%s\n", error->message);
g_error_free (error);
g_free (selection);
return;
}
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (self->text_view));
text = pango_font_description_to_string (desc);
gtk_text_buffer_delete (buffer, &selection->start, &selection->end);
gtk_text_buffer_insert (buffer, &selection->start, text, -1);
g_free (text);
pango_font_description_free (desc);
g_free (selection);
}
static void
file_cb (GObject *source,
GAsyncResult *result,
gpointer data)
{
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
Selection *selection = data;
NodeEditorWindow *self = selection->self;
GError *error = NULL;
GFile *file;
GtkTextBuffer *buffer;
char *text;
file = gtk_file_dialog_open_finish (dialog, result, &error);
if (!file)
{
g_print ("%s\n", error->message);
g_error_free (error);
g_free (selection);
return;
}
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (self->text_view));
text = g_file_get_uri (file);
gtk_text_buffer_delete (buffer, &selection->start, &selection->end);
gtk_text_buffer_insert (buffer, &selection->start, text, -1);
g_free (text);
g_object_unref (file);
g_free (selection);
}
static void
key_pressed (GtkEventControllerKey *controller,
unsigned int keyval,
unsigned int keycode,
GdkModifierType state,
gpointer data)
{
GtkWidget *dd = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (controller));
Selection *selection = data;
NodeEditorWindow *self = selection->self;
unsigned int selected;
GtkStringList *strings;
GtkTextBuffer *buffer;
const char *text;
if (keyval != GDK_KEY_Escape)
return;
strings = GTK_STRING_LIST (gtk_drop_down_get_model (GTK_DROP_DOWN (dd)));
selected = gtk_drop_down_get_selected (GTK_DROP_DOWN (dd));
text = gtk_string_list_get_string (strings, selected);
gtk_text_view_remove (GTK_TEXT_VIEW (self->text_view), dd);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (self->text_view));
gtk_text_iter_backward_search (&selection->start, "mode:", 0, NULL, &selection->start, NULL);
gtk_text_iter_forward_search (&selection->start, ";", 0, &selection->end, NULL, NULL);
gtk_text_buffer_delete (buffer, &selection->start, &selection->end);
gtk_text_buffer_insert (buffer, &selection->start, " ", -1);
gtk_text_buffer_insert (buffer, &selection->start, text, -1);
}
static void
node_editor_window_edit (NodeEditorWindow *self,
GtkTextIter *iter)
{
GtkTextIter start, end;
GtkTextBuffer *buffer;
Selection *selection;
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (self->text_view));
gtk_text_iter_set_line_offset (iter, 0);
if (gtk_text_iter_forward_search (iter, ";", 0, &end, NULL, NULL) &&
gtk_text_iter_forward_search (iter, "color:", 0, NULL, &start, &end))
{
GtkColorDialog *dialog;
GdkRGBA color;
char *text;
while (g_unichar_isspace (gtk_text_iter_get_char (&start)))
gtk_text_iter_forward_char (&start);
gtk_text_buffer_select_range (buffer, &start, &end);
text = gtk_text_buffer_get_text (buffer, &start, &end, TRUE);
gdk_rgba_parse (&color, text);
g_free (text);
selection = g_new0 (Selection, 1);
selection->self = self;
selection->start = start;
selection->end = end;
dialog = gtk_color_dialog_new ();
gtk_color_dialog_choose_rgba (dialog, GTK_WINDOW (self), &color, NULL, color_cb, selection);
}
else if (gtk_text_iter_forward_search (iter, ";", 0, &end, NULL, NULL) &&
gtk_text_iter_forward_search (iter, "font:", 0, NULL, &start, &end))
{
GtkFontDialog *dialog;
PangoFontDescription *desc;
char *text;
while (g_unichar_isspace (gtk_text_iter_get_char (&start)))
gtk_text_iter_forward_char (&start);
/* Skip the quotes */
gtk_text_iter_forward_char (&start);
gtk_text_iter_backward_char (&end);
gtk_text_buffer_select_range (buffer, &start, &end);
text = gtk_text_buffer_get_text (buffer, &start, &end, TRUE);
desc = pango_font_description_from_string (text);
g_free (text);
selection = g_new0 (Selection, 1);
selection->self = self;
selection->start = start;
selection->end = end;
dialog = gtk_font_dialog_new ();
gtk_font_dialog_choose_font (dialog, GTK_WINDOW (self), desc, NULL, font_cb, selection);
pango_font_description_free (desc);
}
else if (gtk_text_iter_forward_search (iter, ";", 0, &end, NULL, NULL) &&
gtk_text_iter_forward_search (iter, "mode:", 0, NULL, &start, &end))
{
/* Assume we have a blend node, for now */
GEnumClass *class;
GtkStringList *strings;
GtkWidget *dd;
GtkTextChildAnchor *anchor;
unsigned int selected = 0;
GtkEventController *key_controller;
gboolean is_blend_mode = FALSE;
char *text;
while (g_unichar_isspace (gtk_text_iter_get_char (&start)))
gtk_text_iter_forward_char (&start);
text = gtk_text_buffer_get_text (buffer, &start, &end, TRUE);
strings = gtk_string_list_new (NULL);
class = g_type_class_ref (GSK_TYPE_BLEND_MODE);
for (unsigned int i = 0; i < class->n_values; i++)
{
if (strcmp (class->values[i].value_nick, text) == 0)
is_blend_mode = TRUE;
}
g_type_class_unref (class);
if (is_blend_mode)
class = g_type_class_ref (GSK_TYPE_BLEND_MODE);
else
class = g_type_class_ref (GSK_TYPE_MASK_MODE);
for (unsigned int i = 0; i < class->n_values; i++)
{
if (i == 0 && is_blend_mode)
gtk_string_list_append (strings, "normal");
else
gtk_string_list_append (strings, class->values[i].value_nick);
if (strcmp (class->values[i].value_nick, text) == 0)
selected = i;
}
g_type_class_unref (class);
gtk_text_buffer_delete (buffer, &start, &end);
anchor = gtk_text_buffer_create_child_anchor (buffer, &start);
dd = gtk_drop_down_new (G_LIST_MODEL (strings), NULL);
gtk_drop_down_set_selected (GTK_DROP_DOWN (dd), selected);
gtk_text_view_add_child_at_anchor (GTK_TEXT_VIEW (self->text_view), dd, anchor);
selection = g_new0 (Selection, 1);
selection->self = self;
selection->start = start;
selection->end = end;
key_controller = gtk_event_controller_key_new ();
g_signal_connect (key_controller, "key-pressed", G_CALLBACK (key_pressed), selection);
gtk_widget_add_controller (dd, key_controller);
}
else if (gtk_text_iter_forward_search (iter, ";", 0, &end, NULL, NULL) &&
gtk_text_iter_forward_search (iter, "texture:", 0, NULL, &start, &end))
{
GtkFileDialog *dialog;
GtkTextIter skip;
char *text;
GFile *file;
while (g_unichar_isspace (gtk_text_iter_get_char (&start)))
gtk_text_iter_forward_char (&start);
skip = start;
gtk_text_iter_forward_chars (&skip, strlen ("url(\""));
text = gtk_text_iter_get_text (&start, &skip);
if (strcmp (text, "url(\"") != 0)
{
g_free (text);
return;
}
g_free (text);
start = skip;
skip = end;
gtk_text_iter_backward_chars (&skip, strlen ("\")"));
text = gtk_text_iter_get_text (&skip, &end);
if (strcmp (text, "\")") != 0)
{
g_free (text);
return;
}
g_free (text);
end = skip;
gtk_text_buffer_select_range (buffer, &start, &end);
text = gtk_text_buffer_get_text (buffer, &start, &end, TRUE);
file = g_file_new_for_uri (text);
g_free (text);
selection = g_new0 (Selection, 1);
selection->self = self;
selection->start = start;
selection->end = end;
dialog = gtk_file_dialog_new ();
gtk_file_dialog_set_initial_file (dialog, file);
gtk_file_dialog_open (dialog, GTK_WINDOW (self), NULL, file_cb, selection);
g_object_unref (file);
}
}
static void
click_gesture_pressed (GtkGestureClick *gesture,
int n_press,
double x,
double y,
NodeEditorWindow *self)
{
GtkTextIter iter;
int bx, by, trailing;
GdkModifierType state;
state = gtk_event_controller_get_current_event_state (GTK_EVENT_CONTROLLER (gesture));
if ((state & GDK_CONTROL_MASK) == 0)
return;
gtk_text_view_window_to_buffer_coords (GTK_TEXT_VIEW (self->text_view), GTK_TEXT_WINDOW_TEXT, x, y, &bx, &by);
gtk_text_view_get_iter_at_position (GTK_TEXT_VIEW (self->text_view), &iter, &trailing, bx, by);
node_editor_window_edit (self, &iter);
}
static void
edit_action_cb (GtkWidget *widget,
const char *action_name,
GVariant *parameter)
{
NodeEditorWindow *self = NODE_EDITOR_WINDOW (widget);
GtkTextBuffer *buffer;
GtkTextIter start, end;
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (self->text_view));
gtk_text_buffer_get_selection_bounds (buffer, &start, &end);
node_editor_window_edit (self, &start);
}
static void
node_editor_window_class_init (NodeEditorWindowClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
GtkShortcutTrigger *trigger;
GtkShortcutAction *action;
GtkShortcut *shortcut;
object_class->dispose = node_editor_window_dispose;
object_class->finalize = node_editor_window_finalize;
@@ -1205,6 +1576,14 @@ node_editor_window_class_init (NodeEditorWindowClass *class)
gtk_widget_class_bind_template_callback (widget_class, dark_mode_cb);
gtk_widget_class_bind_template_callback (widget_class, on_picture_drag_prepare_cb);
gtk_widget_class_bind_template_callback (widget_class, on_picture_drop_cb);
gtk_widget_class_bind_template_callback (widget_class, click_gesture_pressed);
gtk_widget_class_install_action (widget_class, "smart-edit", NULL, edit_action_cb);
trigger = gtk_keyval_trigger_new (GDK_KEY_e, GDK_CONTROL_MASK);
action = gtk_named_action_new ("smart-edit");
shortcut = gtk_shortcut_new (trigger, action);
gtk_widget_class_add_shortcut (widget_class, shortcut);
}
static GtkWidget *

View File

@@ -16,6 +16,14 @@
</item>
</section>
</menu>
<menu id="extra_menu">
<section>
<item>
<attribute name="label" translatable="yes">Assisted _Edit</attribute>
<attribute name="action">smart-edit</attribute>
</item>
</section>
</menu>
<object class="GtkPopover" id="testcase_popover">
<child>
@@ -195,10 +203,17 @@
<property name="right-margin">6</property>
<property name="bottom-margin">6</property>
<property name="has-tooltip">1</property>
<property name="extra-menu">extra_menu</property>
<signal name="query-tooltip" handler="text_view_query_tooltip_cb"/>
<style>
<class name="editor" />
</style>
<child>
<object class="GtkGestureClick">
<property name="button">1</property>
<signal name="pressed" handler="click_gesture_pressed"/>
</object>
</child>
</object>
</child>
</object>

View File

@@ -193,7 +193,7 @@ Creates a node like `gsk_linear_gradient_node_new()` with the given properties.
| property | syntax | default | printed |
| -------- | ---------------- | ---------------------- | ----------- |
| source | `<node>` | color { } | always |
| mode | `<blend-mode>` | alpha | non-default |
| mode | `<mask-mode>` | alpha | non-default |
| mask | `<node>` | color { } | always |
Creates a node like `gsk_mask_node_new()` with the given properties.

View File

@@ -68,6 +68,7 @@ ui_files = [
'stackswitcher.ui',
'statusbar.ui',
'switch.ui',
'switch-state.ui',
'toggle-button.ui',
'video.ui',
'volumebutton.ui',

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow">
<property name="decorated">0</property>
<property name="resizable">0</property>
<property name="default-width">280</property>
<property name="default-height">120</property>
<style>
<class name="nobackground"/>
</style>
<child>
<object class="GtkBox">
<style>
<class name="shadow"/>
<class name="background"/>
<class name="frame"/>
</style>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="spacing">3</property>
<property name="hexpand">1</property>
<property name="vexpand">1</property>
<property name="halign">center</property>
<property name="valign">center</property>
<child>
<object class="GtkSwitch">
<property name="active">1</property>
<property name="state">0</property>
</object>
</child>
<child>
<object class="GtkSwitch">
<property name="active">0</property>
<property name="state">1</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</interface>

View File

@@ -875,10 +875,10 @@ reference.
### Adapt to coordinate API changes
A number of APIs that are accepting or returning coordinates have
been changed from ints to doubles: `gtk_widget_translate_coordinates()`,
been changed from `int`s to `double`s: `gtk_widget_translate_coordinates()`,
`gtk_fixed_put()`, `gtk_fixed_move()`. This change is mostly transparent,
except for cases where out parameters are involved: you need to
pass double* now, instead of int*.
pass `double*` now, instead of `int*`.
### Adapt to GtkStyleContext API changes

View File

@@ -119,3 +119,17 @@ it no longer has a resize handle for the window.
These are very specialized widgets that should better live with the application
where they are used.
## Widget size api changes
The functions gtk_widget_get_allocated_width() and gtk_widget_get_allocated_height()
are going away. In most cases, [method@Gtk.Widget.get_width] and [method@Gtk.Widget.get_height]
are suitable replacements. Note that the semantics are slightly different though:
the old functions return the size of the CSS border area, while the new functions return
the size of the widgets content area. In places where this difference matters, you can
use `gtk_widget_compute_bounds (widget, widget, &bounds)` instead.
The function gtk_widget_get_allocation() is also going away. It does not have a direct
replacement, but the previously mentioned alternatives can be used for it too.
The function gtk_widget_get_allocated_baseline() has been renamed to [method@Gtk.Widget.get_baseline].

View File

@@ -24,7 +24,7 @@
#include "config.h"
#include "gdkversionmacros.h"
#include "version/gdkversionmacros.h"
#include "gdkresources.h"
@@ -132,6 +132,7 @@ static const GdkDebugKey gdk_debug_keys[] = {
{ "vulkan-validate", GDK_DEBUG_VULKAN_VALIDATE, "Load the Vulkan validation layer", TRUE },
{ "default-settings",GDK_DEBUG_DEFAULT_SETTINGS, "Force default values for xsettings", TRUE },
{ "high-depth", GDK_DEBUG_HIGH_DEPTH, "Use high bit depth rendering if possible", TRUE },
{ "no-vsync", GDK_DEBUG_NO_VSYNC, "Repaint instantly (uses 100% CPU with animations)", TRUE },
};

View File

@@ -75,7 +75,7 @@
#include <gdk/gdktoplevellayout.h>
#include <gdk/gdktoplevelsize.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
#include <gdk/version/gdkversionmacros.h>
#include <gdk/gdkvulkancontext.h>
#undef __GDK_H_INSIDE__

View File

@@ -24,7 +24,6 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@@ -1,5 +1,5 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 2005 Red Hat, Inc.
* Copyright (C) 2005 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -19,6 +19,9 @@
#include "gdkcairoprivate.h"
#include "gdkrgba.h"
#include "gdktexture.h"
#include <math.h>
/**

View File

@@ -1,5 +1,5 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 2005 Red Hat, Inc.
* Copyright (C) 2005 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -21,8 +21,7 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdkrgba.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkpixbuf.h>
#include <pango/pangocairo.h>

View File

@@ -24,11 +24,8 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
#include <cairo.h>
G_BEGIN_DECLS
#define GDK_TYPE_CAIRO_CONTEXT (gdk_cairo_context_get_type ())

View File

@@ -22,10 +22,7 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
#include <gio/gio.h>
G_BEGIN_DECLS

View File

@@ -21,8 +21,6 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@@ -21,8 +21,6 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@@ -22,10 +22,8 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS
#define GDK_TYPE_CONTENT_PROVIDER (gdk_content_provider_get_type ())

View File

@@ -22,7 +22,6 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@@ -21,8 +21,6 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@@ -28,7 +28,6 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@@ -52,6 +52,7 @@ typedef enum {
GDK_DEBUG_VULKAN_VALIDATE = 1 << 23,
GDK_DEBUG_DEFAULT_SETTINGS= 1 << 24,
GDK_DEBUG_HIGH_DEPTH = 1 << 25,
GDK_DEBUG_NO_VSYNC = 1 << 26,
} GdkDebugFlags;
extern guint _gdk_debug_flags;

View File

@@ -21,12 +21,10 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkdevicetool.h>
#include <gdk/gdkenums.h>
G_BEGIN_DECLS
#define GDK_TYPE_DEVICE (gdk_device_get_type ())

View File

@@ -23,7 +23,6 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@@ -21,10 +21,7 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkenums.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
G_BEGIN_DECLS

View File

@@ -1,7 +1,7 @@
/* GDK - The GIMP Drawing Kit
* gdkdisplay.c
*
* Copyright 2001 Sun Microsystems Inc.
*
* Copyright 2001 Sun Microsystems Inc.
*
* Erwann Chenede <erwann.chenede@sun.com>
*
@@ -31,10 +31,11 @@
#include "gdkclipboardprivate.h"
#include "gdkdeviceprivate.h"
#include "gdkdisplaymanagerprivate.h"
#include "gdkframeclockidleprivate.h"
#include "gdkeventsprivate.h"
#include "gdkframeclockidleprivate.h"
#include "gdkglcontextprivate.h"
#include "gdkmonitorprivate.h"
#include "gdkrectangle.h"
#ifdef HAVE_EGL
#include <epoxy/egl.h>
@@ -175,7 +176,7 @@ gdk_display_default_rate_egl_config (GdkDisplay *display,
return distance;
}
static GdkSeat *
gdk_display_real_get_default_seat (GdkDisplay *display)
{
@@ -418,10 +419,10 @@ gdk_display_close (GdkDisplay *display)
if (!display->closed)
{
display->closed = TRUE;
g_signal_emit (display, signals[CLOSED], 0, FALSE);
g_object_run_dispose (G_OBJECT (display));
g_object_unref (display);
}
}
@@ -808,7 +809,7 @@ _gdk_display_end_device_grab (GdkDisplay *display,
grab->implicit_ungrab = implicit;
return l->next == NULL;
}
return FALSE;
}
@@ -1268,7 +1269,7 @@ gdk_display_init_gl (GdkDisplay *self)
* Note that even if this function succeeds, creating a `GdkGLContext`
* may still fail.
*
* This function is idempotent. Calling it multiple times will just
* This function is idempotent. Calling it multiple times will just
* return the same value or error.
*
* You never need to call this function, GDK will call it automatically

View File

@@ -25,7 +25,6 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkevents.h>
#include <gdk/gdkseat.h>

View File

@@ -437,7 +437,7 @@ gdk_display_manager_open_display (GdkDisplayManager *manager,
}
}
if (!found && !display)
if (!found && !any && !display)
g_warning ("No such backend: %s", backend);
}

View File

@@ -28,10 +28,9 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkdevice.h>
#include <gdk/gdkenums.h>
#include <gdk/gdkevents.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkdevice.h>
#include <gdk/gdkevents.h>
G_BEGIN_DECLS

View File

@@ -23,7 +23,6 @@
#endif
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
G_BEGIN_DECLS

View File

@@ -24,7 +24,6 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@@ -24,9 +24,7 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkenums.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
G_BEGIN_DECLS

View File

@@ -345,4 +345,3 @@ typedef enum {
} GdkMemoryFormat;
G_END_DECLS

View File

@@ -28,12 +28,10 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdktypes.h>
#include <gdk/gdkdevice.h>
#include <gdk/gdkdevicetool.h>
#include <gdk/gdkdrag.h>
#include <gdk/gdkenums.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
G_BEGIN_DECLS

View File

@@ -79,7 +79,7 @@ static guint signals[LAST_SIGNAL];
static guint fps_counter;
#define FRAME_HISTORY_MAX_LENGTH 16
#define FRAME_HISTORY_MAX_LENGTH 128
struct _GdkFrameClockPrivate
{

View File

@@ -275,58 +275,80 @@ gdk_frame_clock_idle_get_frame_time (GdkFrameClock *clock)
return new_smoothed_time;
}
#define RUN_FLUSH_IDLE(priv) \
((priv)->freeze_count == 0 && \
((priv)->requested & GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS) != 0)
static inline gboolean
gdk_frame_clock_idle_is_frozen (GdkFrameClockIdle *self)
{
GdkFrameClockIdlePrivate *priv = self->priv;
if (GDK_DEBUG_CHECK (NO_VSYNC))
return FALSE;
return priv->freeze_count > 0;
}
static inline gboolean
should_run_flush_idle (GdkFrameClockIdle *self)
{
GdkFrameClockIdlePrivate *priv = self->priv;
return !gdk_frame_clock_idle_is_frozen (self) &&
(priv->requested & GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS) != 0;
}
/* The reason why we track updating_count separately here and don't
* just add GDK_FRAME_CLOCK_PHASE_UPDATE into ->request on every frame
* is so that we can avoid doing one more frame when an animation
* is cancelled.
*/
#define RUN_PAINT_IDLE(priv) \
((priv)->freeze_count == 0 && \
(((priv)->requested & ~GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS) != 0 || \
(priv)->updating_count > 0))
static inline gboolean
should_run_paint_idle (GdkFrameClockIdle *self)
{
GdkFrameClockIdlePrivate *priv = self->priv;
return !gdk_frame_clock_idle_is_frozen (self) &&
((priv->requested & ~GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS) != 0 ||
priv->updating_count > 0);
}
static void
maybe_start_idle (GdkFrameClockIdle *clock_idle,
gboolean caused_by_thaw)
maybe_start_idle (GdkFrameClockIdle *self,
gboolean caused_by_thaw)
{
GdkFrameClockIdlePrivate *priv = clock_idle->priv;
GdkFrameClockIdlePrivate *priv = self->priv;
if (RUN_FLUSH_IDLE (priv) || RUN_PAINT_IDLE (priv))
if (should_run_flush_idle (self) || should_run_paint_idle (self))
{
guint min_interval = 0;
if (priv->min_next_frame_time != 0)
if (priv->min_next_frame_time != 0 &&
!GDK_DEBUG_CHECK (NO_VSYNC))
{
gint64 now = g_get_monotonic_time ();
gint64 min_interval_us = MAX (priv->min_next_frame_time, now) - now;
min_interval = (min_interval_us + 500) / 1000;
}
if (priv->flush_idle_id == 0 && RUN_FLUSH_IDLE (priv))
if (priv->flush_idle_id == 0 && should_run_flush_idle (self))
{
GSource *source;
priv->flush_idle_id = g_timeout_add_full (GDK_PRIORITY_EVENTS + 1,
min_interval,
gdk_frame_clock_flush_idle,
g_object_ref (clock_idle),
g_object_ref (self),
(GDestroyNotify) g_object_unref);
source = g_main_context_find_source_by_id (NULL, priv->flush_idle_id);
g_source_set_static_name (source, "[gtk] gdk_frame_clock_flush_idle");
}
if (!priv->in_paint_idle &&
priv->paint_idle_id == 0 && RUN_PAINT_IDLE (priv))
priv->paint_idle_id == 0 && should_run_paint_idle (self))
{
priv->paint_is_thaw = caused_by_thaw;
priv->paint_idle_id = g_timeout_add_full (GDK_PRIORITY_REDRAW,
min_interval,
gdk_frame_clock_paint_idle,
g_object_ref (clock_idle),
g_object_ref (self),
(GDestroyNotify) g_object_unref);
gdk_source_set_static_name_by_id (priv->paint_idle_id, "[gtk] gdk_frame_clock_paint_idle");
}
@@ -334,17 +356,17 @@ maybe_start_idle (GdkFrameClockIdle *clock_idle,
}
static void
maybe_stop_idle (GdkFrameClockIdle *clock_idle)
maybe_stop_idle (GdkFrameClockIdle *self)
{
GdkFrameClockIdlePrivate *priv = clock_idle->priv;
GdkFrameClockIdlePrivate *priv = self->priv;
if (priv->flush_idle_id != 0 && !RUN_FLUSH_IDLE (priv))
if (priv->flush_idle_id != 0 && !should_run_flush_idle (self))
{
g_source_remove (priv->flush_idle_id);
priv->flush_idle_id = 0;
}
if (priv->paint_idle_id != 0 && !RUN_PAINT_IDLE (priv))
if (priv->paint_idle_id != 0 && !should_run_paint_idle (self))
{
g_source_remove (priv->paint_idle_id);
priv->paint_idle_id = 0;
@@ -432,7 +454,7 @@ gdk_frame_clock_paint_idle (void *data)
break;
case GDK_FRAME_CLOCK_PHASE_NONE:
case GDK_FRAME_CLOCK_PHASE_BEFORE_PAINT:
if (priv->freeze_count == 0)
if (!gdk_frame_clock_idle_is_frozen (clock_idle))
{
gint64 frame_interval = FRAME_INTERVAL;
GdkFrameTimings *prev_timings = gdk_frame_clock_get_current_timings (clock);
@@ -548,7 +570,7 @@ gdk_frame_clock_paint_idle (void *data)
G_GNUC_FALLTHROUGH;
case GDK_FRAME_CLOCK_PHASE_UPDATE:
if (priv->freeze_count == 0)
if (!gdk_frame_clock_idle_is_frozen (clock_idle))
{
if ((priv->requested & GDK_FRAME_CLOCK_PHASE_UPDATE) != 0 ||
priv->updating_count > 0)
@@ -560,7 +582,7 @@ gdk_frame_clock_paint_idle (void *data)
G_GNUC_FALLTHROUGH;
case GDK_FRAME_CLOCK_PHASE_LAYOUT:
if (priv->freeze_count == 0)
if (!gdk_frame_clock_idle_is_frozen (clock_idle))
{
int iter;
#ifdef G_ENABLE_DEBUG
@@ -580,7 +602,8 @@ gdk_frame_clock_paint_idle (void *data)
*/
iter = 0;
while ((priv->requested & GDK_FRAME_CLOCK_PHASE_LAYOUT) &&
priv->freeze_count == 0 && iter++ < 4)
!gdk_frame_clock_idle_is_frozen (clock_idle) &&
iter++ < 4)
{
priv->requested &= ~GDK_FRAME_CLOCK_PHASE_LAYOUT;
_gdk_frame_clock_emit_layout (clock);
@@ -591,7 +614,7 @@ gdk_frame_clock_paint_idle (void *data)
G_GNUC_FALLTHROUGH;
case GDK_FRAME_CLOCK_PHASE_PAINT:
if (priv->freeze_count == 0)
if (!gdk_frame_clock_idle_is_frozen (clock_idle))
{
#ifdef G_ENABLE_DEBUG
if (GDK_DEBUG_CHECK (FRAMES))
@@ -612,7 +635,7 @@ gdk_frame_clock_paint_idle (void *data)
G_GNUC_FALLTHROUGH;
case GDK_FRAME_CLOCK_PHASE_AFTER_PAINT:
if (priv->freeze_count == 0)
if (!gdk_frame_clock_idle_is_frozen (clock_idle))
{
priv->requested &= ~GDK_FRAME_CLOCK_PHASE_AFTER_PAINT;
_gdk_frame_clock_emit_after_paint (clock);
@@ -641,7 +664,7 @@ gdk_frame_clock_paint_idle (void *data)
_gdk_frame_clock_emit_resume_events (clock);
}
if (priv->freeze_count == 0)
if (!gdk_frame_clock_idle_is_frozen (clock_idle))
priv->phase = GDK_FRAME_CLOCK_PHASE_NONE;
priv->in_paint_idle = FALSE;
@@ -650,7 +673,7 @@ gdk_frame_clock_paint_idle (void *data)
* update as soon as the backend unthrottles (if there is work to do),
* otherwise we need to figure when the next frame should be.
*/
if (priv->freeze_count == 0)
if (!gdk_frame_clock_idle_is_frozen (clock_idle))
{
/*
* If we don't receive "frame drawn" events, smooth_cycle_start will simply be advanced in constant increments of
@@ -668,7 +691,7 @@ gdk_frame_clock_paint_idle (void *data)
maybe_start_idle (clock_idle, FALSE);
}
if (priv->freeze_count == 0)
if (!gdk_frame_clock_idle_is_frozen (clock_idle))
priv->sleep_serial = get_sleep_serial ();
gdk_profiler_end_mark (before, "frameclock cycle", NULL);
@@ -742,7 +765,7 @@ gdk_frame_clock_idle_freeze (GdkFrameClock *clock)
GdkFrameClockIdle *clock_idle = GDK_FRAME_CLOCK_IDLE (clock);
GdkFrameClockIdlePrivate *priv = clock_idle->priv;
if (priv->freeze_count == 0)
if (!gdk_frame_clock_idle_is_frozen (clock_idle))
{
if (GDK_PROFILER_IS_RUNNING)
priv->freeze_time = g_get_monotonic_time ();
@@ -761,7 +784,7 @@ gdk_frame_clock_idle_thaw (GdkFrameClock *clock)
g_return_if_fail (priv->freeze_count > 0);
priv->freeze_count--;
if (priv->freeze_count == 0)
if (!gdk_frame_clock_idle_is_frozen (clock_idle))
{
maybe_start_idle (clock_idle, TRUE);
/* If nothing is requested so we didn't start an idle, we need
@@ -775,7 +798,7 @@ gdk_frame_clock_idle_thaw (GdkFrameClock *clock)
if (GDK_PROFILER_IS_RUNNING)
{
if (priv->freeze_time != 0)
if (gdk_frame_clock_idle_is_frozen (clock_idle))
{
gdk_profiler_end_mark (priv->freeze_time * 1000, "frameclock frozen", NULL);
priv->freeze_time = 0;

View File

@@ -21,8 +21,7 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <glib-object.h>
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@@ -1,7 +1,7 @@
/* GDK - The GIMP Drawing Kit
*
* gdkglcontext.h: GL context abstraction
*
*
* Copyright © 2014 Emmanuele Bassi
*
* This library is free software; you can redistribute it and/or
@@ -24,9 +24,7 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkenums.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
G_BEGIN_DECLS

View File

@@ -338,6 +338,7 @@ gdk_gl_texture_new_from_builder (GdkGLTextureBuilder *builder,
gpointer data)
{
GdkGLTexture *self;
GdkTexture *update_texture;
self = g_object_new (GDK_TYPE_GL_TEXTURE,
"width", gdk_gl_texture_builder_get_width (builder),
@@ -353,6 +354,22 @@ gdk_gl_texture_new_from_builder (GdkGLTextureBuilder *builder,
self->destroy = destroy;
self->data = data;
update_texture = gdk_gl_texture_builder_get_update_texture (builder);
if (update_texture)
{
cairo_region_t *update_region = gdk_gl_texture_builder_get_update_region (builder);
if (update_region)
{
update_region = cairo_region_copy (update_region);
cairo_region_intersect_rectangle (update_region,
&(cairo_rectangle_int_t) {
0, 0,
update_texture->width, update_texture->height
});
gdk_texture_set_diff (GDK_TEXTURE (self), update_texture, update_region);
}
}
return GDK_TEXTURE (self);
}

View File

@@ -22,6 +22,7 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdktypes.h>
#include <gdk/gdkglcontext.h>
#include <gdk/gdktexture.h>

View File

@@ -25,6 +25,8 @@
#include "gdkglcontext.h"
#include "gdkgltextureprivate.h"
#include <cairo-gobject.h>
struct _GdkGLTextureBuilder
{
GObject parent_instance;
@@ -36,6 +38,9 @@ struct _GdkGLTextureBuilder
GdkMemoryFormat format;
gboolean has_mipmap;
gpointer sync;
GdkTexture *update_texture;
cairo_region_t *update_region;
};
struct _GdkGLTextureBuilderClass
@@ -70,6 +75,8 @@ enum
PROP_HEIGHT,
PROP_ID,
PROP_SYNC,
PROP_UPDATE_REGION,
PROP_UPDATE_TEXTURE,
PROP_WIDTH,
N_PROPS
@@ -86,6 +93,9 @@ gdk_gl_texture_builder_dispose (GObject *object)
g_clear_object (&self->context);
g_clear_object (&self->update_texture);
g_clear_pointer (&self->update_region, cairo_region_destroy);
G_OBJECT_CLASS (gdk_gl_texture_builder_parent_class)->dispose (object);
}
@@ -123,6 +133,14 @@ gdk_gl_texture_builder_get_property (GObject *object,
g_value_set_pointer (value, self->sync);
break;
case PROP_UPDATE_REGION:
g_value_set_boxed (value, self->update_region);
break;
case PROP_UPDATE_TEXTURE:
g_value_set_object (value, self->update_texture);
break;
case PROP_WIDTH:
g_value_set_int (value, self->width);
break;
@@ -167,6 +185,14 @@ gdk_gl_texture_builder_set_property (GObject *object,
gdk_gl_texture_builder_set_sync (self, g_value_get_pointer (value));
break;
case PROP_UPDATE_REGION:
gdk_gl_texture_builder_set_update_region (self, g_value_get_boxed (value));
break;
case PROP_UPDATE_TEXTURE:
gdk_gl_texture_builder_set_update_texture (self, g_value_get_object (value));
break;
case PROP_WIDTH:
gdk_gl_texture_builder_set_width (self, g_value_get_int (value));
break;
@@ -260,6 +286,30 @@ gdk_gl_texture_builder_class_init (GdkGLTextureBuilderClass *klass)
g_param_spec_pointer ("sync", NULL, NULL,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
/**
* GdkGLTextureBuilder:update-region: (attributes org.gdk.Property.get=gdk_gl_texture_builder_get_update_region org.gdk.Property.set=gdk_gl_texture_builder_set_update_region)
*
* The update region for [property@Gdk.GLTextureBuilder:update-texture].
*
* Since: 4.12
*/
properties[PROP_UPDATE_REGION] =
g_param_spec_boxed ("update-region", NULL, NULL,
CAIRO_GOBJECT_TYPE_REGION,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
/**
* GdkGLTextureBuilder:update-texture: (attributes org.gdk.Property.get=gdk_gl_texture_builder_get_update_texture org.gdk.Property.set=gdk_gl_texture_builder_set_update_texture)
*
* The texture [property@Gdk.GLTextureBuilder:update-region] is an update for.
*
* Since: 4.12
*/
properties[PROP_UPDATE_TEXTURE] =
g_param_spec_object ("update-texture", NULL, NULL,
GDK_TYPE_TEXTURE,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
/**
* GdkGLTextureBuilder:width: (attributes org.gdk.Property.get=gdk_gl_texture_builder_get_width org.gdk.Property.set=gdk_gl_texture_builder_set_width)
*
@@ -271,6 +321,7 @@ gdk_gl_texture_builder_class_init (GdkGLTextureBuilderClass *klass)
g_param_spec_int ("width", NULL, NULL,
G_MININT, G_MAXINT, 0,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (gobject_class, N_PROPS, properties);
}
@@ -613,6 +664,102 @@ gdk_gl_texture_builder_set_format (GdkGLTextureBuilder *self,
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_FORMAT]);
}
/**
* gdk_gl_texture_builder_get_update_texture: (attributes org.gdk.Method.get_property=update_texture)
* @self: a `GdkGLTextureBuilder`
*
* Gets the texture previously set via gdk_gl_texture_builder_set_update_texture() or
* %NULL if none was set.
*
* Returns: (transfer none) (nullable): The texture
*
* Since: 4.12
*/
GdkTexture *
gdk_gl_texture_builder_get_update_texture (GdkGLTextureBuilder *self)
{
g_return_val_if_fail (GDK_IS_GL_TEXTURE_BUILDER (self), NULL);
return self->update_texture;
}
/**
* gdk_gl_texture_builder_set_update_texture: (attributes org.gdk.Method.set_property=update_texture)
* @self: a `GdkGLTextureBuilder`
* @texture: (nullable): the texture to update
*
* Sets the texture to be updated by this texture. See
* [method@Gdk.GLTextureBuilder.set_update_region] for an explanation.
*
* Since: 4.12
*/
void
gdk_gl_texture_builder_set_update_texture (GdkGLTextureBuilder *self,
GdkTexture *texture)
{
g_return_if_fail (GDK_IS_GL_TEXTURE_BUILDER (self));
g_return_if_fail (texture == NULL || GDK_IS_TEXTURE (texture));
if (!g_set_object (&self->update_texture, texture))
return;
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_UPDATE_TEXTURE]);
}
/**
* gdk_gl_texture_builder_get_update_region: (attributes org.gdk.Method.get_property=update_region)
* @self: a `GdkGLTextureBuilder`
*
* Gets the region previously set via gdk_gl_texture_builder_set_update_region() or
* %NULL if none was set.
*
* Returns: (transfer none) (nullable): The region
*
* Since: 4.12
*/
cairo_region_t *
gdk_gl_texture_builder_get_update_region (GdkGLTextureBuilder *self)
{
g_return_val_if_fail (GDK_IS_GL_TEXTURE_BUILDER (self), NULL);
return self->update_region;
}
/**
* gdk_gl_texture_builder_set_update_region: (attributes org.gdk.Method.set_property=update_region)
* @self: a `GdkGLTextureBuilder`
* @region: (nullable): the region to update
*
* Sets the region to be updated by this texture. Together with
* [property@Gdk.GLTextureBuilder:update-texture] this describes an
* update of a previous texture.
*
* When rendering animations of large textures, it is possible that
* consecutive textures are only updating contents in parts of the texture.
* It is then possible to describe this update via these two properties,
* so that GTK can avoid rerendering parts that did not change.
*
* An example would be a screen recording where only the mouse pointer moves.
*
* Since: 4.12
*/
void
gdk_gl_texture_builder_set_update_region (GdkGLTextureBuilder *self,
cairo_region_t *region)
{
g_return_if_fail (GDK_IS_GL_TEXTURE_BUILDER (self));
if (self->update_region == region)
return;
g_clear_pointer (&self->update_region, cairo_region_destroy);
if (region)
self->update_region = cairo_region_reference (region);
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_UPDATE_REGION]);
}
/**
* gdk_gl_texture_builder_build:
* @self: a `GdkGLTextureBuilder`

View File

@@ -23,9 +23,7 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkenums.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
G_BEGIN_DECLS
@@ -78,6 +76,18 @@ GDK_AVAILABLE_IN_4_12
void gdk_gl_texture_builder_set_sync (GdkGLTextureBuilder *self,
gpointer sync);
GDK_AVAILABLE_IN_4_12
GdkTexture * gdk_gl_texture_builder_get_update_texture (GdkGLTextureBuilder *self) G_GNUC_PURE;
GDK_AVAILABLE_IN_4_12
void gdk_gl_texture_builder_set_update_texture (GdkGLTextureBuilder *self,
GdkTexture *texture);
GDK_AVAILABLE_IN_4_12
cairo_region_t * gdk_gl_texture_builder_get_update_region (GdkGLTextureBuilder *self) G_GNUC_PURE;
GDK_AVAILABLE_IN_4_12
void gdk_gl_texture_builder_set_update_region (GdkGLTextureBuilder *self,
cairo_region_t *region);
GDK_AVAILABLE_IN_4_12
GdkTexture * gdk_gl_texture_builder_build (GdkGLTextureBuilder *self,
GDestroyNotify destroy,

View File

@@ -28,7 +28,6 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@@ -23,7 +23,7 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkenums.h>
#include <gdk/gdktypes.h>
#include <gdk/gdktexture.h>
G_BEGIN_DECLS

View File

@@ -24,6 +24,7 @@
#include "gdkmonitorprivate.h"
#include "gdkdisplay.h"
#include "gdkenumtypes.h"
#include "gdkrectangle.h"
/**
* GdkMonitor:

View File

@@ -25,8 +25,6 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdkrectangle.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@@ -24,7 +24,6 @@
#endif
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
G_BEGIN_DECLS

View File

@@ -1,5 +1,5 @@
/* GDK - The GIMP Drawing Kit
* Copyright (C) 2000 Red Hat, Inc.
* Copyright (C) 2000 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -22,7 +22,6 @@
#endif
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
G_BEGIN_DECLS

View File

@@ -18,14 +18,11 @@
#pragma once
#include <gdk/gdkversionmacros.h>
#include <gio/gio.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS
GIOStream * gdk_pipe_io_stream_new (void);
G_END_DECLS

View File

@@ -28,12 +28,8 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <cairo.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktexture.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
G_BEGIN_DECLS

View File

@@ -20,6 +20,7 @@
#include "gdkpopuplayout.h"
#include "gdkrectangle.h"
#include "gdksurface.h"
/**

View File

@@ -22,9 +22,7 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkenums.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
G_BEGIN_DECLS

View File

@@ -29,7 +29,7 @@
#include <unistd.h>
#endif
#include "gdkversionmacros.h"
#include "version/gdkversionmacros.h"
#include "gdkframeclockprivate.h"

View File

@@ -29,7 +29,6 @@
#endif
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
G_BEGIN_DECLS

View File

@@ -29,7 +29,6 @@
#endif
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
G_BEGIN_DECLS

View File

@@ -24,7 +24,6 @@
#endif
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
G_BEGIN_DECLS

View File

@@ -1530,6 +1530,9 @@ gdk_surface_freeze_updates (GdkSurface *surface)
{
g_return_if_fail (GDK_IS_SURFACE (surface));
if (GDK_DEBUG_CHECK (NO_VSYNC))
return;
surface->update_freeze_count++;
if (surface->update_freeze_count == 1)
_gdk_frame_clock_uninhibit_freeze (surface->frame_clock);
@@ -1562,6 +1565,9 @@ gdk_surface_thaw_updates (GdkSurface *surface)
{
g_return_if_fail (GDK_IS_SURFACE (surface));
if (GDK_DEBUG_CHECK (NO_VSYNC))
return;
g_return_if_fail (surface->update_freeze_count > 0);
if (--surface->update_freeze_count == 0)

View File

@@ -28,7 +28,6 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkevents.h>
#include <gdk/gdkframeclock.h>

View File

@@ -282,6 +282,8 @@ gdk_texture_dispose (GObject *object)
{
GdkTexture *self = GDK_TEXTURE (object);
g_clear_pointer (&self->diff_to_previous, cairo_region_destroy);
gdk_texture_clear_render_data (self);
G_OBJECT_CLASS (gdk_texture_parent_class)->dispose (object);
@@ -671,7 +673,47 @@ gdk_texture_do_download (GdkTexture *texture,
guchar *data,
gsize stride)
{
GDK_TEXTURE_GET_CLASS (texture)->download (texture, format, data,stride);
GDK_TEXTURE_GET_CLASS (texture)->download (texture, format, data, stride);
}
void
gdk_texture_diff (GdkTexture *self,
GdkTexture *other,
cairo_region_t *region)
{
if (self == other)
return;
if (self->previous_texture == other &&
g_atomic_pointer_get (&other->next_texture) == self)
{
cairo_region_union (region, self->diff_to_previous);
}
else if (other->previous_texture == self &&
g_atomic_pointer_get (&self->next_texture) == other)
{
cairo_region_union (region, other->diff_to_previous);
}
else
{
cairo_region_union_rectangle (region,
&(cairo_rectangle_int_t) {
0,
0,
MAX (self->width, other->width),
MAX (self->height, other->height)
});
}
}
void
gdk_texture_set_diff (GdkTexture *self,
GdkTexture *previous,
cairo_region_t *diff)
{
self->previous_texture = previous;
self->diff_to_previous = diff;
g_atomic_pointer_set (&previous->next_texture, self);
}
cairo_surface_t *

View File

@@ -22,8 +22,6 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdkenums.h>
#include <gdk/gdktypes.h>
#include <gdk-pixbuf/gdk-pixbuf.h>

View File

@@ -21,9 +21,6 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdkenums.h>
#include <gdk/gdktypes.h>
G_BEGIN_DECLS

View File

@@ -21,6 +21,12 @@ struct _GdkTexture
gpointer render_key;
gpointer render_data;
GDestroyNotify render_notify;
/* for diffing swapchain-like textures.
* Links are only valid if both textures agree on them */
gpointer next_texture; /* atomic, no reference, may be invalid pointer */
gpointer previous_texture; /* no reference, may be invalid pointer */
cairo_region_t *diff_to_previous;
};
struct _GdkTextureClass {
@@ -42,6 +48,14 @@ void gdk_texture_do_download (GdkTexture
GdkMemoryFormat format,
guchar *data,
gsize stride);
void gdk_texture_diff (GdkTexture *self,
GdkTexture *other,
cairo_region_t *region);
void gdk_texture_set_diff (GdkTexture *self,
GdkTexture *previous,
cairo_region_t *diff);
gboolean gdk_texture_set_render_data (GdkTexture *self,
gpointer key,
gpointer data,

View File

@@ -22,9 +22,8 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkmonitor.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
#include <gdk/gdkmonitor.h>
G_BEGIN_DECLS

View File

@@ -23,7 +23,6 @@
#endif
#include <gdk/gdktypes.h>
#include <gdk/gdkversionmacros.h>
G_BEGIN_DECLS

View File

@@ -42,6 +42,8 @@
* (or GTK). One such setting is what windowing API backend is in use.
*/
#include <gdk/gdkconfig.h>
#include <gdk/gdkenums.h>
#include <gdk/version/gdkversionmacros.h>
G_BEGIN_DECLS

View File

@@ -1,324 +0,0 @@
/* gdkversionmacros.h - version boundaries checks
* Copyright (C) 2012 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.▸ See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#if !defined (__GDK_H_INSIDE__) && !defined (__GTK_CSS_H_INSIDE__) && !defined (GTK_COMPILATION) && !defined (GTK_CSS_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#ifndef __GDK_VERSION_MACROS_H__
#define __GDK_VERSION_MACROS_H__
#include <glib.h>
/**
* GDK_MAJOR_VERSION:
*
* The major version component of the library's version, e.g. "1" for "1.2.3".
*/
#define GDK_MAJOR_VERSION (@GTK_MAJOR_VERSION@)
/**
* GDK_MINOR_VERSION:
*
* The minor version component of the library's version, e.g. "2" for "1.2.3".
*/
#define GDK_MINOR_VERSION (@GTK_MINOR_VERSION@)
/**
* GDK_MICRO_VERSION:
*
* The micro version component of the library's version, e.g. "3" for "1.2.3".
*/
#define GDK_MICRO_VERSION (@GTK_MICRO_VERSION@)
#ifndef _GDK_EXTERN
#define _GDK_EXTERN extern
#endif
/**
* GDK_DISABLE_DEPRECATION_WARNINGS:
*
* A macro that should be defined before including the `gdk.h` header.
*
* If this symbol is defined, no compiler warnings will be produced for
* uses of deprecated GDK and GTK APIs.
*/
#ifdef GDK_DISABLE_DEPRECATION_WARNINGS
#define GDK_DEPRECATED _GDK_EXTERN
#define GDK_DEPRECATED_FOR(f) _GDK_EXTERN
#define GDK_UNAVAILABLE(maj,min) _GDK_EXTERN
#else
#define GDK_DEPRECATED G_DEPRECATED _GDK_EXTERN
#define GDK_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) _GDK_EXTERN
#define GDK_UNAVAILABLE(maj,min) G_UNAVAILABLE(maj,min) _GDK_EXTERN
#endif
/* XXX: Every new stable minor release bump should add a macro here */
/**
* GDK_VERSION_4_0:
*
* A macro that evaluates to the 4.0 version of GDK, in a format
* that can be used by the C pre-processor.
*/
#define GDK_VERSION_4_0 (G_ENCODE_VERSION (4, 0))
/**
* GDK_VERSION_4_2:
*
* A macro that evaluates to the 4.2 version of GDK, in a format
* that can be used by the C pre-processor.
*
* Since: 4.2
*/
#define GDK_VERSION_4_2 (G_ENCODE_VERSION (4, 2))
/**
* GDK_VERSION_4_4:
*
* A macro that evaluates to the 4.4 version of GDK, in a format
* that can be used by the C pre-processor.
*
* Since: 4.4
*/
#define GDK_VERSION_4_4 (G_ENCODE_VERSION (4, 4))
/**
* GDK_VERSION_4_6:
*
* A macro that evaluates to the 4.6 version of GDK, in a format
* that can be used by the C pre-processor.
*
* Since: 4.6
*/
#define GDK_VERSION_4_6 (G_ENCODE_VERSION (4, 6))
/**
* GDK_VERSION_4_8:
*
* A macro that evaluates to the 4.8 version of GDK, in a format
* that can be used by the C pre-processor.
*
* Since: 4.8
*/
#define GDK_VERSION_4_8 (G_ENCODE_VERSION (4, 8))
/**
* GDK_VERSION_4_10:
*
* A macro that evaluates to the 4.10 version of GDK, in a format
* that can be used by the C pre-processor.
*
* Since: 4.10
*/
#define GDK_VERSION_4_10 (G_ENCODE_VERSION (4, 10))
/**
* GDK_VERSION_4_12:
*
* A macro that evaluates to the 4.12 version of GDK, in a format
* that can be used by the C pre-processor.
*
* Since: 4.12
*/
#define GDK_VERSION_4_12 (G_ENCODE_VERSION (4, 12))
/* evaluates to the current stable version; for development cycles,
* this means the next stable target, with a hard backstop to the
* beginning of the stable series
*/
#if GDK_MAJOR_VERSION >= 4 && (GDK_MINOR_VERSION % 2)
# define GDK_VERSION_CUR_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION + 1))
#elif G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION) > GDK_VERSION_4_0
# define GDK_VERSION_CUR_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION))
#else
# define GDK_VERSION_CUR_STABLE GDK_VERSION_4_0
#endif
/* evaluates to the previous stable version, with a hard backstop
* to the beginning of the stable series
*/
#if GDK_MAJOR_VERSION >= 4 && (GDK_MINOR_VERSION % 2)
# define GDK_VERSION_PREV_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION - 1))
#elif GDK_MAJOR_VERSION >= 4 && GDK_MINOR_VERSION > 2
# define GDK_VERSION_PREV_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION - 2))
#else
# define GDK_VERSION_PREV_STABLE GDK_VERSION_4_0
#endif
/**
* GDK_VERSION_MIN_REQUIRED:
*
* A macro that should be defined by the user prior to including
* the `gdk.h` header.
*
* The definition should be one of the predefined GDK version
* macros: %GDK_VERSION_4_0, %GDK_VERSION_4_2,...
*
* This macro defines the lower bound for the GDK API to use.
*
* If a function has been deprecated in a newer version of GDK,
* it is possible to use this symbol to avoid the compiler warnings
* without disabling warning for every deprecated function.
*/
#ifndef GDK_VERSION_MIN_REQUIRED
# define GDK_VERSION_MIN_REQUIRED (GDK_VERSION_CUR_STABLE)
#endif
/**
* GDK_VERSION_MAX_ALLOWED:
*
* A macro that should be defined by the user prior to including
* the `gdk.h` header.
*
* The definition should be one of the predefined GDK version
* macros: %GDK_VERSION_4_0, %GDK_VERSION_4_2,...
*
* This macro defines the upper bound for the GDK API to use.
*
* If a function has been introduced in a newer version of GDK,
* it is possible to use this symbol to get compiler warnings when
* trying to use that function.
*/
#ifndef GDK_VERSION_MAX_ALLOWED
# if GDK_VERSION_MIN_REQUIRED > GDK_VERSION_PREV_STABLE
# define GDK_VERSION_MAX_ALLOWED GDK_VERSION_MIN_REQUIRED
# else
# define GDK_VERSION_MAX_ALLOWED GDK_VERSION_CUR_STABLE
# endif
#endif
/* sanity checks */
#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_MIN_REQUIRED
# error "GDK_VERSION_MAX_ALLOWED must be >= GDK_VERSION_MIN_REQUIRED"
#endif
#if GDK_VERSION_MIN_REQUIRED < GDK_VERSION_4_0
# error "GDK_VERSION_MIN_REQUIRED must be >= GDK_VERSION_4_0"
#endif
#define GDK_AVAILABLE_IN_ALL _GDK_EXTERN
/* XXX: Every new stable minor release should add a set of macros here */
/* This is not really necessary for 4.0, since there can't be an
* earlier version, and there are no deprecated symbols. We just
* include it for completeness, and because it's easier to copy
* this stanza every time a new development cycle starts.
*/
#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_4_0
# define GDK_AVAILABLE_IN_4_0 GDK_UNAVAILABLE(4, 0)
#else
# define GDK_AVAILABLE_IN_4_0 _GDK_EXTERN
#endif
#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_4_0
# define GDK_DEPRECATED_IN_4_0 GDK_DEPRECATED
# define GDK_DEPRECATED_IN_4_0_FOR(f) GDK_DEPRECATED_FOR(f)
#else
# define GDK_DEPRECATED_IN_4_0 _GDK_EXTERN
# define GDK_DEPRECATED_IN_4_0_FOR(f) _GDK_EXTERN
#endif
#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_4_2
# define GDK_AVAILABLE_IN_4_2 GDK_UNAVAILABLE(4, 2)
#else
# define GDK_AVAILABLE_IN_4_2 _GDK_EXTERN
#endif
#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_4_2
# define GDK_DEPRECATED_IN_4_2 GDK_DEPRECATED
# define GDK_DEPRECATED_IN_4_2_FOR(f) GDK_DEPRECATED_FOR(f)
#else
# define GDK_DEPRECATED_IN_4_2 _GDK_EXTERN
# define GDK_DEPRECATED_IN_4_2_FOR(f) _GDK_EXTERN
#endif
#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_4_4
# define GDK_AVAILABLE_IN_4_4 GDK_UNAVAILABLE(4, 4)
#else
# define GDK_AVAILABLE_IN_4_4 _GDK_EXTERN
#endif
#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_4_4
# define GDK_DEPRECATED_IN_4_4 GDK_DEPRECATED
# define GDK_DEPRECATED_IN_4_4_FOR(f) GDK_DEPRECATED_FOR(f)
#else
# define GDK_DEPRECATED_IN_4_4 _GDK_EXTERN
# define GDK_DEPRECATED_IN_4_4_FOR(f) _GDK_EXTERN
#endif
#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_4_6
# define GDK_AVAILABLE_IN_4_6 GDK_UNAVAILABLE(4, 6)
#else
# define GDK_AVAILABLE_IN_4_6 _GDK_EXTERN
#endif
#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_4_6
# define GDK_DEPRECATED_IN_4_6 GDK_DEPRECATED
# define GDK_DEPRECATED_IN_4_6_FOR(f) GDK_DEPRECATED_FOR(f)
#else
# define GDK_DEPRECATED_IN_4_6 _GDK_EXTERN
# define GDK_DEPRECATED_IN_4_6_FOR(f) _GDK_EXTERN
#endif
#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_4_8
# define GDK_AVAILABLE_IN_4_8 GDK_UNAVAILABLE(4, 8)
#else
# define GDK_AVAILABLE_IN_4_8 _GDK_EXTERN
#endif
#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_4_8
# define GDK_DEPRECATED_IN_4_8 GDK_DEPRECATED
# define GDK_DEPRECATED_IN_4_8_FOR(f) GDK_DEPRECATED_FOR(f)
#else
# define GDK_DEPRECATED_IN_4_8 _GDK_EXTERN
# define GDK_DEPRECATED_IN_4_8_FOR(f) _GDK_EXTERN
#endif
#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_4_10
# define GDK_AVAILABLE_IN_4_10 GDK_UNAVAILABLE(4, 10)
#else
# define GDK_AVAILABLE_IN_4_10 _GDK_EXTERN
#endif
#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_4_10
# define GDK_DEPRECATED_IN_4_10 GDK_DEPRECATED
# define GDK_DEPRECATED_IN_4_10_FOR(f) GDK_DEPRECATED_FOR(f)
#else
# define GDK_DEPRECATED_IN_4_10 _GDK_EXTERN
# define GDK_DEPRECATED_IN_4_10_FOR(f) _GDK_EXTERN
#endif
#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_4_12
# define GDK_AVAILABLE_IN_4_12 GDK_UNAVAILABLE(4, 12)
#else
# define GDK_AVAILABLE_IN_4_12 _GDK_EXTERN
#endif
#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_4_12
# define GDK_DEPRECATED_IN_4_12 GDK_DEPRECATED
# define GDK_DEPRECATED_IN_4_12_FOR(f) GDK_DEPRECATED_FOR(f)
#else
# define GDK_DEPRECATED_IN_4_12 _GDK_EXTERN
# define GDK_DEPRECATED_IN_4_12_FOR(f) _GDK_EXTERN
#endif
#endif /* __GDK_VERSION_MACROS_H__ */

View File

@@ -223,7 +223,7 @@ gdk_vulkan_strerror (VkResult result)
#if VK_HEADER_VERSION < 140
case VK_RESULT_RANGE_SIZE:
#endif
#if VK_HEADER_VERSION >= 218
#if VK_HEADER_VERSION >= 238
case VK_ERROR_IMAGE_USAGE_NOT_SUPPORTED_KHR:
return "The requested VkImageUsageFlags are not supported. (VK_ERROR_IMAGE_USAGE_NOT_SUPPORTED_KHR)";
case VK_ERROR_VIDEO_PICTURE_LAYOUT_NOT_SUPPORTED_KHR:

View File

@@ -24,7 +24,6 @@
#error "Only <gdk/gdk.h> can be included directly."
#endif
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
#ifdef GDK_RENDERING_VULKAN

View File

@@ -146,7 +146,7 @@ gdk_enums = gnome.mkenums_simple('gdkenumtypes',
sources: gdk_public_headers,
decorator: 'GDK_AVAILABLE_IN_ALL',
body_prefix: '#include "config.h"',
header_prefix: '#include "gdkversionmacros.h"',
header_prefix: '#include "version/gdkversionmacros.h"\n',
install_dir: gtk_includedir / 'gtk-4.0/gdk',
install_header: true,
)
@@ -183,13 +183,6 @@ gdkversion_cdata.set('GTK_MAJOR_VERSION', gtk_major_version)
gdkversion_cdata.set('GTK_MINOR_VERSION', gtk_minor_version)
gdkversion_cdata.set('GTK_MICRO_VERSION', gtk_micro_version)
gdkversionmacros = configure_file(
input: 'gdkversionmacros.h.in',
output: 'gdkversionmacros.h',
configuration: gdkversion_cdata,
install_dir: gtk_includedir / 'gtk-4.0/gdk',
)
gdkinc = include_directories('.')
gdkx11_inc = include_directories('x11')
gdkwayland_inc = include_directories('wayland')
@@ -197,7 +190,7 @@ gdkwayland_inc = include_directories('wayland')
wlinc = include_directories('.')
win32rcinc = include_directories('win32/rc')
gdk_gen_headers = [gdkenum_h, gdkmarshal_h, gdkconfig, gdkversionmacros]
gdk_gen_headers = [gdkenum_h, gdkmarshal_h, gdkconfig, gdkversionmacros_h, gdk_visibility_h]
gdk_deps = [
libm,
@@ -231,7 +224,8 @@ gdk_sources += [
gdk_enums,
gdk_marshalers,
gdkresources,
gdkversionmacros,
gdkversionmacros_h,
gdk_visibility_h,
gdk_private_h_sources,
gdk_public_headers
]

View File

@@ -0,0 +1,146 @@
/* gdkversionmacros.h - version boundaries checks
* Copyright (C) 2012 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.▸ See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#if !defined (__GDK_H_INSIDE__) && !defined (__GTK_CSS_H_INSIDE__) && !defined (GTK_COMPILATION) && !defined (GTK_CSS_COMPILATION)
#error "Only <gdk/gdk.h> can be included directly."
#endif
#pragma once
#include <glib.h>
/* These macros are used to mark deprecated symbols in GLib headers,
* and thus have to be exposed in installed headers. But please
* do *not* use them in other projects. Instead define your own wrappers
* around it.
*/
#if !defined(GDK_DISABLE_DEPRECATION_WARNINGS) && \
(G_GNUC_CHECK_VERSION(4, 6) || \
__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 4))
#define _GDK_GNUC_DO_PRAGMA(x) _Pragma(G_STRINGIFY (x))
#define GDK_DEPRECATED_MACRO _GDK_GNUC_DO_PRAGMA(GCC warning "Deprecated pre-processor symbol")
#define GDK_DEPRECATED_MACRO_FOR(f) \
_GDK_GNUC_DO_PRAGMA(GCC warning G_STRINGIFY (Deprecated pre-processor symbol: replace with #f))
#define GDK_UNAVAILABLE_MACRO(maj,min) \
_GDK_GNUC_DO_PRAGMA(GCC warning G_STRINGIFY (Not available before maj.min))
#else
#define GDK_DEPRECATED_MACRO
#define GDK_DEPRECATED_MACRO_FOR(f)
#define GDK_UNAVAILABLE_MACRO(maj,min)
#endif
#if !defined(GDK_DISABLE_DEPRECATION_WARNINGS) && \
(G_GNUC_CHECK_VERSION(6, 1) || \
(defined (__clang_major__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 0))))
#define GDK_DEPRECATED_ENUMERATOR G_DEPRECATED
#define GDK_DEPRECATED_ENUMERATOR_FOR(f) G_DEPRECATED_FOR(f)
#define GDK_UNAVAILABLE_ENUMERATOR(maj,min) G_UNAVAILABLE(maj,min)
#else
#define GDK_DEPRECATED_ENUMERATOR
#define GDK_DEPRECATED_ENUMERATOR_FOR(f)
#define GDK_UNAVAILABLE_ENUMERATOR(maj,min)
#endif
#if !defined(GDK_DISABLE_DEPRECATION_WARNINGS) && \
(G_GNUC_CHECK_VERSION(3, 1) || \
(defined (__clang_major__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 0))))
#define GDK_DEPRECATED_TYPE G_DEPRECATED
#define GDK_DEPRECATED_TYPE_FOR(f) G_DEPRECATED_FOR(f)
#define GDK_UNAVAILABLE_TYPE(maj,min) G_UNAVAILABLE(maj,min)
#else
#define GDK_DEPRECATED_TYPE
#define GDK_DEPRECATED_TYPE_FOR(f)
#define GDK_UNAVAILABLE_TYPE(maj,min)
#endif
@GDK_VERSIONS@
/* evaluates to the current stable version; for development cycles,
* this means the next stable target, with a hard backstop to the
* beginning of the stable series
*/
#if GDK_MAJOR_VERSION >= 4 && (GDK_MINOR_VERSION % 2)
# define GDK_VERSION_CUR_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION + 1))
#elif G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION) > GDK_VERSION_4_0
# define GDK_VERSION_CUR_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION))
#else
# define GDK_VERSION_CUR_STABLE GDK_VERSION_4_0
#endif
/* evaluates to the previous stable version, with a hard backstop
* to the beginning of the stable series
*/
#if GDK_MAJOR_VERSION >= 4 && (GDK_MINOR_VERSION % 2)
# define GDK_VERSION_PREV_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION - 1))
#elif GDK_MAJOR_VERSION >= 4 && GDK_MINOR_VERSION > 2
# define GDK_VERSION_PREV_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION - 2))
#else
# define GDK_VERSION_PREV_STABLE GDK_VERSION_4_0
#endif
/**
* GDK_VERSION_MIN_REQUIRED:
*
* A macro that should be defined by the user prior to including
* the `gdk.h` header.
*
* The definition should be one of the predefined GDK version
* macros: %GDK_VERSION_4_0, %GDK_VERSION_4_2,...
*
* This macro defines the lower bound for the GDK API to use.
*
* If a function has been deprecated in a newer version of GDK,
* it is possible to use this symbol to avoid the compiler warnings
* without disabling warning for every deprecated function.
*/
#ifndef GDK_VERSION_MIN_REQUIRED
# define GDK_VERSION_MIN_REQUIRED (GDK_VERSION_CUR_STABLE)
#endif
/**
* GDK_VERSION_MAX_ALLOWED:
*
* A macro that should be defined by the user prior to including
* the `gdk.h` header.
*
* The definition should be one of the predefined GDK version
* macros: %GDK_VERSION_4_0, %GDK_VERSION_4_2,...
*
* This macro defines the upper bound for the GDK API to use.
*
* If a function has been introduced in a newer version of GDK,
* it is possible to use this symbol to get compiler warnings when
* trying to use that function.
*/
#ifndef GDK_VERSION_MAX_ALLOWED
# if GDK_VERSION_MIN_REQUIRED > GDK_VERSION_PREV_STABLE
# define GDK_VERSION_MAX_ALLOWED GDK_VERSION_MIN_REQUIRED
# else
# define GDK_VERSION_MAX_ALLOWED GDK_VERSION_CUR_STABLE
# endif
#endif
/* sanity checks */
#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_MIN_REQUIRED
# error "GDK_VERSION_MAX_ALLOWED must be >= GDK_VERSION_MIN_REQUIRED"
#endif
#if GDK_VERSION_MIN_REQUIRED < GDK_VERSION_4_0
# error "GDK_VERSION_MIN_REQUIRED must be >= GDK_VERSION_4_0"
#endif
#include <gdk/version/gdk-visibility.h>

21
gdk/version/meson.build Normal file
View File

@@ -0,0 +1,21 @@
gdkversionmacros_h = custom_target(
input: 'gdkversionmacros.h.in',
output: 'gdkversionmacros.h',
command: [gen_visibility_macros, meson.project_version(), 'versions-macros', '@INPUT@', '@OUTPUT@'],
install: true,
install_dir: gtk_includedir / 'gtk-4.0/gdk/version',
# FIXME: Not needed with Meson >= 0.64.0
install_tag: 'devel',
)
gdk_visibility_h = custom_target(
output: 'gdk-visibility.h',
command: [gen_visibility_macros, meson.project_version(), 'visibility-macros', 'GDK', '@OUTPUT@'],
install: true,
install_dir: gtk_includedir / 'gtk-4.0/gdk/version',
# FIXME: Not needed with Meson >= 0.64.0
install_tag: 'devel',
)

View File

@@ -370,7 +370,8 @@ gdk_wayland_surface_request_frame (GdkSurface *surface)
GdkWaylandSurface *self = GDK_WAYLAND_SURFACE (surface);
GdkFrameClock *clock;
g_assert (self->frame_callback == NULL);
if (self->frame_callback != NULL)
return;
clock = gdk_surface_get_frame_clock (surface);

View File

@@ -646,15 +646,15 @@ gdk_win32_display_dispose (GObject *object)
{
GdkWin32Display *display_win32 = GDK_WIN32_DISPLAY (object);
if (display_win32->dummy_context_wgl.hglrc != NULL)
{
wglMakeCurrent (NULL, NULL);
wglDeleteContext (display_win32->dummy_context_wgl.hglrc);
display_win32->dummy_context_wgl.hglrc = NULL;
}
if (display_win32->hwnd != NULL)
{
if (display_win32->dummy_context_wgl.hglrc != NULL)
{
wglMakeCurrent (NULL, NULL);
wglDeleteContext (display_win32->dummy_context_wgl.hglrc);
display_win32->dummy_context_wgl.hglrc = NULL;
}
DestroyWindow (display_win32->hwnd);
display_win32->hwnd = NULL;
}
@@ -1129,7 +1129,6 @@ gdk_win32_display_get_monitor_scale_factor (GdkWin32Display *display_win32,
{
if (GDK_WIN32_SURFACE (surface)->hdc == NULL)
GDK_WIN32_SURFACE (surface)->hdc = GetDC (GDK_SURFACE_HWND (surface));
hdc = GDK_WIN32_SURFACE (surface)->hdc;
}
else
@@ -1184,11 +1183,6 @@ gdk_win32_display_init_gl (GdkDisplay *display,
HDC init_gl_hdc = NULL;
GdkGLContext *context;
if (display_win32->dummy_context_wgl.hdc == NULL)
display_win32->dummy_context_wgl.hdc = GetDC (display_win32->hwnd);
init_gl_hdc = display_win32->dummy_context_wgl.hdc;
/*
* No env vars set, do the regular GL initialization, first WGL and then EGL,
* as WGL is the more tried-and-tested configuration.
@@ -1201,6 +1195,8 @@ gdk_win32_display_init_gl (GdkDisplay *display,
*/
if (gdk_display_get_debug_flags (display) & (GDK_DEBUG_GL_EGL|GDK_DEBUG_GL_GLES))
{
init_gl_hdc = GetDC (display_win32->hwnd);
if (gdk_display_init_egl (display,
EGL_PLATFORM_ANGLE_ANGLE,
init_gl_hdc,
@@ -1218,12 +1214,14 @@ gdk_win32_display_init_gl (GdkDisplay *display,
#endif
context = gdk_win32_display_init_wgl (display, error);
if (context)
return context;
#ifdef HAVE_EGL
g_clear_error (error);
init_gl_hdc = GetDC (display_win32->hwnd);
if (gdk_display_init_egl (display,
EGL_PLATFORM_ANGLE_ANGLE,
init_gl_hdc,

View File

@@ -108,6 +108,7 @@ typedef enum {
typedef struct
{
HWND hwnd;
HDC hdc;
HGLRC hglrc;
} GdkWin32GLDummyContextWGL;
@@ -133,7 +134,6 @@ struct _GdkWin32Display
guint hasWglEXTSwapControl : 1;
guint hasWglOMLSyncControl : 1;
guint hasWglARBPixelFormat : 1;
guint hasWglARBmultisample : 1;
#ifdef HAVE_EGL
guint hasEglKHRCreateContext : 1;

View File

@@ -140,7 +140,8 @@ get_wgl_pfd (HDC hdc,
pfd->nSize = sizeof (PIXELFORMATDESCRIPTOR);
if (display_win32 != NULL && display_win32->hasWglARBPixelFormat)
if (display_win32 != NULL &&
display_win32->hasWglARBPixelFormat)
{
UINT num_formats;
int colorbits = GetDeviceCaps (hdc, BITSPIXEL);
@@ -152,7 +153,7 @@ get_wgl_pfd (HDC hdc,
HGLRC hglrc_current = wglGetCurrentContext ();
/* Update PIXEL_ATTRIBUTES above if any groups are added here! */
pixelAttribs[i] = WGL_DRAW_TO_WINDOW_ARB;
pixelAttribs[i++] = WGL_DRAW_TO_WINDOW_ARB;
pixelAttribs[i++] = GL_TRUE;
pixelAttribs[i++] = WGL_SUPPORT_OPENGL_ARB;
@@ -170,18 +171,13 @@ get_wgl_pfd (HDC hdc,
pixelAttribs[i++] = WGL_COLOR_BITS_ARB;
pixelAttribs[i++] = colorbits;
pixelAttribs[i++] = WGL_ALPHA_BITS_ARB;
pixelAttribs[i++] = 8;
/* end of "Update PIXEL_ATTRIBUTES above if any groups are added here!" */
if (display_win32->hasWglARBmultisample)
{
pixelAttribs[i++] = WGL_SAMPLE_BUFFERS_ARB;
pixelAttribs[i++] = 1;
pixelAttribs[i++] = WGL_SAMPLES_ARB;
pixelAttribs[i++] = 8;
}
pixelAttribs[i++] = 0; /* end of pixelAttribs */
g_assert (i <= PIXEL_ATTRIBUTES);
best_pf = gdk_init_dummy_wgl_context (display_win32);
if (!wglMakeCurrent (display_win32->dummy_context_wgl.hdc,
@@ -195,8 +191,8 @@ get_wgl_pfd (HDC hdc,
pixelAttribs,
NULL,
1,
&best_pf,
&num_formats);
&best_pf,
&num_formats);
/* Go back to the HDC that we were using, since we are done with the dummy HDC and GL Context */
wglMakeCurrent (hdc_current, hglrc_current);
@@ -247,6 +243,43 @@ gdk_init_dummy_wgl_context (GdkWin32Display *display_win32)
return best_idx;
}
/*
* Use a dummy HWND to init GL, sadly we can't just use the
* HWND that we use for notifications as we may only call
* SetPixelFormat() on an HDC once, and that notification HWND
* uses the CS_OWNDC style meaning that even if we were to call
* DeleteDC() on it, we would get the exact same HDC when we call
* GetDC() on it later, meaning SetPixelFormat() cannot be used
* again on the HDC that we acquire from the notification HWND.
*/
static HWND
create_dummy_gl_window (void)
{
WNDCLASS wclass = { 0, };
ATOM klass;
HWND hwnd;
wclass.lpszClassName = "GdkGLDummyWindow";
wclass.lpfnWndProc = DefWindowProc;
wclass.hInstance = _gdk_app_hmodule;
wclass.style = CS_OWNDC;
klass = RegisterClass (&wclass);
if (klass)
{
hwnd = CreateWindow (MAKEINTRESOURCE (klass),
NULL, WS_POPUP,
0, 0, 0, 0, NULL, NULL,
_gdk_app_hmodule, NULL);
if (!hwnd)
{
UnregisterClass (MAKEINTRESOURCE (klass), _gdk_app_hmodule);
}
}
return hwnd;
}
GdkGLContext *
gdk_win32_display_init_wgl (GdkDisplay *display,
GError **error)
@@ -263,6 +296,15 @@ gdk_win32_display_init_wgl (GdkDisplay *display,
* dummy GL Context, it is used to query functions
* and used for other stuff as well
*/
if (display_win32->dummy_context_wgl.hdc == NULL)
{
display_win32->dummy_context_wgl.hwnd = create_dummy_gl_window ();
if (display_win32->dummy_context_wgl.hwnd != NULL)
display_win32->dummy_context_wgl.hdc = GetDC (display_win32->dummy_context_wgl.hwnd);
}
best_idx = gdk_init_dummy_wgl_context (display_win32);
hdc = display_win32->dummy_context_wgl.hdc;
@@ -287,8 +329,6 @@ gdk_win32_display_init_wgl (GdkDisplay *display,
epoxy_has_wgl_extension (hdc, "WGL_OML_sync_control");
display_win32->hasWglARBPixelFormat =
epoxy_has_wgl_extension (hdc, "WGL_ARB_pixel_format");
display_win32->hasWglARBmultisample =
epoxy_has_wgl_extension (hdc, "WGL_ARB_multisample");
context = g_object_new (GDK_TYPE_WIN32_GL_CONTEXT_WGL,
"display", display,
@@ -309,15 +349,13 @@ gdk_win32_display_init_wgl (GdkDisplay *display,
"\t* WGL_ARB_pixel_format: %s\n"
"\t* WGL_ARB_create_context: %s\n"
"\t* WGL_EXT_swap_control: %s\n"
"\t* WGL_OML_sync_control: %s\n"
"\t* WGL_ARB_multisample: %s\n",
"\t* WGL_OML_sync_control: %s\n",
major, minor,
glGetString (GL_VENDOR),
display_win32->hasWglARBPixelFormat ? "yes" : "no",
display_win32->hasWglARBCreateContext ? "yes" : "no",
display_win32->hasWglEXTSwapControl ? "yes" : "no",
display_win32->hasWglOMLSyncControl ? "yes" : "no",
display_win32->hasWglARBmultisample ? "yes" : "no"));
display_win32->hasWglOMLSyncControl ? "yes" : "no"));
}
#endif
@@ -383,7 +421,6 @@ ensure_legacy_wgl_context (HDC hdc,
static HGLRC
create_wgl_context_with_attribs (HDC hdc,
HGLRC hglrc_base,
GdkGLContext *share,
int flags,
gboolean is_legacy,
@@ -437,36 +474,63 @@ create_wgl_context_with_attribs (HDC hdc,
}
static HGLRC
create_wgl_context (GdkGLContext *context,
HDC hdc,
gboolean hasWglARBCreateContext,
GdkGLContext *share,
int flags,
gboolean legacy,
GError **error)
create_base_wgl_context (GdkWin32Display *display_win32,
HDC hdc,
gboolean force_create_base_context,
gboolean *remove_base_context)
{
/* We need a legacy context for *all* cases */
HGLRC hglrc_base = NULL;
if (force_create_base_context || display_win32->dummy_context_wgl.hglrc == NULL)
{
hglrc_base = wglCreateContext (hdc);
if (hglrc_base == NULL)
return NULL;
*remove_base_context = !force_create_base_context;
}
else
hglrc_base = display_win32->dummy_context_wgl.hglrc;
return hglrc_base;
}
static HGLRC
create_wgl_context (GdkGLContext *context,
GdkWin32Display *display_win32,
HDC hdc,
GdkGLContext *share,
int flags,
gboolean legacy,
GError **error)
{
/* We need a legacy context for *all* cases, if no WGL contexts are created */
HGLRC hglrc_base, hglrc;
GdkGLVersion version;
gboolean remove_base_context = FALSE;
/* Save up the HDC and HGLRC that we are currently using, to restore back to it when we are done here */
HDC hdc_current = wglGetCurrentDC ();
HGLRC hglrc_current = wglGetCurrentContext ();
hglrc_base = wglCreateContext (hdc);
if (hglrc_base == NULL ||
!wglMakeCurrent (hdc, hglrc_base))
{
g_clear_pointer (&hglrc_base, wglDeleteContext);
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
_("Unable to create a GL context"));
return 0;
}
hglrc = NULL;
if (hasWglARBCreateContext)
if (display_win32->hasWglARBCreateContext)
{
hglrc_base = create_base_wgl_context (display_win32,
hdc,
FALSE,
&remove_base_context);
if (hglrc_base == NULL || !wglMakeCurrent (hdc, hglrc_base))
{
g_clear_pointer (&hglrc_base, gdk_win32_private_wglDeleteContext);
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
_("Unable to create a GL context"));
return 0;
}
if (!legacy)
{
gdk_gl_context_get_matching_version (context,
@@ -474,7 +538,6 @@ create_wgl_context (GdkGLContext *context,
FALSE,
&version);
hglrc = create_wgl_context_with_attribs (hdc,
hglrc_base,
share,
flags,
FALSE,
@@ -488,7 +551,6 @@ create_wgl_context (GdkGLContext *context,
TRUE,
&version);
hglrc = create_wgl_context_with_attribs (hdc,
hglrc_base,
share,
flags,
TRUE,
@@ -499,6 +561,20 @@ create_wgl_context (GdkGLContext *context,
if (hglrc == NULL)
{
legacy = TRUE;
hglrc_base = create_base_wgl_context (display_win32,
hdc,
TRUE,
&remove_base_context);
if (hglrc_base == NULL || !wglMakeCurrent (hdc, hglrc_base))
{
g_clear_pointer (&hglrc_base, gdk_win32_private_wglDeleteContext);
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
_("Unable to create a GL context"));
return 0;
}
gdk_gl_context_get_matching_version (context,
GDK_GL_API_GL,
TRUE,
@@ -513,7 +589,8 @@ create_wgl_context (GdkGLContext *context,
gdk_gl_context_set_is_legacy (context, legacy);
}
g_clear_pointer (&hglrc_base, wglDeleteContext);
if (remove_base_context)
g_clear_pointer (&hglrc_base, gdk_win32_private_wglDeleteContext);
wglMakeCurrent (hdc_current, hglrc_current);
@@ -521,34 +598,51 @@ create_wgl_context (GdkGLContext *context,
}
static gboolean
set_wgl_pixformat_for_hdc (HDC hdc,
set_wgl_pixformat_for_hdc (GdkWin32Display *display_win32,
HDC *hdc,
int *best_idx,
GdkWin32Display *display_win32)
gboolean *recreate_dummy_context)
{
gboolean already_checked = TRUE;
*best_idx = GetPixelFormat (hdc);
gboolean skip_acquire = FALSE;
gboolean set_pixel_format_result = FALSE;
PIXELFORMATDESCRIPTOR pfd;
/* one is only allowed to call SetPixelFormat(), and so ChoosePixelFormat()
* one single time per window HDC
*/
if (*best_idx == 0)
GDK_NOTE (OPENGL, g_print ("requesting pixel format...\n"));
*best_idx = get_wgl_pfd (*hdc, &pfd, display_win32);
if (display_win32->dummy_context_wgl.hwnd != NULL)
{
PIXELFORMATDESCRIPTOR pfd;
gboolean set_pixel_format_result = FALSE;
/*
* Ditch the initial dummy HDC, HGLRC and HWND used to initialize WGL,
* we want to ensure that the HDC of the notification HWND that we will
* also use for our new dummy HDC will have the correct pixel format set
*/
wglDeleteContext (display_win32->dummy_context_wgl.hglrc);
display_win32->dummy_context_wgl.hglrc = NULL;
display_win32->dummy_context_wgl.hdc = GetDC (display_win32->hwnd);
*hdc = display_win32->dummy_context_wgl.hdc;
*recreate_dummy_context = TRUE;
GDK_NOTE (OPENGL, g_print ("requesting pixel format...\n"));
already_checked = FALSE;
*best_idx = get_wgl_pfd (hdc, &pfd, display_win32);
if (*best_idx != 0)
set_pixel_format_result = SetPixelFormat (hdc, *best_idx, &pfd);
/* ChoosePixelFormat() or SetPixelFormat() failed, bail out */
if (*best_idx == 0 || !set_pixel_format_result)
return FALSE;
DestroyWindow (display_win32->dummy_context_wgl.hwnd);
display_win32->dummy_context_wgl.hwnd = NULL;
}
GDK_NOTE (OPENGL, g_print ("%s""requested and set pixel format: %d\n", already_checked ? "already " : "", *best_idx));
if (GetPixelFormat (*hdc) != 0)
{
skip_acquire = TRUE;
set_pixel_format_result = TRUE;
}
else if (*best_idx != 0)
set_pixel_format_result = SetPixelFormat (*hdc, *best_idx, &pfd);
/* ChoosePixelFormat() or SetPixelFormat() failed, bail out */
if (*best_idx == 0 || !set_pixel_format_result)
return FALSE;
GDK_NOTE (OPENGL, g_print ("%s""requested and set pixel format: %d\n", skip_acquire ? "already " : "", *best_idx));
return TRUE;
}
@@ -564,8 +658,9 @@ gdk_win32_gl_context_wgl_realize (GdkGLContext *context,
/* request flags and specific versions for core (3.2+) WGL context */
int flags = 0;
HGLRC hglrc;
int pixel_format;
int pixel_format = 0;
HDC hdc;
gboolean recreate_dummy_context = FALSE;
GdkSurface *surface = gdk_gl_context_get_surface (context);
GdkDisplay *display = gdk_gl_context_get_display (context);
@@ -591,9 +686,10 @@ gdk_win32_gl_context_wgl_realize (GdkGLContext *context,
else
hdc = display_win32->dummy_context_wgl.hdc;
if (!set_wgl_pixformat_for_hdc (hdc,
if (!set_wgl_pixformat_for_hdc (display_win32,
&hdc,
&pixel_format,
display_win32))
&recreate_dummy_context))
{
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_UNSUPPORTED_FORMAT,
@@ -611,12 +707,34 @@ gdk_win32_gl_context_wgl_realize (GdkGLContext *context,
flags |= WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB;
hglrc = create_wgl_context (context,
display_win32,
hdc,
display_win32->hasWglARBCreateContext,
share,
flags,
legacy_bit,
error);
if (recreate_dummy_context)
{
display_win32->dummy_context_wgl.hglrc =
create_wgl_context (context,
display_win32,
display_win32->dummy_context_wgl.hdc,
NULL,
flags,
legacy_bit,
error);
if (display_win32->dummy_context_wgl.hglrc == NULL)
{
if (hglrc != NULL)
{
wglDeleteContext (hglrc);
hglrc = NULL;
}
}
}
if (hglrc == NULL)
return 0;

Some files were not shown because too many files have changed in this diff Show More