Compare commits

...

490 Commits

Author SHA1 Message Date
Matthias Clasen
0492ba73e2 Drop gdk_surface_new_temp
GTK is not using this API anymore, and we want
to consolidate our surface types to just toplevels
and popups.
2020-02-14 15:14:52 -05:00
Matthias Clasen
9e70c5d141 testsuite: Stop using gdk_surface_new_temp
We can just use regular toplevels here.
2020-02-14 15:14:52 -05:00
Matthias Clasen
15544815ab Drop GtkWindowType
GtkWindow is always a toplevel now, so we don't
need to pass a type to the constructor anymore.

Adjust all callers.
2020-02-14 15:14:52 -05:00
Benjamin Otte
922f9df86f Merge branch 'wip/otte/for-master' into 'master'
reftests: Change popup windows to non-decorated windows

See merge request GNOME/gtk!1435
2020-02-14 17:12:17 +00:00
Benjamin Otte
980934f82d reftests: Change popup windows to non-decorated windows
This allows getting rid of popup windows.
2020-02-14 17:54:38 +01:00
Matthias Clasen
c45ed9d76e Merge branch 'zhaoqiang/gtk-To_avoid_compiler_warning' 2020-02-14 08:47:36 -05:00
Matthias Clasen
b6cb1a6eb3 Merge branch 'master-subtract-base-size' into 'master'
gdk: Subtract base size when checking aspect ratio

See merge request GNOME/gtk!1331
2020-02-14 13:19:42 +00:00
Mohammed Sadiq
22a6aaf4c5 Merge branch 'wip/otte/for-master' into 'master'
slicelistmodel: Fix two wrong computations

See merge request GNOME/gtk!1433
2020-02-14 02:39:21 +00:00
Benjamin Otte
d303b5b0eb slicelistmodel: Fix two wrong computations
Both of those are thinkos during math.
Found by Mohammed Sadiq.

Testcases triggering both have been added.
2020-02-14 03:15:22 +01:00
Matthias Clasen
97ec29d3f5 Force-create style contexts in realize
This is necessary as long as style contexts are
required for proper css change tracking.

Fixes #2435
2020-02-13 21:14:01 -05:00
Emmanuele Bassi
eb2e0137fa Merge branch 'master' into 'master'
Fixed OpenGL extension detection for extensions promoted to OpenGL core.

Closes #2428

See merge request GNOME/gtk!1424
2020-02-13 19:53:33 +00:00
David Hogan
0969d06925 Fix detection of OpenGL 3.3 core GL_ARB_timer_query.
Some systems (notably macOS) will not allow enumeration of an extension that has been promoted to core OpenGL for context in use. This change assumes that GL_ARB_timer_query is available on OpenGL 3.3+.

I could not find definitive information on whether GL_ARB_debug_output or GL_KHR_debug have been added to core. Other extensions in use were addressed by https://gitlab.gnome.org/GNOME/gtk/merge_requests/1422 .
2020-02-14 05:41:01 +11:00
David Hogan
c4111dad31 Fixed OpenGL extension detection for extensions promoted to OpenGL core.
For a given OpenGL context, macOS in particular does not support enumeration / detection of OpenGL features that have been promoted to core OpenGL functionality. It is possible other drivers are the same. This change assumes support for GL_ARB_texture_non_power_of_two with OpenGL 2.0+, GL_ARB_texture_rectangle with OpenGL 3.1+ and GL_EXT_framebuffer_blit with OpenGL 3.0+. I failed to find definitive information on whether GL_GREMEDY_frame_terminator has been promoted to OpenGL core, or whether GL_ANGLE_framebuffer_blit or GL_EXT_unpack_subimage have been promoted to core in OpenGL ES. This change results in a significant GtkGLArea performance boost on macOS.

Closes #2428
2020-02-14 05:41:01 +11:00
Emmanuele Bassi
33c6032a10 Merge branch 'ci-flatpak' into 'master'
CI pipeline changes for Flatpak jobs

See merge request GNOME/gtk!1429
2020-02-13 18:10:29 +00:00
Emmanuele Bassi
9a631f2942 ci: Remove G_MESSAGES_DEBUG
We don't need all the debugging messages.
2020-02-13 17:10:19 +00:00
Emmanuele Bassi
9332abfd5b ci: Allow flatpak jobs to fail
We have more accurate CI jobs, now; the Flatpak jobs are nice to have.
2020-02-13 17:09:35 +00:00
Matthias Clasen
883980c48c Merge branch 'gi-fixes' into 'master'
Various fixes for documentation and introspectable API

See merge request GNOME/gtk!1427
2020-02-13 16:38:41 +00:00
Matthias Clasen
2e0af29839 Make release builds mandatory for ci
The tests are now passing in release builds, lets keep
it that way.
2020-02-13 11:21:15 -05:00
Matthias Clasen
cdee2ac173 testsuite: Handle icontheme test better
Skip just the failing tests in release builds.
2020-02-13 10:56:26 -05:00
Matthias Clasen
a66ed7c461 gsk: Fix the compiler warning differently 2020-02-13 10:42:21 -05:00
Emmanuele Bassi
09abb43628 Merge branch 'report-fixes' into 'master'
Fixes for the CI test reports

See merge request GNOME/gtk!1426
2020-02-13 15:04:04 +00:00
Emmanuele Bassi
de1543d4fa ci: Use per-suite anchors
Anchors are global, so they need to be namespaced.
2020-02-13 14:55:39 +00:00
Emmanuele Bassi
5ed3f8d98b ci: Rearrange the results in the HTML report
Move the failures up top, so they stand out.
2020-02-13 14:55:39 +00:00
Emmanuele Bassi
affc7b58fa ci: Fix the HTML anchor in the report 2020-02-13 14:55:39 +00:00
Emmanuele Bassi
2b1e273c53 ci: Use result instead of exit code in the JUnit report
We have a result code coming from Meson which is more accurate than just
looking at the exit code of the unit.
2020-02-13 14:55:39 +00:00
Emmanuele Bassi
1a4d1f8994 ci: Unexpected passes are failures
List them as such in our reports.
2020-02-13 14:55:39 +00:00
Emmanuele Bassi
adc7bf9f25 ci: Put the branch name in the HTML header 2020-02-13 14:55:39 +00:00
Emmanuele Bassi
f4a8edf441 ci: Move HTML report meta from header to article
Makes the bar smaller.
2020-02-13 14:55:39 +00:00
Emmanuele Bassi
3dc6a07f5d ci: Re-enable ccache 2020-02-13 14:55:39 +00:00
Emmanuele Bassi
2a0dfa9670 Remove gtk_style_context_get_parent()
The function was declared and mentioned in the documentation, but it has
been removed in commit 416182a20d.
2020-02-13 14:53:25 +00:00
Emmanuele Bassi
40852ea952 gi: Skip gtk_custom_layout_new()
The whole GtkCustomLayout class is mostly a C convenience API, and
there's no reason why high level languages should use it.
2020-02-13 14:53:25 +00:00
Emmanuele Bassi
32a2a629dd Fix the function name in the gtk-doc stanza
The documentation is still referring to the old function's name.
2020-02-13 14:53:25 +00:00
Emmanuele Bassi
35ac7de140 Match argument name between declaration and definition
Otherwise the documentation and the introspection data will complain.
2020-02-13 14:53:25 +00:00
Emmanuele Bassi
0d354d1dc4 docs: Match the argument name with its declaration 2020-02-13 14:53:25 +00:00
Emmanuele Bassi
cdd7e4c5ec Add a notify function to GdkContentProvider
The callback-based content providers need a GDestroyNotify function to
free the data passed to them on construction, otherwise they are going
to leak.
2020-02-13 14:53:25 +00:00
Matthias Clasen
47f2a6cafd Remove border-half-pixel reftest from xfail
It passes both locally and on ci now.
2020-02-13 09:39:27 -05:00
Matthias Clasen
313c399122 Merge branch 'wip/otte/no-clip-on-draw' into 'master'
Various fixes to rendernode drawing with Cairo

See merge request GNOME/gtk!1425
2020-02-13 13:43:59 +00:00
Benjamin Otte
052d0f6e60 gdk: Remove gdk_cairo_get_clip_rectangle()
The function is fundamentally broken for unbounded surfaces.
If a surface is unbounded, we cannot represent this as a
cairo_rectangle_int_t, and using the return value doesn't work because
it's already used for something else.

In GTK3, unbounded surfaces aren't a problem, but GTK4 uses recording
surfaces.

So better remove that function before we keep using it and using it
wrong.
2020-02-13 07:36:38 +01:00
Benjamin Otte
8f6cab6560 cairoblur: Get rid of gdk_cairo_get_clip_rectangle() call
It's about to be removed.
2020-02-13 07:36:38 +01:00
Benjamin Otte
6203cecf97 gsk: Clip shadow node before push_group()
We want to be sure to push a group that's as small as possible, so we
clip to the child's bounds, because that's the smallest we can go.
2020-02-13 07:36:38 +01:00
Benjamin Otte
6f9f18009c gsk: Add a utility function for rectangles
... and use it.
2020-02-13 07:36:38 +01:00
Benjamin Otte
67610b1242 cairoblur: Move the check for early exit
That means we only have one place where we check all kinds of early
exits.
2020-02-13 07:36:38 +01:00
Benjamin Otte
f0993fc881 rendernode: Avoid rounding errors
Compute the pattern matrix directly instead of transforming the cairo_t.

This ensures that when node_size / texture_size is some obscure floating
point value, we don't get rounding issues from scaling by it once we
draw the texture_size rectangle.

I have no actual failure where this comes in handy, but I had written
the code anyway, so decided to keep it.
2020-02-13 07:36:38 +01:00
Benjamin Otte
75b130ed6b testsuite: Add tests for rounded rect code
... including the bug that was fixed in the parent commit.
2020-02-13 07:36:38 +01:00
Benjamin Otte
77d7c713d4 roundedrect: Fix inlining of graphene functions
graphene treats equality for contains() operations as always matching,
so do the same thing.

This is because unlike integer math, floating point cannot do the "as
close as possible to the point, but not reaching it" operation that
integer does by just subtracting 1.
2020-02-13 07:36:38 +01:00
Benjamin Otte
b0369fc300 roundedrect: Fix gsk_rounded_rect_intersects_rect()
The previous code would return FALSE for
  gsk_rounded_rect_intersects_rect (&rounded, &rounded.bounds);
if rounded was indeed rounded.
2020-02-13 07:36:38 +01:00
Benjamin Otte
16e38701b6 testsuite: Don't use gdk_cairo_get_clip_rectangle()
I want to remove it.
2020-02-13 06:15:44 +01:00
Benjamin Otte
9d8ceb0cb2 testsuite: Don't destroy surfaces that are still used
Coercing the surfaces must not unref the old surface, because the old
surface is going to be saved to a file.
2020-02-13 06:15:44 +01:00
Benjamin Otte
c313a71c3a testsuite: Remove accidentally checked in file
This file should go in the listview branch I guess.
2020-02-13 06:14:05 +01:00
Matthias Clasen
fb84fe7065 Fix flickery hover
Commit 47c44644b1 was a bit overzealous in fixing
compiler warnings. We still need to call collect_textures,
even if we don't need the number that it returns.
2020-02-12 22:45:24 -05:00
Matthias Clasen
9be8f8cf43 Merge branch 'wip/baedert/cairo-paint' into 'master'
Remove cairo_clip() when drawing render nodes

Closes #2431

See merge request GNOME/gtk!1418
2020-02-12 23:44:38 +00:00
Matthias Clasen
14ecc9ec7e Remove unused signal enum values
GtkWidget lost even more signals, so we don't need
these enum values anymore.
2020-02-12 18:25:42 -05:00
Matthias Clasen
073e8dd987 popovermenu: Avoid an uninitialized variable
Pointed out by Timm/clang.

Fixes https://gitlab.gnome.org/GNOME/gtk/issues/2434
2020-02-12 17:58:41 -05:00
Matthias Clasen
6c6b3d0d11 Merge branch 'ci-pages' into 'master'
Rename the SCSS files for our themes

Closes #2423

See merge request GNOME/gtk!1423
2020-02-12 22:35:58 +00:00
Emmanuele Bassi
2ab9be54fb Rename the SCSS files for our themes
It seems that Meson's gnome.compile_resources() cannot deal with two
files with the same name under different directories, which breaks the
build parallelism because the GResource file ends up not depending on
either the Adwaita or the HighContrast gtk-contained.css file.

This commit only changes the on-disk names of the Adwaita and
HighContrast SCSS files, and the corresponding generated CSS files; the
files in the GResource are going to be aliased to the old file names, to
minimise the breakage. We might want to change the theme entry points at
some later date, if we decide to commit to this naming scheme.

Fixes: #2423

See Meson bug: https://github.com/mesonbuild/meson/issues/6615
2020-02-12 20:22:43 +00:00
Matthias Clasen
11ab39617e Fix the Emoji chooser finalize
If the Emoji chooser is finalized before the idle
has run, it would spew criticals, breaking some tests.
Avoid that.
2020-02-12 14:23:01 -05:00
Georges Basile Stavracas Neto
7404c393f3 Merge branch 'gbsneto/fix-emojichooser-header' into 'master'
build: Install gtkemojichooser.h

See merge request GNOME/gtk!1420
2020-02-12 18:56:19 +00:00
Georges Basile Stavracas Neto
1b95cd27bc build: Install gtkemojichooser.h
It was made public at ef7172dc1e, but the header file
wasn't added to the public headers list.

Add the header file to the list.
2020-02-12 15:41:49 -03:00
Emmanuele Bassi
88e2a060f8 Merge branch 'ci-pages' into 'master'
Small CI pipeline fixes

See merge request GNOME/gtk!1419
2020-02-12 18:38:39 +00:00
Emmanuele Bassi
4247bf0fb6 ci: Update flatpak job
Use `flatpak build` and point at the nightly repo when generating the
bundle.
2020-02-12 18:24:54 +00:00
Emmanuele Bassi
f2da5e5617 ci: Deploy the API ref before flatpak 2020-02-12 18:12:53 +00:00
Emmanuele Bassi
f51ceb142b ci: Fix linking of the CI assets in the report
The report is relative to the build directory, and so are the generated
assets.
2020-02-12 18:12:53 +00:00
Matthias Clasen
e1d85aeeb0 testsuite: Warn if a necessary env var is missing
Better to warn if we know why the tests are
going to fail. Saves headscratching later.
2020-02-12 12:18:59 -05:00
Matthias Clasen
cc8506ca15 Move performance tests to the right testsuite
This was a copy-paste error.
2020-02-12 12:18:59 -05:00
Timm Bäder
52c46e5c24 rendernode: Don't clip when _draw()ing 2020-02-12 16:54:49 +01:00
Timm Bäder
b12a6be9d9 rendernode: draw() only in node bounds
We currently disable when draw()ing nodes using the cairo fallback path,
which means we can't just use cairo_paint(). Use a proper rectangle
instead.

Fixes #2431
2020-02-12 16:54:46 +01:00
Matthias Clasen
d702c159d5 Merge branch 'cleanup-profiler-marks' into 'master'
Cleanup profiler marks

See merge request GNOME/gtk!1417
2020-02-12 14:31:40 +00:00
Alexander Larsson
6e3dd6dd62 profile: Use separate names for frameclock marks instead of using details
The marks are averaged based on the name, so this makes more sense.

Also rename the map/unmap marks to have the same capitalization as
everything else.
2020-02-12 14:29:31 +01:00
Alexander Larsson
d9c59a7c8c profiler: Add G_GNUC_PRINTF markers to silence warnings
I was getting CI failures like:
 ../gdk/gdkprofiler.c: In function ‘add_markvf’:
../gdk/gdkprofiler.c:111:3: error: function ‘add_markvf’ might be a candidate for ‘gnu_printf’ format attribute [-Werror=suggest-attribute=format]
2020-02-12 13:36:04 +01:00
Alexander Larsson
324202a56c profiler: Clean up profiler marks for frameclock
This drops the marks for before/after-paint as they are internal
things that very rarely use any time, and also flush/resume-events
as any events reported here will get separate marks so will be easy
to see anyway.

Also, we rename the entire frameclock cycle to "frameclock cycle"
rather than "paint_idle" which is rather cryptic.
2020-02-12 13:20:32 +01:00
Alexander Larsson
e3a67385f4 profiler: Add profiler marks for when surfaces are mapped and unmapped
This is done on the X11 side so we can tell when the map/unmap takes
effect and how long it took since the map request.
2020-02-12 12:44:43 +01:00
Alexander Larsson
b4b00e2887 icon theme: Don't add profiler marks for short async icon loads
We do a bunch of preloads, and most of these are not really interesting
anyway.
2020-02-12 12:43:27 +01:00
Alexander Larsson
e134eef505 builder: Don't add profiler marks for short parses
There are a lot of thes (since we're recursing), so don't spew the
output with uninteresting ones.
2020-02-12 12:42:29 +01:00
Alexander Larsson
2890cd849f profiler: Add _end_mark() version of _add_mark()
These don't take a duration, instead they call g_get_monotonic_time() to
and subtract the start time for it.

Almost all our calls are like this, and this makes the callsites clearer
and avoids inlining the clock call into the call site.
2020-02-12 11:25:34 +01:00
Alexander Larsson
01d5ad2056 profiler: Make profiler-is-running a macro
When we use if (GDK_PROFILER_IS_RUNNING) this means we get an
inlined if (FALSE) when the compiler support is not compiled in, which
gets rid of all the related code completely.

We also expand to  G_UNLIKELY(gdk_profiler_is_running ()) in the supported
case which might cause somewhat better code generation.
2020-02-12 11:05:01 +01:00
Alexander Larsson
cc643df88b Convert all profiler times from nsec to usec
usec is the scale of the monotonic timer which is where we get almost
all the times from. The only actual source of nsec is the opengl
GPU time (but who knows what the actual resulution of that is).

Changing this to usec allows us to get rid of " * 1000" in a *lot* of
places all over the codebase, which are ugly and confusing.
2020-02-12 10:44:17 +01:00
Alexander Larsson
13eedf1a9f Use markf in one more place 2020-02-12 10:40:26 +01:00
Alexander Larsson
685fd3c33d fixup! Add gdk_profiler_add_markf() to do printf formating 2020-02-12 10:11:53 +01:00
Alexander Larsson
8a1c51db1c Use the new gdk_profiler_add_markf() function 2020-02-12 09:59:03 +01:00
Alexander Larsson
6de85c0a68 Add gdk_profiler_add_markf() to do printf formating
This allows us to avoid hand-rolling g_strdup_printf calls,
but also moves the printf into the called function where
it doesn't bloat the code of the calling function if the profiler
is not running.
2020-02-12 09:58:52 +01:00
Carmen Bianca BAKKER
c2dcd1bf94 Update Esperanto translation 2020-02-12 07:43:58 +00:00
Matthias Clasen
6e0cf02494 Merge branch 'mark-events-with-kind' into 'master'
profiler: Always mark events with the kind

See merge request GNOME/gtk!1414
2020-02-11 19:01:10 +00:00
Alexander Larsson
36808e0c81 profiler: Always mark events with the kind 2020-02-11 19:51:49 +01:00
Matthias Clasen
9062607d5f Merge branch 'wip/baedert/outline-radius' into 'master'
css boxes: Compute box from border box

Closes #2425

See merge request GNOME/gtk!1408
2020-02-11 16:59:11 +00:00
Emmanuele Bassi
042a5736fa Merge branch 'share-gl-programs' into 'master'
GskGLRenderer: Share programs between different renderers in same display

See merge request GNOME/gtk!1413
2020-02-11 16:30:16 +00:00
Matthias Clasen
720e48ec51 Merge branch 'handle-max-texture-size' into 'master'
gl: Don't require too large texture for offsreen ops

See merge request GNOME/gtk!1411
2020-02-11 16:23:02 +00:00
Matthias Clasen
9d0393d8e6 Merge branch 'fix-angle-normalization' into 'master'
gsk: Fix angle normalization

See merge request GNOME/gtk!1409
2020-02-11 16:17:14 +00:00
Alexander Larsson
7b0b3d9547 GskGLRenderer: Share programs between different renderers in same display
This is similar to how we share texture atlases. Some added complexity
in that the program state also needed to be shared, so it had to move to
the shared Programs object.

With this change realization of additional GskRenderers when opening
popups went from ~60msec to ~35 msec on average.
2020-02-11 16:58:45 +01:00
Emmanuele Bassi
bb71cdd722 Merge branch 'ci-jobs' into 'master'
Update CI jobs

See merge request GNOME/gtk!1412
2020-02-11 15:25:48 +00:00
Emmanuele Bassi
2b425fa88a ci: Allow release job to fail
We need to investigate release-specific failures, and possibly fix our
test suite to deal with debug-specific poking through the internal
state.

For the time being, allow the release job to fail, but this is strictly
a temporary measure.
2020-02-11 15:12:14 +00:00
Emmanuele Bassi
b99a4da939 testsuite/gtk: Add xfail tests
Some tests are expected to fail.

Some tests are expected to fail in non-debugging builds.

The icontheme test is the latter.
2020-02-11 14:53:57 +00:00
Emmanuele Bassi
c69595a3a9 vulkan: Handle VK_ERROR_UNKNOWN
A newly added Vulkan 1.2 error.
2020-02-11 14:47:22 +00:00
Emmanuele Bassi
76aba1f046 ci: Add a style check pass
We should at least try to get the style check done by a machine, as
opposed to have humans go through merge requests with coding style
nitpicks.
2020-02-11 14:47:22 +00:00
Emmanuele Bassi
59028d7d0f ci: Generate the report for the release builds
We are going to need to hide the report generation into the test runner
script, as we want the job to produce the reports even in case of
failure, instead of bailing out immediately.
2020-02-11 14:47:22 +00:00
Emmanuele Bassi
0df542e494 Declare global counters only in debug builds 2020-02-11 14:47:22 +00:00
Emmanuele Bassi
47c44644b1 Silence compiler warnings in non-debug builds 2020-02-11 14:47:22 +00:00
Emmanuele Bassi
1806af1e83 Declare global counter only in debug builds 2020-02-11 14:47:22 +00:00
Matthias Clasen
b5dc03d940 Merge branch 'fix-revealer-scale' into 'master'
revealer: Fix child size allocation at small scales

See merge request GNOME/gtk!1410
2020-02-11 14:06:36 +00:00
Emmanuele Bassi
c4dfacc404 ci: Add missing newline escape
Otherwise we're going to run the accessibility test suite, and it's
going to fail.
2020-02-11 13:39:52 +00:00
Emmanuele Bassi
c00896a090 ci: Remove static build job
Now that we figured out why the build was failing on Fedora when the
profiling code was enabled, we can go back to building both shared and
static libraries by default.
2020-02-11 13:39:52 +00:00
Emmanuele Bassi
5ace9ef4e8 ci: Use the new Fedora image 2020-02-11 13:39:52 +00:00
Emmanuele Bassi
a7d295254f ci: Add static packages for GLib and PCRE
Otherwise Meson will warn about missing static dependencies for
sysprof-capture-3.
2020-02-11 13:39:52 +00:00
Emmanuele Bassi
62352dd1fc Fix compiler warnings in the release build
We have a bunch of debug-only variables that get set and never used
outside of debug code paths, and the compiler is not happy about it.
2020-02-11 13:39:52 +00:00
Emmanuele Bassi
74b5bb12fb ci: Disable ccache 2020-02-11 13:39:52 +00:00
Emmanuele Bassi
02ac7ff0aa Initialise out variable
Otherwise we might return an undefined value, and the compiler will be
very cross at us.
2020-02-11 13:39:52 +00:00
Emmanuele Bassi
c06a08d63a ci: Split the static and shared builds (again)
Sadly, we can't do a static build with the profiling code enabled
because we don't have a static GLib build available.
2020-02-11 13:39:52 +00:00
Emmanuele Bassi
9e38a70c6b ci: Replicate the CI image scripts from GLib
They are easier to use and document, and allow us to add new base images
in the future without making a mess.
2020-02-11 13:39:52 +00:00
Emmanuele Bassi
56f9cdd99d ci: Refactor the CI pipeline
We should have a single job for building both static and shared
versions of GTK. On the other hand, having a separate job for the
release build would be a plus.

Additionally, we shouldn't use an opaque script to build GTK; the only
step in the process that requires hand-holding is running the tests
suites under Xvfb, and having the build options visible from the YAML
file gives us a better idea of what kind of build we're running.
2020-02-11 13:39:52 +00:00
Emmanuele Bassi
153e8a0c92 ci: Use release builds for Flatpak bundles 2020-02-11 13:39:52 +00:00
Chun-wei Fan
6ec546be02 tests/frame-stats.c: Include stdlib.h
It is used for exit().
2020-02-11 20:59:04 +08:00
Alexander Larsson
dc6fe091b9 revealer: Fix child size allocation at small scales
As pointed out in https://gitlab.gnome.org/GNOME/gtk/issues/1481
and seen from critical warnings with swinging revealers in widget-factory
there are some size allocation issues in GtkRevealer.

What happens is that we request a size of the revealer itself
based on the child natural size and the current stage of the transition
by applying a scale to the natural size. We then round up to nearest
int size. However, we want the widget to render as if it did get the
natural size so we can transform it, rather than the scaled down size.
For example, a label should not start ellipsizing in the animation.
So we inverse the scale when allocating the child.

Unfortunately, for very small scales the inversion of the scale can
result in very large sizes, and for such scales we rounded up the
requested size to 1, so we will be allocating huuuuge children.

In order to avoid such issue we pick an arbitrary maximum upscale
scale factor of 100. This means that in the case where the allocated
size is 1 we never allocate the child at > 100 px. This means
that in large downscaling cases we may run into the clipping issue
described above. However, at these downscaling levels (100 times!)
we're unlikely to notice much detail anyway.
2020-02-11 13:52:12 +01:00
Alexander Larsson
1f0438e7fe gsk: Fix angle normalization
I was getting assertions that normalize_angle() failed the
result < 260 check. Doing some research on this it turns out
to be a precision issue. If the incomming angle is very slightly
below zero, then adding 360 to it may end up with exactly 360.

I simplified the code a bit to avoid division and rounding, because in
practice most angles will be "just outside" the 0-360 degree anyway.
And i also added a workaround for the "result is 360" case by just
setting it to 0.
2020-02-11 13:51:06 +01:00
Alexander Larsson
8fdb710c0f gl: Don't require too large texture for offsreen ops
When rendering ops to an offscreen texture we take max-texture-size
in consideration and modify the scale we use such that the required
texture does not exceed the limit.

This means some rendering will be blocky/fuzzy, but that is better
than it being clipped.
2020-02-11 13:50:35 +01:00
Matthias Clasen
af98c46d04 Typo fix 2020-02-11 07:46:12 -05:00
Matthias Clasen
7ac2982617 Revert "Add the label-wrap-justify reftest to xfails"
This reverts commit 5e746d35b2.

Turns out label-wrap-justify isn't failing in ci, and this is
now making ci fail :(
2020-02-11 07:44:01 -05:00
Timm Bäder
8561860aa1 css boxes: Compute inline box from border box
We can't just use the outline rect and apply the border radius because
the outline box is the border box grown by the outline offset, which
will also grow the resulting border radius.

Fixes #2425
2020-02-11 12:10:16 +01:00
Matthias Clasen
37a9d0620d 3.98.0 2020-02-10 15:32:19 -05:00
Matthias Clasen
5e746d35b2 Add the label-wrap-justify reftest to xfails
Seems just like the other label tests, down to details
of text rendering.
2020-02-10 15:19:13 -05:00
Matthias Clasen
d711ca3a67 Drop the toplevel-vs-popup reftest
Popups look different from toplevels. I don't think
a reftest that tries to prove otherwise has much
leg to stand on.
2020-02-10 15:15:05 -05:00
Matthias Clasen
564a43cd3a Disable the buttons a11y test
The test fails because radio buttons are currently broken.
2020-02-10 15:06:56 -05:00
Matthias Clasen
17a5e9b2aa Update expected test output
The a11y test for GtkAssistant produces different
output due to headerbar changes.
2020-02-10 15:03:47 -05:00
Matthias Clasen
c0dcaccf4b calendar: Fix mismatches with GDateTime
GDatetime uses 1-based month and day numbers, whereas
GktCalendars are 0-based. Correct for this.
2020-02-10 14:59:40 -05:00
Matthias Clasen
11cd955591 Calendar: Make year/month/day writable again
Our a11y tests were relying on this.
2020-02-10 14:14:18 -05:00
Matthias Clasen
0677bfeb7f testsuite: Update expected output
The output for combo boxes in a11y tests has changed
because they use popovers now.
2020-02-10 13:55:37 -05:00
Matthias Clasen
b38eb6eab4 Merge branch 'fix-gestures-test' into 'master'
Fix gestures test

See merge request GNOME/gtk!1406
2020-02-10 15:57:54 +00:00
Alexander Larsson
7d23b6dad5 Fix gestures test
This tests was testing gestures by faking an event in the
middle of a window that has a hbox with an expanding image in it.
For me (and I guess this depends on all sorts of issues like whether
CSD is enabled, font sizes, etc) the hbox ended up centered horizontally
but not vertically (probably because of csd at the top), so no events
ever hit the inner widgets.

This is fixed by emitting the events at allocation.x/y of the
hbox, which should contain both the hbox and the image (as it expands).
2020-02-10 16:24:03 +01:00
Matthias Clasen
e5e7dbf2a5 Merge branch 'fix-hidpi-popups' into 'master'
Fix popup placement on hidpi multi-monitor

See merge request GNOME/gtk!1405
2020-02-10 15:08:51 +00:00
Alexander Larsson
23211bcae8 hidpi: Rescan monitors when screen scale factor changes
All the code in e.g. init_randr15() divides the physical resolutions with
the screen scale, however if we get the screen scale from xsettings
rather than e.g. GDK_SCALE the initial setup is using the wrong value.

So, whenever the screen scale size is changed we need to trigger
a re-read of the randr data
2020-02-10 15:34:32 +01:00
Matthias Clasen
59b935af38 Merge branch 'mainloop-cleanup' into 'master'
Mainloop cleanup

See merge request GNOME/gtk!1404
2020-02-10 14:32:09 +00:00
Matthias Clasen
d0f5ce41aa More updates 2020-02-10 08:13:23 -05:00
Alexander Larsson
1698369d52 Merge branch 'icon-theme-api-rework' into 'master'
Icon theme api rework

See merge request GNOME/gtk!1390
2020-02-10 12:45:56 +00:00
Alexander Larsson
96a4bb446c Fix typo in GtkIconPaintable is-symbolic property 2020-02-10 13:30:57 +01:00
Alexander Larsson
ad0e901061 icon-theme: Add back and fix test for handling non-square icons
We test this by looking at the produced render nodes now that
we don't actualluy scale the icon. Also, it turns out that this
code was broken due to some typos, so we also fix those.
2020-02-10 13:17:15 +01:00
Alexander Larsson
ba781eca74 Expose gtk_icon_paintable_new_for_file 2020-02-10 13:17:15 +01:00
Alexander Larsson
8f1253ad26 GtkIconPaintable: Add properties for file, icon-name and is-symbolic 2020-02-10 13:17:05 +01:00
Matthias Clasen
e123fff545 Merge branch 'baselineoverlay' into 'master'
A baseline overlay

See merge request GNOME/gtk!840
2020-02-10 12:07:18 +00:00
Alexander Larsson
904eecd1ed icon paintable: Replace get_filename and get_resource_path with get_file()
This returns a GFile which can represent both the above.
2020-02-10 12:33:17 +01:00
Alexander Larsson
344ad65031 Rename GTK_ICON_LOOKUP_LOAD_IN_THREAD to GTK_ICON_LOOKUP_PRELOAD 2020-02-10 11:43:47 +01:00
Alexander Larsson
14b3b684ef icontheme: Always return some icon name in get_icon_name() for lookup results
If you called gtk_icon_theme_lookup(), then always return some useful
icon name from gtk_icon_paintable_get_icon_name(), even if we picked
an unthemed icon.

Also rewrite the gtk_icon_paintable_get_icon_name() docs to make this
clearer.
2020-02-10 11:40:00 +01:00
Matthias Clasen
9309153abc Remove GTK_DEBUG=baselines
This has been reimplemented differently
in the inspector.
2020-02-10 00:10:43 -05:00
Matthias Clasen
643417dc32 widget: Stop embedding baseline debugging
The inspector has an overlay that achieves the
same, in a cleaner way.
2020-02-10 00:10:43 -05:00
Matthias Clasen
4a978dc8c4 inspector: Draw baselines as an overlay 2020-02-10 00:10:43 -05:00
Matthias Clasen
bc4637fff6 Remove unused includes
We eventually want to get rid of GtkSelectionData.
As a first step, stop including gtkselection.h unnecessarily.
2020-02-09 23:59:22 -05:00
Matthias Clasen
eec219e6c7 docs: Mention gtk_main in the migration guide 2020-02-09 23:13:13 -05:00
Matthias Clasen
a8db322be6 Drop gtk_get_main_thread
This is not a very useful api, and if you need it,
you can just as easily keep track yourself which thread
called gtk_init().
2020-02-09 23:13:13 -05:00
Matthias Clasen
4dd780a96b Drop gtk_main and gtk_main_quit
The alternatives are to use GtkApplication,
or use GMainContext.
2020-02-09 23:13:13 -05:00
Matthias Clasen
4c22939dea docs: Update an example
Don't use gtk_main() in the mainloop example.
It is going away.
2020-02-09 23:12:32 -05:00
Matthias Clasen
a6c5466900 Stop using gtk_main and gtk_main_quit
Replace these calls with direct use of GMainContext api.
2020-02-09 23:12:32 -05:00
Matthias Clasen
c789711652 Stop using gtk_main_quit
Stop using gtk_main and gtk_main_quit in tests and
examples. These APIs are on the way out.
2020-02-09 23:12:32 -05:00
Matthias Clasen
7eb889c7aa Drop gtk_main_level
This api isn't useful without gtk_main, which is also
on the way out.
2020-02-09 23:12:32 -05:00
Matthias Clasen
49a6ad3dd1 Drop gtk_main_iteration
This function and its cousin, gtk_main_iteration_do, are
thin wrappers around GMainContext api that should just
be used directly.
2020-02-09 23:12:32 -05:00
Matthias Clasen
ebc720bfdb Drop gtk_events_pending
This was just a thin wrapper around gtk_main_context_pending,
which should be used directly instead.
2020-02-09 23:11:49 -05:00
Matthias Clasen
24917ac353 tests: Stop using gtk_events_pending
Just use the GMainContext api directly.
2020-02-09 23:11:49 -05:00
Matthias Clasen
9eeeb631ca win32 printing: Stop using gtk_events_pending
Just use the GMainContext API directly.
2020-02-09 23:11:49 -05:00
Matthias Clasen
07988fc17f win32: One more build fix 2020-02-09 23:04:10 -05:00
Matthias Clasen
4f79676b0b win32: Fix the build 2020-02-09 22:58:53 -05:00
Matthias Clasen
900ff743f1 Merge branch 'main-cleanup' into 'master'
Cleanup in gtkmain.h

See merge request GNOME/gtk!1403
2020-02-10 03:55:11 +00:00
Benjamin Otte
810f55c006 filechooser: Remove outdated hack
In GTK2, the filechooser was using a Paned, so switching between sidebar
and files list with the arrow keys didn't work (the slider would be
selected instead). So in
https://bugzilla.gnome.org/show_bug.cgi?id=161489 a crude hack was added
to make this possible.

Over the years the filechooser code has changed so that it now would do
this by default, yet the hack had been retained.
2020-02-09 16:54:38 -05:00
Benjamin Otte
fce37b137d gdk: Make gdk_keyval_name() return a const char
The string is const, so return it like that.
2020-02-09 16:50:22 -05:00
Matthias Clasen
998384aa08 Remove unused include 2020-02-09 16:50:22 -05:00
Emmanuele Bassi
327441fa3e cssprovider: Remove unused include 2020-02-09 16:50:22 -05:00
Matthias Clasen
b927609e21 Remove gtk_propagate_event from public API
This is not a function that can be safely called
outside of GTK.
2020-02-09 11:00:53 -05:00
Matthias Clasen
688f8bf085 Remove gtk_main_do_event from public API 2020-02-09 10:55:56 -05:00
Matthias Clasen
057f41532b Remove gtk_main_do_event from the docs 2020-02-09 10:55:37 -05:00
Matthias Clasen
ebc24d75af testsuite: Stop using gtk_main_do_event
Instead, emit ::event on the surface. Neither of
these is a proper test api, but one works as well
as the other.
2020-02-09 10:54:26 -05:00
Matthias Clasen
c1970009ff docs: Remove more mentions of gtk_main_do_event 2020-02-09 10:45:33 -05:00
Matthias Clasen
8f0fc24516 docs: Remove a reference to gtk_main_do_event
It is not great to put a function in the public api and
document it as "do not call this" only so we can refer
to its docs in other places. Therefore, fold the docs
directly into the input handling overview chapter.
2020-02-09 10:38:01 -05:00
Matthias Clasen
ba825dce29 docs: Remove a mention of gtk_main_do_event 2020-02-09 10:37:24 -05:00
Matthias Clasen
c4b16f7424 css: Add a comment
All the other color values have this comment,
best to be consistent.
2020-02-09 10:23:27 -05:00
Matthias Clasen
cffff36436 Merge branch 'wip/baedert/remove-outline-properties' into 'master'
css: Remove outline border radius properties

Closes #2414

See merge request GNOME/gtk!1402
2020-02-09 15:03:44 +00:00
Matthias Clasen
7de5b391ab gsk: Update docs sections 2020-02-08 19:40:56 -05:00
Matthias Clasen
0e15032635 gsk: Small documentation additions 2020-02-08 19:36:25 -05:00
Matthias Clasen
be2ba89900 Fix a doc comment
Signals take two colons.
2020-02-08 19:27:32 -05:00
Matthias Clasen
a824be2bb9 docs: Drop a few no longer existing symbols 2020-02-08 19:25:13 -05:00
Matthias Clasen
348dcaa4a3 docs: Update the switch thumbnail
Make the thumbnail for switches reflect the
current appearance of this widget.
2020-02-08 19:22:23 -05:00
Matthias Clasen
f240bcbbc4 emojichooser: Fix the docs
Make the emojichooser show up in the docs.
2020-02-08 19:21:57 -05:00
Matthias Clasen
621a427627 Fix the build with -Dgtk_doc=true
We need to export the emoji chooser symbols to
really make it public api.
2020-02-08 19:04:19 -05:00
Matthias Clasen
645f49cf2b Fix build with -Dgtk_doc=true
Toolbars were removed, so don't try to create
thumbnails of them.
2020-02-08 19:02:46 -05:00
Timm Bäder
01ba11fc71 css: Remove outline border radius properties
These are always set to the same value as the corresponding border
radius properties. They are also non-standard, so remove them and
replace them with the border radius properties everywhere.

Fixes #2414
2020-02-08 20:43:16 +01:00
Matthias Clasen
f6b0e0e1c2 Merge branch 'avoid-mime-sniffing' into 'master'
Avoid mime sniffing where possible

See merge request GNOME/gtk!1400
2020-02-08 15:44:16 +00:00
Matthias Clasen
2f17ab3ce7 Avoid mime sniffing where possible
When we are loading symbolic pngs or svgs, we know
that we need to the png or svg loader, so there is
no need to go through (surprisingly expensive) mime
sniffing to find the right loader.
2020-02-08 10:22:54 -05:00
Matthias Clasen
55b60f6da9 gtk-demo: Don't call gtk_main_quit
It doesn't work with GtkApplications that do not
call gtk_main().
2020-02-07 16:25:02 -05:00
Matthias Clasen
1f74695758 Adwaita: Fix selection in vertical spin buttons
This was broken by more specific selectors.
2020-02-07 15:43:07 -05:00
Matthias Clasen
1ab70e2dfa Merge branch 'patch-1' into 'master'
Update migrating-3to4.xml (fixed typo, in line 377)

See merge request GNOME/gtk!1398
2020-02-07 19:23:55 +00:00
J Arun Mani
3cbb3dc0f4 Update migrating-3to4.xml 2020-02-07 18:30:42 +00:00
Matthias Clasen
e3afb2fec8 label: Don't use gtk_widget_peek_style_context
We may just not have a style context. And we can just
as well go directly to the css styles.
2020-02-07 13:16:45 -05:00
Timm Bäder
d3857f8bd3 window: Move variable initialziation just before usage 2020-02-07 13:16:45 -05:00
Timm Bäder
655711fef2 Rename gtk_widget{get,set,has}_style_class to _css_class
We want to use css instead of style everywhere now.
2020-02-07 13:16:45 -05:00
Timm Bäder
69fa15981c treepopover: Fix header guard 2020-02-07 13:16:32 -05:00
Timm Bäder
2a46d5960d box: Move vfunc implementations before class_init
Just like we do everywhere else. This way we can also get rid of all the
prototypes.
2020-02-07 13:16:32 -05:00
Timm Bäder
b9b5cae6d2 calendar: Remove day-selected-double-click signal
It doesn't really make sense to treat double clicks here different than
single clicks (and is bad UX), and it also breaks switching months by
quickly trying to single-click the last/first days in the calendar.
2020-02-07 13:16:32 -05:00
Timm Bäder
3249756648 calendar: Remove an unused enum 2020-02-07 13:16:32 -05:00
Timm Bäder
8ef9009bde calendar: Remove month-changed signal
Listen to notify::month instead.
2020-02-07 13:16:32 -05:00
Timm Bäder
093eac9441 calendar: Keep a GDateTime around
Instead of a year/month/day triple.
2020-02-07 13:16:32 -05:00
Timm Bäder
93c6f2256f calendar: Return a GDateTime from get_date() 2020-02-07 13:16:32 -05:00
Timm Bäder
1151da5cf3 calendar: Use GDateTime to select days 2020-02-07 13:16:32 -05:00
Timm Bäder
a6f9052cf1 calendar: Use widgets for everything 2020-02-07 13:16:32 -05:00
Timm Bäder
a437162f6d calendar: Try to avoid changing size when changing the year 2020-02-07 13:16:32 -05:00
Timm Bäder
9ecd448682 calendar: Remove spinning code
This is dead code
2020-02-07 13:16:32 -05:00
Timm Bäder
74cb1ca2f5 calendar: Add accessors for display properties
Instead of having a display flags enum and bitfield, just add proper
accessors for the properties, which is what we do everywhere else.
2020-02-07 13:16:32 -05:00
Timm Bäder
e94e703685 testcalendar: Remove unused function 2020-02-07 13:16:32 -05:00
Timm Bäder
4cceba06bc calendar: Remove details
This is an unused feature that's way too complicated for a default
calendar widget and complicates the implementation a lot. Since we want
to eventually replace this with actual widgets, remove the details
support now.
2020-02-07 13:16:32 -05:00
Timm Bäder
ab84b17c1a calendar: Fix an uninitialized value
Values pased to gtk_widget_measure must be initialized to 0. This failed
if the header widget of the calendar was invisible.
2020-02-07 13:16:32 -05:00
Timm Bäder
7fd06cacbd Adwaita: Fix levelbar styling
The block nodes are inside a trough node.
2020-02-07 13:16:32 -05:00
Timm Bäder
b471158e38 {box,grid}layout: Access border spacing directly
Instead of going through the style context
2020-02-07 13:16:32 -05:00
Timm Bäder
8388791f87 GskTransform: Remove useless fmod check
All angles are in the [0; 360[ range
2020-02-07 13:16:32 -05:00
Timm Bäder
cbb05a3eab GskTransform: add assertions to make normalize_angle() intentions clear
360deg should be expressed as 0deg and no angle should ever be
negative.
2020-02-07 13:16:32 -05:00
Timm Bäder
4cfac3b91c snapshot: Remove new_with_parent
Unneeded now that we have push_collect()/pop_collect()
2020-02-07 13:16:32 -05:00
Timm Bäder
17ddae5bf9 textlayout: Use gtk_snapshot_{push,pop}_collect() 2020-02-07 13:16:32 -05:00
Timm Bäder
75ef8d8a50 GskRoundedRect: Inline graphene_rect_contains_rect
Brings gsk_rounded_rect_contains_rect down from 0.54% to 0.14% when
rendering rounded backgrounds.
2020-02-07 13:16:32 -05:00
Timm Bäder
47b8facca4 widget: Use gtk_snapshot_{push,pop})_collect
So we avoid allocating a new snapshot just for that.
2020-02-07 13:16:32 -05:00
Timm Bäder
bf8fb2c1a5 snapshot: Add _push_collect() and _pop_collect()
These will replace the previous gtk_snapshot_new_with_parent(), which
allocated an entirely new GObject just to push()/pop() some state. This
is already a problem but will be more important in the future as we
start using this more.
2020-02-07 13:16:32 -05:00
Timm Bäder
b7ee2cbc28 Start using GtkWidget's new style class API 2020-02-07 13:16:32 -05:00
Timm Bäder
b1d64a6b3a renderborder: Make simple border case more obvious
When reaching this point, it is impossible that all border styles are
HIDDEN or NONE, but up to 3 of them can still be that style. In any
case, the "none or solid" border style is the most common on there is,
so try to make this simpler here by just appending a border node
directly instead of going through the snapshot_border path.
2020-02-07 13:15:59 -05:00
Timm Bäder
60095ade9b Move GTK_BORDER_STYLE_HIDDEN before GTK_BORDER_STYLE_SOLID
The simple case when drawing border is "solid or nothing", which we can
now check for as simple as "style <= GTK_BORDER_STYE_SOLID".
2020-02-07 13:15:59 -05:00
Timm Bäder
3a727eed7a testcalendar: Close window properly 2020-02-07 13:15:59 -05:00
Timm Bäder
64c6229f54 searchbar: Use proper getter in _get_property()
Instead of retuning a seemingly random boolean, just use
gtk_search_bar_get_search_mode().
2020-02-07 13:15:59 -05:00
Timm Bäder
60be37d63a searchbar: Use g_object_notify_by_pspec
We already keep the pspecs around, so use them.
2020-02-07 13:15:59 -05:00
Timm Bäder
e044656d99 progressbar: Remove a few unneeded queue_resize() calls
This will happen automatically when adding style classes, setting the
label text, etc.
2020-02-07 13:15:59 -05:00
Timm Bäder
c0fef36692 Window: inline function into only caller 2020-02-07 13:15:59 -05:00
Timm Bäder
a67bd7a04e widget: Fix a from_string/try_string mixup 2020-02-07 13:15:59 -05:00
Timm Bäder
e152d25ac0 widget: Speed up verify_invariants()
Hide the expensive GTK_IS_ROOT() checks behind the cheaper realized,
mapped, etc. checks. This way we only check for the widget being a root
if the invariant does not hold.

This gets pop_verify_invariants() from 16% to 6% when running the
scrolling benchmark in the widget-factory.
2020-02-07 13:15:59 -05:00
Timm Bäder
b561eb8299 widget: Remove verify_child_invariants
Just calls verify_invariants() anyway.
2020-02-07 13:15:59 -05:00
Piotr Drąg
6150344195 Update POTFILES.in 2020-02-07 17:27:16 +01:00
Alexander Larsson
24fede0225 GtkIconHelper: Trigger preload when css sizes is valid
When the css is validated we know the css size, so we can
create the paintable at that point, and we do so passing the
LOAD_IN_THREAD flag.

This causes us to load most icons early on, in parallel instead of
during the first snapshot.
2020-02-07 17:26:22 +01:00
Alexander Larsson
e27413a9ed icon-theme: Add GTK_ICON_LOOKUP_LOAD_IN_THREAD flag
This causes lookup to trigger a thread that loads the icon texture.
2020-02-07 17:25:18 +01:00
Matthias Clasen
03317ec2ec NEWS: Small additions 2020-02-07 09:17:51 -05:00
Matthias Clasen
1a671cfd63 flatpak: Build against the master runtime
This is what the ci is set up to use, and building
against 3.34 fails there.
2020-02-07 09:17:51 -05:00
Matthias Clasen
24e28309fb Merge branch 'wip/otte/toolbar' into 'master'
remove GtkToolbar

See merge request GNOME/gtk!1383
2020-02-07 13:25:51 +00:00
Benjamin Otte
44e153d8a8 GtkToolbar: remove 2020-02-07 14:08:26 +01:00
Benjamin Otte
d72301b3c1 testsuite: Get rid of GtkToolbar
Just use GtkBox instead
2020-02-07 14:08:08 +01:00
Benjamin Otte
e00030dff2 css: Remove .primary-toolbar
It's not used anywhere anymore.
2020-02-07 14:08:08 +01:00
Benjamin Otte
9cccb944ef css: Remove .inline-toolbar
It's not used anywhere anymore.
2020-02-07 14:08:08 +01:00
Benjamin Otte
1363cacb3a widget-factory: Get rid of toolbars 2020-02-07 14:08:08 +01:00
Benjamin Otte
68dbb3f31a gtk-demo: Get rid of toolbars 2020-02-07 14:08:08 +01:00
Benjamin Otte
8a60f5dc78 bloatpad: Use a box, not a toolbar 2020-02-07 14:08:08 +01:00
Benjamin Otte
3d9e622fda print: Don't use a toolbar in the custom paper dialog
Use a regular linked box instead.
2020-02-07 14:08:08 +01:00
Benjamin Otte
645af0917c cssnode: Remove leftover vfunc 2020-02-07 14:06:20 +01:00
Matthias Clasen
c247e7680b Remove accidentally added files 2020-02-07 08:05:45 -05:00
Matthias Clasen
1da23b0c21 Add a forgotten word 2020-02-07 07:59:14 -05:00
Matthias Clasen
de299bb6bf Fix syntax 2020-02-07 07:50:02 -05:00
Matthias Clasen
65cc8305c9 Updates for 3.98 2020-02-07 07:48:30 -05:00
Alexander Larsson
bdbafe63f9 icontheme: Optimize memory use and lookup speed by internalizing icon names
Instead of having the IconTheme have a hashtable that owns
individual strings and then IconThemeDirSize have a similar
hash (but with the strings owned by the other hash), we
have a consecutive memory chunks where we store the icon names
and then the hashtable has pointers into this.

This means we can avoid a bunch of individual strdup()s in a
way that is less fragmented and wastes less space. Additionally,
since we do an initial lookup anyway we have the internalized
icon name during lookup which means we can use g_direct_hash/equal
instead of g_str_hash/equal making the lookup faster too.
2020-02-07 12:00:52 +01:00
Alexander Larsson
2be29f982d Remove stray space 2020-02-07 08:44:46 +01:00
Alexander Larsson
79699cc20d Use G_OBJECT_TYPE_NAME instead of g_type_name_from_instance 2020-02-07 08:44:29 +01:00
Matthias Clasen
c7ab02d38c Merge branch 'wip/carlosg/implicit-grabs-on-leave' into 'master'
Handle implicit grabs on leave events

Closes #13

See merge request GNOME/gtk!1397
2020-02-07 07:06:45 +00:00
Carlos Garnacho
e67f0bfcfd gtkmain: Wait for GDK_CROSSING_UNGRAB leave event with implicit grabs
If there is a passive grab and the pointer leaves the window we would
receive a GDK_CROSSING_NORMAL event when the pointer moves outside
the window, and a GDK_CROSSING_UNGRAB event when we do release the
button and the implicit grab.

We currently would react to the first, but want to react to the
second. In the time between both events, the client would still receive
pointer motion that will reach the implicitly grabbed widget.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/13
2020-02-07 01:02:47 +01:00
Carlos Garnacho
56dc99a9fb gtkroot: Make enum a typedef
Seems a typo, and prevents building as GtkRootProperties is deemed
to be defined multiple times.
2020-02-07 01:00:52 +01:00
Matthias Clasen
cf69b7d4c2 Merge branch 'a11y-fixes' into 'master'
A11y fixes

See merge request GNOME/gtk!1396
2020-02-06 23:54:39 +00:00
Matthias Clasen
e45b668e04 testsuite: Misc. updates of expected output
The a11y dumps for action and header bars
have changed in harmless ways.
2020-02-06 18:04:36 -05:00
Matthias Clasen
769dae2c71 infobar: Implement forall
As a container, that is what you have to do.
2020-02-06 18:04:36 -05:00
Matthias Clasen
048effdc5a testsuite: Clean up a11y menu tests
We don't need some of the tests anymore, since
we just have popovers now.
2020-02-06 17:21:06 -05:00
Matthias Clasen
b916723baf testsuite: Improve --generate support
When using the test binary to generate expected
output, don't initialize the test machinery, since
that pollutes the output with noise.
2020-02-06 16:54:59 -05:00
Matthias Clasen
2dba92fd0c tests: Fix infobars in ui files
GtkInfoBar no longer exposes the content_area
as internal child.
2020-02-06 16:54:59 -05:00
Matthias Clasen
a11b1bd08e testsuite: Update expected output 2020-02-06 16:54:59 -05:00
Matthias Clasen
bc682bef74 colorchooser: Use a composite accessible
This makes the content show up in the a11y tree again.
2020-02-06 16:54:59 -05:00
Matthias Clasen
580384e962 tests: Update expected output
The stackswitcher is no longer a box, so it doesn't
have the horizontal state anymore.
2020-02-06 16:54:59 -05:00
Matthias Clasen
18965eec83 testsuite: Update some a11y tests
GtkMenuButton::use-popover no longer exists, remove it
from test files.
2020-02-06 16:54:59 -05:00
Matthias Clasen
145ccfe1c4 stackswitcher: Use a composite accessible
This makes the buttons show up in the a11y tree again.
2020-02-06 16:54:59 -05:00
Matthias Clasen
d01070d472 a11y: Add an accessible for widgets with children
We've started to turns containers into widgets which
just happen to have children, and some of these need
to be exposed to the a11y stack.

This adds a very minimal implementation, it does not
currently emit change notification when children are
added or removed.
2020-02-06 16:54:59 -05:00
Matthias Clasen
b3f5243aeb a11y: Report children of widgets
We want children of composite accessibles to be
reported.
2020-02-06 16:54:59 -05:00
Matthias Clasen
20aec5a744 Merge branch 'flatpak-build-sassc' into 'master'
Flatpak build sassc

See merge request GNOME/gtk!1392
2020-02-06 20:09:29 +00:00
Matthias Clasen
4a2d539251 Build sassc as a dependency for flatpaks
Downloading the subproject during the GTK build fails
in a flatpak build due to lack of network access.
flatpak-builder insists on having these things explicitly
spelled out as dependencies.
2020-02-06 14:30:31 -05:00
Alexander Larsson
a772bf7517 Add gtk_icon_paintable_get_resource_path()
Also, return NULL from gtk_icon_paintable_get_filename() if the path
is really a resource path.
2020-02-06 17:47:57 +01:00
Alexander Larsson
57ecb2829a Add gtk_icon_paintable_get_icon_name()
This allows you to see which icon was actually chosen.
2020-02-06 17:47:57 +01:00
Alexander Larsson
d45d604df1 Remove gtk_icon_paintable_download_texture() public API
This allows us do do what we want internally, and anyway it didn't
really do what you'd expect anymore now that we do resizing during
rendering.
2020-02-06 17:47:57 +01:00
Alexander Larsson
6317fd3529 Replace last users of gtk_icon_paintable_download_texture ()
These now render the paintable to a cairo surface and convert that
to a texture. This is sort of a hack, but its only used in two
special cases internally and in two hacky test apps.
2020-02-06 17:47:56 +01:00
Alexander Larsson
8282698201 textview: Use paintables instead of textures, and fix the support
This changes gtk_text_buffer_insert_texture() to
gtk_text_buffer_insert_paintable() which is strictly more useful
(as textures are paintables). It also fixes the code to actually
support drawing the paintables (as well as tracking changes
to the paintables.
2020-02-06 17:47:56 +01:00
Alexander Larsson
fcc3c12919 gtk_css_style_snapshot_icon_paintable: Fix uninitialized memory access
We were reading the foreground color alpha even when we didn't read it.
2020-02-06 17:47:56 +01:00
Alexander Larsson
7c73f2fb02 GskPango: Allow specifying a custom shape snapshot handler
We will need this for GtkTextView to render the textures in it.
2020-02-06 17:47:56 +01:00
Alexander Larsson
6ff9f2198d GtkBuilder: Directly load the fallback missing image
No need for all this complexity with the icon theme, especially when
its now a lot more work to get the texture back. We can just load
the pixbuf.
2020-02-06 17:47:56 +01:00
Alexander Larsson
1c253f5dfa icontheme: Move IMAGE_MISSING_RESOURCE_PATH to (private) header
This way other code can use this resource too for fallbacks, avoing
having to go through the icon theme.
2020-02-06 17:47:56 +01:00
Alexander Larsson
a0533923fb icontheme: Handle GEmblemIcon in lookup_by_gicon() 2020-02-06 17:47:52 +01:00
Matthias Clasen
5c594fc46a Merge branch 'WindowsPrintDriverPreferencesMaster' into 'master'
Fixed bug that prevented GTK from storing printer driver preferences in the…

See merge request GNOME/gtk!397
2020-02-06 13:07:13 +00:00
Matthias Clasen
b6e2699409 notebook: Update arrows when text direction changes
Fixes https://gitlab.gnome.org/GNOME/gtk/issues/103
2020-02-06 07:13:10 -05:00
Alexander Larsson
8788c76bd9 icon theme: Also never fail in gtk_icon_theme_lookup_by_gicon()
Similar to regular lookups, if the icon is some unknown type we return
a missing-image.
2020-02-06 10:26:15 +01:00
Alexander Larsson
6865744034 Remove unnecessary image-missing fallbacks
We now always return something from icon theme lookups, so no need to
do custom fallbacks.
2020-02-06 09:50:04 +01:00
Alexander Larsson
de02769a2f icon-theme: Don't pre-scale pixbufs in gtk_icon_theme_lookup_by_gicon
We do scaling during rendering now anyway.
2020-02-06 09:45:03 +01:00
Alexander Larsson
d69f7fd63e IconTheme: Never fail a lookup or icon load
If icon lookup fails or if loading it fails later, just always
fall back to the built in image-missing icon. Nobody is handling
missing icons in a sane way anyway.

If you *truly* need to handle missing icons, you need to manually
use gtk_icon_theme_has_icon().

While changing the loading code I also fixed an issue where it
was always passing "png" to pixbuf, now it also handles "xpm" if
that is the filename suffix.
2020-02-06 09:38:25 +01:00
Alexander Larsson
adccd1391e Support aspect=TRUE in _gdk_pixbuf_new_from_stream_at_scale
The icon theme test failed without this, and we *should* handle
it if we're accepting the argument.
2020-02-06 09:38:25 +01:00
Alexander Larsson
b529f77827 IconTheme: Simplify icon scaling
We had a pretty complex setup where we tried to avoid scaling up themes from dirs
that specified a size. However, not only was it very complex, but it didn't quite
work with window scales, because when using e.g. a size 32 directory for 16@2x
the dir size is wrong anyway. Additionally it turns out most code either picks
an existing icon size, or uses the FORCE_SIZE flags, so it doesn't seem
like a useful behaviour.

This change drops the FORCE_SIZE flags, and always scales
icons. Additionally it moves the scaling of the icon to rendering,
which seems more modern, and allows us to (later) share icons loaded
for different sizes that happened to use the same source file (at
different scales).

Note that this changes the behaviour of
gtk_icon_paintable_download_texture() is it now returns the unscaled
source icon. However, ignore thats, as I plan to remove this function
and replace it with a way to render a paintable to a cairo-surface
instead.
2020-02-06 09:38:25 +01:00
Alexander Larsson
021aaef824 GtkIconPaintable: Always recolor when snapshotting.
It never makes sense to paint a texture that needs recoloring. If
you call the regular snapshot on a symbolic texture we just use the
default recoloring colors.

To support this we also change gtk_css_style_snapshot_icon_paintable()
to call gtk_icon_paintable_snapshot_with_colors() for IconPaintables
so that we get the correct colors, and we make it not emit the color
matrix.

Since we now rely on the icon to do the recoloring we also drop the
recolor argument in gtk_icon_paintable_snapshot_with_colors() as its
not needed anymore.
2020-02-06 09:38:25 +01:00
Alexander Larsson
c691399a80 icontheme: Align function arguments 2020-02-06 09:38:25 +01:00
Matthias Clasen
2f369b6d7a Merge branch 'kill-simple-search' into 'master'
Remove simple search engine

See merge request GNOME/gtk!1393
2020-02-06 06:38:17 +00:00
Matthias Clasen
8703c7b7ac Merge branch 'better-test-isolation-2' into 'master'
Better test isolation

See merge request GNOME/gtk!1391
2020-02-06 04:53:07 +00:00
Matthias Clasen
e41e8072b1 css tests: Ignore ".csd" vs ".solid-csd"
It it hard to control which of the csd style classes we get,
since it depends on details of the X server or compositor.

Explicitly ignore this difference by replacing .solid-csd
with .csd in the output.
2020-02-05 23:35:39 -05:00
Matthias Clasen
d1bd1270c9 testsuite: Make tests run without a11y bus
Not having an a11y bus around causes warnings from
at-spi, which make tests fail. Explicitly ignore those
warnings.
2020-02-05 22:24:39 -05:00
Matthias Clasen
34cc68003c testsuite: Fix bloomfilter style tests
The results were expecting solid-csd, which is not what
we usually have.
2020-02-05 22:23:52 -05:00
Matthias Clasen
ac7dd02f8f Merge branch 'master.msvc' into 'master'
Fix building recent GTK master on Visual Studio

See merge request GNOME/gtk!1369
2020-02-05 18:26:22 +00:00
Matthias Clasen
9746b728ca Merge branch 'public-emojichooser' into 'master'
emojichooser: Make public

See merge request GNOME/gtk!1382
2020-02-05 18:04:42 +00:00
Benjamin Otte
0ad791277a Merge branch 'wip/otte/css' into 'master'
Some CSS cleanup

See merge request GNOME/gtk!1389
2020-02-05 14:04:12 +00:00
Matthias Clasen
54f6515005 emojichooser: Add profiler marks for loading
This is a long-running operation, and worth showing
in traces.
2020-02-05 06:28:39 -05:00
Matthias Clasen
25c25ba5c1 icontheme: Fix various memory leaks
Tasks need to be unreffed too.
2020-02-05 06:28:39 -05:00
Matthias Clasen
fac435ba98 widget: Fix a memory leak with class actions
This code was doing the wrong thing even if the parent class
doesn't have actions.
2020-02-05 06:28:39 -05:00
Matthias Clasen
b996b85504 Add a lib64 variant of gtk.supp 2020-02-05 06:28:39 -05:00
Matthias Clasen
1cb575a138 icontheme: Remove some dead code 2020-02-05 06:28:39 -05:00
Matthias Clasen
9a446f2041 frameclock: cosmetics
Redo the profiler marks for the frame clock signals
to look more uniform.
2020-02-05 06:28:39 -05:00
Matthias Clasen
9e6ae7acd8 gdk: Silence some compiler warnings
These cause unused variable warnings in release builds.
2020-02-05 06:28:39 -05:00
Matthias Clasen
955305a034 treestore: Silence compiler warnings
This was causing compiler warnings in release builds.
2020-02-05 01:01:47 -05:00
Matthias Clasen
b1d5de78e1 notebook: Don't trigger criticals in dispose
When we dismantle our children in dispose, we
trigger a11y children-changed signals which end
up calling back into the notebook. Handle this
without critical warnings.
2020-02-05 01:01:47 -05:00
Matthias Clasen
47c21a255f textview: Don't update action state in dispose
Only update the action state when we have a text buffer,
there is no need to do it otherwise, since we are going
to get a buffer before we get shown. This avoids triggering
the action state updates from finalize, which is a bad
time to be recreating the action muxer.
2020-02-05 01:01:47 -05:00
Matthias Clasen
005ea7a09d entry: Avoid criticals in dispose
The accessible gets properties of the entry, and
resetting the entry icons triggers accessible change
notification, so do that before we dismantle the entry
too far to respond to a g_object_get () call.
2020-02-05 01:01:47 -05:00
Matthias Clasen
ed6c0dc15c Don't export color picker functions
This is not public API, so it shouldn't be exported.
2020-02-05 01:01:47 -05:00
Matthias Clasen
1e6171a4a7 Read bookmarks async
Do not block the main thread while reading the bookmarks file.
This speeds up initial setup of a GtkPlacesSidebar.
2020-02-05 01:01:47 -05:00
Matthias Clasen
85ad943832 placessidebar: Change some initial property values
Giving these properties the initial value that the file
chooser wants for them avoids some calls to update_places
in the setup code.
2020-02-05 01:01:47 -05:00
Matthias Clasen
b7b251019e testperf: More flexible mark selection
Allow selecting marks not just by their name, but
also by the message detail.
2020-02-05 00:46:47 -05:00
Matthias Clasen
ed742f1d6c testperf: Allow measuring start time
This can be used e.g. to measure how long it takes us
to get the first frame on screen.
2020-02-05 00:46:39 -05:00
Benjamin Otte
fcb08a28bf stylecontext: Remove unused typedef 2020-02-05 04:03:43 +01:00
Timm Bäder
b75d408d6d css: Make some local variables const 2020-02-05 04:03:43 +01:00
Timm Bäder
98b42f6740 css: Remove unused function 2020-02-05 04:03:43 +01:00
Timm Bäder
416182a20d style context: Remove parent relationship
We don't have foreign drawing anymore, so we don't need this.
2020-02-05 04:03:43 +01:00
Benjamin Otte
31713ab5ef stylecontext: Remove gtk_style_context_new()
It's private now, no more foreign drawing of any sort.

To be fair, it was entirely useless without widget paths already.
2020-02-05 04:03:43 +01:00
Benjamin Otte
b9c880f58d testsuite: Remove the stylecontext test
Stylecontexts are on their way out and I'm removing API that the
testsuite was relying on, so remove the tests.

Put the useful parts of the tests elsewhere.
2020-02-05 04:03:43 +01:00
Benjamin Otte
db9730b734 stylecontext: Remove the "changed" signal
Instead, always go directly to the GtkWidget::css_changed() call.
2020-02-05 04:03:43 +01:00
Benjamin Otte
546a748cd8 widget: Replace style-updated signal with css_changed vfunc
1. Rename the thing
2. Turn it from a signal to a vfunc
3. Pass the GtkCssStyleChange to it

We don't export any public API about the GtkCssStyleChange yet, it's
just a boring opaque struct.
2020-02-05 02:46:13 +01:00
Benjamin Otte
8722837e67 pathbar: Remove unneeded code
The icons here are GIcons, they don't depend on the theme.
2020-02-05 00:18:41 +01:00
Benjamin Otte
3177ac4270 cssnode: Remove redundant check
We assert that cssnode->parent is NULL, no need to check it again.
2020-02-04 23:24:50 +01:00
Benjamin Otte
3f7e409428 Merge branch 'wip/otte/for-master' into 'master'
Wip/otte/for master

See merge request GNOME/gtk!1388
2020-02-04 17:48:58 +00:00
Timm Bäder
903af75fa1 widget: Skip not-drawable widgets in snapshot_child
Otherwise we transform the snapshot just to not do anything.
2020-02-04 17:53:15 +01:00
Matthias Clasen
6640881711 maplistmodel: Add an example to the docs 2020-02-04 17:51:01 +01:00
Matthias Clasen
3bb8b56ab3 treelistmodel: Small documentation tweaks 2020-02-04 17:51:01 +01:00
Benjamin Otte
a1635719fc widgetfocus: Remove unnecessary check
Mapped widgets are always realized.
2020-02-04 17:51:01 +01:00
Benjamin Otte
3cb150abbe widget: Remove _gtk_widget_is_drawable()
Use _gtk_widget_get_mapped() instead.

Drawable checked visible && mapped and mapped widgets are always
visible, so that was an unnecessary check.
2020-02-04 17:51:01 +01:00
Benjamin Otte
cc22987b1b Merge branch 'wip/otte/icontheme' into 'master'
Do simple icontheme API cleanups

See merge request GNOME/gtk!1378
2020-02-04 16:36:46 +00:00
Alexander Larsson
410541f82b Rename GtkIcon to GtkIconPaintable 2020-02-04 17:19:22 +01:00
Benjamin Otte
c91be540c3 tooltip: Don't css-validate
That's a job for toplevels now.

See 17ca95a161 for the same comit on
popovers.
2020-02-04 17:19:04 +01:00
Benjamin Otte
138de60ab2 icontheme: Remove GENERIC_FALLBACKS
Instead, rely on people passing fallbacks explicitly.

Alternatively, GThemedIcon provides the functionality to create
fallbacks, which is what GtkImage and the testsuite now use.
That method is slightly better, too, so the expected test results
have been updated accordingly.
2020-02-04 16:51:54 +01:00
Benjamin Otte
571021cbc1 icontheme: Pass fallbacks as optional argument to lookup_icon()
This way, we can remove gtk_icon_theme_choose_icon() completely.
2020-02-04 16:51:54 +01:00
Benjamin Otte
f7a5dd7b8b icontheme: Remove contexts
There is no way to query contexts or do anything useful with them.

So don't keep track of them and don't make them an argument in public
APIs with the docs saying "I don't know what to use here, maybe read
some spec somewhere".
2020-02-04 16:51:54 +01:00
Benjamin Otte
544cd1acfc icontheme: Clean up includes 2020-02-04 16:43:59 +01:00
Benjamin Otte
4b96ba592f icontheme: Remove gtk_icon_get_base_size() and gtk_icon_get_base_dir()
Those functions are unused and the documentation says "Returns some
random number that the icon theme creator chose" which does not seem at
all useful and an implementation detail.

So get rid of it.
2020-02-04 16:43:59 +01:00
Benjamin Otte
7e8d8218b9 Revert "Break out cairo color matrix recoloring to gdk_cairo_image_surface_recolor()"
We're not in the business of adding Cairo APIs. That's Cairo's job.

Also, we don't need this API anywhere like the original commit claimed,
so there's no need to make it available in any way.

This reverts commit afa6cc2369.
2020-02-04 16:43:59 +01:00
Benjamin Otte
3bba52ed67 icontheme: Remove crayon APIs
We expose no API to get at any colors for drawing symbolics, so we
shouldn't have APIs to draw with them.

Apart from that, those APIs look like a box of crayons, not like an
icontheme.
2020-02-04 16:43:59 +01:00
Benjamin Otte
48b9791989 icontheme: Remove gtk_icon_theme_rescan_if_needed()
If the icon theme needs to be rescanned, it should just do it.
If it doesn't, there's no need for this function.

Ergo: Don't have the function.
2020-02-04 16:43:59 +01:00
Benjamin Otte
4c3363b8c2 icontheme: Remove NO_SVG and FORCE_SVG flags
If the icon theme loads SVGs or not is an implementation detail and
should not be exposed in public API.
2020-02-04 16:41:36 +01:00
Benjamin Otte
10023b5d6d icontheme: Remove GTK_ICON_LOOKUP_USE_BUILTIN
It's unused.
2020-02-04 16:41:36 +01:00
Benjamin Otte
bbbe39fb44 icontheme: Make text direction a lookup argument
Most users were just forgetting to set the proper flags.
And flags aren't the right way to set this anyway, it was just
acceptable as a workaround during GTK3 to not break API.
2020-02-04 16:41:36 +01:00
Benjamin Otte
b713b9f68d icontheme: Remove async APIs
Widgets would not use them properly. In fact, the only user was using
them wrong.

As icons are loaded async by default, this call isn't necessary.
2020-02-04 16:41:36 +01:00
Benjamin Otte
bfebc2b01a icontheme: Remove gtk_icon_theme_get_default()
The API encouraged wrong usage - most of the users were indeed wrong.

Use the correct version instead:
  gtk_icon_theme_get_for_display (gtk_widget_get_display ())
2020-02-04 16:41:36 +01:00
Alexander Larsson
a1856c30d9 a11y tests: Ignore "active" flag on toplevel
All the a11y tests were failing for me with a window state diff
like this:

-  state: active enabled resizable sensitive showing visible
+  state: enabled resizable sensitive showing visible

I guess the windows in the CI always gets the focus, but not when
I run it here. Generally focus seems asynchronous and hard to rely
on so I just made the test ignore the active state on toplevels.
2020-02-04 15:01:48 +01:00
Alexander Larsson
008eb04125 tests: Initialize dbus before gtk
These days initilizing gtk may create a connection to the sesson bus,
so we have to initialize GTestDBus before initalizing gtk, or we'll
use the address of the "real" session bus (and remember that in the
global).

To further muck things up, g_test_dbus_up() resets important env
vars like DISPLAY and XDG_RUNTIME_DIR, which we have to re-set.
2020-02-04 14:13:33 +01:00
Alexander Larsson
85e59220a5 filechooser portal: Free portal proxy when bus connection closes
This was blocking the clean exit from the testdbus shutdown in
the defaultvalues test. The proxy was keeping the connection alive
which blocks g_test_dbus_down().
2020-02-04 14:08:10 +01:00
Matthias Clasen
b8ffe5b245 css: Fix the initial values optimization
Fix up the index computation. We have duplicate entries
in the type enum, so to go from one of the 'initial' types
to it corresponding type you subtract one, but to find
the size array entry for a type, you divide by 2.
2020-02-04 12:19:23 +01:00
Matthias Clasen
4685fe1716 Merge branch 'faster-theme-lookup' into 'master'
Faster icon theme lookup

See merge request GNOME/gtk!1381
2020-02-04 10:51:27 +00:00
Alexander Larsson
046de4ccbf icon-theme: Only have one copy of the icon flags enum
It turns out with the icon cache now using the virtual SYMBOLIC_PNG_SUFFIX
flag the two enums are now identical, so lets just use one of them, the
one GtkIconCache (so we move it to the header).
2020-02-04 09:35:20 +01:00
Alexander Larsson
a3be0ec5f0 Don't use xsettings or xft defaults in testsuite
This adds a GDK_DEBUG=default-settings flag which disables reads
from xsettings and Xft resources, and enables this for the testsuite.

This is one less way to get different testresults depending on the
environment. In particular, it was failing the css tests for me
due to getting the wrong font size because i have a different dpi.
2020-02-03 15:11:35 +01:00
Matthias Clasen
ef7172dc1e emojichooser: Make public
This is a useful widget to have, and it has minimal api.

Not having it public forces apps to recreate a lot of
complicated machinery for not good reason, if they need
an Emoji chooser in a different context.
2020-02-03 12:49:36 +01:00
Alexander Larsson
308d434b57 GtkIconCache: Remove unused code
We're not really using the icon theme cache much anymore, as the
individual per-directory hashes are no longer used, so delete all the
unused code.
2020-02-03 12:49:32 +01:00
Alexander Larsson
e4170661b9 IconTheme: Make icon lookups faster
Traditionally the icon lookup for a theme has been:

lookup (icon_name, size):
  best_directory = NULL
  forearch theme
    foreach directory in theme
       if dir_size_matches (directory, size) && dir_has_icon (directory, icon-name)
         best_directory = chose_best_size_dir (best_directory, directory)

if best_directory
  return icon from best_directory

However, it turns out that there are a lot of subdirectories which have the same
size, as they differ only in the (essentially useless) "context" value. For example
the "16x16/apps" subdirectory is essentially the same as the "16x16/actions" one.

So, instead rathern than keeping all the directories as separate we store the
all the directories with the same size as a single entity (DirSize) and the
icon lookup in that DirSize looks up not only which suffix to use for that icon
but also which subdir it is in.

Additionally we keep a hashtable with all icon names that are
available in the entire theme (i.e. all DirSizes), which allows use
both to store each icon name only once, but also to do a quick
negative lookup and early exit in case we're looking up an icon that
doesn't exist. This is pretty common because we often look up sets of
icons like "image-png-symbolic", "image-png", "image", expecting some
to fail.

This brings down the time of the initial css validation from 20msec to 15msec for
me when running icon-factory.
2020-02-03 12:49:26 +01:00
Alexander Larsson
0a8d7603ea icon-cache: Add new function to list all the icons in a directory
This lists the icons in a particular director, with their flags in a
hashtable. We also convert from "icon.symbolic" + SUFFIX_PNG to
"icon" + SUFFIX_SYMBOLIC_PNG.
2020-02-03 12:49:26 +01:00
Chun-wei Fan
f8d3845b1a meson/MSVC builds: Use -utf-8 where available
This avoids the build from erroring out on C4819 (Unicode handling issue in
Visual Studio compiler), notably when running on Chinese, Japanese and
Korean locales.

Also apply -D_USE_MATH_DEFINES, -FImsvc_recommended_pragmas.h and -utf-8 to
the C++ compiler options as well.
2020-02-03 17:55:09 +08:00
Rico Tzschichholz
4ab12ab755 Remove last GtkWidgetPath reference
See 49b47c9133
2020-02-03 10:51:50 +01:00
Chun-wei Fan
69ed4c90e5 demos/widget-factory/widget-factory.c: Include stdlib.h
Include it for exit().
2020-02-03 17:18:36 +08:00
Chun-wei Fan
f2915180a6 tests/testdnd2.c: Don't include unistd.h unconditionally
Instead, on Windows when it is not available, include io.h for close()
2020-02-03 17:18:36 +08:00
Matthias Clasen
e7f2833703 Merge branch 'wip/muktupavels/update-documentation' into 'master'
display-x11: don't mention gdk_monitor_is_primary in the docs

See merge request GNOME/gtk!1380
2020-02-03 08:15:30 +00:00
Alberts Muktupāvels
66af531ff3 display-x11: don't mention gdk_monitor_is_primary in the docs
https://gitlab.gnome.org/GNOME/gtk/merge_requests/1371#note_699272
2020-02-02 19:18:22 +02:00
Matthias Clasen
621120d1d3 css: Fix an oversight in style change computation
Take the 'color == NULL means currentColor' trick into account
when computing the changes between two styles.
2020-02-02 16:41:14 +01:00
Matthias Clasen
f84fdfc0c1 Merge branch 'sigma' into 'master'
gdk: Handle small final sigma in gdk_keyval_convert_case

See merge request GNOME/gtk!1351
2020-02-02 12:04:09 +00:00
Matthias Clasen
27223f7956 Merge branch 'initial-style' into 'master'
Make it easy to recognize initial style values

See merge request GNOME/gtk!1375
2020-02-01 12:52:44 +00:00
Matthias Clasen
5faf977f66 border: Don't render initial borders
Add a fast exist for comon case that the border
values are unset.
2020-02-01 09:12:12 +01:00
Matthias Clasen
7fbb37a09f background: Don't render initial backgrounds
Add a fast exit for the common case that the background
values are unset.
2020-02-01 09:11:39 +01:00
Matthias Clasen
7027fc9ab6 Make it easy to recognize initial style values
Reuse the type field in GtkCssValues to make initial
style values easily recognizable.
2020-02-01 09:11:22 +01:00
Matthias Clasen
7479564972 modelbutton: Update a11y states
We took care to set the proper role on our accessible object,
but we forgot to update the state for check and radio button
roles.
2020-01-31 19:14:05 +01:00
Matthias Clasen
09612a1b3c filechooser: Remove debug spew 2020-01-31 16:55:01 +01:00
Matthias Clasen
79c8a16b8d Remove simple search engine 2020-01-31 16:52:27 +01:00
Matthias Clasen
6104c12392 Build fix for GtkCssValues 2020-01-31 11:40:06 +01:00
Jor Teron
0c5ba00d59 Update Karbi translation 2020-01-31 10:15:03 +00:00
Daniel Mustieles
9f55377b69 Updated Spanish translation 2020-01-31 09:09:43 +01:00
Matthias Clasen
f140b151e1 Merge branch 'meson-sassc-subproject' into 'master'
build: require sassc and drop generated .css files

See merge request GNOME/gtk!814
2020-01-31 07:26:48 +00:00
Matthias Clasen
c91c4b60e7 Merge branch 'kill-primary-monitor-2' into 'master'
Remove primary monitor api

See merge request GNOME/gtk!1371
2020-01-30 20:51:07 +00:00
Matthias Clasen
a46f9af1c0 Remove primary monitor api
We only have implementations of this on X11 and Win32,
so make it available as backend api there.

Update all callers to use either the backend api, or
just monitor 0.
2020-01-30 21:33:37 +01:00
Christoph Reiter
4071e1e734 build: require sassc and drop generated .css files
Instead of requiring sassc to be installed add meson subprojects
which build libsass and sassc (currently both forks of mine, tested
under linux/mingw/msvc) when needed.

This allows us to drop the generated .css files and build scripts from git.

See #1502
2020-01-30 20:45:38 +01:00
Alexander Larsson
99c89d61e1 Merge branch 'icon-theme-rework' into 'master'
Rework icon themes

See merge request GNOME/gtk!1368
2020-01-30 17:30:10 +00:00
Alexander Larsson
09ef67afbc icon-theme: Add icon theme name in profiler mark 2020-01-30 18:22:11 +01:00
Alexander Larsson
d478ae1ef5 icon-theme: Avoid reentrancy issues while loading icon theme
In gtk_icon_theme_get_for_display() we were calling
gtk_icon_theme_set_display() which eventually (via the css machinery)
called back into gtk_icon_theme_get_for_display() which created a
second icon theme. We avoid this by setting the user-data earlier so
that the css machinery gets back the currently initializing theme
instead.
2020-01-30 18:19:56 +01:00
Alexander Larsson
b67d582230 GtkIconHelper: Preload icons for mapped widgets with higher priority
We look at whether a widget will be mapped (the actual state is not
yet set, so we can't rely on that at css validation time) and use
that to set the i/o priority of the async task.

This means that its likely that widgets that will be displayed soon
are loaded before those that are not yet going to be needed.
2020-01-30 15:41:24 +01:00
Alexander Larsson
498ab6ac6c IconHelper: Only preload icons once
This limits the amount of preloading we to, which can for instance
avoid trashing if the icon cache is full, and in general do less work
when its likely to be wasted such as when e.g. background-color for an
icon helper changes.
2020-01-30 15:17:59 +01:00
Alexander Larsson
c69327caa8 icon-theme: Show which icon loads are threaded in profile mark 2020-01-30 15:16:40 +01:00
Alexander Larsson
d1cd578d59 icon-theme: Add i/o priority to choose_icon_async()
This is set on the GTask and lower priority will be loaded before,
this can be used to prioritize some icons for preloading.
2020-01-30 15:15:08 +01:00
Alexander Larsson
5f8c2b52c6 indentation: fix various alignment issues
Most of these stem from the GtkIconInfo -> GtkIcon rename
2020-01-30 12:27:15 +01:00
Alexander Larsson
27799ba4f5 Remove final references to "icon info" with just "icon" 2020-01-30 10:53:43 +01:00
Alexander Larsson
2ec51b7010 icon-theme: Update the docs 2020-01-30 10:53:43 +01:00
Alexander Larsson
f7cd2a782b Fix warnings in gdk gir build
We now have graphene arguments in a gdk function, so add that to the
dependencies.
2020-01-30 10:53:43 +01:00
Alexander Larsson
ff0642bba6 icon-theme: Remove trailing whitespaces
Since everything is changing anyway lets just clean up all the
trailing whitespace issues in the whole file.
2020-01-30 10:53:43 +01:00
Alexander Larsson
b227a2f190 icon-theme: Use GtkSnapshot, not GdkSnapshot 2020-01-30 10:53:43 +01:00
Alexander Larsson
2b202129bb icon-theme: Fix indentation of matrix values 2020-01-30 10:53:43 +01:00
Alexander Larsson
d1c6d78ebb GtkImage: Preload icons during css validation
At the end of GtkImage css validation (during style-updated) when the
css properties (like the icon size) are valid we call _gtk_icon_helper_preload
which does an async icon theme lookup and load. This will happen on a thread
in parallel with the rest of the css machinery, and hopefully by the
time we need the icon it will be ready. If not we will block when we need
it, but during that blocking all the other icons will be loaded.

Testing widget-factory this changes the time of snapshot() from 31 to
25 msec, but on the other hand we also load a few more icons that we
didn't before causing the css validation phase to be about 8 msec slower.
This is because we're preloading all the images in the window, not only
the ones that are visible.

Unfortunately we still load a bunch of icons in snapshot(), from
GtkCssImageIconTheme, and ideally we should try to preload those also.
2020-01-30 10:53:43 +01:00
Alexander Larsson
6a8001fe7d icon-theme: Preload default icon themes in thread
This happens when we first get the theme for a display, or then the
icon theme setting changes.

This means we don't have to do this scan in the first snapshot
and can do the i/o it in parallel with other stuff. This moves
a 10msec block from the first snapshot cycle to early setup.
2020-01-30 10:53:43 +01:00
Alexander Larsson
ff3e022182 icon helper: Remove profiler mark
This was hitting every time we looked up an icon, and we already
log the actual load of the icon in the icon theme.
2020-01-30 10:53:43 +01:00
Alexander Larsson
d2f26b2f27 icon-theme: Improve profiler mark for icon loads
This adds the actual time it took to them as well as the icon size
and scale.
2020-01-30 10:53:43 +01:00
Alexander Larsson
55db9d07c5 icon-theme: Only add theme load profiler mark if we actually load theme 2020-01-30 10:53:43 +01:00
Alexander Larsson
1be932279c icon theme: Actually use scale in choose_icon_async() 2020-01-30 10:53:43 +01:00
Alexander Larsson
56ec748824 icon theme: Actually don't block in gtk_icon_theme_choose_icon_async()
If some other thread is lock the icon or icon theme locks they are likely
to do so for a long time, doing i/o. So, switch to trylock() for the
nonblocking part of _async(). This way we can return directly if the
result is available, but do a thread otherwise, never blocking the
calling (main) thread.
2020-01-30 10:53:43 +01:00
Alexander Larsson
1e6a82513b icon-theme: Clean up locking
Move the lru cache under the global cache lock to avoid some ABBA
style deadlocks when going from icon_theme->icon lock an icon->icon_theme.
We also move all the icon lock uses to a small part of code and make
sure that code never calls out or blocks with any locks held.

Rename the GtkIcon->cache_lock to texture_lock to avoid confusion withe
the global cache_lock.

Removed any mentions of threadsafety from the API docs, we don't
want apps to rely on this, but rather use it outselves internally.
2020-01-30 10:53:43 +01:00
Alexander Larsson
b087f9ca51 icon-theme: Drop the _for_scale() versions and always take scale 2020-01-30 10:53:43 +01:00
Alexander Larsson
e2f778602b icon-theme: Rename GtkIconInfo to GtkIcon 2020-01-30 10:53:43 +01:00
Alexander Larsson
6a15e9169d Rename GtkIcon widget to GtkBuiltinIcon
This is an internal widget whose name is not very important, and we
want to rename GtkIconInfo to GtkIcon, so lets rename this.
2020-01-30 10:53:33 +01:00
Matthias Clasen
929d325560 profiler: Exit gracefully on SIGTERM
This is nice, since it lets me quickly launch a test app
and terminate it with Ctrl-C and still produce a usable
sysprof trace.
2020-01-30 10:04:38 +01:00
Matthias Clasen
cb60c1b83d builder: Add profiler marks for parsing
This is useful to understand what ui files take
long to load.
2020-01-30 10:04:38 +01:00
Matthias Clasen
ab69d43089 builder: Use a better name for templates
This name can show up in error messages or profiler
traces, so it is nice to provide some hint what
file we are dealing with.
<GtkFileChoser template> is a lot more helpful
than <input>.
2020-01-30 10:04:38 +01:00
Alexander Larsson
6af4b6a644 icon-theme: Drop all load() calls from GtkIconInfo
All users now either use it directly as a paintable or download
the texture to use the pixels.
2020-01-29 19:12:15 +01:00
Alexander Larsson
0d666f0cec icon-theme: Use gtk_icon_theme_choose_icon_async in tests 2020-01-29 19:06:16 +01:00
Alexander Larsson
317b395f0f icon-theme: Drop loading_themes recursion check
This was added in 0b1c9b7cc2 to protect
against reentrancy from the theme-changed signal, but we only emit this
from an idle these days, so thats not necessary anymore, and the recursion
check was causing issues with the async operations where a different
thread loading the theme caused the calling thread to thing the
theme is valid.
2020-01-29 19:06:16 +01:00
Alexander Larsson
71b3b54215 icon-theme: Add async icon loader 2020-01-29 19:06:16 +01:00
Alexander Larsson
97b24b0732 tests: Use gtk_icon_info_download_colored_texture instead of load_symbolic 2020-01-29 19:06:16 +01:00
Alexander Larsson
6ffb54f47f icon-theme: Add gtk_icon_info_download_colored_texture()
This is a way to get at recolored pixels and will replace all existing users
of _load_symbolic*()
2020-01-29 19:06:16 +01:00
Alexander Larsson
afa6cc2369 Break out cairo color matrix recoloring to gdk_cairo_image_surface_recolor()
This is useful in some parts of the icon theme APIs.
2020-01-29 19:06:16 +01:00
Alexander Larsson
dbe021239f icons: Convert use of load() to download_texture() 2020-01-29 19:06:16 +01:00
Alexander Larsson
884e06ad37 icon theme: Add gtk_icon_info_download_texture() function
This returns a reference to the texture (if possible) and can be
used to get access to the pixels of the icon.
2020-01-29 19:06:16 +01:00
Alexander Larsson
53c542765f Add gtk_icon_info_snapshot_with_colors() and use instead of custom code 2020-01-29 19:06:16 +01:00
Alexander Larsson
c42977af04 Convert trivial users of icon theme loading to use info as paintable 2020-01-29 19:06:16 +01:00
Alexander Larsson
aefd8443de GtkIconHelper use GtkIconInfo as paintable 2020-01-29 19:06:16 +01:00
Alexander Larsson
b96ab7453b GtkIconInfo: Implement paintable
This makes GtkIconInfo directly implement paintable by loading
the icon as needed. This is done in a blocking fashion for now, but
could be made more async in the future.

It also means we can't return errors to the called, but I doubt
anyone actually does anything useful with them other than showing
nothing (which we already do).

This also changes a fringe behaviour for unthemed icons. They used to
be never scaled down, but that means we can't tell without i/o the
size of the paintable. Since this is the only case we can't know the
size i took an executive decision and removed that behaviour. I don't
think picking some arbitrary much larger than requested size is ever
right, nor do i think using GtkIconTheme with unthemed icons is overly
useful. If you want to display some random non-iconish image, use
GtkImage instead.
2020-01-29 19:06:16 +01:00
Alexander Larsson
3ac7e30455 icon theme: Make GtkIconInfo cached data threadsafe
Whenever this is accessed or updated we just grab a lock, thus
blocking on whoever is currenly updating it.
2020-01-29 19:06:16 +01:00
Alexander Larsson
aef67bd53a GtkIconTheme: Make the base GtkIconTheme threadsafe
This makes the core icon theme object threadsafe, however its
not yet very useful because the IconInfo objects are not threadsafe.
2020-01-29 19:06:16 +01:00
Piotr Drąg
bba5de7c6d Update POTFILES.skip 2020-01-29 17:20:23 +01:00
Emmanuele Bassi
556a8a8351 Merge branch 'wip/muktupavels/work-areas' into 'master'
per-monitor work areas

Closes #1086 and #980

See merge request GNOME/gtk!1300
2020-01-29 13:38:31 +00:00
Matthias Clasen
5e95e15a03 animatedstyle: Fix the debug build
This wasn't caught by our ci.
2020-01-29 14:10:24 +01:00
Alberts Muktupāvels
248883089c x11: add support for _GTK_WORKAREAS_Dn
If window manager supports _GTK_WORKAREAS use per-monitor work areas.

https://mail.gnome.org/archives/wm-spec-list/2018-December/msg00000.html
https://gitlab.freedesktop.org/xdg/xdg-specs/merge_requests/22

https://gitlab.gnome.org/GNOME/gtk/merge_requests/1300
2020-01-29 14:38:08 +02:00
Carlos Garnacho
aabb250741 Merge branch 'gtk-4-im-wayland-controller-focus-in' into 'master'
imwayland: Connect gtk_im_context_focus_in/out to GtkEventControllerKey

See merge request GNOME/gtk!1349
2020-01-29 11:22:11 +00:00
Matthias Clasen
83cccfc984 Merge branch 'gdk-device-leak-fix' into 'master'
GdkDevice leak fix

See merge request GNOME/gtk!1358
2020-01-29 10:44:42 +00:00
Matthias Clasen
b97054fc38 Merge branch 'css-style-split-2' into 'master'
css: Split styles into groups

See merge request GNOME/gtk!1362
2020-01-29 10:39:43 +00:00
Matthias Clasen
b859407620 Merge branch 'reset-with-click' into 'master'
Always emit reset for IM preedit with mouse click

Closes #1534

See merge request GNOME/gtk!460
2020-01-29 10:39:22 +00:00
Matthias Clasen
75c73ac3cd Merge branch 'robertroth/shortcuts-overlay-accel' into 'master'
Application: Do not reuse Ctrl+F1 for help-overlay

See merge request GNOME/gtk!307
2020-01-29 10:25:40 +00:00
Matthias Clasen
10e4c04e61 Use style values directly
Replace uses of gtk_css_style_get_value with direct access,
throughout the tree. We don't replace all uses, just those
where we are dealing with a fixed property. Be careful to
handle the currentColor special case for color properties.
2020-01-29 11:07:32 +01:00
Matthias Clasen
b378f566d7 Compute style change based on values structs
We can save some time here by comparing struct by
struct and avoiding individual values comparisons
as much as possible.
2020-01-29 11:07:32 +01:00
Matthias Clasen
5776d0dd99 css: Split styles into groups
Introduce refcounted structs for groups of related css properties,
and use them to store the style values. Both GtkCssStaticStyle and
GtkCssAnimatedStyle fill in the structs in GtkCssStyle, and we
can avoid vfuncs for value access, which should be much faster.
We can even start accessing style->core->color directly.
2020-01-29 11:07:32 +01:00
Matthias Clasen
59994bdd22 performance test: Produce better numbers
Try to isolate the test runs from each other in the
eyes of the kernel scheduler, by sleeping a bit. And
ignore the first run, to avoid cache effects.
2020-01-29 11:06:32 +01:00
Matthias Clasen
db8276f470 Merge branch 'wip/baedert/widget-add-style-class' into 'master'
widget: Add style class API

See merge request GNOME/gtk!1366
2020-01-29 09:46:36 +00:00
Matthias Clasen
c3421cea25 Silence a compiler warning 2020-01-29 10:44:25 +01:00
Emmanuele Bassi
6830845fda Merge branch 'gtk-doc-ci' into 'master'
Publish the API reference

See merge request GNOME/gtk!1367
2020-01-29 09:11:15 +00:00
Emmanuele Bassi
db5d9ccdfb Remove reftests from expected-fail list
With an updated version of the base CI image it seems some tests that
were failing have started to pass again.
2020-01-29 10:02:02 +01:00
Emmanuele Bassi
51e155bffa ci: Deploy the API reference on our GitLab pages
Now that we can build gtk-doc as a sub-project, we can go back to
publishing the API reference for the master branch every time we
build it.
2020-01-29 09:46:13 +01:00
Emmanuele Bassi
98e6e0cf77 ci: Update the version of Meson in the CI image
We need at least 0.52.1 to be able to use gtk-doc as a sub-project.
2020-01-29 09:39:21 +01:00
Emmanuele Bassi
058f82d03d Add gtk-doc as a subproject
We rely on a specific minimum version of gtk-doc to be able to build the
GTK API reference for the new API. In order to be able to use gtk-doc as
a subproject, though, we need to use a recent version of Meson.
2020-01-29 09:39:21 +01:00
Timm Bäder
a7b34df6af widget: Add style class API
Add GtkWidget API for adding and removing style classes, as well as
checking whether a widget has a style class applied.

Everyone has to go through GtkStyleContext for this these days but with
GtkStyleContext eventually going away, it makse sense for GtkWidget to
have API for this.
2020-01-29 09:36:48 +01:00
Timm Bäder
b3f454ed98 Merge branch 'fix-doc-typo' into 'master'
Fix a doc typo

See merge request GNOME/gtk!1364
2020-01-29 07:49:13 +00:00
Benjamin Otte
fd021e794c Merge branch 'wip/otte/for-master' into 'master'
Wip/otte/for master

See merge request GNOME/gtk!1365
2020-01-29 04:35:56 +00:00
Benjamin Otte
5e3cbff8d2 cssselector: Rework how we handle the bloom filter
Instead of foreaching through all the previous selectors every time we
bloom-filter, just bloom-filter the current element and return a special
value if that filter fails (FALSE). If that happens, don't try
filter-matching more nodes in the caller as we know it's an abort.
2020-01-29 04:20:47 +01:00
Luca Bacci
f0fe2e0743 Fix a doc typo 2020-01-28 20:42:03 +00:00
Benjamin Otte
c6158f1684 cssselector: Reorder functions
This just changes the order of functions in the source code in
preparation for the next commit.
2020-01-28 18:28:32 +01:00
Benjamin Otte
65050a1c81 css: Don't do the "all set" test
We have so many properties that it is basically impossible that all of
them are set and the time spent checking is higher than the time saved
if it does indeed happen.
2020-01-28 17:57:59 +01:00
Benjamin Otte
12ec090a7b Merge branch 'wip/otte/for-master' into 'master'
popover: Do not validate the css node on show()

See merge request GNOME/gtk!1363
2020-01-28 16:43:33 +00:00
Benjamin Otte
17ca95a161 popover: Do not validate the css node on show()
This was a good idea back in GTK3 when popovers were toplevels, but now
they're regular child widgets, so they should behave that way.

Also, with the introduction of the bloom filter, gtk_css_node_validate()
now assumes it's only called on root nodes, so assert that that is the
case.
2020-01-28 17:19:28 +01:00
Takao Fujiwara
5be14577d6 imwayland: Connect gtk_im_context_focus_in/out to GtkEventControllerKey
GtkEventControllerKey can handle GDK_FOCUS_CHANGE and call
gtk_im_context_focus_in/out directly.

https://gitlab.gnome.org/GNOME/gtk/issues/2390
2020-01-28 23:47:16 +09:00
Benjamin Otte
1a9ab1a32f Merge branch 'wip/otte/css' into 'master'
selector: Rework iterating over subnodes

See merge request GNOME/gtk!1361
2020-01-28 03:56:49 +00:00
Benjamin Otte
c7dca199ae selector: Rework iterating over subnodes
Instead of a foreach() function, introduce an iterator, so that the
caller can drive the iteration.

This allows doing stuff inbetween callbacks and avoids closures when
more than one data object should be passed.

As a side effect I even get a small, but noticeable performance
improvement in the 2-10% range depending on benchmark, I guess that's
because there's no function pointer passing going on anymore.
2020-01-28 04:32:15 +01:00
Benjamin Otte
50a3d9be6a Merge branch 'wip/otte/css' into 'master'
CSS improvements

See merge request GNOME/gtk!1360
2020-01-28 02:47:25 +00:00
Benjamin Otte
5e4b102273 styleproperty: Remove ability to query properties
With gtk_style_context_get() gone, this is no longer used.
2020-01-28 02:58:02 +01:00
Benjamin Otte
632fab0ca7 stylecontext: Get rid of gtk_style_context_get()
... and replace all the calls to it with
gtk_style_context_peek_property().

All the calls are hacks that need to go away btw.
2020-01-28 02:58:02 +01:00
Benjamin Otte
43339f1c1c testcalendar: Don't do dumb stuff with font sizes.
If you want to test font stuff, it's 2020 and we have an inspector.
2020-01-28 02:17:32 +01:00
Benjamin Otte
afbff574f5 filechooser: Remove default size machinery
The FileChooser ToolKit (fctk) had its own machinery to handle default
sizes which was completely busted and trying to marshal random numbers
through the widget hierarchy that maybe made sense in 2012 but don't do
now.

Get rid of it, just keep the dialog's GSetting - which funnily enough
used to be written by the dialog but written by the widget.
But that's fctk for you.
2020-01-28 02:17:31 +01:00
Benjamin Otte
aff25212df cellrenderertoggle: size based on -gtk-icon-size
Instead of hardcoding 16px.
2020-01-28 02:17:03 +01:00
Benjamin Otte
18cb15a05a stylecontext: Remove gtk_style_context_get_section()
The inspectors gets values differently these days.
2020-01-28 02:17:03 +01:00
Benjamin Otte
6c8b65baf9 stylecontext: Remove GTK_STYLE_PROPERTY_* defines
They shouldn't be (and aren't) used anymore.
2020-01-28 02:17:03 +01:00
Benjamin Otte
495eaf31d4 css: Use the bloom filter for change matching
Instead of just doing radical change matching on the node itself, also
consider the parent nodes via the bloom filter.

This means a radical change is now also one where the parent
name/id/classes change, but since that's considered a radical change on
the parent already, those things are slow anyway.

Improves the benchmark times for CSS validation during backdrop
transitions in widget-factory from 45ms to 35ms on my machine.
2020-01-28 02:17:03 +01:00
Benjamin Otte
ccdc3ee406 selector: Make :not() selectors not radical
:not() selectors cannot be radical because the bloomfilter only knows if
a value is set in any of the nodes, but cannot determine the opposite
(if a value is not set in at least one node), but that would be required
for:not() selectors.
However, this is very unlikely to happen in the real world, so it's not
worth optimizing.

Unfortunately, change tracking could know this, so by excluding the
:not() selectors from radical changes, the change tracking will now pick
them up. If that turns out to be a performance problem, we need to add a
special category for radical not filters, so change tracking and bloom
filters can deal with them.

The testcase demonstrating the problem in widget-factory has been
extrated and added.
2020-01-28 02:17:03 +01:00
Benjamin Otte
93cf76b068 testsuite: Improve diff_with_file() function
Properly handle diff(1) failing.

In this particular case, the test passed a NULL input file to the diff
(that was fixed, too) and then diff only found one input file and
aborted.

But without this fix, we'd also not catch other abortion reasons for
diff() - as long as it exited in any way, we were happy.
2020-01-28 02:17:03 +01:00
Benjamin Otte
170130f1d9 css: Add fast-path for parent selector matching
Add a fast path for parent selector matching that uses a bloom filter to
quickly discard selectors that can't possibly match.

Keep in mind that we match using a bloom filter, so we might
accidentally include too many selectors when hash/bucket collisions
occur.
That's not a correctness problem though, because we'll do a real check
afterwards.

The idea for this change is taken from browsers, in particular WebKit.
2020-01-28 02:17:03 +01:00
Benjamin Otte
6aac56e144 cssnodedeclaration: C99-ify the code
zero-sized arrays are allowed now.
2020-01-28 02:17:03 +01:00
Benjamin Otte
2d5a8974b3 selector: Hash differently
This will be relevant for a bloom filter. And bloom filters want 12bit
hashes, so we try to produce hash values < 4096.
2020-01-28 02:17:03 +01:00
Benjamin Otte
146b921246 cssnode: Convert name + id from interned string to GQuark
The reason for this is simply that I want to get hash functions that
have their values close together, so they can fit in a smaller range
(the goal here is 12 bits). By using GQuark, we get consecutive numbers
starting with 1 (and applications have <1000 quarks usually), whereas
interned strings can be all over the place.

As a side effect we also save 64 bytes per declaration.
2020-01-28 02:17:03 +01:00
Benjamin Otte
8b93ea9238 css: Get rid of GtkCssMatcher 2020-01-28 02:17:02 +01:00
Benjamin Otte
aa7c5e96a6 css: Pass node through the lookup code
... instead of passing a matcher.

The matcher code is now local to the CssProvider/CssSelector machinery.
2020-01-28 02:17:02 +01:00
Benjamin Otte
1953bc92bc cssnode: Remove init_matcher() vfunc
It's unused.
2020-01-28 02:17:02 +01:00
Benjamin Otte
98eeee5bce cssnode: Remove ability to set GType as fallback name 2020-01-28 02:17:02 +01:00
Benjamin Otte
49b47c9133 Remove GtkWidgetPath
... and all associated demos and tests.
2020-01-28 02:17:02 +01:00
Benjamin Otte
af6128b3ab Remove gtkwidgetpath.h include where no longer needed 2020-01-28 02:17:02 +01:00
Benjamin Otte
496f3c17bd Revert "cssmatcher: Inline node values into matcher"
This reverts commit a75529f3c0.

It just complicates code and there are no performance numbers that would
warrant such a commit.
2020-01-28 02:17:02 +01:00
Benjamin Otte
c2d69643a8 css: Move utility function
The function was not selector-specific, so putting it with all the other
utility functions makes more sense.

Also use the utility function in the node declaration printing.
2020-01-28 02:17:02 +01:00
Sebastian Keller
9c6669be48 gdk/x11: Properly unref removed device in XI2 device manager
When a device is added, there are two references to it by the device
manager, the initial one and the one used for the id_table. Removing a
device only removed the reference added by the id_table resulting in the
GdkDevice being leaked.

https://gitlab.gnome.org/GNOME/gtk/merge_requests/1358
2020-01-27 21:42:34 +01:00
Matthias Clasen
d0aa79b5a1 textutil: Stop using GtkStyleContext
We can just use the css style directly.
2020-01-27 13:35:04 -05:00
Matthias Clasen
4b63523b1f gskpango: Don't free rgba's we don't own
We don't copy them anymore, so don't free them.
2020-01-27 13:35:04 -05:00
Matthias Clasen
997186f640 filechooser: Stop using gtk_style_context_get
Just go to the css style directly.
2020-01-27 12:52:24 -05:00
Rafael Fontenelle
3940482820 Update Brazilian Portuguese translation 2020-01-27 17:09:32 +00:00
Timm Bäder
616a83fb53 popover: Fix an oversight in gap coord computation
This caused a border to show up between the popover arrow and the
contents.
2020-01-27 13:37:50 +01:00
Timm Bäder
baeadea342 calendar: Use widgets for the header
This is not meant to be a full GtkCalendar conversion to use widgets
instead of custom drawing, but we lost the arrows in the calendar header
when builtin icons were removed. Using proper button for the year/month
buttons brings them back.
2020-01-27 13:37:50 +01:00
Umarzuki Bin Mochlis Moktar
04beedfef0 Update Malay translation 2020-01-27 12:25:12 +00:00
Umarzuki Bin Mochlis Moktar
da73394abd Update Malay translation 2020-01-27 12:22:47 +00:00
Fabio Tomat
d0f69794a5 Update Friulian translation 2020-01-27 08:56:42 +00:00
Dušan Kazik
185ef214fa Update Slovak translation 2020-01-27 07:01:51 +00:00
Sebastian Keller
5040d81e03 gdkseatdefault: Unref removed slave devices
Adding a slave device adds a ref, but removing it does not unref it.

https://gitlab.gnome.org/GNOME/gtk/merge_requests/1358
2020-01-27 01:37:14 +01:00
Alex Henrie
f15a34c7e4 gdk: Handle small final sigma in gdk_keyval_convert_case 2020-01-24 17:10:07 -07:00
Vlad Zahorodnii
b36258f204 gdk: Subtract base size when checking aspect ratio
According to the ICCCM spec [1], one should subtract the base size from
the window size before checking that the aspect ratio falls in range.

This change fixes shrinking Firefox Picture-in-Picture windows when
running KDE Plasma (with KWin as the window manager).

[1] https://tronche.com/gui/x/icccm/sec-4.html#s-4.1.2.3
2020-01-19 02:22:44 +02:00
ZhaoQiang
e75bc172ef Remove some unused variables
To avoid compiler warnings.

See merge request GNOME/gtk!513
2019-04-09 22:06:50 +08:00
Takao Fujiwara
4b2e4f6628 Always emit reset for IM preedit with mouse click
Hangul inputs treat pre-edit text as output text and the pre-edit
text won't be moved with mouse click.
Now the reset signal is always emitted simply with mouse click and
each IM engine could handle the signal whether the preedit is committed,
cleared or kept.

Closes #1534
2019-02-20 18:58:51 +09:00
Rick Yorgason
26febcc3a8 Fixed win32 printer dialogue not saving devmode->dmDeviceName. Caused the print dialogue to select the wrong printer, and potentially feed bad "extra" data to the default printer. 2018-11-01 11:31:05 -07:00
Rick Yorgason
5dd7f20dab Fixed code styling. 2018-10-29 04:04:10 -07:00
Rick Yorgason
fc15a409cc Fixed bug that prevented GTK from storing printer driver preferences in the print dialogue on Windows. 2018-10-27 06:00:20 -07:00
Daniel Boles
4b96e7fc78 Application: Do not reuse Ctrl+F1 for help-overlay
It just gets overridden to do something else, as the 1st GtkWidget’s
class_init() adds it as a binding to toggle tooltips with the keyboard.
The last entity to hook it (& return TRUE) is the only one who gets it.

So, worse: If users needed to manually set accels for a ShortcutsWindow,
coincidentally waited until after the 1st GtkWidget init() to do it, &
copied what GtkApplication said in an attempt to be good & consistent —
they inadvertently broke the keyboard tooltips (except for users with a
GDK_KEY_KP_F1 – whatever that is) as their handler blocked GtkWidget’s.

So, one side has to drop this accelerator, and it seems clear that being
able to open tooltips with the keyboard is more important than having a
second accel for the help-overlay. We can make up a replacement later.

https://gitlab.gnome.org/GNOME/gtk/issues/626
2018-08-24 14:51:21 +03:00
1000 changed files with 34923 additions and 49694 deletions

11
.clang-format Normal file
View File

@@ -0,0 +1,11 @@
# See https://wiki.apertis.org/Guidelines/Coding_conventions#Code_formatting
BasedOnStyle: GNU
AlwaysBreakAfterDefinitionReturnType: All
BreakBeforeBinaryOperators: None
BinPackParameters: false
SpaceAfterCStyleCast: true
# Our column limit is actually 80, but setting that results in clang-format
# making a lot of dubious hanging-indent choices; disable it and assume the
# developer will line wrap appropriately. clang-format will still check
# existing hanging indents.
ColumnLimit: 0

View File

@@ -1,7 +1,8 @@
stages:
- style-check
- build
- deploy
- flatpak
# - deploy
.cache-paths: &cache-paths
paths:
@@ -12,16 +13,45 @@ stages:
- subprojects/libepoxy/
- subprojects/pango/
fedora-x86_64: &fedora-x86_64-defaults
image: registry.gitlab.gnome.org/gnome/gtk/master:v9
stage: build
# Common variables
variables:
COMMON_MESON_FLAGS: "--fatal-meson-warnings --werror"
MESON_TEST_TIMEOUT_MULTIPLIER: 2
.only-default:
only:
- branches
except:
- tags
style-check-diff:
extends: .only-default
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v13
stage: style-check
allow_failure: true
script:
- bash -x ./.gitlab-ci/test-docker.sh
- .gitlab-ci/run-style-check-diff.sh
fedora-x86_64:
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v13
stage: build
variables:
EXTRA_MESON_FLAGS: "--buildtype=debug --default-library=both"
script:
- meson ${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS}
-Dx11-backend=true
-Dwayland-backend=true
-Dbroadway-backend=true
-Dvulkan=yes
-Dprofiler=true
_build
- ninja -C _build
- .gitlab-ci/run-tests.sh _build
artifacts:
when: always
reports:
junit:
- "${CI_PROJECT_DIR}/_build/report.xml"
- "${CI_PROJECT_DIR}/_build/report.xml"
name: "gtk-${CI_COMMIT_REF_NAME}"
paths:
- "${CI_PROJECT_DIR}/_build/meson-logs"
@@ -34,10 +64,36 @@ fedora-x86_64: &fedora-x86_64-defaults
key: "$CI_JOB_NAME"
<<: *cache-paths
fedora-x86_64-staticlibs:
release-build:
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v13
stage: build
variables:
EXTRA_MESON_FLAGS: "-Ddefault_library=both"
<<: *fedora-x86_64-defaults
EXTRA_MESON_FLAGS: "--buildtype=release"
script:
- meson ${COMMON_MESON_FLAGS} ${EXTRA_MESON_FLAGS}
-Dx11-backend=true
-Dwayland-backend=true
-Dbroadway-backend=true
-Dvulkan=yes
_build
- ninja -C _build
- .gitlab-ci/run-tests.sh _build
artifacts:
when: always
reports:
junit:
- "${CI_PROJECT_DIR}/_build/report.xml"
name: "gtk-${CI_COMMIT_REF_NAME}"
paths:
- "${CI_PROJECT_DIR}/_build/meson-logs"
- "${CI_PROJECT_DIR}/_build/report.xml"
- "${CI_PROJECT_DIR}/_build/report.html"
- "${CI_PROJECT_DIR}/_build/testsuite/reftests/output/*.png"
- "${CI_PROJECT_DIR}/_build/testsuite/gsk/compare/*/*.png"
- "${CI_PROJECT_DIR}/_build/testsuite/css/output/*.syscap"
cache:
key: "$CI_JOB_NAME"
<<: *cache-paths
.mingw-defaults: &mingw-defaults
stage: build
@@ -59,6 +115,7 @@ msys2-mingw32:
.flatpak-defaults: &flatpak-defaults
image: registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master
stage: flatpak
allow_failure: true
artifacts:
paths:
- "${APPID}-dev.flatpak"
@@ -107,19 +164,20 @@ flatpak-master:icon-browser:
APPID: org.gtk.IconBrowser4
<<: *flatpak-master
#pages:
# image: registry.gitlab.gnome.org/gnome/gtk/master:v6
# stage: deploy
# script:
# - meson -Dgtk_doc=true _build .
# - ninja -C _build
# - ninja -C _build gdk4-doc gsk4-doc gtk4-doc
# - mkdir -p public/
# - mv _build/docs/reference/gtk/html/ public/gtk/
# - mv _build/docs/reference/gdk/html/ public/gdk/
# - mv _build/docs/reference/gsk/html/ public/gsk/
# artifacts:
# paths:
# - public
# only:
# - master
pages:
image: registry.gitlab.gnome.org/gnome/gtk/fedora:v13
stage: deploy
variables:
EXTRA_MESON_FLAGS: "--buildtype=release"
script:
- meson ${COMMON_MESON_FLAGS} -Dgtk_doc=true _build
- ninja -C _build gdk4-doc gsk4-doc gtk4-doc
- mkdir -p public/
- mv _build/docs/reference/gdk/html/ public/gdk/
- mv _build/docs/reference/gsk/html/ public/gsk/
- mv _build/docs/reference/gtk/html/ public/gtk/
artifacts:
paths:
- public
only:
- master

38
.gitlab-ci/README.md Normal file
View File

@@ -0,0 +1,38 @@
## GTK CI infrastructure
GTK uses different CI images depending on platform and jobs.
The CI images are Docker containers, generated either using `docker` or
`podman`, and pushed to the GitLab [container registry][registry].
Each Docker image has a tag composed of two parts:
- `${image}`: the base image for a given platform, like "fedora" or
"debian-stable"
- `${number}`: an incremental version number, or `latest`
See the [container registry][registry] for the available images for each
branch, as well as their available versions.
### Checklist for Updating a CI image
- [ ] Update the `${image}.Dockerfile` file with the dependencies
- [ ] Run `./run-docker.sh build --base ${image} --base-version ${number}`
- [ ] Run `./run-docker.sh push --base ${image} --base-version ${number}`
once the Docker image is built; you may need to log in by using
`docker login` or `podman login`
- [ ] Update the `image` keys in the `.gitlab-ci.yml` file with the new
image tag
- [ ] Open a merge request with your changes and let it run
### Checklist for Adding a new CI image
- [ ] Write a new `${image}.Dockerfile` with the instructions to set up
a build environment
- [ ] Add the `pip3 install meson` incantation
- [ ] Run `./run-docker.sh build --base ${image} --base-version ${number}`
- [ ] Run `./run-docker.sh push --base ${image} --base-version ${number}`
- [ ] Add the new job to `.gitlab-ci.yml` referencing the image
- [ ] Open a merge request with your changes and let it run
[registry]: https://gitlab.gnome.org/GNOME/gtk/container_registry

133
.gitlab-ci/clang-format-diff.py Executable file
View File

@@ -0,0 +1,133 @@
#!/usr/bin/env python3
#
# === clang-format-diff.py - ClangFormat Diff Reformatter ---*- python -*-=== #
#
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
# See https://llvm.org/LICENSE.txt for license information.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
#
# ===---------------------------------------------------------------------=== #
"""
This script reads input from a unified diff and reformats all the changed
lines. This is useful to reformat all the lines touched by a specific patch.
Example usage for git/svn users:
git diff -U0 --no-color HEAD^ | clang-format-diff.py -p1 -i
svn diff --diff-cmd=diff -x-U0 | clang-format-diff.py -i
"""
from __future__ import absolute_import, division, print_function
import argparse
import difflib
import re
import subprocess
import sys
if sys.version_info.major >= 3:
from io import StringIO
else:
from io import BytesIO as StringIO
def main():
parser = argparse.ArgumentParser(
description=__doc__,
formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument('-i', action='store_true', default=False,
help='apply edits to files instead of displaying a '
'diff')
parser.add_argument('-p', metavar='NUM', default=0,
help='strip the smallest prefix containing P slashes')
parser.add_argument('-regex', metavar='PATTERN', default=None,
help='custom pattern selecting file paths to reformat '
'(case sensitive, overrides -iregex)')
parser.add_argument('-iregex', metavar='PATTERN',
default=r'.*\.(cpp|cc|c\+\+|cxx|c|cl|h|hh|hpp|m|mm|inc'
r'|js|ts|proto|protodevel|java|cs)',
help='custom pattern selecting file paths to reformat '
'(case insensitive, overridden by -regex)')
parser.add_argument('-sort-includes', action='store_true', default=False,
help='let clang-format sort include blocks')
parser.add_argument('-v', '--verbose', action='store_true',
help='be more verbose, ineffective without -i')
parser.add_argument('-style',
help='formatting style to apply (LLVM, Google, '
'Chromium, Mozilla, WebKit)')
parser.add_argument('-binary', default='clang-format',
help='location of binary to use for clang-format')
args = parser.parse_args()
# Extract changed lines for each file.
filename = None
lines_by_file = {}
for line in sys.stdin:
match = re.search(r'^\+\+\+\ (.*?/){%s}(\S*)' % args.p, line)
if match:
filename = match.group(2)
if filename is None:
continue
if args.regex is not None:
if not re.match('^%s$' % args.regex, filename):
continue
else:
if not re.match('^%s$' % args.iregex, filename, re.IGNORECASE):
continue
match = re.search(r'^@@.*\+(\d+)(,(\d+))?', line)
if match:
start_line = int(match.group(1))
line_count = 1
if match.group(3):
line_count = int(match.group(3))
if line_count == 0:
continue
end_line = start_line + line_count - 1
lines_by_file.setdefault(filename, []).extend(
['-lines', str(start_line) + ':' + str(end_line)])
# Reformat files containing changes in place.
# We need to count amount of bytes generated in the output of
# clang-format-diff. If clang-format-diff doesn't generate any bytes it
# means there is nothing to format.
format_line_counter = 0
for filename, lines in lines_by_file.items():
if args.i and args.verbose:
print('Formatting {}'.format(filename))
command = [args.binary, filename]
if args.i:
command.append('-i')
if args.sort_includes:
command.append('-sort-includes')
command.extend(lines)
if args.style:
command.extend(['-style', args.style])
p = subprocess.Popen(command,
stdout=subprocess.PIPE,
stderr=None,
stdin=subprocess.PIPE,
universal_newlines=True)
stdout, _ = p.communicate()
if p.returncode != 0:
sys.exit(p.returncode)
if not args.i:
with open(filename) as f:
code = f.readlines()
formatted_code = StringIO(stdout).readlines()
diff = difflib.unified_diff(code, formatted_code,
filename, filename,
'(before formatting)',
'(after formatting)')
diff_string = ''.join(diff)
if diff_string:
format_line_counter += sys.stdout.write(diff_string)
if format_line_counter > 0:
sys.exit(1)
if __name__ == '__main__':
main()

View File

@@ -8,6 +8,7 @@ RUN dnf -y install \
cairo-devel \
cairo-gobject-devel \
ccache \
clang \
colord-devel \
cups-devel \
dbus-daemon \
@@ -23,6 +24,7 @@ RUN dnf -y install \
gettext \
git \
glib2-devel \
glib2-static \
glibc-devel \
glibc-headers \
gobject-introspection-devel \
@@ -61,9 +63,11 @@ RUN dnf -y install \
ninja-build \
pango-devel \
pcre-devel \
pcre-static \
python3 \
python3-jinja2 \
python3-pip \
python3-pygments \
python3-wheel \
redhat-rpm-config \
sassc \
@@ -76,7 +80,7 @@ RUN dnf -y install \
xorg-x11-server-Xvfb \
&& dnf clean all
RUN pip3 install meson==0.50.1
RUN pip3 install meson==0.52.1
ARG HOST_USER_ID=5555
ENV HOST_USER_ID ${HOST_USER_ID}

View File

@@ -4,7 +4,7 @@ set -e
appid=$1
builddir=app
builddir=flatpak_app
repodir=repo
flatpak-builder \
@@ -12,12 +12,10 @@ flatpak-builder \
${builddir} \
build-aux/flatpak/${appid}.json
flatpak-builder \
--run ${builddir} build-aux/flatpak/${appid}.json \
meson \
--prefix /app \
--libdir /app/lib \
--buildtype debug \
flatpak build ${builddir} meson \
--prefix=/app \
--libdir=/app/lib \
--buildtype=release \
-Dx11-backend=true \
-Dwayland-backend=true \
-Dprint-backends=file \
@@ -27,9 +25,7 @@ flatpak-builder \
-Ddemos=true \
_build .
flatpak-builder \
--run ${builddir} build-aux/flatpak/${appid}.json \
ninja -C _build install
flatpak build ${builddir} ninja -C _build install
flatpak-builder \
--finish-only \
@@ -40,5 +36,5 @@ flatpak-builder \
flatpak build-bundle \
${repodir} \
${appid}-dev.flatpak \
--runtime-repo=https://flathub.org/repo/flathub.flatpakrepo \
--runtime-repo=https://nightly.gnome.org/gnome-nightly.flatpakrepo \
${appid}

View File

@@ -138,22 +138,25 @@ ul.images li {
</head>
<body>
<header>
<h1>{{ report.project_name }} :: Test Reports</h1>
<div class="report-meta">
<p><strong>Branch:</strong> {{ report.branch_name }}</p>
<p><strong>Date:</strong> <time datetime="{{ report.date.isoformat() }}">{{ report.locale_date }}</time></p>
{% if report.job_id %}<p><strong>Job ID:</strong> {{ report.job_id }}</p>{% endif %}
</div>
<h1>{{ report.project_name }}/{{ report.branch_name }} :: Test Reports</h1>
</header>
<article>
<section>
<div class="report-meta">
<p><strong>Branch:</strong> {{ report.branch_name }}</p>
<p><strong>Date:</strong> <time datetime="{{ report.date.isoformat() }}">{{ report.locale_date }}</time></p>
{% if report.job_id %}<p><strong>Job ID:</strong> {{ report.job_id }}</p>{% endif %}
</div>
</section>
<section>
<div class="summary">
<h3><a name="summary">Summary</a></h3>
<ul>
<li><strong>Total units:</strong> {{ report.total_units }}</li>
<li><strong>Passed:</strong> <a href="#passed">{{ report.total_successes }}</a></li>
<li><strong>Failed:</strong> <a href="#failures">{{ report.total_failures }}</a></li>
<li><strong>Failed:</strong> {{ report.total_failures }}</li>
<li><strong>Passed:</strong> {{ report.total_successes }}</li>
</ul>
</div>
</section>
@@ -164,54 +167,14 @@ ul.images li {
<h3><a name="results">Suite: {{ suite_result.suite_name }}</a></h3>
<ul>
<li><strong>Units:</strong> {{ suite_result.n_units }}</li>
<li><strong>Passed:</strong> {{ suite_result.n_successes }}</li>
<li><strong>Failed:</strong> {{ suite_result.n_failures }}</li>
<li><strong>Failed:</strong> <a href="#{{ suite_result.suite_name }}-failed">{{ suite_result.n_failures }}</a></li>
<li><strong>Passed:</strong> <a href="#{{ suite_result.suite_name }}-passed">{{ suite_result.n_successes }}</a></li>
</ul>
<div class="successes">
<h4><a name="passed">Passed</a></h4>
<ul class="passed">
{% for success in suite_result.successes if success.result == 'OK' %}
<li>{{ success.name }} - result: <span class="result pass">{{ success.result }}</li>
{% else %}
<li>None</li>
{% endfor %}
</ul>
<h4><a name="skipped">Skipped</a></h4>
<ul>
{% for success in suite_result.successes if success.result == 'SKIP' %}
<li>{{ success.name }} - result: <span class="result skip">{{ success.result }}</li>
{% else %}
<li>None</li>
{% endfor %}
</ul>
<h4><a name="expected-fail">Expected failures</a></h4>
<ul>
{% for success in suite_result.successes if success.result == 'EXPECTEDFAIL' %}
<li><a name="{{ success.name }}">{{ success.name }}</a> - result: <span class="result xfail">{{ success.result }}</span><br/>
{% if success.stdout %}
Output: <pre>{{ success.stdout }}</pre>
{% endif %}
{% if success.image_data is defined %}
<ul class="images">
<li><img alt="ref" src="{{ success.image_data.ref }}" /></li>
<li><img alt="out" src="{{ success.image_data.out }}" /></li>
<li><img alt="diff" src="{{ success.image_data.diff }}" /></li>
</ul>
{% endif %}
</li>
{% else %}
<li>None</li>
{% endfor %}
</ul>
</div>
<div class="failures">
<h4><a name="failed">Failed</a></h4>
<h4><a name="{{ suite_result.suite_name }}-failed">Failures</a></h4>
<ul class="failed">
{% for failure in suite_result.failures if failure.result == 'FAIL' %}
{% for failure in suite_result.failures if failure.result in [ 'FAIL', 'UNEXPECTEDPASS' ] %}
<li><a name="{{ failure.name }}">{{ failure.name }}</a> - result: <span class="result fail">{{ failure.result }}</span><br/>
{% if failure.stdout %}
Output: <pre>{{ failure.stdout }}</pre>
@@ -229,7 +192,7 @@ ul.images li {
{% endfor %}
</ul>
<h4><a name="timed-out">Timed out</a></h4>
<h4><a name="{{ suite_result.suite_name }}-timed-out">Timed out</a></h4>
<ul class="failed">
{% for failure in suite_result.failures if failure.result == 'TIMEOUT' %}
<li><a name="{{ failure.name }}">{{ failure.name }}</a> - result: <span class="result fail">{{ failure.result }}</span><br/>
@@ -243,6 +206,46 @@ ul.images li {
</ul>
</div>
<div class="successes">
<h4><a name="{{ suite_result.suite_name }}-skipped">Skipped</a></h4>
<ul>
{% for success in suite_result.successes if success.result == 'SKIP' %}
<li>{{ success.name }} - result: <span class="result skip">{{ success.result }}</li>
{% else %}
<li>None</li>
{% endfor %}
</ul>
<h4><a name="{{ suite_result.suite_name }}-passed">Passed</a></h4>
<ul class="passed">
{% for success in suite_result.successes if success.result == 'OK' %}
<li>{{ success.name }} - result: <span class="result pass">{{ success.result }}</li>
{% else %}
<li>None</li>
{% endfor %}
</ul>
<h4><a name="{{ suite_result.suite_name }}-expected-fail">Expected failures</a></h4>
<ul>
{% for success in suite_result.successes if success.result == 'EXPECTEDFAIL' %}
<li><a name="{{ success.name }}">{{ success.name }}</a> - result: <span class="result xfail">{{ success.result }}</span><br/>
{% if success.stdout %}
Output: <pre>{{ success.stdout }}</pre>
{% endif %}
{% if success.image_data is defined %}
<ul class="images">
<li><img alt="ref" src="{{ success.image_data.ref }}" /></li>
<li><img alt="out" src="{{ success.image_data.out }}" /></li>
<li><img alt="diff" src="{{ success.image_data.diff }}" /></li>
</ul>
{% endif %}
</li>
{% else %}
<li>None</li>
{% endfor %}
</ul>
</div>
</div>
</section>
{% endfor %}
@@ -328,7 +331,7 @@ for name, units in suites.items():
print('Processing {} suite {}:'.format(project_name, suite_name))
def if_failed(unit):
if unit['result'] in ['FAIL', 'TIMEOUT']:
if unit['result'] in ['FAIL', 'UNEXPECTEDPASS', 'TIMEOUT']:
return True
return False

View File

@@ -51,6 +51,7 @@ for line in args.infile:
duration = data['duration']
return_code = data['returncode']
result = data['result']
log = data['stdout']
unit = {
@@ -58,6 +59,7 @@ for line in args.infile:
'name': unit_name,
'duration': duration,
'returncode': return_code,
'result': result,
'stdout': log,
}
@@ -68,12 +70,12 @@ for name, units in suites.items():
print('Processing suite {} (units: {})'.format(name, len(units)))
def if_failed(unit):
if unit['returncode'] != 0:
if unit['result'] in ['FAIL', 'UNEXPECTEDPASS', 'TIMEOUT']:
return True
return False
def if_succeded(unit):
if unit['returncode'] == 0:
if unit['result'] in ['OK', 'EXPECTEDFAIL', 'SKIP']:
return True
return False

View File

@@ -1,11 +1,130 @@
#!/bin/bash
read_arg() {
# $1 = arg name
# $2 = arg value
# $3 = arg parameter
local rematch='^[^=]*=(.*)$'
if [[ $2 =~ $rematch ]]; then
read "$1" <<< "${BASH_REMATCH[1]}"
else
read "$1" <<< "$3"
# There is no way to shift our callers args, so
# return 1 to indicate they should do it instead.
return 1
fi
}
set -e
TAG="registry.gitlab.gnome.org/gnome/gtk/master:v7"
build=0
run=0
push=0
list=0
print_help=0
no_login=0
sudo docker build --build-arg HOST_USER_ID="$UID" --tag "${TAG}" \
--file "Dockerfile" .
sudo docker run --rm --security-opt label=disable \
--volume "$(pwd)/..:/home/user/app" --workdir "/home/user/app" \
--tty --interactive "${TAG}" bash
while (($# > 0)); do
case "${1%%=*}" in
build) build=1;;
run) run=1;;
push) push=1;;
list) list=1;;
help) print_help=1;;
--base|-b) read_arg base "$@" || shift;;
--base-version) read_arg base_version "$@" || shift;;
--no-login) no_login=1;;
*) echo -e "\e[1;31mERROR\e[0m: Unknown option '$1'"; exit 1;;
esac
shift
done
if [ $print_help == 1 ]; then
echo "$0 - Build and run Docker images"
echo ""
echo "Usage: $0 <command> [options] [basename]"
echo ""
echo "Available commands"
echo ""
echo " build --base=<BASENAME> - Build Docker image <BASENAME>.Dockerfile"
echo " run --base=<BASENAME> - Run Docker image <BASENAME>"
echo " push --base=<BASENAME> - Push Docker image <BASENAME> to the registry"
echo " list - List available images"
echo " help - This help message"
echo ""
exit 0
fi
cd "$(dirname "$0")"
if [ $list == 1 ]; then
echo "Available Docker images:"
for f in *.Dockerfile; do
filename=$( basename -- "$f" )
basename="${filename%.*}"
echo -e " \e[1;39m$basename\e[0m"
done
exit 0
fi
# All commands after this require --base to be set
if [ -z $base ]; then
echo "Usage: $0 <command>"
exit 1
fi
if [ ! -f "$base.Dockerfile" ]; then
echo -e "\e[1;31mERROR\e[0m: Dockerfile for '$base' not found"
exit 1
fi
if [ -z $base_version ]; then
base_version="latest"
else
base_version="v$base_version"
fi
TAG="registry.gitlab.gnome.org/gnome/gtk/${base}:${base_version}"
if [ $build == 1 ]; then
if docker --help |& grep -q podman; then
# Docker is actually implemented by podman, and its OCI output
# is incompatible with some of the dockerd instances on GitLab
# CI runners.
format="--format docker"
else
format=""
fi
echo -e "\e[1;32mBUILDING\e[0m: ${base} as ${TAG}"
sudo docker build \
${format} \
--build-arg HOST_USER_ID="$UID" \
--tag "${TAG}" \
--file "${base}.Dockerfile" .
exit $?
fi
if [ $push == 1 ]; then
echo -e "\e[1;32mPUSHING\e[0m: ${base} as ${TAG}"
if [ $no_login == 0 ]; then
sudo docker login registry.gitlab.gnome.org
fi
sudo docker push $TAG
exit $?
fi
if [ $run == 1 ]; then
echo -e "\e[1;32mRUNNING\e[0m: ${base} as ${TAG}"
sudo docker run \
--rm \
--volume "$(pwd)/..:/home/user/app" \
--workdir "/home/user/app" \
--tty \
--interactive "${TAG}" \
bash
exit $?
fi

View File

@@ -0,0 +1,34 @@
#!/bin/bash
set +e
# We need to add a new remote for the upstream master, since this script could
# be running in a personal fork of the repository which has out of date branches.
git remote add upstream https://gitlab.gnome.org/GNOME/gtk.git
git fetch upstream
# Work out the newest common ancestor between the detached HEAD that this CI job
# has checked out, and the upstream target branch (which will typically be
# `upstream/master` or `upstream/gtk-3-24`).
#
# `${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}` is only defined if were running in
# a merge request pipeline; fall back to `${CI_DEFAULT_BRANCH}` otherwise.
newest_common_ancestor_sha=$(diff --old-line-format='' --new-line-format='' <(git rev-list --first-parent upstream/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-${CI_DEFAULT_BRANCH}}) <(git rev-list --first-parent HEAD) | head -1)
git diff -U0 --no-color "${newest_common_ancestor_sha}" | .gitlab-ci/clang-format-diff.py -binary "clang-format" -p1
# The style check is not infallible. The clang-format configuration cannot
# perfectly describe GTKs coding style: in particular, it cannot align
# function arguments. The documented coding style for GTK takes priority over
# clang-format suggestions. Hopefully we can eventually improve clang-format to
# be configurable enough for our coding style. Thats why this CI check is OK
# to fail: the idea is that people can look through the output and ignore it if
# its wrong. (That situation can also happen if someone touches pre-existing
# badly formatted code and it doesnt make sense to tidy up the wider coding
# style with the changes theyre making.)
echo ""
echo "Note that clang-format output is advisory and cannot always match the"
echo "GTK coding style, documented at:"
echo " https://gitlab.gnome.org/GNOME/gtk/blob/master/docs/CODING-STYLE"
echo "Warnings from this tool can be ignored in favour of the documented "
echo "coding style, or in favour of matching the style of existing"
echo "surrounding code."

34
.gitlab-ci/run-tests.sh Executable file
View File

@@ -0,0 +1,34 @@
#!/bin/bash
set +x
set +e
srcdir=$( pwd )
builddir=$1
export GDK_BACKEND=x11
xvfb-run -a -s "-screen 0 1024x768x24" \
meson test -C ${builddir} \
--print-errorlogs \
--suite=gtk \
--no-suite=gtk:a11y
# Store the exit code for the CI run, but always
# generate the reports
exit_code=$?
cd ${builddir}
$srcdir/.gitlab-ci/meson-junit-report.py \
--project-name=gtk \
--job-id="${CI_JOB_NAME}" \
--output=report.xml \
meson-logs/testlog.json
$srcdir/.gitlab-ci/meson-html-report.py \
--project-name=gtk \
--job-id="${CI_JOB_NAME}" \
--reftest-output-dir="testsuite/reftests/output" \
--output=report.html \
meson-logs/testlog.json
exit $exit_code

80
NEWS
View File

@@ -1,3 +1,81 @@
Overview of Changes in GTK 3.98.0
=================================
While this release gets significantly closer to what we aim for in GTK 4,
there are still a few big items outstanding that we are currently working
on:
- Event controllers for keyboard shortcuts
- Movable popovers
- Row-recycling list and grid views
- Revamped accessibility infrastructure
- Animation API
We will do further 3.98.x snapshots as these land.
*****************
* The DND refactoring has been completed. The GTK API for DND has been turned
into event controllers: GtkDragSource and GtkDropTarget. Support for file
transfers via file transfer portal has been added for both DND and the clipboard.
* Child surfaces have been removed. GDK only supports toplevel and popup surfaces
now. The client-side window implementation has been removed too. On the GTK side,
the GtkNative interface has been introduced for widgets that have their own
surface. This cleanup is not 100% complete yet.
* Global positions and related apis such as gdk_surface_move are no longer available.
* A constraint-based layout manager has been added.
* Many classes have been made explicitly non-subclassable, and the widget hierarchy
has been simplified, by making widgets derive directly from GtkWidget instead of
a container.
* Menu-related changes:
- GtkMenu, GtkMenuBar and related classes have been removed. They are being replaced
by GMenu and popover-based variants. Popover menus can now do traditional, nested
menus, and model buttons show accelerators.
- Context menus are no longer created with ::populate-popup signals, but use menu
models and actions.
- Widget actions can be created in class_init, with gtk_widget_class_install_action.
- GtkToolbar has been removed as well.
* Text-related changed:
- Text cursor blinking has been made smooth.
- GtkTextView is caching rendernodes for the visible text range now, improving the
scrolling performance of text.
- Add a simple undo stack for text edits has been added.
* The native Win32 filechooser backend supports choices.
* GtkTreeView renders tree and grid lines with textures.
* GtkEmojiChooser has been made public.
* GtkGestureMultiPress has been renamed to GtkGestureClick.
* GtkWidget has api to handle style classes: gtk_widget_add_style_class.
This is the first step towards moving away from GtkStyleContext.
* X11-specific changes:
- XI2 is now mandatory
- The xim input method has been removed
* Wayland-specific changes:
- The loading of cursor themes has been improved to load cursors on demand,
and no longer relies on libwayland-cursor.
* The GL renderer is now sharing icon and glyph caches for all surfaces,
and has better support for blurring and shadow rendering.
* Performance-related changes:
- GTK provides profiling information for Sysprof when launched with GTK_TRACE=1.
- Css computation has been optimized
- Css lookups are using a Bloom filter
- Icon loading IO has been moved to a thread
Overview of Changes in GTK+ 3.96.0
==================================
@@ -360,7 +438,7 @@ Overview of Changes in GTK+ 3.92.1, 重庆市
The bulk of the preparation for this release was done during
and after the fantastic GNOME.Asia Summit 2017 in Chongqing, China.
* Drop autotools support. Meson 0.42.1 is now required
* Drop autotools support. Meson 0.42.1 is now required
* Implement most of CSS3 font-variant

View File

@@ -54,6 +54,36 @@
}
]
},
{
"name" : "libsass",
"buildsystem" : "meson",
"builddir" : true,
"config-opts": [
"--libdir=/app/lib"
],
"sources" : [
{
"type" : "git",
"url" : "https://github.com/lazka/libsass.git",
"branch" : "meson"
}
]
},
{
"name" : "sassc",
"buildsystem" : "meson",
"builddir" : true,
"config-opts": [
"--libdir=/app/lib"
],
"sources" : [
{
"type" : "git",
"url" : "https://github.com/lazka/sassc.git",
"branch" : "meson"
}
]
},
{
"name": "gtk",
"buildsystem": "meson",

View File

@@ -54,6 +54,36 @@
}
]
},
{
"name" : "libsass",
"buildsystem" : "meson",
"builddir" : true,
"config-opts": [
"--libdir=/app/lib"
],
"sources" : [
{
"type" : "git",
"url" : "https://github.com/lazka/libsass.git",
"branch" : "meson"
}
]
},
{
"name" : "sassc",
"buildsystem" : "meson",
"builddir" : true,
"config-opts": [
"--libdir=/app/lib"
],
"sources" : [
{
"type" : "git",
"url" : "https://github.com/lazka/sassc.git",
"branch" : "meson"
}
]
},
{
"name": "gtk",
"buildsystem": "meson",

View File

@@ -54,6 +54,36 @@
}
]
},
{
"name" : "libsass",
"buildsystem" : "meson",
"builddir" : true,
"config-opts": [
"--libdir=/app/lib"
],
"sources" : [
{
"type" : "git",
"url" : "https://github.com/lazka/libsass.git",
"branch" : "meson"
}
]
},
{
"name" : "sassc",
"buildsystem" : "meson",
"builddir" : true,
"config-opts": [
"--libdir=/app/lib"
],
"sources" : [
{
"type" : "git",
"url" : "https://github.com/lazka/sassc.git",
"branch" : "meson"
}
]
},
{
"name": "gtk",
"buildsystem": "meson",

View File

@@ -400,7 +400,7 @@ edit_constraint (ConstraintEditorWindow *win,
ConstraintEditor *editor;
GListModel *model;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (win));
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
if (constraint)
@@ -440,7 +440,7 @@ edit_guide (ConstraintEditorWindow *win,
GtkWidget *window;
GuideEditor *editor;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (win));
gtk_window_set_title (GTK_WINDOW (window), "Edit Guide");

View File

@@ -14,7 +14,7 @@ typedef struct {
GtkWidget *message;
GtkWidget *infobar;
GtkWidget *status;
GtkWidget *menutool;
GtkWidget *menubutton;
GMenuModel *toolmenu;
GtkTextBuffer *buffer;
@@ -428,8 +428,8 @@ demo_application_window_init (DemoApplicationWindow *window)
gtk_widget_init_template (GTK_WIDGET (window));
popover = gtk_popover_menu_new_from_model (window->menutool, window->toolmenu);
gtk_menu_tool_button_set_popover (GTK_MENU_TOOL_BUTTON (window->menutool), popover);
popover = gtk_popover_menu_new_from_model (window->menubutton, window->toolmenu);
gtk_menu_button_set_popover (GTK_MENU_BUTTON (window->menubutton), popover);
g_action_map_add_action_entries (G_ACTION_MAP (window),
win_entries, G_N_ELEMENTS (win_entries),
@@ -528,7 +528,7 @@ demo_application_window_class_init (DemoApplicationWindowClass *class)
gtk_widget_class_bind_template_child (widget_class, DemoApplicationWindow, infobar);
gtk_widget_class_bind_template_child (widget_class, DemoApplicationWindow, status);
gtk_widget_class_bind_template_child (widget_class, DemoApplicationWindow, buffer);
gtk_widget_class_bind_template_child (widget_class, DemoApplicationWindow, menutool);
gtk_widget_class_bind_template_child (widget_class, DemoApplicationWindow, menubutton);
gtk_widget_class_bind_template_child (widget_class, DemoApplicationWindow, toolmenu);
gtk_widget_class_bind_template_callback (widget_class, clicked_cb);
gtk_widget_class_bind_template_callback (widget_class, update_statusbar);

View File

@@ -8,27 +8,24 @@
<child>
<object class="GtkGrid">
<child>
<object class="GtkToolbar">
<object class="GtkBox">
<property name="hexpand">1</property>
<style>
<class name="primary-toolbar"/>
</style>
<child>
<object class="GtkMenuToolButton" id="menutool">
<object class="GtkMenuButton" id="menubutton">
<property name="icon-name">document-open</property>
</object>
</child>
<child>
<object class="GtkToolButton">
<object class="GtkButton">
<property name="icon-name">application-exit</property>
<property name="action-name">app.quit</property>
</object>
</child>
<child>
<object class="GtkSeparatorToolItem"/>
<object class="GtkSeparator"/>
</child>
<child>
<object class="GtkToolButton">
<object class="GtkButton">
<property name="icon-name">applications-other</property>
<property name="action-name">win.logo</property>
</object>

View File

@@ -63,7 +63,6 @@ GtkWidget *
do_builder (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
GtkWidget *toolbar;
GActionGroup *actions;
if (!window)
@@ -77,9 +76,6 @@ do_builder (GtkWidget *do_widget)
gtk_widget_get_display (do_widget));
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
toolbar = GTK_WIDGET (gtk_builder_get_object (builder, "toolbar1"));
gtk_style_context_add_class (gtk_widget_get_style_context (toolbar),
"primary-toolbar");
actions = (GActionGroup*)g_simple_action_group_new ();
g_action_map_add_action_entries (G_ACTION_MAP (actions),
win_entries, G_N_ELEMENTS (win_entries),

View File

@@ -98,7 +98,7 @@ get_image_paintable (GtkImage *image)
{
const gchar *icon_name;
GtkIconTheme *icon_theme;
GtkIconInfo *icon_info;
GtkIconPaintable *icon;
switch (gtk_image_get_storage_type (image))
{
@@ -107,10 +107,15 @@ get_image_paintable (GtkImage *image)
case GTK_IMAGE_ICON_NAME:
icon_name = gtk_image_get_icon_name (image);
icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (GTK_WIDGET (image)));
icon_info = gtk_icon_theme_lookup_icon (icon_theme, icon_name, 48, GTK_ICON_LOOKUP_GENERIC_FALLBACK);
if (icon_info == NULL)
icon = gtk_icon_theme_lookup_icon (icon_theme,
icon_name,
NULL,
48, 1,
gtk_widget_get_direction (GTK_WIDGET (image)),
0);
if (icon == NULL)
return NULL;
return gtk_icon_info_load_icon (icon_info, NULL);
return GDK_PAINTABLE (icon);
default:
g_warning ("Image storage type %d not handled",
gtk_image_get_storage_type (image));
@@ -149,7 +154,7 @@ prepare_drag (GtkDragSource *source,
double y,
GtkWidget *image)
{
return gdk_content_provider_new_with_callback (GDK_TYPE_TEXTURE, get_texture, image);
return gdk_content_provider_new_with_callback (GDK_TYPE_TEXTURE, get_texture, image, NULL);
}
static void
@@ -275,7 +280,7 @@ do_clipboard (GtkWidget *do_widget)
GtkDropTarget *dest;
GdkContentFormats *formats;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Clipboard");

View File

@@ -69,7 +69,7 @@ do_colorsel (GtkWidget *do_widget)
color.green = 0;
color.alpha = 1;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Color Chooser");

View File

@@ -310,7 +310,7 @@ do_combobox (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Combo Boxes");

View File

@@ -255,7 +255,7 @@ do_constraints (GtkWidget *do_widget)
{
GtkWidget *header, *box, *grid, *button;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
header = gtk_header_bar_new ();

View File

@@ -211,7 +211,7 @@ do_constraints2 (GtkWidget *do_widget)
{
GtkWidget *header, *box, *grid, *button;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
header = gtk_header_bar_new ();

View File

@@ -131,7 +131,7 @@ do_constraints3 (GtkWidget *do_widget)
{
GtkWidget *header, *box, *grid, *button;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
header = gtk_header_bar_new ();

View File

@@ -24,7 +24,7 @@ do_css_accordion (GtkWidget *do_widget)
GtkWidget *container, *child;
GtkStyleProvider *provider;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_title (GTK_WINDOW (window), "CSS Accordion");
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window), 600, 300);

View File

@@ -72,7 +72,7 @@ do_css_basics (GtkWidget *do_widget)
GtkTextBuffer *text;
GBytes *bytes;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_title (GTK_WINDOW (window), "CSS Basics");
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);

View File

@@ -86,7 +86,7 @@ do_css_multiplebgs (GtkWidget *do_widget)
GtkTextBuffer *text;
GBytes *bytes;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_title (GTK_WINDOW (window), "Multiple Backgrounds");
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);

View File

@@ -72,7 +72,7 @@ do_css_pixbufs (GtkWidget *do_widget)
GtkTextBuffer *text;
GBytes *bytes;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_title (GTK_WINDOW (window), "Animated Backgrounds");
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);

View File

@@ -62,22 +62,19 @@ GtkWidget *
create_toolbar (void)
{
GtkWidget *toolbar;
GtkToolItem *item;
GtkWidget *item;
toolbar = gtk_toolbar_new ();
toolbar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_widget_set_valign (toolbar, GTK_ALIGN_CENTER);
item = gtk_tool_button_new (NULL, NULL);
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "go-next");
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
item = gtk_button_new_from_icon_name ("go-next");
gtk_container_add (GTK_CONTAINER (toolbar), item);
item = gtk_tool_button_new (NULL, NULL);
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "go-previous");
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
item = gtk_button_new_from_icon_name ("go-previous");
gtk_container_add (GTK_CONTAINER (toolbar), item);
item = gtk_tool_button_new (NULL, "Hello World");
gtk_tool_item_set_is_important (item, TRUE);
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), item, -1);
item = gtk_button_new_with_label ("Hello World");
gtk_container_add (GTK_CONTAINER (toolbar), item);
return toolbar;
}
@@ -94,7 +91,7 @@ do_css_shadows (GtkWidget *do_widget)
GtkTextBuffer *text;
GBytes *bytes;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_title (GTK_WINDOW (window), "Shadows");
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window), 400, 300);

View File

@@ -173,7 +173,6 @@
<file>fishbowl.c</file>
<file>fixed.c</file>
<file>flowbox.c</file>
<file>foreigndrawing.c</file>
<file>font_features.c</file>
<file>fontplane.c</file>
<file>fontrendering.c</file>

View File

@@ -111,53 +111,52 @@
</object>
</child>
<child>
<object class="GtkToolbar" id="toolbar1">
<object class="GtkBox" id="toolbar1">
<child internal-child="accessible">
<object class="AtkObject" id="a11y-toolbar">
<property name="AtkObject::accessible-name">The toolbar</property>
</object>
</child>
<child>
<object class="GtkToolButton">
<object class="GtkButton">
<property name="label" translatable="yes">New</property>
<property name="tooltip-text" translatable="yes">Create a new file</property>
<property name="icon-name">document-new</property>
</object>
</child>
<child>
<object class="GtkToolButton">
<object class="GtkButton">
<property name="label" translatable="yes">Open</property>
<property name="tooltip-text" translatable="yes">Open a file</property>
<property name="icon-name">document-open</property>
</object>
</child>
<child>
<object class="GtkToolButton">
<object class="GtkButton">
<property name="label" translatable="yes">Save</property>
<property name="tooltip-text" translatable="yes">Save a file</property>
<property name="icon-name">document-save</property>
<property name="is-important">1</property>
</object>
</child>
<child>
<object class="GtkSeparatorToolItem"/>
<object class="GtkSeparator"/>
</child>
<child>
<object class="GtkToolButton">
<object class="GtkButton">
<property name="label" translatable="yes">Copy</property>
<property name="tooltip-text" translatable="yes">Copy selected object into the clipboard</property>
<property name="icon-name">edit-copy</property>
</object>
</child>
<child>
<object class="GtkToolButton">
<object class="GtkButton">
<property name="label" translatable="yes">Cut</property>
<property name="tooltip-text" translatable="yes">Cut selected object into the clipboard</property>
<property name="icon-name">edit-cut</property>
</object>
</child>
<child>
<object class="GtkToolButton">
<object class="GtkButton">
<property name="label" translatable="yes">Paste</property>
<property name="tooltip-text" translatable="yes">Paste object from the clipboard</property>
<property name="icon-name">edit-paste</property>

View File

@@ -105,7 +105,7 @@ do_dialog (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Dialogs and Message Boxes");

View File

@@ -356,7 +356,7 @@ do_dnd (GtkWidget *do_widget)
GtkGesture *multipress;
GtkCssProvider *provider;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Drag-and-drop");

View File

@@ -189,7 +189,7 @@ do_drawingarea (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Drawing Area");

View File

@@ -345,7 +345,7 @@ do_editable_cells (GtkWidget *do_widget)
GtkTreeModel *items_model;
GtkTreeModel *numbers_model;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Editable Cells");

View File

@@ -45,7 +45,7 @@ do_entry_completion (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Entry Completion");

View File

@@ -20,7 +20,7 @@ do_entry_undo (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Entry Undo");

View File

@@ -28,7 +28,7 @@ init_icon_names (GtkIconTheme *theme)
if (icon_names)
return;
icon_list = gtk_icon_theme_list_icons (theme, NULL);
icon_list = gtk_icon_theme_list_icons (theme);
icons = g_ptr_array_new ();
for (l = icon_list; l; l = l->next)
@@ -60,8 +60,10 @@ create_icon (void)
{
GtkWidget *image;
image = gtk_image_new_from_icon_name (get_random_icon_name (gtk_icon_theme_get_default ()));
image = gtk_image_new ();
gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE);
gtk_image_set_from_icon_name (GTK_IMAGE (image),
get_random_icon_name (gtk_icon_theme_get_for_display (gtk_widget_get_display (image))));
return image;
}

View File

@@ -124,7 +124,7 @@ create_demo_window (GtkWidget *do_widget)
{
GtkWidget *window, *sw, *fixed, *cube;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Fixed layout");
gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);

View File

@@ -719,7 +719,7 @@ do_flowbox (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Flow Box");

View File

@@ -1,984 +0,0 @@
/* Foreign drawing
*
* Many applications can't use GTK widgets, for a variety of reasons,
* but still want their user interface to appear integrated with the
* rest of the desktop, and follow GTK themes. This demo shows how to
* use GtkStyleContext and the gtk_render_ APIs to achieve this.
*
* Note that this is a very simple, non-interactive example.
*/
#include <gtk/gtk.h>
#include <string.h>
static void
append_element (GtkWidgetPath *path,
const char *selector)
{
static const struct {
const char *name;
GtkStateFlags state_flag;
} pseudo_classes[] = {
{ "active", GTK_STATE_FLAG_ACTIVE },
{ "hover", GTK_STATE_FLAG_PRELIGHT },
{ "selected", GTK_STATE_FLAG_SELECTED },
{ "disabled", GTK_STATE_FLAG_INSENSITIVE },
{ "indeterminate", GTK_STATE_FLAG_INCONSISTENT },
{ "focus", GTK_STATE_FLAG_FOCUSED },
{ "backdrop", GTK_STATE_FLAG_BACKDROP },
{ "dir(ltr)", GTK_STATE_FLAG_DIR_LTR },
{ "dir(rtl)", GTK_STATE_FLAG_DIR_RTL },
{ "link", GTK_STATE_FLAG_LINK },
{ "visited", GTK_STATE_FLAG_VISITED },
{ "checked", GTK_STATE_FLAG_CHECKED },
{ "drop(active)", GTK_STATE_FLAG_DROP_ACTIVE }
};
const char *next;
char *name;
char type;
guint i;
next = strpbrk (selector, "#.:");
if (next == NULL)
next = selector + strlen (selector);
name = g_strndup (selector, next - selector);
if (g_ascii_isupper (selector[0]))
{
GType gtype;
gtype = g_type_from_name (name);
if (gtype == G_TYPE_INVALID)
{
g_critical ("Unknown type name `%s'", name);
g_free (name);
return;
}
gtk_widget_path_append_type (path, gtype);
}
else
{
/* Omit type, we're using name */
gtk_widget_path_append_type (path, G_TYPE_NONE);
gtk_widget_path_iter_set_object_name (path, -1, name);
}
g_free (name);
while (*next != '\0')
{
type = *next;
selector = next + 1;
next = strpbrk (selector, "#.:");
if (next == NULL)
next = selector + strlen (selector);
name = g_strndup (selector, next - selector);
switch (type)
{
case '#':
gtk_widget_path_iter_set_name (path, -1, name);
break;
case '.':
gtk_widget_path_iter_add_class (path, -1, name);
break;
case ':':
for (i = 0; i < G_N_ELEMENTS (pseudo_classes); i++)
{
if (g_str_equal (pseudo_classes[i].name, name))
{
gtk_widget_path_iter_set_state (path,
-1,
gtk_widget_path_iter_get_state (path, -1)
| pseudo_classes[i].state_flag);
break;
}
}
if (i == G_N_ELEMENTS (pseudo_classes))
g_critical ("Unknown pseudo-class :%s", name);
break;
default:
g_assert_not_reached ();
break;
}
g_free (name);
}
}
static GtkStyleContext *
create_context_for_path (GtkWidgetPath *path,
GtkStyleContext *parent)
{
GtkStyleContext *context;
context = gtk_style_context_new ();
gtk_style_context_set_path (context, path);
gtk_style_context_set_parent (context, parent);
/* Unfortunately, we have to explicitly set the state again here
* for it to take effect
*/
gtk_style_context_set_state (context, gtk_widget_path_iter_get_state (path, -1));
gtk_widget_path_unref (path);
return context;
}
static GtkStyleContext *
get_style (GtkStyleContext *parent,
const char *selector)
{
GtkWidgetPath *path;
if (parent)
path = gtk_widget_path_copy (gtk_style_context_get_path (parent));
else
path = gtk_widget_path_new ();
append_element (path, selector);
return create_context_for_path (path, parent);
}
static GtkStyleContext *
get_style_with_siblings (GtkStyleContext *parent,
const char *selector,
const char **siblings,
gint position)
{
GtkWidgetPath *path, *siblings_path;
guint i;
if (parent)
path = gtk_widget_path_copy (gtk_style_context_get_path (parent));
else
path = gtk_widget_path_new ();
siblings_path = gtk_widget_path_new ();
for (i = 0; siblings[i]; i++)
append_element (siblings_path, siblings[i]);
gtk_widget_path_append_with_siblings (path, siblings_path, position);
gtk_widget_path_unref (siblings_path);
return create_context_for_path (path, parent);
}
static void
draw_style_common (GtkStyleContext *context,
cairo_t *cr,
gint x,
gint y,
gint width,
gint height,
gint *contents_x,
gint *contents_y,
gint *contents_width,
gint *contents_height)
{
GtkBorder margin, border, padding;
int min_width, min_height;
gtk_style_context_get_margin (context, &margin);
gtk_style_context_get_border (context, &border);
gtk_style_context_get_padding (context, &padding);
gtk_style_context_get (context,
"min-width", &min_width,
"min-height", &min_height,
NULL);
x += margin.left;
y += margin.top;
width -= margin.left + margin.right;
height -= margin.top + margin.bottom;
width = MAX (width, min_width);
height = MAX (height, min_height);
gtk_render_background (context, cr, x, y, width, height);
gtk_render_frame (context, cr, x, y, width, height);
if (contents_x)
*contents_x = x + border.left + padding.left;
if (contents_y)
*contents_y = y + border.top + padding.top;
if (contents_width)
*contents_width = width - border.left - border.right - padding.left - padding.right;
if (contents_height)
*contents_height = height - border.top - border.bottom - padding.top - padding.bottom;
}
static void
query_size (GtkStyleContext *context,
gint *width,
gint *height)
{
GtkBorder margin, border, padding;
int min_width, min_height;
gtk_style_context_get_margin (context, &margin);
gtk_style_context_get_border (context, &border);
gtk_style_context_get_padding (context, &padding);
gtk_style_context_get (context,
"min-width", &min_width,
"min-height", &min_height,
NULL);
min_width += margin.left + margin.right + border.left + border.right + padding.left + padding.right;
min_height += margin.top + margin.bottom + border.top + border.bottom + padding.top + padding.bottom;
if (width)
*width = MAX (*width, min_width);
if (height)
*height = MAX (*height, min_height);
}
static void
draw_menu (GtkWidget *widget,
cairo_t *cr,
gint x,
gint y,
gint width,
gint *height)
{
GtkStyleContext *menu_context;
GtkStyleContext *menuitem_context;
GtkStyleContext *hovermenuitem_context;
GtkStyleContext *hoveredarrowmenuitem_context;
GtkStyleContext *arrowmenuitem_context;
GtkStyleContext *checkmenuitem_context;
GtkStyleContext *disabledarrowmenuitem_context;
GtkStyleContext *disabledcheckmenuitem_context;
GtkStyleContext *radiomenuitem_context;
GtkStyleContext *disablemenuitem_context;
GtkStyleContext *disabledradiomenuitem_context;
GtkStyleContext *separatormenuitem_context;
gint menuitem1_height, menuitem2_height, menuitem3_height, menuitem4_height, menuitem5_height;
gint contents_x, contents_y, contents_width, contents_height;
gint menu_x, menu_y, menu_width, menu_height;
gint arrow_width, arrow_height, arrow_size;
gint toggle_x, toggle_y, toggle_width, toggle_height;
/* This information is taken from the GtkMenu docs, see "CSS nodes" */
menu_context = get_style (NULL, "menu");
hovermenuitem_context = get_style (menu_context, "menuitem:hover");
hoveredarrowmenuitem_context = get_style (hovermenuitem_context, "arrow.right:dir(ltr)");
menuitem_context = get_style (menu_context, "menuitem");
arrowmenuitem_context = get_style (menuitem_context, "arrow:dir(rtl)");
disablemenuitem_context = get_style (menu_context, "menuitem:disabled");
disabledarrowmenuitem_context = get_style (disablemenuitem_context, "arrow:dir(rtl)");
checkmenuitem_context = get_style (menuitem_context, "check:checked");
disabledcheckmenuitem_context = get_style (disablemenuitem_context, "check");
separatormenuitem_context = get_style (menu_context, "separator:disabled");
radiomenuitem_context = get_style (menuitem_context, "radio:checked");
disabledradiomenuitem_context = get_style (disablemenuitem_context, "radio");
*height = 0;
query_size (menu_context, NULL, height);
menuitem1_height = 0;
query_size (hovermenuitem_context, NULL, &menuitem1_height);
query_size (hoveredarrowmenuitem_context, NULL, &menuitem1_height);
*height += menuitem1_height;
menuitem2_height = 0;
query_size (menu_context, NULL, &menuitem5_height);
query_size (menuitem_context, NULL, &menuitem2_height);
query_size (arrowmenuitem_context, NULL, &menuitem2_height);
query_size (disabledarrowmenuitem_context, NULL, &menuitem2_height);
*height += menuitem2_height;
menuitem3_height = 0;
query_size (menu_context, NULL, &menuitem5_height);
query_size (menuitem_context, NULL, &menuitem3_height);
query_size (checkmenuitem_context, NULL, &menuitem3_height);
query_size (disabledcheckmenuitem_context, NULL, &menuitem3_height);
*height += menuitem3_height;
menuitem4_height = 0;
query_size (menu_context, NULL, &menuitem5_height);
query_size (separatormenuitem_context, NULL, &menuitem4_height);
*height += menuitem4_height;
menuitem5_height = 0;
query_size (menu_context, NULL, &menuitem5_height);
query_size (menuitem_context, NULL, &menuitem5_height);
query_size (radiomenuitem_context, NULL, &menuitem5_height);
query_size (disabledradiomenuitem_context, NULL, &menuitem5_height);
*height += menuitem5_height;
draw_style_common (menu_context, cr, x, y, width, *height,
&menu_x, &menu_y, &menu_width, &menu_height);
/* Hovered with right arrow */
gtk_style_context_get (hoveredarrowmenuitem_context,
"min-width", &arrow_width, "min-height", &arrow_height, NULL);
arrow_size = MIN (arrow_width, arrow_height);
draw_style_common (hovermenuitem_context, cr, menu_x, menu_y, menu_width, menuitem1_height,
&contents_x, &contents_y, &contents_width, &contents_height);
gtk_render_arrow (hoveredarrowmenuitem_context, cr, G_PI / 2,
contents_x + contents_width - arrow_size,
contents_y + (contents_height - arrow_size) / 2, arrow_size);
/* Left arrow sensitive, and right arrow insensitive */
draw_style_common (menuitem_context, cr, menu_x, menu_y + menuitem1_height, menu_width, menuitem2_height,
&contents_x, &contents_y, &contents_width, &contents_height);
gtk_style_context_get (arrowmenuitem_context,
"min-width", &arrow_width, "min-height", &arrow_height, NULL);
arrow_size = MIN (arrow_width, arrow_height);
gtk_render_arrow (arrowmenuitem_context, cr, G_PI / 2,
contents_x,
contents_y + (contents_height - arrow_size) / 2, arrow_size);
gtk_style_context_get (disabledarrowmenuitem_context,
"min-width", &arrow_width, "min-height", &arrow_height, NULL);
arrow_size = MIN (arrow_width, arrow_height);
gtk_render_arrow (disabledarrowmenuitem_context, cr, G_PI / 2,
contents_x + contents_width - arrow_size,
contents_y + (contents_height - arrow_size) / 2, arrow_size);
/* Left check enabled, sensitive, and right check unchecked, insensitive */
draw_style_common (menuitem_context, cr, menu_x, menu_y + menuitem1_height + menuitem2_height, menu_width, menuitem3_height,
&contents_x, &contents_y, &contents_width, &contents_height);
gtk_style_context_get (checkmenuitem_context,
"min-width", &toggle_width, "min-height", &toggle_height, NULL);
draw_style_common (checkmenuitem_context, cr,
contents_x,
contents_y,
toggle_width, toggle_height,
&toggle_x, &toggle_y, &toggle_width, &toggle_height);
gtk_render_check (checkmenuitem_context, cr, toggle_x, toggle_y, toggle_width, toggle_height);
gtk_style_context_get (disabledcheckmenuitem_context,
"min-width", &toggle_width, "min-height", &toggle_height, NULL);
draw_style_common (disabledcheckmenuitem_context, cr,
contents_x + contents_width - toggle_width,
contents_y,
toggle_width, toggle_height,
&toggle_x, &toggle_y, &toggle_width, &toggle_height);
gtk_render_check (disabledcheckmenuitem_context, cr, toggle_x, toggle_y, toggle_width, toggle_height);
/* Separator */
draw_style_common (separatormenuitem_context, cr, menu_x, menu_y + menuitem1_height + menuitem2_height + menuitem3_height,
menu_width, menuitem4_height,
NULL, NULL, NULL, NULL);
/* Left check enabled, sensitive, and right check unchecked, insensitive */
draw_style_common (menuitem_context, cr, menu_x, menu_y + menuitem1_height + menuitem2_height + menuitem3_height + menuitem4_height,
menu_width, menuitem5_height,
&contents_x, &contents_y, &contents_width, &contents_height);
gtk_style_context_get (radiomenuitem_context,
"min-width", &toggle_width, "min-height", &toggle_height, NULL);
draw_style_common (radiomenuitem_context, cr,
contents_x,
contents_y,
toggle_width, toggle_height,
&toggle_x, &toggle_y, &toggle_width, &toggle_height);
gtk_render_check (radiomenuitem_context, cr, toggle_x, toggle_y, toggle_width, toggle_height);
gtk_style_context_get (disabledradiomenuitem_context,
"min-width", &toggle_width, "min-height", &toggle_height, NULL);
draw_style_common (disabledradiomenuitem_context, cr,
contents_x + contents_width - toggle_width,
contents_y,
toggle_width, toggle_height,
&toggle_x, &toggle_y, &toggle_width, &toggle_height);
gtk_render_check (disabledradiomenuitem_context, cr, toggle_x, toggle_y, toggle_width, toggle_height);
g_object_unref (menu_context);
g_object_unref (menuitem_context);
g_object_unref (hovermenuitem_context);
g_object_unref (hoveredarrowmenuitem_context);
g_object_unref (arrowmenuitem_context);
g_object_unref (checkmenuitem_context);
g_object_unref (disabledarrowmenuitem_context);
g_object_unref (disabledcheckmenuitem_context);
g_object_unref (radiomenuitem_context);
g_object_unref (disablemenuitem_context);
g_object_unref (disabledradiomenuitem_context);
g_object_unref (separatormenuitem_context);
}
static void
draw_menubar (GtkWidget *widget,
cairo_t *cr,
gint x,
gint y,
gint width,
gint *height)
{
GtkStyleContext *frame_context;
GtkStyleContext *border_context;
GtkStyleContext *menubar_context;
GtkStyleContext *hovered_menuitem_context;
GtkStyleContext *menuitem_context;
gint contents_x, contents_y, contents_width, contents_height;
gint item_width;
/* Menubar background is the same color as our base background, so use a frame */
frame_context = get_style (NULL, "frame");
border_context = get_style (frame_context, "border");
/* This information is taken from the GtkPopoverMenuBar docs, see "CSS nodes" */
menubar_context = get_style (NULL, "menubar");
hovered_menuitem_context = get_style (menubar_context, "menuitem:hover");
menuitem_context = get_style (menubar_context, "menuitem");
*height = 0;
query_size (frame_context, NULL, height);
query_size (border_context, NULL, height);
query_size (menubar_context, NULL, height);
query_size (hovered_menuitem_context, NULL, height);
query_size (menuitem_context, NULL, height);
draw_style_common (frame_context, cr, x, y, width, *height,
NULL, NULL, NULL, NULL);
draw_style_common (border_context, cr, x, y, width, *height,
&contents_x, &contents_y, &contents_width, &contents_height);
draw_style_common (menubar_context, cr, contents_x, contents_y, contents_width, contents_height,
NULL, NULL, NULL, NULL);
item_width = contents_width / 3;
draw_style_common (hovered_menuitem_context, cr, contents_x, contents_y, item_width, contents_height,
NULL, NULL, NULL, NULL);
draw_style_common (menuitem_context, cr, contents_x + item_width * 2, contents_y, item_width, contents_height,
NULL, NULL, NULL, NULL);
g_object_unref (menuitem_context);
g_object_unref (hovered_menuitem_context);
g_object_unref (menubar_context);
g_object_unref (border_context);
g_object_unref (frame_context);
}
static void
draw_notebook (GtkWidget *widget,
cairo_t *cr,
gint x,
gint y,
gint width,
gint height)
{
GtkStyleContext *notebook_context;
GtkStyleContext *header_context;
GtkStyleContext *tabs_context;
GtkStyleContext *tab1_context, *tab2_context;
GtkStyleContext *stack_context;
gint header_height;
gint contents_x, contents_y, contents_width, contents_height;
/* This information is taken from the GtkNotebook docs, see "CSS nodes" */
notebook_context = get_style (NULL, "notebook.frame");
header_context = get_style (notebook_context, "header.top");
tabs_context = get_style (header_context, "tabs");
tab1_context = get_style (tabs_context, "tab:checked");
tab2_context = get_style (tabs_context, "tab:hover");
stack_context = get_style (notebook_context, "stack");
header_height = 0;
query_size (notebook_context, NULL, &header_height);
query_size (header_context, NULL, &header_height);
query_size (tabs_context, NULL, &header_height);
query_size (tab1_context, NULL, &header_height);
query_size (tab2_context, NULL, &header_height);
draw_style_common (notebook_context, cr, x, y, width, height, NULL, NULL, NULL, NULL);
draw_style_common (header_context, cr, x, y, width, header_height, NULL, NULL, NULL, NULL);
draw_style_common (tabs_context, cr, x, y, width, header_height, NULL, NULL, NULL, NULL);
draw_style_common (tab1_context, cr, x, y, width / 2, header_height,
&contents_x, &contents_y, &contents_width, &contents_height);
draw_style_common (tab2_context, cr, x + width / 2, y, width / 2, header_height,
NULL, NULL, NULL, NULL);
draw_style_common (stack_context, cr, x, y + header_height, width,height - header_height,
NULL, NULL, NULL, NULL);
g_object_unref (stack_context);
g_object_unref (tabs_context);
g_object_unref (tab1_context);
g_object_unref (tab2_context);
g_object_unref (header_context);
g_object_unref (notebook_context);
}
static void
draw_horizontal_scrollbar (GtkWidget *widget,
cairo_t *cr,
gint x,
gint y,
gint width,
gint position,
GtkStateFlags state,
gint *height)
{
GtkStyleContext *scrollbar_context;
GtkStyleContext *contents_context;
GtkStyleContext *trough_context;
GtkStyleContext *slider_context;
gint slider_width;
/* This information is taken from the GtkScrollbar docs, see "CSS nodes" */
scrollbar_context = get_style (NULL, "scrollbar.horizontal.bottom");
contents_context = get_style (scrollbar_context, "contents");
trough_context = get_style (contents_context, "trough");
slider_context = get_style (trough_context, "slider");
gtk_style_context_set_state (scrollbar_context, state);
gtk_style_context_set_state (contents_context, state);
gtk_style_context_set_state (trough_context, state);
gtk_style_context_set_state (slider_context, state);
*height = 0;
query_size (scrollbar_context, NULL, height);
query_size (contents_context, NULL, height);
query_size (trough_context, NULL, height);
query_size (slider_context, NULL, height);
gtk_style_context_get (slider_context,
"min-width", &slider_width, NULL);
draw_style_common (scrollbar_context, cr, x, y, width, *height, NULL, NULL, NULL, NULL);
draw_style_common (contents_context, cr, x, y, width, *height, NULL, NULL, NULL, NULL);
draw_style_common (trough_context, cr, x, y, width, *height, NULL, NULL, NULL, NULL);
draw_style_common (slider_context, cr, x + position, y, slider_width, *height, NULL, NULL, NULL, NULL);
g_object_unref (slider_context);
g_object_unref (trough_context);
g_object_unref (contents_context);
g_object_unref (scrollbar_context);
}
static void
draw_text (GtkWidget *widget,
cairo_t *cr,
gint x,
gint y,
gint width,
gint height,
const gchar *text,
GtkStateFlags state)
{
GtkStyleContext *label_context;
GtkStyleContext *selection_context;
GtkStyleContext *context;
PangoLayout *layout;
/* This information is taken from the GtkLabel docs, see "CSS nodes" */
label_context = get_style (NULL, "label.view");
selection_context = get_style (label_context, "selection");
gtk_style_context_set_state (label_context, state);
if (state & GTK_STATE_FLAG_SELECTED)
context = selection_context;
else
context = label_context;
layout = gtk_widget_create_pango_layout (widget, text);
gtk_render_background (context, cr, x, y, width, height);
gtk_render_frame (context, cr, x, y, width, height);
gtk_render_layout (context, cr, x, y, layout);
g_object_unref (layout);
g_object_unref (selection_context);
g_object_unref (label_context);
}
static void
draw_check (GtkWidget *widget,
cairo_t *cr,
gint x,
gint y,
GtkStateFlags state,
gint *width,
gint *height)
{
GtkStyleContext *button_context;
GtkStyleContext *check_context;
gint contents_x, contents_y, contents_width, contents_height;
/* This information is taken from the GtkCheckButton docs, see "CSS nodes" */
button_context = get_style (NULL, "checkbutton");
check_context = get_style (button_context, "check");
gtk_style_context_set_state (check_context, state);
*width = *height = 0;
query_size (button_context, width, height);
query_size (check_context, width, height);
draw_style_common (button_context, cr, x, y, *width, *height, NULL, NULL, NULL, NULL);
draw_style_common (check_context, cr, x, y, *width, *height,
&contents_x, &contents_y, &contents_width, &contents_height);
gtk_render_check (check_context, cr, contents_x, contents_y, contents_width, contents_height);
g_object_unref (check_context);
g_object_unref (button_context);
}
static void
draw_radio (GtkWidget *widget,
cairo_t *cr,
gint x,
gint y,
GtkStateFlags state,
gint *width,
gint *height)
{
GtkStyleContext *button_context;
GtkStyleContext *check_context;
gint contents_x, contents_y, contents_width, contents_height;
/* This information is taken from the GtkRadioButton docs, see "CSS nodes" */
button_context = get_style (NULL, "radiobutton");
check_context = get_style (button_context, "radio");
gtk_style_context_set_state (check_context, state);
*width = *height = 0;
query_size (button_context, width, height);
query_size (check_context, width, height);
draw_style_common (button_context, cr, x, y, *width, *height, NULL, NULL, NULL, NULL);
draw_style_common (check_context, cr, x, y, *width, *height,
&contents_x, &contents_y, &contents_width, &contents_height);
gtk_render_check (check_context, cr, contents_x, contents_y, contents_width, contents_height);
g_object_unref (check_context);
g_object_unref (button_context);
}
static void
draw_progress (GtkWidget *widget,
cairo_t *cr,
gint x,
gint y,
gint width,
gint position,
gint *height)
{
GtkStyleContext *bar_context;
GtkStyleContext *trough_context;
GtkStyleContext *progress_context;
/* This information is taken from the GtkProgressBar docs, see "CSS nodes" */
bar_context = get_style (NULL, "progressbar.horizontal");
trough_context = get_style (bar_context, "trough");
progress_context = get_style (trough_context, "progress.left");
*height = 0;
query_size (bar_context, NULL, height);
query_size (trough_context, NULL, height);
query_size (progress_context, NULL, height);
draw_style_common (bar_context, cr, x, y, width, *height, NULL, NULL, NULL, NULL);
draw_style_common (trough_context, cr, x, y, width, *height, NULL, NULL, NULL, NULL);
draw_style_common (progress_context, cr, x, y, position, *height, NULL, NULL, NULL, NULL);
g_object_unref (progress_context);
g_object_unref (trough_context);
g_object_unref (bar_context);
}
static void
draw_scale (GtkWidget *widget,
cairo_t *cr,
gint x,
gint y,
gint width,
gint position,
gint *height)
{
GtkStyleContext *scale_context;
GtkStyleContext *contents_context;
GtkStyleContext *trough_context;
GtkStyleContext *slider_context;
GtkStyleContext *highlight_context;
gint contents_x, contents_y, contents_width, contents_height;
gint trough_height, slider_height;
scale_context = get_style (NULL, "scale.horizontal");
contents_context = get_style (scale_context, "contents");
trough_context = get_style (contents_context, "trough");
slider_context = get_style (trough_context, "slider");
highlight_context = get_style (trough_context, "highlight.top");
*height = 0;
query_size (scale_context, NULL, height);
query_size (contents_context, NULL, height);
query_size (trough_context, NULL, height);
query_size (slider_context, NULL, height);
query_size (highlight_context, NULL, height);
draw_style_common (scale_context, cr, x, y, width, *height,
&contents_x, &contents_y, &contents_width, &contents_height);
draw_style_common (contents_context, cr, contents_x, contents_y, contents_width, contents_height,
&contents_x, &contents_y, &contents_width, &contents_height);
/* Scale trough defines its size querying slider and highlight */
trough_height = 0;
query_size (trough_context, NULL, &trough_height);
slider_height = 0;
query_size (slider_context, NULL, &slider_height);
query_size (highlight_context, NULL, &slider_height);
trough_height += slider_height;
draw_style_common (trough_context, cr, contents_x, contents_y, contents_width, trough_height,
&contents_x, &contents_y, &contents_width, &contents_height);
draw_style_common (highlight_context, cr, contents_x, contents_y,
contents_width / 2, contents_height,
NULL, NULL, NULL, NULL);
draw_style_common (slider_context, cr, contents_x + position, contents_y, contents_height, contents_height,
NULL, NULL, NULL, NULL);
g_object_unref (scale_context);
g_object_unref (contents_context);
g_object_unref (trough_context);
g_object_unref (slider_context);
g_object_unref (highlight_context);
}
static void
draw_combobox (GtkWidget *widget,
cairo_t *cr,
gint x,
gint y,
gint width,
gboolean has_entry,
gint *height)
{
GtkStyleContext *combo_context;
GtkStyleContext *box_context;
GtkStyleContext *button_context;
GtkStyleContext *button_box_context;
GtkStyleContext *entry_context;
GtkStyleContext *arrow_context;
gint contents_x, contents_y, contents_width, contents_height;
gint button_width;
gint arrow_width, arrow_height, arrow_size;
/* This information is taken from the GtkComboBox docs, see "CSS nodes" */
combo_context = get_style (NULL, "combobox:focus");
box_context = get_style (combo_context, "box.horizontal.linked");
if (has_entry)
{
const char *siblings[3] = { "entry.combo:focus", "button.combo" , NULL };
entry_context = get_style_with_siblings (box_context, "entry.combo:focus", siblings, 0);
button_context = get_style_with_siblings (box_context, "button.combo", siblings, 1);
}
else
{
const char *siblings[2] = { "button.combo" , NULL };
button_context = get_style_with_siblings (box_context, "button.combo", siblings, 0);
}
button_box_context = get_style (button_context, "box.horizontal");
arrow_context = get_style (button_box_context, "arrow");
*height = 0;
query_size (combo_context, NULL, height);
query_size (box_context, NULL, height);
if (has_entry)
query_size (entry_context, NULL, height);
query_size (button_context, NULL, height);
query_size (button_box_context, NULL, height);
query_size (arrow_context, NULL, height);
gtk_style_context_get (arrow_context,
"min-width", &arrow_width, "min-height", &arrow_height, NULL);
arrow_size = MIN (arrow_width, arrow_height);
draw_style_common (combo_context, cr, x, y, width, *height, NULL, NULL, NULL, NULL);
draw_style_common (box_context, cr, x, y, width, *height, NULL, NULL, NULL, NULL);
if (has_entry)
{
button_width = *height;
draw_style_common (entry_context, cr, x, y, width - button_width, *height, NULL, NULL, NULL, NULL);
draw_style_common (button_context, cr, x + width - button_width, y, button_width, *height,
&contents_x, &contents_y, &contents_width, &contents_height);
}
else
{
button_width = width;
draw_style_common (button_context, cr, x, y, width, *height,
&contents_x, &contents_y, &contents_width, &contents_height);
}
draw_style_common (button_box_context, cr, contents_x, contents_y, contents_width, contents_height,
NULL, NULL, NULL, NULL);
draw_style_common (arrow_context, cr, contents_x, contents_y, contents_width, contents_height,
NULL, NULL, NULL, NULL);
gtk_render_arrow (arrow_context, cr, G_PI / 2,
contents_x + contents_width - arrow_size,
contents_y + (contents_height - arrow_size) / 2, arrow_size);
g_object_unref (arrow_context);
if (has_entry)
g_object_unref (entry_context);
g_object_unref (button_context);
g_object_unref (combo_context);
}
static void
draw_spinbutton (GtkWidget *widget,
cairo_t *cr,
gint x,
gint y,
gint width,
gint *height)
{
GtkStyleContext *spin_context;
GtkStyleContext *entry_context;
GtkStyleContext *up_context;
GtkStyleContext *down_context;
GtkIconTheme *icon_theme;
GtkIconInfo *icon_info;
GdkTexture *texture;
gint icon_width, icon_height, icon_size;
gint button_width;
gint contents_x, contents_y, contents_width, contents_height;
/* This information is taken from the GtkSpinButton docs, see "CSS nodes" */
spin_context = get_style (NULL, "spinbutton.horizontal:focus");
entry_context = get_style (spin_context, "entry:focus");
up_context = get_style (spin_context, "button.up:focus:active");
down_context = get_style (spin_context, "button.down:focus");
*height = 0;
query_size (spin_context, NULL, height);
query_size (entry_context, NULL, height);
query_size (up_context, NULL, height);
query_size (down_context, NULL, height);
button_width = *height;
draw_style_common (spin_context, cr, x, y, width, *height, NULL, NULL, NULL, NULL);
draw_style_common (entry_context, cr, x, y, width, *height, NULL, NULL, NULL, NULL);
icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (widget));
gtk_style_context_get (up_context,
"min-width", &icon_width, "min-height", &icon_height, NULL);
icon_size = MIN (icon_width, icon_height);
icon_info = gtk_icon_theme_lookup_icon (icon_theme, "list-add-symbolic", icon_size, 0);
texture = GDK_TEXTURE (gtk_icon_info_load_symbolic_for_context (icon_info, up_context, NULL, NULL));
g_object_unref (icon_info);
draw_style_common (up_context, cr, x + width - button_width, y, button_width, *height,
&contents_x, &contents_y, &contents_width, &contents_height);
gtk_render_icon (up_context, cr, texture, contents_x, contents_y + (contents_height - icon_size) / 2);
g_object_unref (texture);
gtk_style_context_get (down_context,
"min-width", &icon_width, "min-height", &icon_height, NULL);
icon_size = MIN (icon_width, icon_height);
icon_info = gtk_icon_theme_lookup_icon (icon_theme, "list-remove-symbolic", icon_size, 0);
texture = GDK_TEXTURE (gtk_icon_info_load_symbolic_for_context (icon_info, down_context, NULL, NULL));
g_object_unref (icon_info);
draw_style_common (down_context, cr, x + width - 2 * button_width, y, button_width, *height,
&contents_x, &contents_y, &contents_width, &contents_height);
gtk_render_icon (down_context, cr, texture, contents_x, contents_y + (contents_height - icon_size) / 2);
g_object_unref (texture);
g_object_unref (down_context);
g_object_unref (up_context);
g_object_unref (entry_context);
g_object_unref (spin_context);
}
static void
draw_func (GtkDrawingArea *da,
cairo_t *cr,
int width,
int height,
gpointer data)
{
GtkWidget *widget = GTK_WIDGET (da);
gint panewidth;
gint x, y;
panewidth = width / 2;
cairo_rectangle (cr, 0, 0, width, height);
cairo_set_source_rgb (cr, 0.9, 0.9, 0.9);
cairo_fill (cr);
x = y = 10;
draw_horizontal_scrollbar (widget, cr, x, y, panewidth - 20, 30, GTK_STATE_FLAG_NORMAL, &height);
y += height + 8;
draw_horizontal_scrollbar (widget, cr, x, y, panewidth - 20, 40, GTK_STATE_FLAG_PRELIGHT, &height);
y += height + 8;
draw_horizontal_scrollbar (widget, cr, x, y, panewidth - 20, 50, GTK_STATE_FLAG_ACTIVE|GTK_STATE_FLAG_PRELIGHT, &height);
y += height + 8;
draw_text (widget, cr, x, y, panewidth - 20, 20, "Not selected", GTK_STATE_FLAG_NORMAL);
y += 20 + 10;
draw_text (widget, cr, x, y, panewidth - 20, 20, "Selected", GTK_STATE_FLAG_SELECTED);
x = 10;
y += 20 + 10;
draw_check (widget, cr, x, y, GTK_STATE_FLAG_NORMAL, &width, &height);
x += width + 10;
draw_check (widget, cr, x, y, GTK_STATE_FLAG_CHECKED, &width, &height);
x += width + 10;
draw_radio (widget, cr, x, y, GTK_STATE_FLAG_NORMAL, &width, &height);
x += width + 10;
draw_radio (widget, cr, x, y, GTK_STATE_FLAG_CHECKED, &width, &height);
x = 10;
y += height + 10;
draw_progress (widget, cr, x, y, panewidth - 20, 50, &height);
y += height + 10;
draw_scale (widget, cr, x, y, panewidth - 20, 75, &height);
y += height + 20;
draw_notebook (widget, cr, x, y, panewidth - 20, 160);
/* Second column */
x += panewidth;
y = 10;
draw_menu (widget, cr, x, y, panewidth - 20, &height);
y += height + 10;
draw_menubar (widget, cr, x, y, panewidth - 20, &height);
y += height + 20;
draw_spinbutton (widget, cr, x, y, panewidth - 20, &height);
y += height + 30;
draw_combobox (widget, cr, x, y, panewidth - 20, FALSE, &height);
y += height + 10;
draw_combobox (widget, cr, 10 + panewidth, y, panewidth - 20, TRUE, &height);
}
GtkWidget *
do_foreigndrawing (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
if (!window)
{
GtkWidget *box;
GtkWidget *da;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "Foreign drawing");
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
gtk_container_add (GTK_CONTAINER (window), box);
da = gtk_drawing_area_new ();
gtk_drawing_area_set_content_width (GTK_DRAWING_AREA (da), 400);
gtk_drawing_area_set_content_height (GTK_DRAWING_AREA (da), 400);
gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (da), draw_func, NULL, NULL);
gtk_widget_set_hexpand (da, TRUE);
gtk_widget_set_vexpand (da, TRUE);
gtk_container_add (GTK_CONTAINER (box), da);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_widget_destroy (window);
return window;
}

View File

@@ -146,7 +146,7 @@ do_gestures (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_default_size (GTK_WINDOW (window), 400, 400);
gtk_window_set_title (GTK_WINDOW (window), "Gestures");
g_signal_connect (window, "destroy",

View File

@@ -389,7 +389,7 @@ create_glarea_window (GtkWidget *do_widget)
GtkWidget *window, *box, *button, *controls;
int i;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "OpenGL Area");
gtk_window_set_default_size (GTK_WINDOW (window), 400, 600);

View File

@@ -23,7 +23,7 @@ do_headerbar (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);

View File

@@ -232,7 +232,7 @@ do_hypertext (GtkWidget *do_widget)
GtkTextBuffer *buffer;
GtkEventController *controller;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_title (GTK_WINDOW (window), "Hypertext");
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));

View File

@@ -26,7 +26,7 @@ enum
static GdkPixbuf *file_pixbuf, *folder_pixbuf;
gchar *parent;
GtkToolItem *up_button;
GtkWidget *up_button;
/* Loads the images for the demo and returns whether the operation succeeded */
static void
@@ -188,8 +188,8 @@ item_activated (GtkIconView *icon_view,
}
static void
up_clicked (GtkToolItem *item,
gpointer user_data)
up_clicked (GtkButton *item,
gpointer user_data)
{
GtkListStore *store;
gchar *dir_name;
@@ -209,8 +209,8 @@ up_clicked (GtkToolItem *item,
}
static void
home_clicked (GtkToolItem *item,
gpointer user_data)
home_clicked (GtkButton *item,
gpointer user_data)
{
GtkListStore *store;
@@ -248,9 +248,9 @@ do_iconview (GtkWidget *do_widget)
GtkListStore *store;
GtkWidget *vbox;
GtkWidget *tool_bar;
GtkToolItem *home_button;
GtkWidget *home_button;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_default_size (GTK_WINDOW (window), 650, 400);
gtk_window_set_display (GTK_WINDOW (window),
@@ -265,23 +265,15 @@ do_iconview (GtkWidget *do_widget)
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
tool_bar = gtk_toolbar_new ();
tool_bar = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_container_add (GTK_CONTAINER (vbox), tool_bar);
up_button = gtk_tool_button_new (NULL, NULL);
gtk_tool_button_set_label (GTK_TOOL_BUTTON (up_button), _("_Up"));
gtk_tool_button_set_use_underline (GTK_TOOL_BUTTON (up_button), TRUE);
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (up_button), "go-up");
gtk_tool_item_set_is_important (up_button, TRUE);
up_button = gtk_button_new_with_mnemonic ("_Up");
gtk_widget_set_sensitive (GTK_WIDGET (up_button), FALSE);
gtk_toolbar_insert (GTK_TOOLBAR (tool_bar), up_button, -1);
gtk_container_add (GTK_CONTAINER (tool_bar), up_button);
home_button = gtk_tool_button_new (NULL, NULL);
gtk_tool_button_set_label (GTK_TOOL_BUTTON (home_button), _("_Home"));
gtk_tool_button_set_use_underline (GTK_TOOL_BUTTON (home_button), TRUE);
gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (home_button), "go-home");
gtk_tool_item_set_is_important (home_button, TRUE);
gtk_toolbar_insert (GTK_TOOLBAR (tool_bar), home_button, -1);
home_button = gtk_button_new_with_mnemonic ("_Home");
gtk_container_add (GTK_CONTAINER (tool_bar), home_button);
sw = gtk_scrolled_window_new (NULL, NULL);

View File

@@ -106,7 +106,7 @@ do_iconview_edit (GtkWidget *do_widget)
GtkListStore *store;
GtkCellRenderer *renderer;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));

View File

@@ -331,7 +331,7 @@ do_images (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Images");

View File

@@ -53,7 +53,7 @@ do_infobar (GtkWidget *do_widget)
{
actions = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Info Bars");

View File

@@ -52,7 +52,7 @@ do_links (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Links");

View File

@@ -255,7 +255,7 @@ do_list_store (GtkWidget *do_widget)
GtkWidget *treeview;
/* create window, etc */
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "List Store");

View File

@@ -347,7 +347,7 @@ do_listbox (GtkWidget *do_widget)
{
avatar_pixbuf_other = gdk_pixbuf_new_from_resource_at_scale ("/listbox/apple-red.png", 32, 32, FALSE, NULL);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "List Box");

View File

@@ -28,7 +28,6 @@
<property name="default-width">800</property>
<property name="default-height">600</property>
<property name="title">GTK Demo</property>
<signal name="destroy" handler="gtk_main_quit" swapped="no"/>
<child type="titlebar">
<object class="GtkHeaderBar" id="headerbar">
<property name="show-title-buttons">1</property>

View File

@@ -54,7 +54,7 @@ do_markup (GtkWidget *do_widget)
GtkWidget *header;
GtkWidget *show_source;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window), 450, 450);

View File

@@ -28,7 +28,6 @@ demos = files([
'fishbowl.c',
'fixed.c',
'fontrendering.c',
'foreigndrawing.c',
'gestures.c',
'glarea.c',
'headerbar.c',

View File

@@ -31,7 +31,7 @@ do_overlay (GtkWidget *do_widget)
int i, j;
char *text;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_default_size (GTK_WINDOW (window), 500, 510);
gtk_window_set_title (GTK_WINDOW (window), "Interactive Overlay");

View File

@@ -35,7 +35,7 @@ do_overlay2 (GtkWidget *do_widget)
GtkTextIter start, end;
GtkAdjustment *adjustment;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_default_size (GTK_WINDOW (window), 500, 510);
gtk_window_set_title (GTK_WINDOW (window), "Decorative Overlay");

View File

@@ -384,7 +384,7 @@ do_paint (GtkWidget *toplevel)
{
GtkWidget *draw_area, *headerbar, *colorbutton;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
draw_area = drawing_area_new ();
gtk_container_add (GTK_CONTAINER (window), draw_area);

View File

@@ -156,7 +156,7 @@ do_paintable (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Nuclear Icon");

View File

@@ -188,7 +188,7 @@ do_paintable_animated (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Nuclear Animation");

View File

@@ -288,7 +288,7 @@ do_paintable_mediastream (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Nuclear MediaStream");

View File

@@ -146,7 +146,7 @@ do_panes (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));

View File

@@ -36,7 +36,7 @@ do_password_entry (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
header = gtk_header_bar_new ();

View File

@@ -14,7 +14,7 @@ do_pickers (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Pickers");

View File

@@ -174,7 +174,7 @@ do_pixbufs (GtkWidget *do_widget)
{
GError *error;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Pixbufs");

View File

@@ -130,7 +130,7 @@ do_popover (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_title (GTK_WINDOW (window), "Popovers");
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 24);
g_object_set (box, "margin", 24, NULL);

View File

@@ -178,7 +178,7 @@ do_rotated_text (GtkWidget *do_widget)
PangoLayout *layout;
PangoAttrList *attrs;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Rotated Text");

View File

@@ -250,7 +250,7 @@ do_search_entry (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Search Entry");
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);

View File

@@ -68,7 +68,7 @@ do_search_entry2 (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_title (GTK_WINDOW (window), "Delayed Search Entry");
gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (do_widget));
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);

View File

@@ -76,7 +76,7 @@ do_shortcuts (GtkWidget *do_widget)
if (!icons_added)
{
icons_added = TRUE;
gtk_icon_theme_add_resource_path (gtk_icon_theme_get_default (), "/icons");
gtk_icon_theme_add_resource_path (gtk_icon_theme_get_for_display (gtk_widget_get_display (do_widget)), "/icons");
}
g_type_ensure (G_TYPE_FILE_ICON);

View File

@@ -35,7 +35,7 @@ do_sidebar (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
gtk_widget_set_size_request (window, 500, 350);

View File

@@ -100,7 +100,7 @@ do_sizegroup (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Size Groups");
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);

View File

@@ -462,7 +462,7 @@ do_sliding_puzzle (GtkWidget *do_widget)
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), TRUE);
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), restart);
gtk_header_bar_pack_end (GTK_HEADER_BAR (header), tweak);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Sliding Puzzle");

View File

@@ -18,7 +18,7 @@ do_tabs (GtkWidget *do_widget)
GtkTextBuffer *buffer;
PangoTabArray *tabs;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_title (GTK_WINDOW (window), "Tabs");
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));

View File

@@ -63,7 +63,7 @@ do_tagged_entry (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
header = gtk_header_bar_new ();

View File

@@ -59,7 +59,7 @@ do_textmask (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
gtk_widget_set_size_request (window, 400, 200);
gtk_window_set_title (GTK_WINDOW (window), "Text Mask");

View File

@@ -180,7 +180,7 @@ do_textscroll (GtkWidget *do_widget)
{
GtkWidget *hbox;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_title (GTK_WINDOW (window), "Automatic Scrolling");
g_signal_connect (window, "destroy",
G_CALLBACK (gtk_widget_destroyed), &window);

View File

@@ -23,7 +23,7 @@ do_textundo (GtkWidget *do_widget)
GtkTextBuffer *buffer;
GtkTextIter iter;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window),

View File

@@ -9,6 +9,7 @@
#include <gtk/gtk.h>
#include <stdlib.h> /* for exit() */
#include "paintable.h"
static void easter_egg_callback (GtkWidget *button, gpointer data);
@@ -124,20 +125,24 @@ create_tags (GtkTextBuffer *buffer)
}
static void
insert_text (GtkTextBuffer *buffer)
insert_text (GtkTextView *view)
{
GtkWidget *widget = GTK_WIDGET (view);
GtkTextBuffer *buffer = gtk_text_view_get_buffer (view);
GtkTextIter iter;
GtkTextIter start, end;
GdkTexture *texture;
GtkIconTheme *icon_theme;
GtkIconPaintable *icon;
GdkPaintable *nuclear;
icon_theme = gtk_icon_theme_get_default ();
texture = GDK_TEXTURE (gtk_icon_theme_load_icon (icon_theme,
"gtk3-demo",
32,
GTK_ICON_LOOKUP_GENERIC_FALLBACK,
NULL));
g_assert (texture);
icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (widget));
icon = gtk_icon_theme_lookup_icon (icon_theme,
"face-cool",
NULL,
32, 1,
gtk_widget_get_direction (widget),
0);
nuclear = gtk_nuclear_animation_new ();
/* get start of buffer; each insertion will revalidate the
* iterator to point to just after the inserted text.
@@ -233,9 +238,11 @@ insert_text (GtkTextBuffer *buffer)
"heading", NULL);
gtk_text_buffer_insert (buffer, &iter, "The buffer can have images in it: ", -1);
gtk_text_buffer_insert_texture (buffer, &iter, texture);
gtk_text_buffer_insert_texture (buffer, &iter, texture);
gtk_text_buffer_insert_texture (buffer, &iter, texture);
gtk_text_buffer_insert_paintable (buffer, &iter, GDK_PAINTABLE (icon));
gtk_text_buffer_insert_paintable (buffer, &iter, GDK_PAINTABLE (icon));
gtk_text_buffer_insert_paintable (buffer, &iter, nuclear);
gtk_text_buffer_insert (buffer, &iter, " for example.\n\n", -1);
gtk_text_buffer_insert_with_tags_by_name (buffer, &iter, "Spacing. ", -1,
@@ -380,7 +387,8 @@ insert_text (GtkTextBuffer *buffer)
gtk_text_buffer_end_irreversible_action (buffer);
g_object_unref (texture);
g_object_unref (icon);
g_object_unref (nuclear);
}
static gboolean
@@ -466,7 +474,7 @@ do_textview (GtkWidget *do_widget)
GtkWidget *sw;
GtkTextBuffer *buffer;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window),
@@ -506,7 +514,7 @@ do_textview (GtkWidget *do_widget)
gtk_container_add (GTK_CONTAINER (sw), view2);
create_tags (buffer);
insert_text (buffer);
insert_text (GTK_TEXT_VIEW (view1));
attach_widgets (GTK_TEXT_VIEW (view1));
attach_widgets (GTK_TEXT_VIEW (view2));
@@ -580,7 +588,7 @@ easter_egg_callback (GtkWidget *button,
g_object_unref (buffer);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
sw = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,

View File

@@ -15,104 +15,6 @@
<property name="margin">10</property>
<property name="row-spacing">10</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkToolbar">
<property name="hexpand">1</property>
<property name="show-arrow">0</property>
<style>
<class name="primary-toolbar"/>
</style>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="label" translatable="yes">Normal</property>
<property name="use-underline">1</property>
<property name="is-important">1</property>
<property name="icon-name">edit-find</property>
</object>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="label" translatable="yes">Active</property>
<property name="use-underline">1</property>
<property name="is-important">1</property>
<property name="icon-name">edit-find</property>
<property name="active">1</property>
</object>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="sensitive">0</property>
<property name="label" translatable="yes">Insensitive</property>
<property name="use-underline">1</property>
<property name="is-important">1</property>
<property name="icon-name">edit-find</property>
</object>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="label" translatable="yes">Raised</property>
<property name="use-underline">1</property>
<property name="is-important">1</property>
<property name="icon-name">edit-find</property>
<style>
<class name="raised"/>
</style>
</object>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="label" translatable="yes">Raised Active</property>
<property name="use-underline">1</property>
<property name="is-important">1</property>
<property name="icon-name">edit-find</property>
<property name="active">1</property>
<style>
<class name="raised"/>
</style>
</object>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="sensitive">0</property>
<property name="label" translatable="yes">Insensitive Active</property>
<property name="use-underline">1</property>
<property name="icon-name">edit-find</property>
<property name="is-important">1</property>
<property name="active">1</property>
</object>
</child>
<child>
<object class="GtkToolItem">
<child>
<object class="GtkEntry" id="entry1">
<property name="can-focus">1</property>
<property name="width-chars">10</property>
<property name="invisible-char">•</property>
<property name="placeholder-text" translatable="yes">Search...</property>
<property name="secondary-icon-name">edit-find-symbolic</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkToolItem">
<child>
<object class="GtkSwitch" id="switch1">
<property name="can-focus">1</property>
<property name="valign">center</property>
<property name="tooltip_text">Switch it</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox">
<property name="valign">center</property>
@@ -143,68 +45,6 @@
</child>
</object>
</child>
<child>
<object class="GtkToolbar">
<property name="hexpand">1</property>
<property name="toolbar-style">icons</property>
<style>
<class name="inline-toolbar"/>
</style>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="label" translatable="yes">Normal</property>
<property name="use-underline">1</property>
<property name="icon-name">list-add-symbolic</property>
</object>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="label" translatable="yes">Normal</property>
<property name="use-underline">1</property>
<property name="icon-name">list-add-symbolic</property>
</object>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="label" translatable="yes">Active</property>
<property name="use-underline">1</property>
<property name="icon-name">list-remove-symbolic</property>
<property name="active">1</property>
</object>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="label" translatable="yes">Active</property>
<property name="use-underline">1</property>
<property name="icon-name">list-remove-symbolic</property>
<property name="active">1</property>
</object>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="sensitive">0</property>
<property name="label" translatable="yes">Insensitive</property>
<property name="use-underline">1</property>
<property name="icon-name">edit-find-symbolic</property>
</object>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="sensitive">0</property>
<property name="label" translatable="yes">Insensitive Active</property>
<property name="use-underline">1</property>
<property name="icon-name">go-up-symbolic</property>
<property name="active">1</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox">
<property name="spacing">10</property>

View File

@@ -4,103 +4,6 @@
<property name="row-spacing">10</property>
<property name="margin">10</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkToolbar">
<property name="hexpand">1</property>
<property name="show-arrow">0</property>
<style>
<class name="primary-toolbar"/>
</style>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="label" translatable="yes">Normal</property>
<property name="use-underline">1</property>
<property name="is-important">1</property>
<property name="icon-name">edit-find</property>
</object>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="label" translatable="yes">Active</property>
<property name="use-underline">1</property>
<property name="is-important">1</property>
<property name="icon-name">edit-find</property>
<property name="active">1</property>
</object>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="sensitive">0</property>
<property name="label" translatable="yes">Insensitive</property>
<property name="use-underline">1</property>
<property name="is-important">1</property>
<property name="icon-name">edit-find</property>
</object>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="label" translatable="yes">Raised</property>
<property name="use-underline">1</property>
<property name="is-important">1</property>
<property name="icon-name">edit-find</property>
<style>
<class name="raised"/>
</style>
</object>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="label" translatable="yes">Raised Active</property>
<property name="use-underline">1</property>
<property name="is-important">1</property>
<property name="icon-name">edit-find</property>
<property name="active">1</property>
<style>
<class name="raised"/>
</style>
</object>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="sensitive">0</property>
<property name="label" translatable="yes">Insensitive Active</property>
<property name="use-underline">1</property>
<property name="icon-name">edit-find</property>
<property name="is-important">1</property>
<property name="active">1</property>
</object>
</child>
<child>
<object class="GtkToolItem">
<child>
<object class="GtkEntry" id="entry1">
<property name="can-focus">1</property>
<property name="invisible-char">•</property>
<property name="placeholder-text" translatable="yes">Search...</property>
<property name="secondary-icon-name">edit-find-symbolic</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkToolItem">
<child>
<object class="GtkSwitch" id="switch1">
<property name="can-focus">1</property>
<property name="valign">center</property>
<property name="tooltip_text">Switch it</property>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox">
<property name="valign">center</property>
@@ -131,68 +34,6 @@
</child>
</object>
</child>
<child>
<object class="GtkToolbar">
<property name="hexpand">1</property>
<property name="toolbar-style">icons</property>
<style>
<class name="inline-toolbar"/>
</style>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="label" translatable="yes">Normal</property>
<property name="use-underline">1</property>
<property name="icon-name">list-add-symbolic</property>
</object>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="label" translatable="yes">Normal</property>
<property name="use-underline">1</property>
<property name="icon-name">list-add-symbolic</property>
</object>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="label" translatable="yes">Active</property>
<property name="use-underline">1</property>
<property name="icon-name">list-remove-symbolic</property>
<property name="active">1</property>
</object>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="label" translatable="yes">Active</property>
<property name="use-underline">1</property>
<property name="icon-name">list-remove-symbolic</property>
<property name="active">1</property>
</object>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="sensitive">0</property>
<property name="label" translatable="yes">Insensitive</property>
<property name="use-underline">1</property>
<property name="icon-name">edit-find-symbolic</property>
</object>
</child>
<child>
<object class="GtkToggleToolButton">
<property name="homogeneous">1</property>
<property name="sensitive">0</property>
<property name="label" translatable="yes">Insensitive Active</property>
<property name="use-underline">1</property>
<property name="icon-name">go-up-symbolic</property>
<property name="active">1</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox">
<property name="spacing">10</property>

View File

@@ -4,8 +4,8 @@
* with widgets to inform the theme about intended rendering.
*
* This demo shows some common examples where theming features
* of GTK are used for certain effects: primary toolbars,
* inline toolbars and linked buttons.
* of GTK are used for certain effects: primary toolbars
* and linked buttons.
*/
#include <gtk/gtk.h>
@@ -20,7 +20,7 @@ do_theming_style_classes (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Style Classes");

View File

@@ -18,7 +18,7 @@ do_transparent (GtkWidget *do_widget)
GtkWidget *label;
GtkWidget *picture;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window), 450, 450);

View File

@@ -390,7 +390,7 @@ do_tree_store (GtkWidget *do_widget)
GtkTreeModel *model;
/* create window, etc */
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Tree Store");

View File

@@ -63,7 +63,7 @@ do_video_player (GtkWidget *do_widget)
if (!window)
{
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Video Player");

View File

@@ -49,7 +49,9 @@ struct _IconBrowserWindow
GtkWidget *image4;
GtkWidget *image5;
GtkWidget *image6;
GtkWidget *label6;
GtkWidget *image7;
GtkWidget *image8;
GtkWidget *label8;
GtkWidget *description;
};
@@ -60,6 +62,12 @@ struct _IconBrowserWindowClass
G_DEFINE_TYPE(IconBrowserWindow, icon_browser_window, GTK_TYPE_APPLICATION_WINDOW);
static GtkIconTheme *
icon_browser_window_get_icon_theme (IconBrowserWindow *win)
{
return gtk_icon_theme_get_for_display (gtk_widget_get_display (GTK_WIDGET (win)));
}
static void
search_text_changed (GtkEntry *entry, IconBrowserWindow *win)
{
@@ -83,6 +91,7 @@ set_image (GtkWidget *image, const gchar *name, gint size)
static void
item_activated (GtkIconView *icon_view, GtkTreePath *path, IconBrowserWindow *win)
{
GtkIconTheme *icon_theme = icon_browser_window_get_icon_theme (win);
GtkTreeIter iter;
gchar *name;
gchar *description;
@@ -99,28 +108,30 @@ item_activated (GtkIconView *icon_view, GtkTreePath *path, IconBrowserWindow *wi
ICON_STORE_DESCRIPTION_COLUMN, &description,
-1);
if (name == NULL || !gtk_icon_theme_has_icon (gtk_icon_theme_get_default (), name))
if (name == NULL || !gtk_icon_theme_has_icon (icon_theme, name))
{
g_free (description);
return;
}
gtk_window_set_title (GTK_WINDOW (win->details), name);
set_image (win->image1, name, 16);
set_image (win->image2, name, 24);
set_image (win->image3, name, 32);
set_image (win->image4, name, 48);
set_image (win->image5, name, 64);
set_image (win->image1, name, 8);
set_image (win->image2, name, 16);
set_image (win->image3, name, 18);
set_image (win->image4, name, 24);
set_image (win->image5, name, 32);
set_image (win->image6, name, 48);
set_image (win->image7, name, 64);
if (win->symbolic)
{
gtk_widget_show (win->image6);
gtk_widget_show (win->label6);
set_image (win->image6, name, 64);
gtk_widget_show (win->image8);
gtk_widget_show (win->label8);
set_image (win->image8, name, 64);
}
else
{
gtk_widget_hide (win->image6);
gtk_widget_hide (win->label6);
gtk_widget_hide (win->image8);
gtk_widget_hide (win->label8);
}
if (description && description[0])
{
@@ -144,18 +155,19 @@ add_icon (IconBrowserWindow *win,
const gchar *description,
const gchar *context)
{
GtkIconTheme *icon_theme = icon_browser_window_get_icon_theme (win);
gchar *regular_name;
gchar *symbolic_name;
regular_name = g_strdup (name);
if (!gtk_icon_theme_has_icon (gtk_icon_theme_get_default (), regular_name))
if (!gtk_icon_theme_has_icon (icon_theme, regular_name))
{
g_free (regular_name);
regular_name = NULL;
}
symbolic_name = g_strconcat (name, "-symbolic", NULL);
if (!gtk_icon_theme_has_icon (gtk_icon_theme_get_default (), symbolic_name))
if (!gtk_icon_theme_has_icon (icon_theme, symbolic_name))
{
g_free (symbolic_name);
symbolic_name = NULL;
@@ -348,7 +360,7 @@ get_image_paintable (GtkImage *image)
{
const gchar *icon_name;
GtkIconTheme *icon_theme;
GtkIconInfo *icon_info;
GtkIconPaintable *icon;
int size;
switch (gtk_image_get_storage_type (image))
@@ -359,11 +371,15 @@ get_image_paintable (GtkImage *image)
icon_name = gtk_image_get_icon_name (image);
size = gtk_image_get_pixel_size (image);
icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (GTK_WIDGET (image)));
icon_info = gtk_icon_theme_lookup_icon (icon_theme, icon_name, size,
GTK_ICON_LOOKUP_FORCE_SIZE | GTK_ICON_LOOKUP_GENERIC_FALLBACK);
if (icon_info == NULL)
icon = gtk_icon_theme_lookup_icon (icon_theme,
icon_name,
NULL,
size, 1,
gtk_widget_get_direction (GTK_WIDGET (image)),
0);
if (icon == NULL)
return NULL;
return gtk_icon_info_load_icon (icon_info, NULL);
return GDK_PAINTABLE (icon);
default:
g_warning ("Image storage type %d not handled",
gtk_image_get_storage_type (image));
@@ -404,16 +420,20 @@ static void
get_file (GValue *value,
gpointer data)
{
GtkIconTheme *icon_theme;
const char *name;
GtkIconInfo *info;
GFile *file;
GtkIconPaintable *info;
name = gtk_image_get_icon_name (GTK_IMAGE (data));
icon_theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (GTK_WIDGET (data)));
info = gtk_icon_theme_lookup_icon (gtk_icon_theme_get_default (), name, -1, 0);
file = g_file_new_for_path (gtk_icon_info_get_filename (info));
g_value_set_object (value, file);
g_object_unref (file);
info = gtk_icon_theme_lookup_icon (icon_theme,
name,
NULL,
32, 1,
gtk_widget_get_direction (GTK_WIDGET (data)),
0);
g_value_take_object (value, gtk_icon_paintable_get_file (info));
g_object_unref (info);
}
@@ -424,7 +444,7 @@ setup_image_dnd (GtkWidget *image)
GtkDragSource *source;
source = gtk_drag_source_new ();
content = gdk_content_provider_new_with_callback (GDK_TYPE_TEXTURE, get_texture, image);
content = gdk_content_provider_new_with_callback (GDK_TYPE_TEXTURE, get_texture, image, NULL);
gtk_drag_source_set_content (source, content);
g_object_unref (content);
g_signal_connect (source, "drag-begin", G_CALLBACK (drag_begin), image);
@@ -438,7 +458,7 @@ setup_scalable_image_dnd (GtkWidget *image)
GtkDragSource *source;
source = gtk_drag_source_new ();
content = gdk_content_provider_new_with_callback (G_TYPE_FILE, get_file, image);
content = gdk_content_provider_new_with_callback (G_TYPE_FILE, get_file, image, NULL);
gtk_drag_source_set_content (source, content);
g_object_unref (content);
@@ -465,7 +485,9 @@ icon_browser_window_init (IconBrowserWindow *win)
setup_image_dnd (win->image3);
setup_image_dnd (win->image4);
setup_image_dnd (win->image5);
setup_scalable_image_dnd (win->image6);
setup_image_dnd (win->image6);
setup_image_dnd (win->image7);
setup_scalable_image_dnd (win->image8);
win->contexts = g_hash_table_new_full (g_str_hash, g_str_equal, NULL, context_free);
@@ -522,7 +544,9 @@ icon_browser_window_class_init (IconBrowserWindowClass *class)
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, image4);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, image5);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, image6);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, label6);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, image7);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, image8);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, label8);
gtk_widget_class_bind_template_child (GTK_WIDGET_CLASS (class), IconBrowserWindow, description);
gtk_widget_class_bind_template_callback (GTK_WIDGET_CLASS (class), search_text_changed);

View File

@@ -198,7 +198,7 @@
<property name="halign">center</property>
<property name="valign">end</property>
<accessibility>
<relation type="labelled-by" target="label6"/>
<relation type="labelled-by" target="label5"/>
</accessibility>
<layout>
<property name="left-attach">5</property>
@@ -206,11 +206,37 @@
</layout>
</object>
</child>
<child>
<object class="GtkImage" id="image7">
<property name="halign">center</property>
<property name="valign">end</property>
<accessibility>
<relation type="labelled-by" target="label5"/>
</accessibility>
<layout>
<property name="left-attach">6</property>
<property name="top-attach">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkImage" id="image8">
<property name="halign">center</property>
<property name="valign">end</property>
<accessibility>
<relation type="labelled-by" target="label6"/>
</accessibility>
<layout>
<property name="left-attach">7</property>
<property name="top-attach">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="label1">
<property name="halign">center</property>
<property name="valign">baseline</property>
<property name="label">16×16</property>
<property name="label">8×8</property>
<style>
<class name="dim-label"/>
</style>
@@ -227,7 +253,7 @@
<object class="GtkLabel" id="label2">
<property name="halign">center</property>
<property name="valign">baseline</property>
<property name="label">24×24</property>
<property name="label">16×16</property>
<style>
<class name="dim-label"/>
</style>
@@ -244,7 +270,7 @@
<object class="GtkLabel" id="label3">
<property name="halign">center</property>
<property name="valign">baseline</property>
<property name="label">32×32</property>
<property name="label">18×18</property>
<style>
<class name="dim-label"/>
</style>
@@ -261,7 +287,7 @@
<object class="GtkLabel" id="label4">
<property name="halign">center</property>
<property name="valign">baseline</property>
<property name="label">48×48</property>
<property name="label">24×24</property>
<style>
<class name="dim-label"/>
</style>
@@ -278,7 +304,7 @@
<object class="GtkLabel" id="label5">
<property name="halign">center</property>
<property name="valign">baseline</property>
<property name="label">64×64</property>
<property name="label">32×32</property>
<style>
<class name="dim-label"/>
</style>
@@ -295,7 +321,7 @@
<object class="GtkLabel" id="label6">
<property name="halign">center</property>
<property name="valign">baseline</property>
<property name="label">scalable</property>
<property name="label">48×48</property>
<style>
<class name="dim-label"/>
</style>
@@ -308,6 +334,40 @@
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="label7">
<property name="halign">center</property>
<property name="valign">baseline</property>
<property name="label">64×64</property>
<style>
<class name="dim-label"/>
</style>
<accessibility>
<relation type="label-for" target="image7"/>
</accessibility>
<layout>
<property name="left-attach">6</property>
<property name="top-attach">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkLabel" id="label8">
<property name="halign">center</property>
<property name="valign">baseline</property>
<property name="label">scalable</property>
<style>
<class name="dim-label"/>
</style>
<accessibility>
<relation type="label-for" target="image8"/>
</accessibility>
<layout>
<property name="left-attach">7</property>
<property name="top-attach">2</property>
</layout>
</object>
</child>
</object>
</child>
<child>

View File

@@ -20,6 +20,8 @@
#include "config.h"
#include <stdlib.h>
#include <glib/gi18n.h>
#include <gtk/gtk.h>

View File

@@ -1815,26 +1815,26 @@ microphone-sensitivity-medium-symbolic</property>
</object>
</child>
<child>
<object class="GtkToolbar" id="toolbar">
<object class="GtkBox" id="toolbar">
<child>
<object class="GtkToolButton">
<object class="GtkButton">
<property name="label" translatable="yes">New</property>
<property name="icon-name">document-new</property>
<property name="tooltip-text" translatable="yes">Create a new document</property>
</object>
</child>
<child>
<object class="GtkToolButton">
<object class="GtkButton">
<property name="label" translatable="yes">Save</property>
<property name="icon-name">document-save</property>
<property name="tooltip-text" translatable="yes">Save the current document</property>
</object>
</child>
<child>
<object class="GtkSeparatorToolItem"/>
<object class="GtkSeparator"/>
</child>
<child>
<object class="GtkToolButton">
<object class="GtkButton">
<property name="label" translatable="yes">Search</property>
<property name="icon-name">edit-find</property>
<property name="action-name">win.search</property>
@@ -1842,7 +1842,7 @@ microphone-sensitivity-medium-symbolic</property>
</object>
</child>
<child>
<object class="GtkToolButton">
<object class="GtkButton">
<property name="sensitive">0</property>
<property name="label" translatable="yes">Insert</property>
<property name="icon-name">insert-image</property>
@@ -2007,27 +2007,26 @@ microphone-sensitivity-medium-symbolic</property>
</object>
</child>
<child>
<object class="GtkToolbar">
<property name="toolbar-style">icons</property>
<object class="GtkBox">
<style>
<class name="inline-toolbar"/>
<class name="linked"/>
</style>
<child>
<object class="GtkToolButton" id="decrease_button">
<object class="GtkButton" id="decrease_button">
<property name="icon-name">zoom-out-symbolic</property>
<property name="tooltip-text">Normal icons</property>
<signal name="clicked" handler="decrease_icon_size" object="iconview1" swapped="yes"/>
</object>
</child>
<child>
<object class="GtkToolButton" id="increase_button">
<object class="GtkButton" id="increase_button">
<property name="icon-name">zoom-in-symbolic</property>
<property name="tooltip-text">Large icons</property>
<signal name="clicked" handler="increase_icon_size" object="iconview1" swapped="yes"/>
</object>
</child>
<child>
<object class="GtkToolButton" id="reset_button">
<object class="GtkButton" id="reset_button">
<property name="icon-name">zoom-original-symbolic</property>
<property name="tooltip-text">Inherited icon size</property>
<signal name="clicked" handler="reset_icon_size" object="iconview1" swapped="yes"/>
@@ -2478,26 +2477,25 @@ microphone-sensitivity-medium-symbolic</property>
<child>
<object class="GtkBox">
<child>
<object class="GtkToolbar">
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="toolbar-style">icons</property>
<child>
<object class="GtkToolButton" id="toolbutton1">
<object class="GtkButton" id="toolbutton1">
<property name="icon-name">document-open-symbolic</property>
</object>
</child>
<child>
<object class="GtkToolButton" id="toolbutton2">
<object class="GtkButton" id="toolbutton2">
<property name="icon-name">send-to-symbolic</property>
</object>
</child>
<child>
<object class="GtkToolButton" id="toolbutton3">
<object class="GtkButton" id="toolbutton3">
<property name="icon-name">view-fullscreen-symbolic</property>
</object>
</child>
<child>
<object class="GtkToolButton" id="toolbutton4">
<object class="GtkButton" id="toolbutton4">
<property name="icon-name">star-new-symbolic</property>
</object>
</child>
@@ -2557,7 +2555,7 @@ microphone-sensitivity-medium-symbolic</property>
<child>
<object class="GtkOverlay">
<child type="overlay">
<object class="GtkToolbar" id="totem_like_osd">
<object class="GtkBox" id="totem_like_osd">
<property name="visible">0</property>
<property name="opacity">0.9</property>
<property name="margin">20</property>
@@ -2566,48 +2564,36 @@ microphone-sensitivity-medium-symbolic</property>
<class name="osd"/>
</style>
<child>
<object class="GtkToolItem">
<object class="GtkBox">
<style>
<class name="linked"/>
</style>
<child>
<object class="GtkBox">
<style>
<class name="linked"/>
</style>
<child>
<object class="GtkButton">
<property name="icon-name">pan-start-symbolic</property>
</object>
</child>
<child>
<object class="GtkButton">
<property name="icon-name">pan-end-symbolic</property>
</object>
</child>
<object class="GtkButton">
<property name="icon-name">pan-start-symbolic</property>
</object>
</child>
<child>
<object class="GtkButton">
<property name="icon-name">pan-end-symbolic</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkToolItem">
<property name="expand-item">1</property>
<child>
<object class="GtkScale">
<property name="draw-value">0</property>
<property name="adjustment">adjustment1</property>
</object>
</child>
<object class="GtkScale">
<property name="hexpand">1</property>
<property name="draw-value">0</property>
<property name="adjustment">adjustment1</property>
</object>
</child>
<child>
<object class="GtkToolItem">
<child>
<object class="GtkVolumeButton">
<property name="orientation">vertical</property>
<property name="value">.5</property>
<style>
<class name="image-button"/>
</style>
</object>
</child>
<object class="GtkVolumeButton">
<property name="orientation">vertical</property>
<property name="value">.5</property>
<style>
<class name="image-button"/>
</style>
</object>
</child>
</object>

View File

@@ -94,7 +94,6 @@ gdk_display_get_default_seat
gdk_display_list_seats
gdk_display_get_n_monitors
gdk_display_get_monitor
gdk_display_get_primary_monitor
gdk_display_get_monitor_at_surface
gdk_display_get_clipboard
gdk_display_get_primary_clipboard
@@ -178,7 +177,6 @@ GdkSurfaceEdge
GdkSurfaceTypeHint
GdkSurfaceState
gdk_surface_new_toplevel
gdk_surface_new_temp
gdk_surface_new_popup
gdk_surface_get_parent
gdk_surface_destroy
@@ -186,7 +184,6 @@ gdk_surface_get_surface_type
gdk_surface_get_display
gdk_surface_show
gdk_surface_show_unraised
gdk_surface_show_with_auto_dismissal
gdk_surface_hide
gdk_surface_is_destroyed
gdk_surface_is_visible
@@ -368,7 +365,6 @@ gdk_pango_layout_line_get_clip_region
<TITLE>Cairo Interaction</TITLE>
<FILE>cairo_interaction</FILE>
gdk_surface_create_similar_surface
gdk_cairo_get_clip_rectangle
gdk_cairo_set_source_rgba
gdk_cairo_set_source_pixbuf
gdk_cairo_rectangle
@@ -1127,7 +1123,6 @@ gdk_monitor_get_scale_factor
gdk_monitor_get_refresh_rate
GdkSubpixelLayout
gdk_monitor_get_subpixel_layout
gdk_monitor_is_primary
gdk_monitor_is_valid
<SUBSECTION Standard>

View File

@@ -109,9 +109,8 @@ gsk_text_node_new
gsk_text_node_peek_font
gsk_text_node_peek_glyphs
gsk_text_node_peek_color
gsk_text_node_get_x
gsk_text_node_get_y
gsk_text_node_get_num_glyphs
gsk_text_node_get_offset
gsk_blur_node_new
gsk_blur_node_get_child
gsk_blur_node_get_radius

View File

@@ -1092,42 +1092,6 @@ We use <literallayout> for syntax productions, and each line is put in a <code>
<entry><ulink url="https://www.w3.org/TR/css3-ui/#outline-offset">CSS3</ulink></entry>
<entry></entry>
</row>
<row>
<entry><phrase role="nowrap">-gtk-outline-top-left-radius</phrase></entry>
<entry><code>〈corner radius〉</code></entry>
<entry><code>0</code></entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry></entry>
</row>
<row>
<entry><phrase role="nowrap">-gtk-outline-top-right-radius</phrase></entry>
<entry><code>〈corner radius〉</code></entry>
<entry><code>0</code></entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry></entry>
</row>
<row>
<entry><phrase role="nowrap">-gtk-outline-bottom-right-radius</phrase></entry>
<entry><code>〈corner radius〉</code></entry>
<entry><code>0</code></entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry></entry>
</row>
<row>
<entry><phrase role="nowrap">-gtk-outline-bottom-left-radius</phrase></entry>
<entry><code>〈corner radius〉</code></entry>
<entry><code>0</code></entry>
<entry></entry>
<entry></entry>
<entry></entry>
<entry></entry>
</row>
</tbody>
</tgroup>
<tgroup cols="5">
@@ -1143,13 +1107,6 @@ We use <literallayout> for syntax productions, and each line is put in a <code>
<ulink url="https://www.w3.org/TR/css3-ui/#propdef-outline">CSS3</ulink></entry>
<entry></entry>
</row>
<row>
<entry><phrase role="nowrap">-gtk-outline-radius</phrase></entry>
<entry><code>[ 〈length〉 | 〈percentage〉 ]{1,4} [ / [ 〈length〉 | 〈percentage〉 ]{1,4} ]?</code></entry>
<entry>see individual properties</entry>
<entry></entry>
<entry></entry>
</row>
</tbody>
</tgroup>
</table>

View File

@@ -214,17 +214,9 @@
</chapter>
<chapter id="MenusAndCombos">
<title>Menus, Combo Box, Toolbar</title>
<title>Menus, Combo Box</title>
<xi:include href="xml/gtkcombobox.xml" />
<xi:include href="xml/gtkcomboboxtext.xml" />
<xi:include href="xml/gtktoolshell.xml" />
<xi:include href="xml/gtktoolbar.xml" />
<xi:include href="xml/gtktoolitem.xml" />
<xi:include href="xml/gtkseparatortoolitem.xml" />
<xi:include href="xml/gtktoolbutton.xml" />
<xi:include href="xml/gtkmenutoolbutton.xml" />
<xi:include href="xml/gtktoggletoolbutton.xml" />
<xi:include href="xml/gtkradiotoolbutton.xml" />
<xi:include href="xml/gtkpopover.xml" />
<xi:include href="xml/gtkpopovermenu.xml" />
<xi:include href="xml/gtkpopovermenubar.xml" />
@@ -246,6 +238,7 @@
<xi:include href="xml/gtkfontbutton.xml" />
<xi:include href="xml/gtkfontchooserwidget.xml" />
<xi:include href="xml/gtkfontchooserdialog.xml" />
<xi:include href="xml/gtkemojichooser.xml" />
</chapter>
<chapter id="DrawingWidgets">
@@ -374,7 +367,6 @@
<xi:include href="xml/gtkstylecontext.xml" />
<xi:include href="xml/gtkcssprovider.xml" />
<xi:include href="xml/gtkstyleprovider.xml" />
<xi:include href="xml/gtkwidgetpath.xml" />
<xi:include href="xml/gtkicontheme.xml" />
</part>

View File

@@ -616,7 +616,6 @@ gtk_button_get_type
<FILE>gtkcalendar</FILE>
<TITLE>GtkCalendar</TITLE>
GtkCalendar
GtkCalendarDetailFunc
GtkCalendarDisplayOptions
<SUBSECTION>
@@ -633,13 +632,6 @@ gtk_calendar_get_display_options
gtk_calendar_set_display_options
gtk_calendar_get_date
<SUBSECTION>
gtk_calendar_set_detail_func
gtk_calendar_get_detail_width_chars
gtk_calendar_set_detail_width_chars
gtk_calendar_get_detail_height_rows
gtk_calendar_set_detail_height_rows
<SUBSECTION Standard>
GTK_CALENDAR
GTK_IS_CALENDAR
@@ -3003,218 +2995,6 @@ gtk_toggle_button_get_type
GtkToggleButtonPrivate
</SECTION>
<SECTION>
<FILE>gtktoolshell</FILE>
<TITLE>GtkToolShell</TITLE>
GtkToolShell
GtkToolShellIface
gtk_tool_shell_get_ellipsize_mode
gtk_tool_shell_get_orientation
gtk_tool_shell_get_style
gtk_tool_shell_get_text_alignment
gtk_tool_shell_get_text_orientation
gtk_tool_shell_rebuild_menu
gtk_tool_shell_get_text_size_group
<SUBSECTION Standard>
GTK_IS_TOOL_SHELL
GTK_TOOL_SHELL
GTK_TOOL_SHELL_GET_IFACE
GTK_TYPE_TOOL_SHELL
<SUBSECTION Private>
gtk_tool_shell_get_type
</SECTION>
<SECTION>
<FILE>gtktoolbar</FILE>
<TITLE>GtkToolbar</TITLE>
GtkToolbar
gtk_toolbar_new
gtk_toolbar_insert
gtk_toolbar_get_item_index
gtk_toolbar_get_n_items
gtk_toolbar_get_nth_item
gtk_toolbar_get_drop_index
gtk_toolbar_set_drop_highlight_item
gtk_toolbar_set_show_arrow
gtk_toolbar_get_show_arrow
gtk_toolbar_get_style
gtk_toolbar_set_style
gtk_toolbar_unset_style
<SUBSECTION Standard>
GTK_TOOLBAR
GTK_IS_TOOLBAR
GTK_TYPE_TOOLBAR
GTK_TOOLBAR_CLASS
GTK_IS_TOOLBAR_CLASS
GTK_TOOLBAR_GET_CLASS
<SUBSECTION Private>
gtk_toolbar_get_type
GtkToolbarPrivate
</SECTION>
<SECTION>
<FILE>gtktoolitem</FILE>
<TITLE>GtkToolItem</TITLE>
GtkToolItem
GtkToolItemClass
gtk_tool_item_new
gtk_tool_item_set_homogeneous
gtk_tool_item_get_homogeneous
gtk_tool_item_set_expand
gtk_tool_item_get_expand
gtk_tool_item_set_tooltip_text
gtk_tool_item_set_tooltip_markup
gtk_tool_item_set_visible_horizontal
gtk_tool_item_get_visible_horizontal
gtk_tool_item_set_visible_vertical
gtk_tool_item_get_visible_vertical
gtk_tool_item_set_is_important
gtk_tool_item_get_is_important
gtk_tool_item_get_ellipsize_mode
gtk_tool_item_get_orientation
gtk_tool_item_get_toolbar_style
gtk_tool_item_get_text_alignment
gtk_tool_item_get_text_orientation
gtk_tool_item_set_overflow_text
gtk_tool_item_get_overflow_text
gtk_tool_item_rebuild_menu
gtk_tool_item_toolbar_reconfigured
gtk_tool_item_get_text_size_group
<SUBSECTION Standard>
GTK_TYPE_TOOL_ITEM
GTK_TOOL_ITEM
GTK_TOOL_ITEM_CLASS
GTK_IS_TOOL_ITEM
GTK_IS_TOOL_ITEM_CLASS
GTK_TOOL_ITEM_GET_CLASS
<SUBSECTION Private>
gtk_tool_item_get_type
GtkToolItemPrivate
</SECTION>
<SECTION>
<FILE>gtkseparatortoolitem</FILE>
<TITLE>GtkSeparatorToolItem</TITLE>
GtkSeparatorToolItem
gtk_separator_tool_item_new
gtk_separator_tool_item_set_draw
gtk_separator_tool_item_get_draw
<SUBSECTION Standard>
GTK_TYPE_SEPARATOR_TOOL_ITEM
GTK_SEPARATOR_TOOL_ITEM
GTK_SEPARATOR_TOOL_ITEM_CLASS
GTK_IS_SEPARATOR_TOOL_ITEM
GTK_IS_SEPARATOR_TOOL_ITEM_CLASS
GTK_SEPARATOR_TOOL_ITEM_GET_CLASS
<SUBSECTION Private>
gtk_separator_tool_item_get_type
GtkSeparatorToolItemPrivate
</SECTION>
<SECTION>
<FILE>gtktoolbutton</FILE>
<TITLE>GtkToolButton</TITLE>
GtkToolButton
GtkToolButtonClass
gtk_tool_button_new
gtk_tool_button_set_label
gtk_tool_button_get_label
gtk_tool_button_set_use_underline
gtk_tool_button_get_use_underline
gtk_tool_button_set_icon_name
gtk_tool_button_get_icon_name
gtk_tool_button_set_icon_widget
gtk_tool_button_get_icon_widget
gtk_tool_button_set_label_widget
gtk_tool_button_get_label_widget
<SUBSECTION Standard>
GTK_TYPE_TOOL_BUTTON
GTK_TOOL_BUTTON
GTK_TOOL_BUTTON_CLASS
GTK_IS_TOOL_BUTTON
GTK_IS_TOOL_BUTTON_CLASS
GTK_TOOL_BUTTON_GET_CLASS
<SUBSECTION Private>
gtk_tool_button_get_type
GtkToolButtonPrivate
</SECTION>
<SECTION>
<FILE>gtkmenutoolbutton</FILE>
<TITLE>GtkMenuToolButton</TITLE>
GtkMenuToolButton
gtk_menu_tool_button_new
gtk_menu_tool_button_set_popover
gtk_menu_tool_button_get_popover
gtk_menu_tool_button_set_arrow_tooltip_text
gtk_menu_tool_button_set_arrow_tooltip_markup
<SUBSECTION Standard>
GTK_TYPE_MENU_TOOL_BUTTON
GTK_MENU_TOOL_BUTTON
GTK_MENU_TOOL_BUTTON_CLASS
GTK_IS_MENU_TOOL_BUTTON
GTK_IS_MENU_TOOL_BUTTON_CLASS
GTK_MENU_TOOL_BUTTON_GET_CLASS
<SUBSECTION Private>
gtk_menu_tool_button_get_type
GtkMenuToolButtonPrivate
</SECTION>
<SECTION>
<FILE>gtkradiotoolbutton</FILE>
<TITLE>GtkRadioToolButton</TITLE>
GtkRadioToolButton
gtk_radio_tool_button_new
gtk_radio_tool_button_new_from_widget
gtk_radio_tool_button_get_group
gtk_radio_tool_button_set_group
<SUBSECTION Standard>
GTK_TYPE_RADIO_TOOL_BUTTON
GTK_RADIO_TOOL_BUTTON
GTK_RADIO_TOOL_BUTTON_CLASS
GTK_IS_RADIO_TOOL_BUTTON
GTK_IS_RADIO_TOOL_BUTTON_CLASS
GTK_RADIO_TOOL_BUTTON_GET_CLASS
<SUBSECTION Private>
gtk_radio_tool_button_get_type
</SECTION>
<SECTION>
<FILE>gtktoggletoolbutton</FILE>
<TITLE>GtkToggleToolButton</TITLE>
GtkToggleToolButton
GtkToggleToolButtonClass
gtk_toggle_tool_button_new
gtk_toggle_tool_button_set_active
gtk_toggle_tool_button_get_active
<SUBSECTION Standard>
GTK_TYPE_TOGGLE_TOOL_BUTTON
GTK_TOGGLE_TOOL_BUTTON
GTK_TOGGLE_TOOL_BUTTON_CLASS
GTK_IS_TOGGLE_TOOL_BUTTON
GTK_IS_TOGGLE_TOOL_BUTTON_CLASS
GTK_TOGGLE_TOOL_BUTTON_GET_CLASS
<SUBSECTION Private>
gtk_toggle_tool_button_get_type
GtkToggleToolButtonPrivate
</SECTION>
<SECTION>
<FILE>gtktooltip</FILE>
<TITLE>GtkTooltip</TITLE>
@@ -4409,6 +4189,9 @@ gtk_widget_insert_after
gtk_widget_set_layout_manager
gtk_widget_get_layout_manager
gtk_widget_should_layout
gtk_widget_add_css_class
gtk_widget_remove_css_class
gtk_widget_has_css_class
<SUBSECTION>
gtk_widget_get_style_context
@@ -4503,7 +4286,6 @@ gtk_requisition_get_type
<TITLE>GtkWindow</TITLE>
GtkWindow
GtkWindowClass
GtkWindowType
gtk_window_new
gtk_window_set_title
gtk_window_set_resizable
@@ -4635,13 +4417,6 @@ gtk_get_default_language
gtk_get_locale_direction
gtk_init
gtk_init_check
gtk_events_pending
gtk_main
gtk_main_level
gtk_main_quit
gtk_main_iteration
gtk_main_iteration_do
gtk_main_do_event
<SUBSECTION>
gtk_grab_add
@@ -4661,7 +4436,6 @@ gtk_get_current_event_device
gtk_get_event_widget
gtk_get_event_target
gtk_get_event_target_with_type
gtk_propagate_event
<SUBSECTION Private>
gtk_init_abi_check
@@ -4689,50 +4463,6 @@ GTK_INTERFACE_AGE
GTK_CHECK_VERSION
</SECTION>
<SECTION>
<FILE>gtkwidgetpath</FILE>
<TITLE>GtkWidgetPath</TITLE>
GtkWidgetPath
gtk_widget_path_append_type
gtk_widget_path_append_with_siblings
gtk_widget_path_append_for_widget
gtk_widget_path_copy
gtk_widget_path_ref
gtk_widget_path_unref
gtk_widget_path_free
gtk_widget_path_get_object_type
gtk_widget_path_has_parent
gtk_widget_path_is_type
gtk_widget_path_iter_add_class
gtk_widget_path_iter_clear_classes
gtk_widget_path_iter_get_name
gtk_widget_path_iter_get_object_name
gtk_widget_path_iter_get_object_type
gtk_widget_path_iter_get_siblings
gtk_widget_path_iter_get_sibling_index
gtk_widget_path_iter_get_state
gtk_widget_path_iter_has_class
gtk_widget_path_iter_has_name
gtk_widget_path_iter_has_qclass
gtk_widget_path_iter_has_qname
gtk_widget_path_iter_list_classes
gtk_widget_path_iter_remove_class
gtk_widget_path_iter_set_name
gtk_widget_path_iter_set_object_name
gtk_widget_path_iter_set_object_type
gtk_widget_path_iter_set_state
gtk_widget_path_length
gtk_widget_path_new
gtk_widget_path_prepend_type
gtk_widget_path_to_string
<SUBSECTION Standard>
GTK_TYPE_WIDGET_PATH
<SUBSECTION Private>
gtk_widget_path_get_type
</SECTION>
<SECTION>
<FILE>gtkstyleprovider</FILE>
<TITLE>GtkStyleProvider</TITLE>
@@ -4755,16 +4485,6 @@ gtk_style_provider_get_type
<FILE>gtkstylecontext</FILE>
<TITLE>GtkStyleContext</TITLE>
<SUBSECTION>
GTK_STYLE_PROPERTY_BACKGROUND_COLOR
GTK_STYLE_PROPERTY_COLOR
GTK_STYLE_PROPERTY_FONT
GTK_STYLE_PROPERTY_MARGIN
GTK_STYLE_PROPERTY_PADDING
GTK_STYLE_PROPERTY_BORDER_WIDTH
GTK_STYLE_PROPERTY_BORDER_RADIUS
GTK_STYLE_PROPERTY_BORDER_STYLE
GTK_STYLE_PROPERTY_BORDER_COLOR
GTK_STYLE_PROPERTY_BACKGROUND_IMAGE
GtkBorderStyle
<SUBSECTION>
GTK_STYLE_CLASS_ACCELERATOR
@@ -4794,7 +4514,6 @@ GTK_STYLE_CLASS_HIGHLIGHT
GTK_STYLE_CLASS_HORIZONTAL
GTK_STYLE_CLASS_IMAGE
GTK_STYLE_CLASS_INFO
GTK_STYLE_CLASS_INLINE_TOOLBAR
GTK_STYLE_CLASS_INSERTION_CURSOR
GTK_STYLE_CLASS_LABEL
GTK_STYLE_CLASS_LEFT
@@ -4816,7 +4535,6 @@ GTK_STYLE_CLASS_PANE_SEPARATOR
GTK_STYLE_CLASS_PAPER
GTK_STYLE_CLASS_POPUP
GTK_STYLE_CLASS_POPOVER
GTK_STYLE_CLASS_PRIMARY_TOOLBAR
GTK_STYLE_CLASS_PROGRESSBAR
GTK_STYLE_CLASS_PULSE
GTK_STYLE_CLASS_QUESTION
@@ -4852,17 +4570,10 @@ GTK_STYLE_CLASS_WARNING
GTK_STYLE_CLASS_WIDE
<SUBSECTION>
GtkStyleContext
gtk_style_context_new
gtk_style_context_add_provider
gtk_style_context_add_provider_for_display
gtk_style_context_get
gtk_style_context_get_parent
gtk_style_context_get_path
gtk_style_context_get_property
gtk_style_context_get_display
gtk_style_context_get_state
gtk_style_context_get_valist
gtk_style_context_get_section
gtk_style_context_get_color
gtk_style_context_get_border
gtk_style_context_get_padding
@@ -4874,7 +4585,6 @@ gtk_style_context_reset_widgets
gtk_style_context_restore
gtk_style_context_save
gtk_style_context_set_parent
gtk_style_context_set_path
gtk_style_context_add_class
gtk_style_context_remove_class
gtk_style_context_has_class
@@ -5035,7 +4745,6 @@ GtkScrollType
GtkSelectionMode
GtkShadowType
GtkStateFlags
GtkToolbarStyle
GtkSortType
GtkIconSize
@@ -5044,13 +4753,14 @@ GtkIconSize
<SECTION>
<FILE>gtkicontheme</FILE>
<TITLE>GtkIconTheme</TITLE>
GtkIconInfo
GtkIconPaintable
GtkIconTheme
GtkIconLookupFlags
GTK_ICON_THEME_ERROR
GTK_TYPE_ICON_THEME_ERROR
GTK_TYPE_ICON_LOOKUP_FLAGS
GtkIconThemeError
gtk_icon_theme_new
gtk_icon_theme_get_default
gtk_icon_theme_get_for_display
gtk_icon_theme_set_display
gtk_icon_theme_set_search_path
@@ -5061,31 +4771,17 @@ gtk_icon_theme_add_resource_path
gtk_icon_theme_set_custom_theme
gtk_icon_theme_has_icon
gtk_icon_theme_lookup_icon
gtk_icon_theme_lookup_icon_for_scale
gtk_icon_theme_choose_icon
gtk_icon_theme_choose_icon_for_scale
gtk_icon_theme_choose_icon_async
gtk_icon_theme_choose_icon_finish
gtk_icon_theme_lookup_by_gicon
gtk_icon_theme_lookup_by_gicon_for_scale
gtk_icon_theme_load_icon
gtk_icon_theme_load_icon_for_scale
gtk_icon_theme_list_icons
gtk_icon_theme_get_icon_sizes
gtk_icon_theme_rescan_if_needed
gtk_icon_info_get_base_size
gtk_icon_info_get_base_scale
gtk_icon_info_get_filename
gtk_icon_info_load_icon
gtk_icon_info_load_icon_async
gtk_icon_info_load_icon_finish
gtk_icon_info_load_symbolic
gtk_icon_info_load_symbolic_async
gtk_icon_info_load_symbolic_finish
gtk_icon_info_load_symbolic_for_context
gtk_icon_info_load_symbolic_for_context_async
gtk_icon_info_load_symbolic_for_context_finish
gtk_icon_info_is_symbolic
gtk_icon_paintable_new_for_file
gtk_icon_paintable_get_file
gtk_icon_paintable_get_icon_name
gtk_icon_paintable_is_symbolic
<SUBSECTION Standard>
GtkIconInfoClass
GtkIconClass
GTK_ICON_THEME
GTK_IS_ICON_THEME
GTK_TYPE_ICON_THEME
@@ -5093,13 +4789,13 @@ gtk_icon_theme_get_type
GTK_ICON_THEME_CLASS
GTK_IS_ICON_THEME_CLASS
GTK_ICON_THEME_GET_CLASS
gtk_icon_info_get_type
GTK_TYPE_ICON_INFO
GTK_ICON_INFO
GTK_ICON_INFO_CLASS
GTK_ICON_INFO_GET_CLASS
GTK_IS_ICON_INFO
GTK_IS_ICON_INFO_CLASS
gtk_icon_paintable_get_type
GTK_ICON_PAINTABLE
GTK_IS_ICON
GTK_TYPE_ICON
GTK_ICON_PAINTABLE_CLASS
GTK_ICON_PAINTABLE_GET_CLASS
GTK_IS_ICON_CLASS
<SUBSECTION Private>
GtkIconThemePrivate
gtk_icon_theme_error_quark
@@ -7211,3 +6907,20 @@ GTK_DRAG_ICON_GET_CLASS
<SUBSECTION Private>
gtk_drag_icon_get_type
</SECTION>
<SECTION>
<FILE>gtkemojichooser</FILE>
GtkEmojiChooser
gtk_emoji_chooser_new
<SUBSECTION Standard>
GTK_TYPE_EMOJI_CHOOSER
GTK_EMOJI_CHOOSER
GTK_EMOJI_CHOOSER_CLASS
GTK_IS_EMOJI_CHOOSER
GTK_IS_EMOJI_CHOOSER_CLASS
GTK_EMOJI_CHOOSER_GET_CLASS
<SUBSECTION Private>
gtk_emoji_chooser_get_type
</SECTION>

View File

@@ -62,6 +62,7 @@ gtk_drag_source_get_type
gtk_drawing_area_get_type
gtk_drop_target_get_type
gtk_editable_get_type
gtk_emoji_chooser_get_type
gtk_entry_buffer_get_type
gtk_entry_completion_get_type
gtk_entry_get_type
@@ -122,7 +123,6 @@ gtk_media_controls_get_type
gtk_media_file_get_type
gtk_media_stream_get_type
gtk_menu_button_get_type
gtk_menu_tool_button_get_type
gtk_message_dialog_get_type
gtk_mount_operation_get_type
gtk_native_get_type
@@ -150,7 +150,6 @@ gtk_print_settings_get_type
@DISABLE_ON_W32@gtk_print_unix_dialog_get_type
gtk_progress_bar_get_type
gtk_radio_button_get_type
gtk_radio_tool_button_get_type
gtk_range_get_type
gtk_recent_manager_get_type
gtk_revealer_get_type
@@ -164,7 +163,6 @@ gtk_search_bar_get_type
gtk_search_entry_get_type
gtk_selection_model_get_type
gtk_separator_get_type
gtk_separator_tool_item_get_type
gtk_settings_get_type
gtk_shortcut_label_get_type
gtk_shortcuts_window_get_type
@@ -196,10 +194,6 @@ gtk_text_tag_get_type
gtk_text_tag_table_get_type
gtk_text_view_get_type
gtk_toggle_button_get_type
gtk_toggle_tool_button_get_type
gtk_toolbar_get_type
gtk_tool_button_get_type
gtk_tool_item_get_type
gtk_tree_drag_dest_get_type
gtk_tree_drag_source_get_type
gtk_tree_list_model_get_type

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@@ -92,12 +92,50 @@
<para>
The function which initially receives input events on the GTK
side is gtk_main_do_event(). See its documentation
for details of what it does: compression of enter/leave events,
identification of the widget receiving the event, pushing the event onto a
stack for gtk_get_current_event(), and propagating the event to the
widget.
side is responsible for a number of tasks.
</para>
<orderedlist>
<listitem><para>
Compress enter/leave notify events. If the event passed build an
enter/leave pair together with the next event (peeked from GDK), both
events are thrown away. This is to avoid a backlog of (de-)highlighting
widgets crossed by the pointer.
</para></listitem>
<listitem><para>
Find the widget which got the event. If the widget cant be determined
the event is thrown away unless it belongs to a INCR transaction.
</para></listitem>
<listitem><para>
Then the event is pushed onto a stack so you can query the currently
handled event with gtk_get_current_event().
</para></listitem>
<listitem><para>
The event is sent to a widget. If a grab is active all events for widgets
that are not in the contained in the grab widget are sent to the latter
with a few exceptions:
<itemizedlist>
<listitem><para>
Deletion and destruction events are still sent to the event widget for
obvious reasons.
</para></listitem>
<listitem><para>
Events which directly relate to the visual representation of the event
widget.
</para></listitem>
<listitem><para>
Leave events are delivered to the event widget if there was an enter
event delivered to it before without the paired leave event.
</para></listitem>
<listitem><para>
Drag events are not redirected because it is unclear what the semantics
of that would be.
</para></listitem>
</itemizedlist>
</para></listitem>
<listitem><para>
After finishing the delivery the event is popped from the event stack.
</para></listitem>
</orderedlist>
<para>
When a GDK backend produces an input event, it is tied to a #GdkDevice and
@@ -118,8 +156,7 @@
</para>
<para>
An event is propagated to a widget using gtk_propagate_event().
Propagation goes down and up the widget hierarchy in three phases
An event is propagated down and up the widget hierarchy in three phases
(see #GtkPropagationPhase) towards a target widget.
</para>

View File

@@ -199,6 +199,19 @@
</para>
</section>
<section>
<title>Stop using gtk_main() and related APIs</title>
<para>
GTK4 removes the gtk_main_ family of APIs. The recommended replacement
is GtkApplication, but you can also iterate the GLib mainloop directly,
using GMainContext APIs.
</para>
<para>
The replacement for gtk_events_pending() is g_main_context_pending(),
the replacement for gtk_main_iteration() is g_main_context_iteration().
</para>
</section>
</section>
<section>
@@ -374,7 +387,7 @@
</section>
<section>
<title>Adapt to GtkButton API changes</title>
<title>Adapt to GtkBox API changes</title>
<para>
GtkBox no longer has pack-start and -end. Pack your widgets in the
correct order, or reorder them as necessary.
@@ -877,20 +890,19 @@
switching to menu models and actions.
</para>
<para>
Since menus are gone, GtkMenuButton and GtkMenuToolButton also lost their
ability to show menus, and need to be used with popovers in GTK 4.
Since menus are gone, GtkMenuButton also lost its ability to show menus,
and needs to be used with popovers in GTK 4.
</para>
</section>
<section>
<title>GtkToolbar overflow handling has changed</title>
<title>GtkToolbar has been removed</title>
<para>
The handling of overflow in toolbars has been simplified.
Instead of creating a proxy menuitem and setting it with
gtk_tool_item_set_proxy_menu_item(), you simply provide
a label for the overflow menu with gtk_tool_item_set_overflow_text().
GTK will figure out itself whether to create a check- or
radioitem as proxy.
Toolbars were using outdated concepts such as requiring special toolitem
widgets.
</para>
<para>
Toolbars should be replaced by using a GtkBox with regular widgets instead.
</para>
</section>

View File

@@ -95,10 +95,6 @@ additional environment variables.
<term>touchscreen</term>
<listitem><para>Pretend the pointer is a touchscreen device</para></listitem>
</varlistentry>
<varlistentry>
<term>baselines</term>
<listitem><para>Show baselines</para></listitem>
</varlistentry>
<varlistentry>
<term>updates</term>
<listitem><para>Visual feedback about window updates</para></listitem>

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