Compare commits

...

642 Commits

Author SHA1 Message Date
Matthias Clasen
e16c836f60 curve2: Show osculating circles 2020-12-27 00:26:44 -05:00
Matthias Clasen
55bfc167e3 Add gsk_path_measure_get_curvature 2020-12-27 00:26:44 -05:00
Matthias Clasen
5516ec2bf0 Add an interactive path test
This one is for interactive exploring of svg paths.

You can enter an SVG path in the entry and hit Enter
to see how GSK renders it. If you click the button
in the headerbar, you can see what GTK thinks the
closest point, tangent and distance are wrt. to the
mouse position, and the bounding box of the path.

There's also stroke parameters to play with.
2020-12-27 00:26:44 -05:00
Matthias Clasen
7e7d1987a3 xxx: Make gsk_stroke_to_cairo public
It comes in handy, and does no harm.
2020-12-27 00:26:44 -05:00
Matthias Clasen
304c3055ad Add a path editor demo
Add a simple demo for editing a poly-Bezier curve.
2020-12-27 00:26:44 -05:00
Matthias Clasen
226f556cf8 Implement gsk_path_offset
Implement offsetting of paths by reusing the
infrastructure of the stroker.
2020-12-27 00:10:08 -05:00
Matthias Clasen
be7fead1fb Add gsk_path_offset
Add a function that takes a path, and offsets it
by some distance, applying line-join parameters
as needed.

This commit just adds the api, the implementation
will be in the following commit.
2020-12-27 00:10:08 -05:00
Matthias Clasen
b871c2a3cb stroker: Cleanups
Move some utility functions around.
2020-12-26 23:57:41 -05:00
Matthias Clasen
7c67a9c76a stroker: Implement arcs
Implement arced joins as specified in SVG2.
2020-12-26 23:57:41 -05:00
Matthias Clasen
427e185bcf Add GSK_LINE_JOIN_ARCS
Implementation will follow.
2020-12-26 23:57:41 -05:00
Matthias Clasen
30552e9988 xxx: assorted fixes for special contours
Fix winding numbers, and strokes wrt to direction.
2020-12-26 23:57:41 -05:00
Matthias Clasen
08d8d6c029 Add another stroker test
Check that the outlines of random paths look as
expected. We currently have to exclude paths where
points get too close to each other.
2020-12-26 23:57:41 -05:00
Matthias Clasen
61a84956d4 Add basic tests for strokes
Add tests to check that any point on a path is
always at most half the line-width away from the
stroke path with that line-width.
2020-12-26 23:57:41 -05:00
Matthias Clasen
e44780923a Implement stroking
Implement gsk_contour_default_add_stroke, which takes a contour
and stroke parameters, and adds contours to a path builder for
the outline that woul be produced by stroking the path with these
parameters.

The current implementation does not try to handle short segments
in the vicinity of sharp joins in any special way, so there can
be some artifacts in that situation.
2020-12-26 23:57:41 -05:00
Matthias Clasen
dd1a2e0396 Special-case circles for strokes
The outline of a circle is just two circles.
2020-12-26 23:57:41 -05:00
Matthias Clasen
0100c33b71 Special-case rects for strokes
In many cases, the outline of a rectangle is just
two rectangles.
2020-12-26 23:57:41 -05:00
Matthias Clasen
8b8197a662 Add gsk_path_stroke
Add the plumbing that will let us do special-case stroking
for rectangles, circles and other special contours. There
is no implementation yet.
2020-12-26 23:57:41 -05:00
Matthias Clasen
e293f10fa1 Add gsk_curve_get_curvature
This will be used in the stroker.
2020-12-26 23:56:26 -05:00
Matthias Clasen
3a4c3c3d8c Add gsk_curve_get_normal
Its easy but thats no reason not to have this api.
2020-12-26 23:56:26 -05:00
Matthias Clasen
944735071e Add a test for gsk_curve_offset
The stroker relies on offsetting.
This only tests a few very simple cases.
2020-12-26 23:56:26 -05:00
Matthias Clasen
91356de96a Add a test for gsk_curve_reverse
The stroker relies on this working.
2020-12-26 23:56:26 -05:00
Matthias Clasen
3f29c50800 Add a test for tangents of degenerate curves
The stroker relies on these to work.
2020-12-26 23:56:26 -05:00
Matthias Clasen
59b1f9e7b1 curve: Handle degenerate cases
Nothing prevents control points from being identical,
and if that happens, some of our constructions involving
tangents and normals break down. Handle these cases in
get_{start,end}_tangent and offset, for the case of
cubics.
2020-12-26 23:56:26 -05:00
Matthias Clasen
dd3cf83a35 Add gsk_curve_reverse
This will be used in stroking.
2020-12-26 23:56:26 -05:00
Matthias Clasen
7f8a9e5543 Add gsk_curve_offset
This method creates an offset curve from an existing
curve by just moving the control points laterally.

This will be used in stroking.
2020-12-26 23:56:26 -05:00
Matthias Clasen
8523c6cb2d Add conic decomposition tests
We don't have good error bounds here, unfortunately.
2020-12-26 23:56:26 -05:00
Matthias Clasen
49b25424c5 path: support conic->curve in foreach 2020-12-26 23:56:26 -05:00
Matthias Clasen
db2046cb67 Add gsk_curve_decompose_curve
This is mainly useful for decomposing a conic into
cubics. The criterion here for terminating the
subdivision is very improvised.
2020-12-26 23:56:26 -05:00
Matthias Clasen
61264165ff Add a performance test for curve eval
All curve types are equally fast here.
2020-12-26 23:56:26 -05:00
Matthias Clasen
7b3d283fc0 Add a performance test for curve intersection
This shows how much more expensive curve
intersections are.
2020-12-26 23:56:26 -05:00
Matthias Clasen
44ffed0283 Add curve split tests 2020-12-26 23:56:26 -05:00
Matthias Clasen
e91ec1f26f Add another intersection testcase
This tests horizontal line/conic intersection,
which failed before the fix in the previous commit.
2020-12-26 23:56:26 -05:00
Matthias Clasen
eace55daa6 xxx: work around bounding box problems
graphene_rect_intersect returns FALSE when you
intersect the bounding boxes of axis-aligned
lines, so we never find intersections with those.

Make things better by making the bounding boxes worse.
2020-12-26 23:56:26 -05:00
Matthias Clasen
097e58558b Add curve intersection tests
These tests check that gsk_curve_intersect finds
the intersections we want.
2020-12-26 23:56:26 -05:00
Matthias Clasen
f0acb0f073 Add gsk_curve_intersect
Add a way to find the intersections of two curves.
This will be used in stroking.
2020-12-26 23:56:25 -05:00
Matthias Clasen
b779ba19ca Add gsk_curve_get_bounds
Add getters for bounding boxes of curves.
2020-12-26 23:56:25 -05:00
Matthias Clasen
aa0f1ce956 Only test conic weights between 1/20 and 20
The rest just give us no end of numeric trouble.
2020-12-26 23:56:25 -05:00
Benjamin Otte
e9d01c1a63 Ottie: Add ottie-editor 2020-12-27 01:12:11 +01:00
Benjamin Otte
e235392894 ottie: Add a snapshot testsuite test
The test takes a lottie file and a timestamp in seconds and produces a
rendernode at that timestamp.

It then serializes that node and compares it via diff(1) with a file
containing the expected output.

This is a lot stricter than it needs to be (because different node files
can generate the same output and updates to the rendering pipeline can
break everything) but I chose this method on purpose because it does a
good job at guarding against accidental changes in other parts of the
code.

It's also better than comparing image output because it avoids
antialiasing artifacts when using curves and things like that.
2020-12-27 01:12:11 +01:00
Benjamin Otte
73904f3034 ottie: Add a command-line tool
Supports:

 * Taking a screenie:
   ottie image file.lottie image.png

 * Recording a rendernode:
   ottie node file.lottie render.node

 * Encoding an image:
   ottie video file.lottie video.webm
2020-12-27 01:12:11 +01:00
Benjamin Otte
c2ed71af7a Ottie: Add 2020-12-27 01:12:11 +01:00
Benjamin Otte
aa2f6345c8 path: Add gsk_path_builder_add_ellipse() 2020-12-27 00:31:18 +01:00
Benjamin Otte
cef1bc9098 path: Change semantics of gtk_path_builder_add_segment()
Allow start >= end to mean that the path continues at the beginning
after reaching the end until it reaches the point at @end.
2020-12-27 00:31:18 +01:00
Benjamin Otte
828ccc51d9 path: Add gsk_path_measure_is_closed () 2020-12-27 00:31:18 +01:00
Benjamin Otte
8397d10c20 path: Add gsk_path_measure_restrict_to_contour() 2020-12-27 00:31:18 +01:00
Matthias Clasen
78d06e58d0 Add gsk_path_measure_get_{path,tolerance}
These are just nice apis to have and avoid having to carry
these around as extra arguments in many places.

This was showing up as inconvenience in writing tests
for the measure apis.
2020-12-27 00:31:18 +01:00
Benjamin Otte
a5e13cc96b xxx path)_fill 2020-12-27 00:31:18 +01:00
Matthias Clasen
776dc54c8a Add gsk_path_get_stroke_bounds
A relatively cheap way to get bounds for the area
that would be affected by stroking a path.
2020-12-27 00:31:18 +01:00
Benjamin Otte
ee6879fba8 testsuite: Add tests for the dasher 2020-12-27 00:31:18 +01:00
Benjamin Otte
14f9395476 path: Add a foreach function that dashes a path 2020-12-27 00:31:18 +01:00
Benjamin Otte
1349cf2454 path: Deal with non-uniformness of progress parameter
The progress is non-uniform, so simple translation of progress doesn't work.
So check if larger and smaller values inch closer towards minimal distance.
2020-12-27 00:31:18 +01:00
Benjamin Otte
d47ebd388c path: Always decompose conics into at least 2 segments
Conics are evil in that their parameter skews towards the center, and if
it's a very flat conic (weight almost equal to 0), then we'd approximate
it with a single segment and not subdivide, which would cause the
parameter to be wildly off around 0.25 or 0.75.

And that would cause offset calculations to fail.
2020-12-27 00:31:18 +01:00
Matthias Clasen
61214221b3 testsuite Add curve tangent tests 2020-12-27 00:31:18 +01:00
Benjamin Otte
7eb4ed8f86 testsuite: Add a test for the conic that got us segment() 2020-12-27 00:31:18 +01:00
Benjamin Otte
92b472fec1 path: Add gsk_curve_segment()
Using split() twice with scaled t values does not work with conics.
2020-12-27 00:31:18 +01:00
Benjamin Otte
7a6b008479 testsuite: Add a test for gsk_curve_decompose() 2020-12-27 00:31:18 +01:00
Benjamin Otte
d8c26172a5 testuite: Add tests for gsk_curve_get_tangent() 2020-12-27 00:31:18 +01:00
Matthias Clasen
da835321a5 testuite: Add tests for gsk_curve_get_point()
Add a few tests for gsk_curve_get_point().

Since GskCurve is not public api, we add gskcurve.c
as source to the test binary.
2020-12-27 00:31:18 +01:00
Benjamin Otte
30635d1cac curve: Split eval() into get_point() and get_tangent()
That's more in line with the get_start/end_point/tangent() functions.

Plus, those calls are independent and we usually want one or the other.
2020-12-27 00:31:18 +01:00
Matthias Clasen
a60b72ba58 Add gsk_curve_get_{start,end}_tangent
Add a way to get the tangents at the start and end of the curve.
This will be used in stroking.
2020-12-27 00:31:18 +01:00
Benjamin Otte
36347892d8 testsuite: Add conics to the random paths 2020-12-27 00:31:18 +01:00
Benjamin Otte
924f0bc2c5 path: Add GskCurve
GskCurve is an abstraction for path operations. It's essentially a
collection of vfuncs per GskPathOperation.

GskStandardContour has been ported to use it where appropriate.
2020-12-27 00:31:18 +01:00
Benjamin Otte
23c5318de1 path: Introduce gskpathop
A gskpathop is a pointer to a graphene_point_t* with the low bits used
to encode the GskPathOperation. It's an easy way to introduce API for
operations.

So far it's just used to replace GskStandardOperation.
2020-12-27 00:31:18 +01:00
Benjamin Otte
678405bd22 WIP: css: Replace border rendering code with GskPath
The weight is wrong still, I need to compute the correct one to get real
45deg circle corners and not just roughly correct ones.
2020-12-27 00:31:18 +01:00
Benjamin Otte
946b76881b WIP: pathbuilder: Add gsk_path_builder_add_rounded_rect()
It works, but does not use a custom contour yet.
2020-12-27 00:31:18 +01:00
Benjamin Otte
061683344f path: Add conic curves
So far this just adds the API, if you use it, you'll get lots of
g_warnings().

This will be fixed in future commits.
2020-12-27 00:31:18 +01:00
Benjamin Otte
af9a85616d path: Rename to gtk_path_builder_add_segment()
It's about bulding paths, not about measuring them.
2020-12-27 00:31:18 +01:00
Benjamin Otte
0f332de3d3 path: Split contours into their own file
I'm not sure I want to keep all contours in one file, but for now that's
how it is.
2020-12-27 00:31:18 +01:00
Benjamin Otte
15e8f2bacc path: Make all private contour APIs take a GskContour
... instead of a path, index tuple.
2020-12-27 00:31:18 +01:00
Benjamin Otte
25f9eadb0d stroke: Add support for dashes
... and hook it up in the node parser and for Cairo rendering.
2020-12-27 00:31:18 +01:00
Matthias Clasen
ced2959cdd gsk: Implement parsing fill and stroke nodes
Make serialization and deserialization work for stroke and
fill nodes.
2020-12-27 00:31:18 +01:00
Benjamin Otte
3c363f00d5 path: Add flags to gsk_path_foreach()
This way we can default to the siplest possible foreach() output - like
cairo_copy_path_flat() decomposing everything into lines - and add flags
to get more and more fancy.

This will be useful to have conics automatically decomposed for Cairo
drawing or if we want to add more line types in the future.
2020-12-27 00:31:18 +01:00
Benjamin Otte
a9ad37ed89 testsuite: Add an in_fill() test 2020-12-27 00:31:18 +01:00
Matthias Clasen
acdf04287d Implement gsk_path_measure_in_fill
Implement this in the obvious way, using the decomposed form
of standard contours. Since the decomposed form is part of the
measure object, this api moves from gsk_path_in_fill to
gsk_path_measure_in_fill.
2020-12-27 00:31:18 +01:00
Benjamin Otte
34725c1207 testsuite: Add a parsing test
This test includes an implementation of a gsk_path_equal() func with
a tolerance that is necessary because parsing does not always work
100% exactly due to floating point rounding, so we can't just
compare the to_string() output.
2020-12-27 00:31:18 +01:00
Matthias Clasen
cb10cf07e6 path: Special-case rects and circles
Write out the commands for rects and circles in a special
way, and add code in the parser to recognize this, so we
can successfully round-trip these through the SVG path format.

The special way - for people who want to use it for debugging -
for now is that we use uppercase "Z" to close standard paths, but
lowercase "z" to close our special paths.

A test is included, but the random path serializations should take care
of it, too.
2020-12-27 00:31:18 +01:00
Matthias Clasen
a7ba2bde86 path: Fix serialization for circles
The svg A can not do a full circle, since it is a two point
parametrization - if the start and end point are the same,
it draws nothing. So, use two arcs.
2020-12-27 00:31:18 +01:00
Benjamin Otte
87b3cb1df8 testsuite: Add librsvg path tests 2020-12-27 00:31:18 +01:00
Matthias Clasen
2478963cbb path: Implement gsk_path_parse
Implement the SVG path syntax to read back the strings
that we generate when serializing paths. The tests for
this code are taken from librsvg.

This includes an elliptical arc implementation according
to the SVG spec. The code is mostly taken from librsvg,
but pretty directly follows the SVG spec implementation
notes. We don't export this, since the parametrization
is inconvenient. We do want an arc_to API, but
these are not the arcs we are looking for.
2020-12-27 00:31:18 +01:00
Matthias Clasen
abbbaef7e8 path: Implement SVG arcs
This is elliptical arc implementation according to the SVG spec.
The code is mostly taken from librsvg, but pretty directly
follows the SVG spec implementation notes.

We don't export this, since the parametrization is inconvenient.
We do want an arc_to API, but these are not the arcs we are
looking for.

It will be used in parsing SVG path syntax.
2020-12-27 00:31:18 +01:00
Matthias Clasen
69177416a0 stroke: Add miter limit
Add a miter limit to GskStroke. This will be needed to
fully implement line joins.

Also introduce the GSK_LINE_JOIN_MITER_CLIP value,
following SVG 2.0. cairo does not have it, so translate
it to plain miter when using cairo.
2020-12-27 00:31:18 +01:00
Matthias Clasen
ff47bfdbcf Documentation typo fixes 2020-12-27 00:31:18 +01:00
Benjamin Otte
120e449bdd testsuite: Add relative path functions
They're making the paths slightly weirder, but they test public API, so
woohoo!
2020-12-27 00:31:18 +01:00
Benjamin Otte
237c37f6c2 pathbuilder: Add relative path commands
And gsk_path_builder_get_current_point().

They will be needed by the string parser.
2020-12-27 00:31:18 +01:00
Benjamin Otte
683729c388 path: Add GSK_CIRCLE_POINT_INIT() to initialize points on the circle
This is just splitting out a commonly done operation into a macro.
2020-12-27 00:31:18 +01:00
Benjamin Otte
9fe71e7dae pathbuilder: Redo semantics for starting curves
We now always have a "current point" which is either the last point an
operation was made to, or (0, 0) if no drawing operation has
been made yet.

Adding a contour of any kind to the builder will always update the
current point to that contour's end point.
2020-12-27 00:31:18 +01:00
Benjamin Otte
c74970e6c1 xxx: demo 2020-12-27 00:31:18 +01:00
Benjamin Otte
5225d01504 path: Split GskPathBuilder into its own file
... and add missing API docs.
2020-12-27 00:31:18 +01:00
Benjamin Otte
916d950069 testsuite: Add a test using get_point() and get_closest_point() 2020-12-27 00:31:18 +01:00
Benjamin Otte
76d6fed248 testsuite: Add a test for get_point() 2020-12-27 00:31:18 +01:00
Benjamin Otte
7ff6235ae6 testsuite: Update create_random_path()
1. Allow specifying the max number of contours
2. Be smarter about creating the paths:
   With 10% chance, create a "weird" path like the empty one or only
   points or things like that.
   Otherwise create a bunch of contours, with 2/3 a standard contour,
   with 1/3 a predetermined one.
2020-12-27 00:31:18 +01:00
Benjamin Otte
9b957c26cb gtk-demo: Add cute maze demo 2020-12-27 00:31:18 +01:00
Benjamin Otte
445b2382e6 testsuite: Add tests for gsk_path_measure_get_closest_point() 2020-12-27 00:31:18 +01:00
Benjamin Otte
790a4201c3 path: Add gsk_path_measure_get_closest_point()
... and gsk_path_measure_get_closest_point_full().

Those 2 functions allow finding the closest point on a path to a given
point.
2020-12-27 00:31:18 +01:00
Benjamin Otte
00b9af65b5 spline: Use Skia's tolerance checks
This avoids measuring being too far off (it's still off, but it's less
than a percent now.
2020-12-27 00:31:18 +01:00
Benjamin Otte
f7c367338c testsuite: Add tests for gsk_path_measure_add_segment() 2020-12-27 00:31:18 +01:00
Benjamin Otte
5d69887618 gtk-demo: Add a text-on-path demo 2020-12-27 00:31:18 +01:00
Benjamin Otte
b658c26a3e xxx: path_fill demo 2020-12-27 00:31:18 +01:00
Benjamin Otte
e4c147cf2f path: Add gsk_path_measure_get_point()
Allows querying the coordinates and direction of any specific point on a
path.
2020-12-27 00:31:18 +01:00
Matthias Clasen
fc2c6f1566 path: Add gsk_path_add_circle()
Adds a circle contour, too.
2020-12-27 00:31:18 +01:00
Benjamin Otte
b0d6130905 pathmeasure: Implement support for beziers
Instead of treating bezier curves as lines, we properly decompose them
into line segments now so that we can treat those as lines.
2020-12-27 00:31:18 +01:00
Benjamin Otte
a0b9238a15 path: Implement gsk_path_to_cairo() using foreach() 2020-12-27 00:31:18 +01:00
Benjamin Otte
801c63494c path: Add gsk_path_foreach() 2020-12-27 00:31:17 +01:00
Benjamin Otte
d2cfe74140 path: Collect flags
We don't need them yet, but maybe later.
2020-12-27 00:31:17 +01:00
Benjamin Otte
a3ac003546 testsuite: Add path tests 2020-12-27 00:31:17 +01:00
Benjamin Otte
483a4773cd pathmeasure: Add gsk_path_measure_add_segment()
This allows chunking paths, weeee.
2020-12-27 00:31:17 +01:00
Benjamin Otte
c82ad0214e path: Add gsk_path_builder_add_path() 2020-12-27 00:31:17 +01:00
Benjamin Otte
207feeb7a9 gsk: Add GskPathMeasure
An object to do measuring operations on paths - determining their
length, cutting off subpaths, things like that.
2020-12-27 00:31:17 +01:00
Benjamin Otte
9a2e4ac9a9 path: Change data structure for standard path
Instead of the Cairo method and imitating cairo_path_data_t, use the
Skia method and keep points and operations separate.

That way we get a points array that includes the starting point -
because it's always the end point of the previous operation.
2020-12-27 00:31:17 +01:00
Benjamin Otte
2bd3aa3cbe popover: Use fill and stroke nodes instead of Cairo
... to render the arrow.

The arrow should really be turned into a real thing - maybe an icon?
2020-12-27 00:31:17 +01:00
Benjamin Otte
118e41f432 snapshot: Add gtk_snapshot_push_stroke() 2020-12-27 00:31:17 +01:00
Benjamin Otte
2d7897a769 gsk: Add GskStrokeNode 2020-12-27 00:31:17 +01:00
Benjamin Otte
c279e1aa1e gsk: Add GskStroke
It's unused in this commit. This just prepares the new object.
2020-12-27 00:31:17 +01:00
Benjamin Otte
3c91d0be91 demos: Add a simple demo filling a path 2020-12-27 00:31:17 +01:00
Benjamin Otte
e7bbed54b5 snapshot: Add gtk_snapshot_push_fill() 2020-12-27 00:31:17 +01:00
Benjamin Otte
4eb7d68970 gsk: Add GskFillNode
Take a rendernode as source and a GskPath and fill the region in the
path just like cairo_fill() would.
2020-12-27 00:31:17 +01:00
Benjamin Otte
98337f7115 gsk: Add GskPath 2020-12-27 00:31:17 +01:00
Benjamin Otte
08ee6c7acf mediafile: Load extension at startup with GTK_MEDIA
When the GTK_MEDIA env var is set, check at startup that it works, not
only when the first MeidaFile is instantiated.

This has the fortunate side effect that it prints help output for
GTK_MEDIA=help at startup, too.
2020-12-27 00:31:17 +01:00
Benjamin Otte
c815496fe3 gtk: Build as static library first
This allows linking against the static libgtk from the testsuite.

We build the dynamic library by linking all the static libraries into
the final product.
2020-12-27 00:31:16 +01:00
Benjamin Otte
9c84fa127a Merge branch 'unused-static-inline' into 'master'
Remove unused static inline function

See merge request GNOME/gtk!3002
2020-12-25 18:05:11 +00:00
Emmanuel Gil Peyrot
84c6708366 Remove unused static inline function
This was causing a warning on AArch64 since __LITTLE_ENDIAN__ and
__BIG_ENDIAN__ weren’t set, but the functions were actually completely
unused.
2020-12-25 16:16:43 +01:00
Benjamin Otte
f7e3016949 Merge branch 'gles-gears' into 'master'
Fix gtk4-demo’s gears demo on OpenGL ES

See merge request GNOME/gtk!3000
2020-12-25 01:36:34 +00:00
Emmanuel Gil Peyrot
dd1110ca5c Fix some of gtk4-demo’s transitions example on OpenGL ES
Same issue as the previous commit, int+float is error, and pow() only
works on floats.
2020-12-25 01:36:21 +01:00
Emmanuel Gil Peyrot
28c4adac24 Fix gtk4-demo’s gears demo on OpenGL ES
Here is a command to reproduce this testcase:
GDK_DEBUG=gl-gles gtk4-demo --run gears

Without this patch, Mesa throws this compile error:
0:130(13): error: no matching function for call to `mod(error, float)'; candidates are:

This is caused by `u_rotation - 90` being of type error since
`u_rotation` is a float and it’s illegal to subtract it with an integer.
2020-12-25 01:21:08 +01:00
Matthias Clasen
7e579bb59a Merge branch 'wip/otte/for-master' into 'master'
Wip/otte/for master

See merge request GNOME/gtk!2997
2020-12-24 07:13:22 +00:00
Benjamin Otte
96e1b85c2c gdkarray: Add a "stolen" boolean to splice()
If set to TRUE, does not call the free func for the removed items.

This can be used to move items between arrays without having to do the
refcounting dance.
2020-12-24 06:38:45 +01:00
Benjamin Otte
71e616d17e listview: Use the correct scroll policy
Use the horizontal policy for horizontal decisions, not the vertical
one.

This broke in 0011ce949c.
2020-12-24 06:38:45 +01:00
Benjamin Otte
f85d939e5e docs: Put render nodes in their own sections 2020-12-24 06:38:45 +01:00
Benjamin Otte
8d014d6cb0 roundedbox: Remove unused API 2020-12-24 06:38:45 +01:00
Benjamin Otte
f7f8990f7a picture: Fix copy/paste error in docs 2020-12-24 06:38:45 +01:00
Benjamin Otte
d6f288427a video: When autoplaying, start playing once the video is prepared
This fixe video sources with longer loading times not automatically
playing.
2020-12-24 06:38:45 +01:00
Benjamin Otte
2a8f371643 gtk-demo: Don't put the search bar in the scroll area
1. That's a bad idea UI wise as you can't see the search after you
   scrolled.

2. That's a bad idea code-wise because Listviews need to be put into
   a ScrolledWindow or they won't scroll.
2020-12-24 06:38:45 +01:00
Benjamin Otte
dee863dbb2 rendernode: Bail if matrix is invalid
Invalid matrices are okay in GSK (and GL), but not in Cairo.

Testcase included.
2020-12-24 06:38:45 +01:00
A S Alam
7d6877ec80 Update Punjabi translation 2020-12-23 19:48:28 +00:00
Danial Behzadi
f426d23690 Update Persian translation 2020-12-23 15:53:07 +00:00
Matthias Clasen
e128a77eed Merge branch 'matthiasc/for-master' into 'master'
window: Release application in destroy

See merge request GNOME/gtk!2994
2020-12-23 03:01:55 +00:00
Matthias Clasen
5cd2ee927a window: Release application in destroy
We used to do this; it was lost in some life-cycle
reshuffling.
2020-12-22 20:34:13 -05:00
Matthias Clasen
e854b90293 Merge branch 'wip/baedert/for-master' into 'master'
Wip/baedert/for master

See merge request GNOME/gtk!2990
2020-12-22 04:53:31 +00:00
Matthias Clasen
6d042d9e61 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2988
2020-12-22 02:29:03 +00:00
Matthias Clasen
4310f24a4e Fix warnings with Vulkan < 162
Tiring to watch the Vulkan people stumble through
ABI and API compat, but what can you do.
2020-12-21 20:00:16 -05:00
Matthias Clasen
aebf8e3c29 Merge branch 'mcatanzaro/fix-gtk-builder-tool' into 'master'
Fix buffer overruns in 'gtk-builder-tool simplify'

See merge request GNOME/gtk!2987
2020-12-21 22:49:42 +00:00
Matthias Clasen
fcd449f0d4 modelbutton: Remove an unused field
We're not using the centered field anymore.
2020-12-21 17:45:01 -05:00
Michael Catanzaro
ab1b117d91 Fix buffer overruns in 'gtk-builder-tool simplify'
Oops, here we allocate only one byte for each pointer we want to store.
We need to multiply by the size of a pointer.
2020-12-21 15:39:34 -06:00
Emmanuele Bassi
1253296387 Merge branch 'fix-printbackends' into 'master'
Fix the value for the print-backends setting

Closes #3486

See merge request GNOME/gtk!2986
2020-12-21 20:04:26 +00:00
Matthias Clasen
466484176f Merge branch 'ebassi/docs-for-master' into 'master'
Ebassi/docs for master

See merge request GNOME/gtk!2983
2020-12-21 19:22:38 +00:00
Matthias Clasen
20289ad8e1 Fix the value for the print-backends setting
This was broken in the meson conversion, causing
us to default to "" instead of the built print
backends.

Fixes: #3486
2020-12-21 14:10:03 -05:00
Matthias Clasen
0abb8c6862 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2984
2020-12-21 19:00:10 +00:00
Matthias Clasen
147386189f inspector: Show glyphs as in node files
Reuse the glyph serialization code from gsk to
show glyphs in the same way here.
2020-12-21 13:11:46 -05:00
Matthias Clasen
9cec9e4ce2 gsk: Export the glyph serialization privately
We want to use the same serialization in the inspector,
so export this function.
2020-12-21 13:11:08 -05:00
Matthias Clasen
26119af7a6 gsk: Improve glyph serialization
The special case for ASCII glyphs is unfortunately not
working very well, because of an oversight in pango:
When I added subpixel positioning, I made pango_shape()
default to not rounding, and make PangoLayout call
pango_shape_with_flags() and pass the rounding information
down. The upshot is that we need to use the _with_flags
variant here and tell it to round position, so it matches
what the text node contains.
2020-12-21 13:08:34 -05:00
Timm Bäder
478d1f71e3 Merge branch 'fix-node-glyphs' into 'master'
gsk: Fix serialization of glyphs

Closes #3496

See merge request GNOME/gtk!2982
2020-12-21 17:16:38 +00:00
Emmanuele Bassi
b1d952b8a2 docs: Add examples for GtkDropTarget
Like we did for GtkDragSource.
2020-12-21 17:11:42 +00:00
Emmanuele Bassi
b9bcdbbfdc docs: Add examples of GtkDragSource use
The description is a bit terse; we should help out application
developers some more.
2020-12-21 17:03:59 +00:00
Emmanuele Bassi
6c31ed53f4 docs: Fix typo and whitespace 2020-12-21 17:03:42 +00:00
Matthias Clasen
aa95ae774f gsk: Fix serialization of glyphs
We were forgetting to put a space between two numbers
in some cases, confusing the parser.

Test included.

Fixes: #3496
2020-12-21 10:49:56 -05:00
Emmanuele Bassi
65adfd9243 Merge branch 'box_docs' into 'master'
box: improve documentation

Closes #3499

See merge request GNOME/gtk!2981
2020-12-21 15:40:07 +00:00
Yetizone
c4a8c0893b box: improve documentation
Rephrase a function parameter description and remove "." from all function parameters descriptions

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3499
2020-12-21 17:26:23 +02:00
Timm Bäder
e90f5e8a20 gskpango: Don't copy fg color
No need to do that here, we copy it in to the individual render nodes
anyway.
2020-12-21 15:23:25 +01:00
Timm Bäder
526c76181e gl renderer: Check for pointer equality in rounded_rect_equal 2020-12-21 15:22:08 +01:00
Timm Bäder
cf352374ae gskpango: Correct a comment
Not all other draw calls will use cairo.
2020-12-21 13:23:28 +01:00
Timm Bäder
98b99201b0 gskpango: Remove bounds rect
We only need this to render shapes and trapezoids, i.e. only when
falling back to cairo. Remove code to measure the layout and convert the
ink_rect to a graphene_rect_t from gtk_snapshot_append_layout() and do
it when drawing shapes and trapezoids instead.
2020-12-21 12:56:38 +01:00
Timm Bäder
bce4d669ee gskpango: Fix a potential cairo_t leak
The previous early return did not cairo_destroy() it.
2020-12-21 12:49:06 +01:00
Timm Bäder
e7a326e230 label: Refactor get_layout_location()
Rename a few local variables to be clearer about whether they belong to
the widget or to the layout.

Remove a workaround for an old bug that is no longer valid. We don't
underallocate the layout anymore. Aways center vertically, with respect
to the yalign.
2020-12-21 12:44:01 +01:00
Timm Bäder
9eaeaa8452 label: Refactor snapshot()
Use two early-out style if statements to reduce indentation in this
entire function.
2020-12-21 12:32:32 +01:00
Timm Bäder
2031c5bf90 textlayout: Remove dead offset_y code 2020-12-21 10:26:03 +01:00
Timm Bäder
9fefa7b44c rendernode: Different uniformity in border nodes
Means they are different and a diff is impossible.
2020-12-21 10:26:03 +01:00
Timm Bäder
a2a70c3b65 rendernode: Sort diff() requirements by complexity 2020-12-21 10:26:03 +01:00
Timm Bäder
0b4ed8d791 renderborder: Avoid 0 width outline color nodes 2020-12-21 10:26:03 +01:00
Timm Bäder
c34f98931e layoutoverlay: Avoid adding transparent color nodes
We have a region for the border here, but the color is defined as
transparent black because we don't want to render anything for it.

This way, the generated .node file for the listbox demo in gtk4-demo
with enabled layout borders is 3.5MB instead of 3.8MB.
2020-12-21 10:26:03 +01:00
Timm Bäder
2feac2772f layoutoverlay: Avoid adding 0 sized color nodes
This way, the output node file of the listbox demo in gtk4-demo with
enabled layout borders is only 3.8MB instead of 12MB.
2020-12-21 10:26:03 +01:00
Timm Bäder
fdda4e4e99 GskTransform: Add nullable annotations to _equals()
Both can be NULL here.
2020-12-21 10:26:03 +01:00
Timm Bäder
e1cf0cff26 gl renderer: Proper state tracking for color matrix ops 2020-12-21 10:26:03 +01:00
Timm Bäder
634fa772c9 gl renderer: Add missing debug output for repeat ops 2020-12-21 10:26:03 +01:00
Timm Bäder
4b3bbe0ecd gl renderer: Create shader-global uniform ops on draw()
This way we can render the first frame of tests/testoutsetshadowdrawing
in 153 ops instead of 183.

And the first frame of gtk4-demo in 260 instead of 300.
2020-12-21 10:26:03 +01:00
Timm Bäder
cde43541d0 gl renderer: Unify new clip/viewport rects in blur_texture() 2020-12-21 10:26:03 +01:00
Timm Bäder
186287ecfb GskTransform: Fix identity transform class name 2020-12-21 10:26:02 +01:00
Timm Bäder
bd5d1615ac GskTransform: Avoid a ref+unref pair
If gsk_transform_is_identity() returned FALSE for the next transform,
the previous code did a ref + unref pair, even though it was unneeded.
2020-12-21 10:26:02 +01:00
Timm Bäder
21299cc7e4 icontheme: Make some constant values const 2020-12-21 10:26:02 +01:00
Timm Bäder
e747ea7dfd pixbufutils: Only convert icon size to string once 2020-12-21 10:26:02 +01:00
Timm Bäder
810cd7881e icontheme: Make icon_paintable_ensure_texture() return an unowned value
It's private, has only one caller and that one doesn't need the extra
ref.
2020-12-21 10:26:02 +01:00
Timm Bäder
a8213d7f45 gl renderer: Avoid setting modelview to identical values
The previous comment here was incorrect. We can save the op itself, we
just can't save us the entry in the modelview stack.
2020-12-21 10:26:02 +01:00
Timm Bäder
e6f6d1e478 main: Add & use gdk_event_dup_axes()
The way this code is written trips up scan-build. Add
gdk_event_dup_axes() and use it in gtkmain.c.
2020-12-21 10:26:02 +01:00
Rafael Fontenelle
933d241bba Update Brazilian Portuguese translation 2020-12-21 07:02:13 +00:00
Matthias Clasen
7249c3a09b Merge branch 'ebassi/issue-3495' into 'master'
Use full path when calling gtk4-update-icon-cache

Closes #3495

See merge request GNOME/gtk!2979
2020-12-20 22:40:48 +00:00
Emmanuele Bassi
d13f8ac3a9 Call the newly installed gtk4-update-icon-cache
Otherwise we rely on whatever it's inside the PATH.
2020-12-20 16:33:41 +00:00
Emmanuele Bassi
fa35e3b874 Pass the bindir to the post-install script 2020-12-20 16:33:25 +00:00
Rafael Fontenelle
853883c6e5 Update Brazilian Portuguese translation 2020-12-20 14:06:52 +00:00
sicklylife
b467279c7d Update Japanese translation 2020-12-20 08:03:00 +00:00
sicklylife
c6a5ac1d16 Update Japanese translation 2020-12-20 07:58:09 +00:00
A S Alam
e41288de4f Update Punjabi translation 2020-12-20 06:14:42 +00:00
Jordi Mas i Hernandez
b886988a54 Update Catalan translation 2020-12-19 18:29:08 +00:00
Matthias Clasen
bb8a459fe2 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2978
2020-12-19 17:20:39 +00:00
Matthias Clasen
d5143a1bf0 Revert "gl renderer: Render too big textures to the clipped area"
This reverts commit 7f6608cbed.
2020-12-19 11:43:56 -05:00
Matthias Clasen
12611fa142 Revert "gl renderer: Take a out graphene_rect in blur_node()"
This reverts commit 7eece7e769.
2020-12-19 11:43:43 -05:00
Matthias Clasen
3e319b409b Merge branch 'ebassi/issue-3492' into 'master'
3to4: Remove GtkCheckButton:draw-indicator

Closes #3492

See merge request GNOME/gtk!2976
2020-12-19 16:41:14 +00:00
Emmanuele Bassi
f2b16836c2 3to4: Add test for GtkCheckButton:draw-indicator removal 2020-12-19 15:52:22 +00:00
Emmanuele Bassi
14bf45a0d5 3to4: Remove GtkCheckButton:draw-indicator
The property was removed from the widget, so we need to remove it from
UI files too.

Fixes: #3492
2020-12-18 23:14:24 +00:00
Timm Bäder
0c6a6b3370 Merge branch 'doc_backticks' into 'master'
docs: backtick fixes

See merge request GNOME/gtk!2975
2020-12-18 15:57:30 +00:00
wisp3rwind
9521f609d8 docs: backtick fixes
- in the gettext() examples, at least the _() triggers italics
- add missing closing backtick
2020-12-18 16:31:41 +01:00
Matthias Clasen
7533369695 Merge branch 'wip/baedert/for-master' into 'master'
Wip/baedert/for master

See merge request GNOME/gtk!2973
2020-12-18 05:06:35 +00:00
Matthias Clasen
f31765d5dd Merge branch 'ebassi/mnemonic-label-remove' into 'master'
a11y: Fix removing mnemonic widgets

See merge request GNOME/gtk!2970
2020-12-18 00:00:48 +00:00
Matthias Clasen
d33062795c Merge branch 'ebassi/docs-for-master' into 'master'
Ebassi/docs for master

See merge request GNOME/gtk!2971
2020-12-17 23:59:41 +00:00
Emmanuele Bassi
2da8d9b0ac Do not build gdk-pixbuf's man page
When using it as a sub-project. We don't really need them.
2020-12-17 20:50:16 +00:00
Matthias Clasen
3f56e8191f Merge branch 'shortcuts' into 'master'
docs: Add separation between kinds of shortcuts in Keyboard input

See merge request GNOME/gtk!2964
2020-12-17 19:43:38 +00:00
Chris Mayo
bf4c3dc2c5 docs: Fix list of kinds of shortcuts in Keyboard input
Formatting in HTML was mangled.
2020-12-17 19:18:10 +00:00
Emmanuele Bassi
a5365ec8cb docs: Add missing GTK types
If we don't specify the get_type() function, gtk-doc will not collect
properties and signals, and will use a different URL for the page.
2020-12-17 18:30:19 +00:00
Emmanuele Bassi
ec94ec0286 Merge branch 'ebassi/password-entry-notify' into 'master'
Notify properties on deletion in PasswordEntryBuffer

Closes #3484

See merge request GNOME/gtk!2969
2020-12-17 15:51:04 +00:00
Emmanuele Bassi
af0973c847 a11y: Fix removing mnemonic widgets
We must not use the variadic arguments version with GList, as it expects
a pointer to a GtkAccessible.
2020-12-17 15:49:00 +00:00
Emmanuele Bassi
e71f6b0bc0 docs: Note the caveat on GtkEditable signals with delegates
We cannot bubble up ::insert-text and ::delete-text signals from the
delegate to the wrapper editable without causing an infinite recursion,
due to how the signals are designed; ideally, we would have decoupled
signal emission from virtual functions *before* releasing GTK4, but now
that we have, we can't break the contract.
2020-12-17 15:13:43 +00:00
Emmanuele Bassi
1738724e4a Notify properties on deletion in PasswordEntryBuffer
The GtkEntryBufferClass.deleted_text() behaviour changed between GTK3
and GTK4, which means any subclass of GtkEntryBuffer is now responsible
for emitting the "notify" signal for the "text" and "length" properties.

Without this, the GtkText delegate widget used by GtkPasswordEntry would
not be able to communicate changes in the contents of its buffer.

Fixes: #3484
2020-12-17 15:01:35 +00:00
Emmanuele Bassi
e9e09be37e Merge branch 'issue-3483' into 'master'
Fix URLs for the download.gnome.org locations

Closes #3483

See merge request GNOME/gtk!2968
2020-12-17 13:47:01 +00:00
Matthias Clasen
8a923e02a1 Merge branch 'wip/jimmac/flat-button-tweaks' into 'master'
Adwaita: flat button adjustments

See merge request GNOME/gtk!2967
2020-12-17 12:52:22 +00:00
Emmanuele Bassi
4f12e2f711 Fix URLs for the download.gnome.org locations
Use a trailing slash, otherwise we end up on an out of date mirror.

Fixes: #3483
2020-12-17 12:46:12 +00:00
Jakub Steiner
addcf57b4d Adwaita: flat button adjustments
- normally lighter (on bg_color)
- darker for headerbar
- undecorated checked buttons were never style properly (even gtk3)
  see page2 volume buttons

Finetunes https://gitlab.gnome.org/GNOME/gtk/-/issues/3427
2020-12-17 12:20:29 +01:00
Matthias Clasen
db08bccb11 Merge branch 'cursor-aspect-ratio' into 'master'
Cursor aspect ratio fixes for gtk 4

Closes #3441

See merge request GNOME/gtk!2966
2020-12-16 23:40:26 +00:00
Sebastian Keller
02f0681344 settings: Change gtk-cursor-aspect-ratio from float to double
Float properties can not be read from keyfiles. This was causing changes
to this property in settings.ini to be ignored. Fix this by changing it
to a double.

Technically this change could be considered an API break, but there are
no users of this property as float yet and it is early enough to expect
there to never be any.

Also document this change in the 3 to 4 migration guide since in gtk 3
this setting will be kept a float.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3441
2020-12-16 22:35:36 +01:00
Emmanuele Bassi
62dbadd536 Merge branch 'fix-macos-compilation' into 'master'
macos: fix typo that breaks compilation

See merge request GNOME/gtk!2962
2020-12-16 20:18:27 +00:00
Matthias Clasen
0588db8a69 Merge branch 'wip/carlosg/for-master' into 'master'
gdk/x11: Transform XI_Motion based scroll into discrete

Closes #3459

See merge request GNOME/gtk!2959
2020-12-16 19:56:16 +00:00
Emmanuele Bassi
58b1a13453 Merge branch 'ricotz/for-master' into 'master'
gdk: Use correct parameter name to fix g-ir-scanner warning

See merge request GNOME/gtk!2963
2020-12-16 19:46:51 +00:00
Rico Tzschichholz
df70dbbae4 gdk: Use correct parameter name to fix g-ir-scanner warning
../gdk/gdktoplevellayout.c:217: Warning: Gdk: gdk_toplevel_layout_get_maximized:
  unknown parameter 'maximized' in documentation comment, should be 'maximize'
2020-12-16 20:19:05 +01:00
Tom Schoonjans
81c55b06d2 macos: fix typo that breaks compilation 2020-12-16 19:16:19 +00:00
Matthias Clasen
591c2f0595 4.0 2020-12-16 12:12:58 -05:00
Matthias Clasen
9c5a42be0d Update expected test results
We have one test that expected 3.99 to show up in an error message.
2020-12-16 12:12:58 -05:00
Matthias Clasen
45b7fa15e5 Merge branch 'ebassi/docs-for-master' into 'master'
Ebassi/docs for master

See merge request GNOME/gtk!2960
2020-12-16 16:41:44 +00:00
Emmanuele Bassi
e3de92f1ea docs: Fix annotation for GtkSearchEntry::activate 2020-12-16 16:29:01 +00:00
Emmanuele Bassi
2ffa2be64e doc: Document missing GtkNotebook types 2020-12-16 16:29:01 +00:00
Emmanuele Bassi
387078b40c docs: Document GtkNativeDialogClass 2020-12-16 16:29:01 +00:00
Emmanuele Bassi
5203bf0b83 docs: Document GtkTreeViewColumn::clicked 2020-12-16 16:29:01 +00:00
Emmanuele Bassi
fb93baeae4 docs: Add missing description for GtkWidget::move-focus 2020-12-16 16:29:01 +00:00
Emmanuele Bassi
9fa4c2f5b8 docs: Ignore gtkspinbuttonprivate.h 2020-12-16 16:29:01 +00:00
Emmanuele Bassi
cc9528eaec docs: Add missing documentation to GtkStatusbar 2020-12-16 16:29:01 +00:00
Emmanuele Bassi
73dda96711 docs: Add missing stanzas for gtk_test_accessible API 2020-12-16 16:29:01 +00:00
Emmanuele Bassi
d711acc954 docs: Ignore gtksorterprivate.h 2020-12-16 16:29:01 +00:00
Emmanuele Bassi
ab59c47880 docs: Add missing documentation to GtkPopover 2020-12-16 16:29:01 +00:00
Emmanuele Bassi
e4b7847904 docs: Fix documentation of GtkGestureStylus
Document all the signals, and fix the syntax for boolean values.
2020-12-16 16:29:01 +00:00
Emmanuele Bassi
308115ebae docs: Add gtk-doc stanza for GtkExpander::activate 2020-12-16 16:29:00 +00:00
Emmanuele Bassi
1cb72536ea docs: Fix syntax of GtkEntry::activate signal 2020-12-16 16:29:00 +00:00
Emmanuele Bassi
f24429e84a docs: Remove private symbols 2020-12-16 16:29:00 +00:00
Emmanuele Bassi
fc4402b456 docs: Ignore gtkpasswordentryprivate.h 2020-12-16 16:29:00 +00:00
Emmanuele Bassi
077aec5d32 docs: Add missing documentation for GtkTextCharPredicate 2020-12-16 16:29:00 +00:00
Emmanuele Bassi
548949214c docs: Add missing documentation GtkNative 2020-12-16 16:29:00 +00:00
Emmanuele Bassi
2aec47f56f docs: Add missing documentation for GtkCellRenderer 2020-12-16 16:29:00 +00:00
Emmanuele Bassi
344eb21bee docs: Complete symbol coverage for GSK
100% symbol docs coverage.
241 symbols documented.
0 symbols incomplete.
0 not documented.
2020-12-16 16:29:00 +00:00
Emmanuele Bassi
4fb55b3270 docs: Complete symbol coverage for GDK
100% symbol docs coverage.
833 symbols documented.
0 symbols incomplete.
0 not documented.

What's left are just type system macros and windowing system opaque
structures.
2020-12-16 16:28:58 +00:00
Matthias Clasen
75764c284d Merge branch 'wip/toplevel-layout-intent' into 'master'
Fix toplevel layout state communication

Closes #3466

See merge request GNOME/gtk!2958
2020-12-16 16:02:00 +00:00
Carlos Garnacho
c95a32def8 gdk/x11: Transform XI_Motion based scroll into discrete
Depending on the input driver, we will get XI_Motion based scroll
events for regular mouse wheels. These are intended to be handled
as discrete scroll, so detect smooth scroll events that move by
exactly 1.0 in either direction.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3459
2020-12-16 14:26:44 +01:00
Jonas Ådahl
142f7862ed gdk/toplevellayout: Change API to be about intent, not full state
When being fullscreen, and wanting to unfullscreen but not caring about
whether to go unmaximized or maximized (as this information is lost), if
the GdkToplevelLayout represents the full intended state, we won't be
able to do the right thing.

To avoid this issue, make the GdkToplevelLayout API intend based, where
if one e.g. doesn't call gdk_toplevel_set_maximized() with anything, the
backend will not attempt to change the maximized state.

This means we can also remove the old 'initially_maximized' and
'initially_fullscreen' fields from the private GtkWindow struct, as we
only deal with intents now.
2020-12-16 14:16:08 +01:00
Jonas Ådahl
b6412adc32 gtk/window: Check widget mappdness and not surface mappedness
When deciding whether to call gdk_toplevel_present(), check the
mappedness of GtkWidget instead of the mapped-ness of GdkSurface, as the
latter is mapped asynchronously, while the former is direct state of the
GtkWindow itself.

This fixes an issue where calling e.g. gtk_window_maximize() shortly
after showing it didn't take effect, as hadn't been mapped yet. While
maximizing after showing is racy, and will likely glitch from time to
time, the correct thing to do is still to maximize and handle whatever
state the compositor configured the window to be in.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3466
2020-12-16 11:56:41 +01:00
Timm Bäder
7eece7e769 gl renderer: Take a out graphene_rect in blur_node() 2020-12-16 09:13:12 +01:00
Timm Bäder
7f6608cbed gl renderer: Render too big textures to the clipped area 2020-12-16 08:26:46 +01:00
Timm Bäder
f816a8fb82 gl renderer: Unify viewport setting in add_offscreen_ops()
We use the same rect here a few times.
2020-12-16 08:26:46 +01:00
Timm Bäder
3c2484142d vulkancontext: Remove usage of VK_ERROR_INCOMPATIBLE_VERSION_KHR
According to
https://www.khronos.org/registry/vulkan/specs/1.0-wsi_extensions/html/chap46.html
this has been removed. It also breaks the build on my system
2020-12-16 08:26:46 +01:00
Matthias Clasen
2192bb3dde Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2957
2020-12-15 20:33:01 +00:00
Matthias Clasen
e1df9a043f Add a doc comment for GskConicGradientNode 2020-12-15 14:18:26 -05:00
Matthias Clasen
338d3ffa13 Add a doc comment for gdk_surface_request_layout 2020-12-15 14:14:49 -05:00
Emmanuele Bassi
6039a36183 Merge branch 'ebassi/for-master' into 'master'
Clean up the build system

See merge request GNOME/gtk!2955
2020-12-15 16:54:59 +00:00
Matthias Clasen
c551f693c2 Merge branch 'matthiasc/for-master' into 'master'
Update the node format docs

See merge request GNOME/gtk!2956
2020-12-15 16:23:15 +00:00
Emmanuele Bassi
5d2278a5ca docs: Add public symbols to the GTK reference 2020-12-15 16:21:20 +00:00
Emmanuele Bassi
ea5e186bb8 Hide GtkTextAttributes functions
The type is private, so making functions operating on it public is
pointless.
2020-12-15 16:20:21 +00:00
Emmanuele Bassi
69b181f263 Remove boxed type for GtkCrossingData
The GtkCrossingData type is completely private, so there's no point in
having a boxed type for it.
2020-12-15 15:55:15 +00:00
Emmanuele Bassi
3132b10bc0 docs: Add more private headers 2020-12-15 15:55:06 +00:00
Matthias Clasen
7335e166b7 Update the node format docs
Update this document to mention all the render nodes we
have, and the default values for their properties.
2020-12-15 10:30:18 -05:00
Emmanuele Bassi
91bba794a6 docs: Add missing symbols to the GTK reference 2020-12-15 14:30:32 +00:00
Emmanuele Bassi
a6bd0c7eed Remove stray mentions of GdkConfigureEvent
The event was removed, but some traces of it linger.
2020-12-15 13:58:52 +00:00
Emmanuele Bassi
ff351721b2 docs: Add missing symbols to the GDK reference 2020-12-15 13:47:40 +00:00
Emmanuele Bassi
538aa6c200 Move private GdkX11 symbols out of a public header
This avoids private symbols showing up in the introspection data, as
well as in the undocumented symbols list when generating the GDK API
reference.
2020-12-15 13:46:50 +00:00
Emmanuele Bassi
f546e03d31 docs: Add missing symbols to the GSK reference 2020-12-15 13:35:19 +00:00
Emmanuele Bassi
bdbea0d037 docs: Add more ignored header for GSK 2020-12-15 13:31:02 +00:00
Emmanuele Bassi
474b4ac1af build: Use Meson support for dylib versions
Do not hand-code it inside GTK's meson.build.
2020-12-15 12:47:05 +00:00
Emmanuele Bassi
99e0929d6c build: Use a consistent style for Meson files 2020-12-15 12:46:59 +00:00
Emmanuele Bassi
e75e44bdcc build: Remove duplicate definition
The `GTK_COMPILATION` symbol is defined in gir_args.
2020-12-15 11:47:32 +00:00
Emmanuele Bassi
7975bbfcaa build: Remove linker flags from static libraries
We only need hardening linker flags on the libgtk shared library;
internal static libraries don't really need them.
2020-12-15 11:36:20 +00:00
Emmanuele Bassi
11bca98a29 build: Remove unused variable
We don't need a `gsk_source` variable after all.
2020-12-15 11:35:27 +00:00
Emmanuele Bassi
618186723a build: Remove unused backend_immodules variable
We don't have input method modules any more.
2020-12-15 11:20:19 +00:00
Emmanuele Bassi
a5986f0dcd build: Use get_supported_link_arguments()
Instead of hand-coding it ourselves, let Meson deal with linker
arguments discovery.
2020-12-15 11:19:39 +00:00
Daniel Mustieles
c162d7148f Updated Spanish translation 2020-12-15 10:28:49 +01:00
Matthias Clasen
7e1a210ae0 Merge branch 'ebassi/for-master' into 'master'
docs: Add note for the removal of GtkFileChooserButton

See merge request GNOME/gtk!2954
2020-12-14 20:37:34 +00:00
Jordi Mas
bf5e3efd54 Update Catalan translation 2020-12-14 18:39:00 +01:00
Emmanuele Bassi
08d52bee14 docs: Add note for the removal of GtkFileChooserButton
Point developers in the direction of GtkButton and GtkFileChooserNative.
2020-12-14 16:55:15 +00:00
Emmanuele Bassi
a6e9a9b644 Merge branch 'pixbuf-from-surface-leak' into 'master'
gdkpixbuf-drawable: Free the pixbuf on Cairo error

See merge request GNOME/gtk!2951
2020-12-14 15:12:56 +00:00
Adrien Plazas
dc96542742 gdkpixbuf-drawable: Free the pixbuf on Cairo error
This avoids leaking the pixbuf.
2020-12-14 15:07:41 +01:00
Matthias Clasen
e2afb59a0b Merge branch 'matthiasc/for-master' into 'master'
Avoid adding // to resource paths

Closes #3469

See merge request GNOME/gtk!2947
2020-12-14 13:14:32 +00:00
Jakub Steiner
daa5d5aead Merge branch 'dropdown-searchbar' into 'master'
dropdown: Improve search bar styling

See merge request GNOME/gtk!2948
2020-12-14 09:39:38 +00:00
Jakub Steiner
fd0a03cf78 Merge branch 'emoji-searchbar' into 'master'
Adwaita: Improve emoji picker styling

See merge request GNOME/gtk!2949
2020-12-14 09:38:45 +00:00
nana-4
34d99ea1d0 Adwaita: Improve emoji picker styling
- Add borders around the main scrollable content, like most other
  places.
- Set padding and spacing on .emoji-searchbar and .emoji-toolbar in a
  more proper way.
- Remove unused button.emoji-section label styles.
2020-12-14 05:26:39 +09:00
nana-4
90355c0b27 emojichooser: Add .emoji-searchbar style class
Similar to .emoji-toolbar, it would be nice to have this for styling.
2020-12-14 05:26:13 +09:00
nana-4
538cf9e294 dropdown: Improve search bar styling
As per the mockup. See:

https://gitlab.gnome.org/Teams/Design/os-mockups/-/blob/master/dropdown-lists/dropdown-lists.png
2020-12-14 05:08:59 +09:00
Piotr Drąg
8e3f2b879e Update Polish translation 2020-12-13 16:51:51 +01:00
Florentina Mușat
8fa6a25aa5 Update Romanian translation 2020-12-12 18:49:22 +00:00
Matthias Clasen
96a300b2de Merge branch 'wip/jimmac/button-shed' into 'master'
headerbar window controls & clean up flat button extend

Closes #3427

See merge request GNOME/gtk!2942
2020-12-12 02:51:05 +00:00
Matthias Clasen
aeca9cb7ba Avoid adding // to resource paths
The GResource machinery is not forgiving about this
sort of thing.

Fixes: #3469
2020-12-11 21:47:54 -05:00
Matthias Clasen
c2727e6e04 Merge branch 'wip/carlosg/for-master' into 'master'
Wip/carlosg/for master

Closes #3461, #593, #3083, #3009, #3463, and #3426

See merge request GNOME/gtk!2945
2020-12-12 02:35:01 +00:00
Carlos Garnacho
8be0918d7e gdk/surface: Trigger motion check for next frame after thaw
This is a more reliable calling point than ::resume-events, and a
good one to schedule things so they happen on a frame clock in no
special phase (Thus still fixing the original issue at 80d4a08e30)

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3461
2020-12-12 02:14:02 +01:00
Carlos Garnacho
612d3bca7d gtk/window: Bring back L-shaped resize corners
These ended up square in the various refactors. Make them again L-shaped
by extending these along the edge being checked. This means we have to
check for corner positions in all edges, though.
2020-12-12 01:42:42 +01:00
Carlos Garnacho
e9fe270e94 gtk/scrolledwindow: Handle full scroll sequences only
In order to do this, leverage smooth scroll handling into the capture
phase scroll controller, controlled by ::scroll-begin in the propagation
phase controller.

There's 2 cases here:
- A child widget handles scroll. The scrolled window does not get
  ::scroll-begin, the child widget handles the full scroll sequence.
- No child handles scroll, the scrolled window gets ::scroll-begin,
  and transfers control of scrolling to the capture phase controller.
  As scrolling is performed, the pointer may fall into scrollable children,
  but the scrolled window will be capturing the scroll events, so these
  won't be seen by the child widgets.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/593
2020-12-12 01:42:42 +01:00
Carlos Garnacho
8402665c55 gtk/eventscrollerscroll: Handle smooth events in discrete controllers
We let smooth scroll events that don't trigger a ::scroll signal through.
This is unintended, these are handled, even if just accumulated.

This fixes cases like GtkSpinButton inside GtkScrolledWindow, where both
would handle events, until the GtkSpinButton eventually shifts away from
underneath the pointer.

Brought up at https://gitlab.gnome.org/GNOME/gtk/-/issues/593
2020-12-12 01:42:42 +01:00
Carlos Garnacho
79090f1755 gtk/entrycompletion: Ensure to show first row when shown, not allocated
This code was here in gtk3 to cater for the completion window being
positioned. That was only to meant once as long as the completion window
was shown.

This doesn't work as well for gtk4, ::size-allocate gets propagated from
the toplevel, so happens much more often for the completion window, this
ends up with the completion position being reset to the first row
frequently.

Do this simply once when popping up the completion, instead.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3083
2020-12-12 01:42:42 +01:00
Carlos Garnacho
3d84a38867 gtk/treeview: Position editable widgets correctly wrt left border
The coordinates are already widget-local here, not transformed by the
adjustment positions. Using the adjustment value here ends up pushing
the entry far from the left border.

The correct minimum value here is 0, which matches the treeview left
border.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3009
2020-12-12 01:42:42 +01:00
Carlos Garnacho
5155fac94f gtk/modelbutton: Handle unpaired releases
Let model buttons handle unpaired releases, these may happen indirectly
e.g. due to other child menus being opened at the time. Clicking would
dismiss the menu, but the menu item beneath the pointer would not get
activated.

We can handle that button release though via ::unpaired-release, so
there's no second click required.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3463
2020-12-12 01:42:42 +01:00
Carlos Garnacho
7a4d15dc67 gtk/range: Move button release handling to GtkGestureDrag
Tracking it through the GtkGestureClick becomes a bit cumbersome for
handling of simultaneously pressed buttons. We can track ::stopped,
but that also emits for a number of situations where we want drag to
continue.

However, the GtkGestureDrag is grouped with the click gesture, and
knows better when to finish the drag gesture (not just because of a
button release), so hook drag and zoom mode finalization there.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3426
2020-12-12 01:42:42 +01:00
Emmanuele Bassi
e4d8d50a8b Merge branch 'ebassi/for-master' into 'master'
Ebassi/for master

See merge request GNOME/gtk!2944
2020-12-12 00:01:38 +00:00
Emmanuele Bassi
3c9a13e6cf Update CODEOWNERS
Add me as the reference for the accessibility bits of the code base.
2020-12-11 23:42:25 +00:00
Emmanuele Bassi
2c97d44281 docs: Fix the Widget as Buildable example
The layout properties use an old name.
2020-12-11 23:41:51 +00:00
Kjartan Maraas
2d3a398678 Update Norwegian Bokmål translation 2020-12-11 11:40:55 +00:00
Florentina Mușat
d380ed2b3a Update Romanian translation 2020-12-10 15:34:51 +00:00
Matthias Clasen
644a45714a Merge branch 'matthiasc/for-master' into 'master'
docs: Update references to GtkWindow:fullscreened

See merge request GNOME/gtk!2943
2020-12-10 14:31:54 +00:00
Matthias Clasen
324683993e docs: Update references to GtkWindow:fullscreened
The property got renamed from fullscreen to fullscreened.
Update all references.
2020-12-10 09:10:21 -05:00
Jakub Steiner
f6f6241627 Adwaita: special case flat headerbar buttons
- make sure the hovers and pushed states are legible on a tintend headerbar

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3427
2020-12-10 14:24:29 +01:00
Jakub Steiner
6a33bed353 Adwaita: flat button :hover and :active
- special case undecorated button hovers
2020-12-10 14:16:25 +01:00
Jakub Steiner
f83ee0be23 Adwaita: headerbar_color > headerbar_bg_color
- semantic correction
2020-12-10 13:58:42 +01:00
Jakub Steiner
7442bdc383 Adwaita: duplicate selector
- awkward duplicate selector that should have no effect
  (resulting in the same css)
2020-12-10 13:51:10 +01:00
Luna Jernberg
82950528ed Update Swedish translation 2020-12-09 21:05:25 +00:00
Matthias Clasen
97eaef8308 Merge branch 'ebassi/popcount' into 'master'
Share the popcount() fallback for MSVC

See merge request GNOME/gtk!2940
2020-12-09 16:32:09 +00:00
Matthias Clasen
92189cf96a Merge branch 'matthiasc/for-master' into 'master'
Remove NoDisplay from demo desktop files

Closes #2932

See merge request GNOME/gtk!2939
2020-12-09 16:10:04 +00:00
Emmanuele Bassi
b8a651df47 Share the popcount() fallback for MSVC
We use __builtin_popcount() in a couple of places, so it makes sense to
have it in one header.
2020-12-09 16:06:52 +00:00
Matthias Clasen
c0ed89be9a widget-factory: Autoplay the video
The empty video on the frontpage is a bit of a letdown, since
the big arrow can't be clicked.
2020-12-09 10:52:55 -05:00
Matthias Clasen
ade4bcb125 Remove NoDisplay from demo desktop files
When these are installed (in particular, as flatpaks),
we should not hide them.

Fixes: #2932
2020-12-09 10:09:06 -05:00
Matthias Clasen
c5dd34344f Merge branch 'wip/carlosg/for-master' into 'master'
Wip/carlosg/for master

Closes #3426 and #3264

See merge request GNOME/gtk!2933
2020-12-09 15:04:01 +00:00
Matthias Clasen
c90cc976a5 Merge branch 'wip/jimmac/row-transitions-and-spacing' into 'master'
Adwaita: row transitions and spacing

Closes #3434

See merge request GNOME/gtk!2937
2020-12-09 13:35:54 +00:00
Matthias Clasen
bd9bcd5905 Merge branch 'wip/baedert/for-master' into 'master'
Wip/baedert/for master

Closes #3431

See merge request GNOME/gtk!2938
2020-12-09 13:34:21 +00:00
Matthias Clasen
0ddcbb52e6 Merge branch 'ebassi/4-0-abi-bump' into 'master'
Ebassi/4 0 abi bump

Closes #3392

See merge request GNOME/gtk!2883
2020-12-09 13:20:20 +00:00
Emmanuele Bassi
2457f3d54c build: Bump up the SONAME for GTK4
We released all the 3.9x development snapshots using:

  libgtk-4.0.so.0.xxxx.y

which means that the 4.0.0 release of GTK will have a lower SONAME than
the snapshots. To avoid that, bump the SONAME to 1.xxxx.y.

Fixes: #3392
2020-12-09 12:19:50 +00:00
Emmanuele Bassi
1cc207af32 build: Tie interface age to the development cycle
We don't want to increase the interface age manually, because we're
going to end up forgetting about it.

Instead, we should tie it to the rest of the version:

 - in stable (even minor) cycles, we don't add new API; the interface
   age is the same as the micro version
 - in unstable (odd minor) cycles, every new release might have new API,
   or updates to newly added API; keep the interface age to 0

This removes one more manual thing to change during release, and keeps
us honest with our promise not to add symbols during stable cycles.
2020-12-09 12:19:50 +00:00
Emmanuele Bassi
f4a0d57c07 Prepare version macros for 4.0
Remove the 3.9x version macros, and ensure that we handle 4.0 as the
backstop for the minimum required version.
2020-12-09 12:19:50 +00:00
Jakub Steiner
a76ee61e97 Adwaita: row transitions and spacing
- no fading out of row hovers. Many feel like it's a slow
  refresh rather than intentional effect.
- give some margin to navigation lists

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3434
2020-12-09 12:16:15 +01:00
Yuri Chornoivan
fac367495b Update Ukrainian translation 2020-12-09 07:08:51 +00:00
Matthias Clasen
76177b6065 Merge branch 'ebassi/prop-names' into 'master'
Ebassi/prop names

See merge request GNOME/gtk!2936
2020-12-09 05:51:00 +00:00
Matthias Clasen
433f305fa9 Merge branch 'sophie-h-master-patch-62064' into 'master'
gtk-demo: Remove potentially ableist metaphor

See merge request GNOME/gtk!2934
2020-12-09 00:53:10 +00:00
Matthias Clasen
fce824e78f Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

Closes #3451

See merge request GNOME/gtk!2935
2020-12-09 00:52:53 +00:00
Emmanuele Bassi
c4b768a4ec Rename GtkWindow:fullscreen to :fullscreened
Having a property with the same name of a method makes some languages
which put properties and method names in the same flat namespace not
really happy about our choices. To avoid collisions, let's put the the
"fullscreen" property into the past, alongside the "maximized" property.
2020-12-09 00:11:49 +00:00
Emmanuele Bassi
6d1be832d9 Fix the documentation for GtkWindow state properties
Drop the "don't write code that crashes" folksy bit; don't start
sentences with conjunctions; remove copy-pasted references to
"iconified" states; point to the corresponding property notification in
a consistent manner.
2020-12-08 23:49:45 +00:00
Matthias Clasen
a828d4318e Mark flaky tests as flaky
We can't mark these as xfail, since it sometimes succeed.
2020-12-08 18:10:02 -05:00
Sophie Herold
a36ccd7f42 gtk-demo: Remove potentially ableist metaphor 2020-12-08 23:02:03 +00:00
Matthias Clasen
b4a7fe8d8f Add bug reporting address to pot files
Fixes: #3451
2020-12-08 17:51:38 -05:00
Carlos Garnacho
43e4848872 gtk/main: Keep implicit grab until all buttons are released
Currently, the implicit grab is broken on the first button release,
in the case of pressing multiple buttons simultaneously. This means
that we emit crossing events early, and the next button releases
are sent to the pointer focus widget instead.

Consider the implicit grab effective until all buttons are released,
and only unset the pointer implicit grab (and emit crossing events)
after there are no further buttons pressed. We do this by checking
event modifiers, given button release events do contain the modifiers
in effect at the time the event was generated, we have to look for
exactly one active button modifier.

Fixes weird pointer states after pressing multiple buttons on a
widget.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3426
2020-12-08 23:27:03 +01:00
Carlos Garnacho
80d4a08e30 gdk/surface: Delay gdk_surface_request_motion() requests internally
Those requests are received while dealing with the ::layout frame
clock phase, this has the unintended side effect of making the
frame clock "rewind" to handle ::flush-events again during this
frame, which delays everything and practically halves the frame
rate.

We do intend to make the motion events dispatches on the next frame,
so do this in an idle at a slightly lower priority than layout/draw,
so the ::flush-events phase is actually requested for the next frame.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3264
2020-12-08 23:27:03 +01:00
Carlos Garnacho
47d0b5ad0c gkt/textview: Set an iter position for event-less menu activation
This went missing. Use the current insertion position as a reference.
Fixes invoking the menu via keyboard.
2020-12-08 23:27:03 +01:00
Matthias Clasen
c59b433395 Merge branch 'wip/chergert/gdk-macos-for-master' into 'master'
macos: fix macOS build breakage

See merge request GNOME/gtk!2931
2020-12-08 20:32:51 +00:00
Yuri Chornoivan
18d06a1cd5 Update Ukrainian translation 2020-12-08 20:25:26 +00:00
Florentina Mușat
f13041360a Update Romanian translation 2020-12-08 19:52:12 +00:00
Christian Hergert
0236fe80c1 macos: fix macOS build breakage
Fixes breakages due to recent refactoring around sizing changes.
2020-12-08 11:29:31 -08:00
Matthias Clasen
2caf283323 Mark the window-show-contents-on-map.ui reftest as xfail
We know now what the test is trying to test, just lack
the right plumbing to do it properly. So, keep the test
around, marked as expected fail.
2020-12-08 12:04:47 -05:00
Matthias Clasen
6fb66e299a Revert "reftests: Remove window-show-contents-on-map.ui test"
This reverts commit 074b933ae4.
2020-12-08 11:45:52 -05:00
Matthias Clasen
398a74d871 3.99.5 2020-12-08 10:58:40 -05:00
Matthias Clasen
08ca8a361e docs: Remove a mention of gtk_window_get_size
That function has been removed.
2020-12-08 10:44:33 -05:00
Matthias Clasen
1f141c1953 Merge branch 'wip/surface-state-rework' into 'master'
Rework surface state and geometry computation

See merge request GNOME/gtk!2885
2020-12-08 15:38:36 +00:00
Jakub Steiner
1e14a91cb9 Merge branch 'wip/jimmac/no-inner-shadow-sidebars' into 'master'
Adwaita: no 3d shadow for pressed sidebar

Closes #3413

See merge request GNOME/gtk!2928
2020-12-08 14:18:44 +00:00
Jonas Ådahl
074b933ae4 reftests: Remove window-show-contents-on-map.ui test
It tested that a widget shown after the window was mapped deals with
window resizing appropriately when doing the follow-up allocation. Now,
doing this only allocates both at the same time, as allocation happens
during the frame dispatch.

To do the equivalent now, one would have to write code that shows the
label after the first frame was drawn, and that's not possible via a
reftest, so lets remove it.
2020-12-08 14:22:59 +01:00
Jonas Ådahl
7b7f3342d8 reftests/textview-tags: Hide text view cursor
Otherwise it'd sometimes show up, causing test flakyness.
2020-12-08 12:03:18 +01:00
Matthias Clasen
adc4bcbd24 Merge branch 'wip/chergert/gdk-macos-for-master' into 'master'
macos: various GL context cleanups

See merge request GNOME/gtk!2929
2020-12-08 00:06:19 +00:00
Jonas Ådahl
130ff5f841 testsuite/notify: Don't fiddle with GtkWidget::visible
It may map toplevel windows with arbitrary modes, which will effect
other properties, such as GtkWindow::maximized and
GtkWindow::fullscreen.
2020-12-07 22:41:36 +01:00
Jonas Ådahl
fea1b151e6 testsuite/filtermodel: Remove calls to gtk_widget_realize()
They don't do what they used to do.
2020-12-07 22:29:51 +01:00
Christian Hergert
6e0fffa0f8 macos: use CGLSetParameter and CGLEnable
We don't need to go through the NSOpenGLContext for these.
We can just use the C API directly. It's also clearer what is using
CGLEnable() vs CGLSetParameter().
2020-12-07 11:47:51 -08:00
Jonas Ådahl
d2c95a1b13 gdk: Replace 'WITHDRAWN' state with async 'is-mapped' boolean
It was used by all surfaces to track 'is-mapped', but still part of the
GdkToplevelState, and is now replaced with a separate boolean in the
GdkSurface structure.

It also caused issues when a widget was unmapped, and due to that
unmapped a popover which hid its corresponding surface. When this
surface was hidden, it emitted a state change event, which would then go
back into GTK and queue a resize on popover widget, which would travel
back down to the widget that was originally unmapped, causing confusino
when doing future allocations.

To summarize, one should not hide widgets during allocation, and to
avoid this, make this new is-mapped boolean asynchronous when hiding a
surface, meaning the notification event for the changed mapped state
will be emitted in an idle callback. This avoids the above described
reentry issue.
2020-12-07 20:37:30 +01:00
Jonas Ådahl
8f8c5040db gtk/headerbar: Remove unused 'state' field 2020-12-07 20:37:30 +01:00
Matthias Clasen
3b69facf0b Mention window sizes in the migration guide 2020-12-07 20:37:30 +01:00
Matthias Clasen
a6bc4c95b1 docs: Add gtk_window_is_fullscreen 2020-12-07 20:37:30 +01:00
Matthias Clasen
59fd171515 popup: Documentation tweaks
Use proper syntax for referring to signals.
2020-12-07 20:37:30 +01:00
Matthias Clasen
3db0d06901 Properly remove gtk_window_get_size
It was still in the headers and the docs, but did
not have an implementation anymore.
2020-12-07 20:37:30 +01:00
Jonas Ådahl
d7d738d745 tests/animated-resizing: Use gtk_window_default_size() instead
This will actually make it resize on-demand, as the default size is the
size used when computing the window size when the size is not fixed.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
ac17217c69 wayland/toplevel: Don't alwyas skip changing xdg_toplevel state
We only called xdg_toplevel.(un)set_maximize() if the toplevel layout
changed, but this misses the case when the compositor had changed the
maximized state. Change it to call the xdg_toplevel request if either
the local layout changed, or if the layout differs from the current
state.

This fixes an issue where one couldn't unmaximize a window by double
clicking the titlebar that, had previously been maximized e.g. using a
keyboard binding.

Do the same for fullscreen.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
2e5eeb6b92 gtk/window: Add 'fullscreen' prop and gtk_window_is_fullscreen()
This makes it possible to set 'fullscreen' to 'true' in a .ui file to
start an application in fullscreen mode.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
eb0eac0f03 gtk/window: Make R/O is-maximized R/W maximized prop
This makes it possible to set 'maximized' to true in .ui files, and the
window will show up maximized.

gtk_window_is_maximized() will return the intended maximized state until
actually mapped, it will then show the actual maximized state. The same
applies to reading the property.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
27077d5be8 gtk/window: Make 'default-size' adapt to configured size
This commit changes the behavior of window size computation and the
default size properties to:

 * The default-width and default-height properties are updated to the
   current window size unless the size is fixed by e.g. being maxmized,
   tiled etc.
 * The compute-size semantics are to just pick the default size, or if
   not adequate, use the measured size, and consequently update the
   default size, unless unresizable.
 * gtk_window_get_size() is removed, what's more likely relevant is the
   gtk_window_get_default_size() which will now contain more sensible
   values.

Various places that used gtk_window_get_size() were updated to use
gtk_window_get_default_size() to remember and restore previous sizes.

This also changes the default value of 'default-width' and
'default-height' from -1 to 0. The gtk builder simplify tool is taught
how to omit when the default size is set to both -1 and 0.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
fd01723470 x11/surface: Avoid resizing if computed size didn't change
This fixes an issue where we'd resize to the previous window size during
interactive resize.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
994aa41ccc x11/surface: Move the scattered compute-size calls to helper
This simplifies things, and fixes issue where we'd resize the wrong
time, and miss resizing other times.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
c791185c20 x11/surface: Remember the toplevel layout 2020-12-07 20:37:29 +01:00
Jonas Ådahl
e7ddaf5ed1 x11/surface: Compute size after update too
This will sometimes mean a frame is skipped if a resize was requested
during the update phase of the frame dispatch. Not doing so can cause
trying to allocate a window smaller than the minimum size of the widget.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
2217cf8ea2 x11/surface: Remember when there is a pending ConfigureNotify
This will be used to decide whether to try to resize windows when .
2020-12-07 20:37:29 +01:00
Jonas Ådahl
3bbeb891c4 gdk/surface: Allow inhibit layout from backend
If compute_size() returns TRUE, the layout will not be propagated to
GTK. This will be used by the X11 backend to queue asynchronous resizes
that shouldn't yet allocate in GTK.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
ff23a2a582 x11: Use resize counting for freezing updates too
It's already keep strack of when we're waiting for configure events, so
lets reuse it. This fixes an issue where reshown dialogs wouldn't
reappear.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
8396bdb759 wayland/surface: Reset last sent min/max size when hiding
As with the window geometry, the last sent min/max values must be reset
so they are sent again next time the surface is shown.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
351d88f7ae wayland/surface: Clear shadow width when hiding
Not doing this means the next time the same surface is shown, if the
shadow size wasn't changed, it wouldn't be sent to the compositor, which
then would result in compositor deriving its own window geometry which
would include the shadow margin.

This fixes an issue where the file chooser dialog would grow each time
it opened.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
dfb7ab3352 x11/surface: Compute toplevel size outside of frame dispatch
We can't compute and resize a toplevel size during dispatch, as resizing
on X11 is an asynhronous operation, requiring a configuration event.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
8e3ee58e3f tests/animated-resizing: Don't try to resize during frame dispatch
This will not work on X11 because it's too late to resize, due to
resizing being asynchronous i.e. it won't be complete before we need to
draw.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
40a9baa2db gtk/native: Remove gtk_native_check_resize()
This is now handle by the corresponding implemenatations using per
non-gobject-type API.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
4b2aae9950 gtk/dragicon: Use private gtk_drag_icon_present() instead of GtkNative
It didn't even use GtkNative, just the vfunc it set to the interface
sturct.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
9d3f497a21 gtk/tooltipwindow: Use gtk_tooltip_window_present() instead of GtkNative 2020-12-07 20:37:29 +01:00
Jonas Ådahl
517bc0db84 gtk/texthandle: Use gtk_text_handle_present() instead of GtkNative 2020-12-07 20:37:29 +01:00
Jonas Ådahl
369b03a3d8 gtk/window: Don't go via GtkNative when presenting
It'll only call directly back into GtkWindow's toplevel present handling
code.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
2cddec7798 gtk/popover: Use gtk_popover_present() instead of going via GtkNative
This makes it more explicit that managers of popovers make it "present".
2020-12-07 20:37:29 +01:00
Jonas Ådahl
f7fceab40b gtk/entry: Remove emoji chooser field
It wasn't ever set.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
3b66f63523 gtk/popover: Request fake motion events for popovers too
As with GtkWindow, we need to request fake motion events if allocation
changes, to emulate motion events given the new layout.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
96450ed9cc gdk/surface: Emit layout event while frozen
The allocation of popups are part dependent of the allocation of the
root, which means the root must still be allocated when updates are
frozen, otherwise we'll try to allocate non-laid out popups.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
5eee1dfcd1 gdk/popup: Remove the popup-layout-changed signal
It was replaced with GdkSurface::layout.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
19d2a4ab94 gtk/window: Only fake motion events on windows with pending allocations
This fixes an issue where the focus of the window continuously received
fake motion events even when a popover was open, making input events end
up behind the popover.

It also adds a comment describing why motion events are requested. Note
that popovers won't work with this, and it's possible both in the past
and now that sporadic missplaced motion events will appear, e.g. when a
window changes allocation but a popover is open.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
6ee7535af0 gdk/toplevelsize: Rename 'margin' to 'shadow' and 'shadow_width'
This makes it more consistent with everywhere else.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
b738054344 gdk: Remove GdkSurface::size-changed
It's not emitted, and everyone should use the GdkSurface::layout signal
from now on.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
b8fa892b70 gtk/window: Minor cleanup 2020-12-07 20:37:29 +01:00
Jonas Ådahl
ca65ee8d50 gtk/window: Remove out-dated comment 2020-12-07 20:37:29 +01:00
Jonas Ådahl
5eca548acc gtk/window: Use default size if non-resizable if set 2020-12-07 20:37:29 +01:00
Jonas Ådahl
42679f2903 gdk: Replace all GDK_CONFIGURE usage with GdkSurface::layout
This removes the GDK_CONFIGURE event and all related functions and data
types; it includes untested changes to the MacOSX, Win32 and Broadway
backends.
2020-12-07 20:37:29 +01:00
Christian Hergert
b431e39d4e macos: we only need 24-bit for color 2020-12-07 11:27:11 -08:00
Emmanuele Bassi
606cb51293 Merge branch 'ebassi/activate-signal' into 'master'
Add accessors for GtkWidgetClass.activate_signal

See merge request GNOME/gtk!2925
2020-12-07 15:23:55 +00:00
Jakub Steiner
62e0c0de59 Adwaita: no 3d shadow for pressed sidebar
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3413
2020-12-07 14:19:24 +01:00
Jakub Steiner
30f789650f Revert "Adwaita: avoid clipping menu shadows"
While the workaround hides majority of the issue there are still two big downsides:

  - shadow does eat from the widget dimensions so alignment is broken
  - situations like popover going upwards on screen edge break completely

The appropriate action is to revert these theme duct tape solutions to make room
for a proper fix.

This reverts commit b3dba1dca6.

Issue https://gitlab.gnome.org/GNOME/gtk/-/issues/1987
2020-12-07 10:58:12 +01:00
Jonas Ådahl
3f96d4b6da gdk: Always get shadow width via GdkToplevelSize
This removes the gdk_surface_set_shadow_width() function and related
vfuncs. The point here is that the shadow width and surface size can now
be communicated to GDK atomically, meaning it's possible to avoid
intermediate stages where the surface size includes the shadow, but
without the shadow width set, or the other way around.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
0dcd4a5bdb wayland: Stop emitting size-changed
It's dealt with by GdkSurface::layout now.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
8a599b2582 gtk: Allocate everything from GtkNativeClass::layout
This changes allocation of the widget trees to happen as a side effect
to the GdkSurface::layout signal, which first passes the GtkNative
instance where it is then forwarded to the implementations of the
GtkNative interface.

The implementations of GtkNative are the ones doing the actual
gtk_widget_allocate(), and they do so in their GtkNativeClass::layout
function.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
a798edc360 gtk/window: Only deal with shadow when (ex|in)cluding csd size
The size should correspond what gtk_widget_measure() does, and it
measures what's within the window excluding the shadow; so make this
helper function correspond to this.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
e51c32b9c1 gdk/wayland: Always compute-size if GTK asked fer layout 2020-12-07 09:46:39 +01:00
Jonas Ådahl
048a0172a0 gdk/wayland: Always configured size when resizing
GTK4 doesn't support arbitrary constraints when resizing a window (e.g.
steps, or aspect ratio), so we don't need to care about the result from
compute-size when doing interactive resizing.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
64f6118af4 gdk/toplevelsize: Don't complain if only shadow extends out of bounds 2020-12-07 09:46:39 +01:00
Jonas Ådahl
14b5a5a4c7 gtk/window: Remove gtk_window_resize()
Use gtk_window_set_default_size() or change the size of the widget
inside the window to get the same effect.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
4083f7e47f testsuite: Remove test for gtk_window_resize()
And use gtk_window_set_default_size() in the other place.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
2854d0339c tests/testgtk: Remove 'Resize' button
The gtk_window_resize() API is going away, so remove this test.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
98fffe6f23 tests/animated-resizing: Resize widget instead of window
This means the window needs to be marked as non-resizable, otherwise it
won't shrink.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
f083849ebb tests: Use gtk_window_set_default_size() when appropriate
Replace the usage of gtk_window_resize() with
gtk_window_set_default_size() where possible.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
deb58339b9 gtk/expander: Remove manual call to gtk_window_resize()
It happens implicitly for a non-resizeable window.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
65ad9d6d96 gdk/x11: Flush layout changes to the frame clack dispatch
This follows the trail of the Wayland backend in that GdkSurface changes
happen during the layout phase, and that a GDK_CONFIGURE no longer being
used to communicate the size changes of a surface; this now also uses
the layout signal on the GdkSurface.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
e0f13ecae7 gdk/surface: Try to reschedule pending phase until dispatched
If a surface scheduled a relayout, got frozen, and a layout phase
happened, then got unfrozen, it wouldn't see it's layout being
requested; avoid this race by remembering the pending phases until they
actually happened.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
880ceebae4 gdk/surface: Make backends aware of when layout is requested 2020-12-07 09:46:39 +01:00
Jonas Ådahl
8c014e63af x11: Remove handling of 'substructure' events
Reading the comment, it seems to be related being a window manager
decoration utility; this is not something GTK4 aims to handle, just drop
support for this.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
ecd40fa265 wayland: Layout drag icon from GdkSurface::layout 2020-12-07 09:46:39 +01:00
Jonas Ådahl
3b140a05a4 gtk/dragicon: Don't show until child is set
Showing before the child would result in bogus
gdk_drag_surface_present() with an "empty" (1x1) size. This can easily
be avoided by postponing showing until there is anything to show.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
d38f81999e wayland: Communicate popup layout changes via GdkSurface::layout
By moving popup layout emission to the layout phase, the current
GdkPopup::poup-layout-changed signal has no value on its own as it'd be
ignored by GtkPopover.

Make the Wayland backend communicate the popup layout changes via the
common signal; but leave the rest intact until other backends catch up.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
efcfd23652 wayland/surface: Restructure fields used for the next layout
Put them in a anonymous struct, and separate the toplevel specific ones
into another anonymous struct inside the first one. Later popup related
fields will be added.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
70b83c9a70 gdk/surface: Remove left-over signal enum value
The popup-layout-change signal was moved to GdkPopup, but the enum was
never removed from GdkSurface.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
4779e4e488 gdk/frame-clock: Remove the newly added 'compute-size' phase
What was previously done in the layout phase is now done in response to
a GdkSurface signal, which means size computation can happen on layout.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
13931463bd wayland/surface: Compute size on layout
Stop using the 'compute-size' phase of the frame clock, use the layout
phase instead, now that GTK isn't using the layout phase anymore.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
ecc861bf06 Pass the layout signal via GdkSurface to GtkRoot
Don't have GtkRoot listen directly to the layout signal on the frame
clock, but let it pass through GdkSurface. This will allow GdkSurface to
be more involved in the layout phase.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
475c07e935 gdk/surface: Make pending schedule a phase enum
Scheduling an update when frozen would reschedule when unfrozen; change
this to a generic pending phase enum, and use this for resrcheduling
paint and compute-size.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
0c8d97e3f7 gtk/root: Validate css node after update
It should happen before layout, but after the animation tick, thus after
the update.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
8d4f8f0cfc wayland: Concentrate size computation to 'compute-size' phase
This includes computing the surface size, including shadow margin,
setting the surface size, during the 'compute-size' clock phase.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
289b50785b wayland/surface: Don't save uninitialized size
GdkSurface's are initialized to have the size 1x1, as otherwise we'd
receive an X11 error, would a corresponding X11 window be created.

This confuses the "saved size" mechanisms in the Wayland backend, as
treats 0 as uninitialized, and not 1.

Fix this simply not saving size that if it's smaller or equal than 1.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
68c14242b2 gdk/surface: Add API to request 'compute-size' clock phase 2020-12-07 09:46:39 +01:00
Jonas Ådahl
4af54fb410 gdk/surface: Use helper to emit 'size-changed' signal 2020-12-07 09:46:39 +01:00
Jonas Ådahl
13b4a4b24c gdk/toplevelsize: Add way to set margin
Will be used to communicate the shadow margin, instead of using
gdk_surface_set_shadow_width().

Also set these values in gtkwindow.c.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
e07fde5c81 frame-clock: Add 'compute-size' phase
This will be handled between 'update' (which may trigger animation
ticks, CSS update, etc) and 'layout' which will allocate the widget
tree. It's meant to perform surface size computation, and is done
between these two phases in order to have an up to date state, and
letting the layout phase have an up to date size to layout in.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
8f27b3fcf6 gtk/window: Let the backend handle toplevel freezing 2020-12-07 09:46:39 +01:00
Jonas Ådahl
251bd15597 wayland: Apply new surface state at the beginning of a frame
Concentrate state application to the start of a frame; this is to avoid
having GTK going back and forth between different state if so would
happen between two frames.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
dd738d2787 surface: Only keep state 'withdrawn' after hiding
A hidden surface should start from a clean slate when showing again, so
clear any now out of date state.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
18d92c3f16 wayland: Keep pending initial state separate
Queue it, and then wait for it to actually take effect, i.e. be
confirmed via a configure event from the compositor, before setting the
actual GdkSurface::state value.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
f4c36fe1ce gdk/surface: Add API to queue and apply state changes
This will be used to compress state changes and apply as part of a frame
clock dispatch.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
23d7392eb9 gdk/surface: Removed unused struct field
The 'old_state' wasn't used anywhere, lets remove it.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
996eeec16c gtk/window: Don't gdk_toplevel_present() if not mapped
That would map the window too early.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
641915974b gdk/toplevel: Make gdk_toplevel_present() async
The plan is to concencrate size computations as part of the frame clock
dispatch, meaning we shouldn't do it synchronously in the present()
function.

Still, in Wayland, and maybe elsewhere, it is done in the present()
function, e.g. when no state change was made, but this will eventually
be changed.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
528ec4dded wayland: Only set mapped state when mapped
Mapping a surface under Wayland is an asynchronous process, where one
creates a surface and commits an initial state without having drawn
anything, then waiting for a configuration, which then is acknowledged
and content is painted and committed. Not until having received this
configuration is a surface actually mapped, so wait with setting the
mappedness until this.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
366b946f5b wayland/popup: Use maybe_notify_mapped() helper 2020-12-07 09:46:38 +01:00
Jonas Ådahl
9e6a55a086 wayland: Decouple mapped state from surface creation 2020-12-07 09:46:38 +01:00
Christian Hergert
285781724f macos: set opengl view as opaque in opaque windows
We don't need the OpenGL view to be transparent if the window itself
is not transparent. This has the potential to speed up the compositing
of the GL view onto the NSWindow.
2020-12-06 20:14:52 -08:00
Emmanuele Bassi
2d103cf80c Merge branch 'wayland-inhbit0' into 'master'
wayland: avoid referencing unallocated memory when uninhibiting

See merge request GNOME/gtk!2927
2020-12-07 00:26:50 +00:00
Michael Terry
c8d991e4de wayland: avoid referencing unallocated memory when uninhibiting 2020-12-06 18:37:40 -05:00
Zander Brown
a165bb9f46 Update British English translation 2020-12-06 22:08:30 +00:00
Timm Bäder
33ed42d985 gl renderer: Remove RESET_OPACITY flag
We always need to do that (and always passed the flag to
add_offscreen_ops() anyway).
2020-12-06 20:03:35 +01:00
Timm Bäder
1ee4f6138b gl renderer: Reset opacity when rendering blend node children
We render those on a texture, so we need to reset the opacity because
that will be applied when rendering the resulting texture.
2020-12-06 20:01:36 +01:00
Timm Bäder
7b61ef9e0f gl renderer: Initialize rounded rect early 2020-12-06 19:57:48 +01:00
Timm Bäder
b46d077b3a gl renderer: Fix rendering clipped blurred inset shadow nodes 2020-12-06 19:18:10 +01:00
Timm Bäder
e32331d002 gl renderer: Ignore crossfades between equal texture nodes 2020-12-06 19:18:10 +01:00
Timm Bäder
05928608ec gl renderer: Use scale_x and scale_y everywhere
Try to handle two different values for scale in horizontal and vertical
direction better.

Fixes #3431
2020-12-06 19:18:05 +01:00
Emmanuele Bassi
d8c9a67d20 docs: Clarify gtk_widget_activate()
We need to tell people what signal will be emitted when calling
gtk_widget_activate(), and that the shortcuts API might be more
appropriate to what they are looking for.
2020-12-06 15:13:57 +00:00
Emmanuele Bassi
c352fe9ab0 Move activate_signal to the widget private class data
Instead of having it as a field in the class structure.
2020-12-06 15:06:18 +00:00
Emmanuele Bassi
e396874f3c Merge branch 'ebassi/a11y-leak' into 'master'
a11y: Plug a leak in the AT-SPI context

Closes #3450

See merge request GNOME/gtk!2926
2020-12-05 20:52:04 +00:00
Emmanuele Bassi
f6c53ced0d a11y: Plug a leak in the AT-SPI context
Fixes: #3450
2020-12-05 20:25:30 +00:00
Matthias Clasen
ee26e282cc Update contribution guide
Make my feelings about bug reporting by screencast known.
2020-12-05 11:34:52 -05:00
Matthias Clasen
894f893223 Merge branch 'revert-round-windows' into 'master'
Revert "theme: Round all window corners"

See merge request GNOME/gtk!2921
2020-12-05 15:10:16 +00:00
Piotr Drąg
67d7e2007f Update POTFILES.in 2020-12-05 15:05:48 +01:00
Emmanuele Bassi
3a9cca74fc Use WidgetClass.activate_signal getter function 2020-12-05 01:04:18 +00:00
Emmanuele Bassi
fe9c0db603 Add getter for WidgetClass.activate_signal
Just like we have a setter.
2020-12-05 01:04:18 +00:00
Emmanuele Bassi
fde32c5219 Use private can_activate() method
Instead of checking the activate_signal field directly.
2020-12-05 01:04:18 +00:00
Emmanuele Bassi
213024a560 Use function setter for WidgetClass.activate_signal 2020-12-05 01:04:18 +00:00
Emmanuele Bassi
e5e18ddffb Add private method to check activatability
We should have an actual method, instead of checking the
WidgetClass.activate_signal directly.
2020-12-05 01:04:18 +00:00
Emmanuele Bassi
b3e03fa6f0 Add wrappers for setting the WidgetClass.activate_signal field
Setting a field on a class structure is not always an easy task from
languages other than C. While bindings can provide access to the class
pointer, twiddling the fields in the class structure can be awkward.
Additionally, signal ids are not always readily available.

We can paper over the direct access to the class structure, as well as
the "signal name to id" mapping with a simple couple of setter
functions.
2020-12-05 01:04:18 +00:00
Emmanuele Bassi
c0586ca6e2 Merge branch 'wip/jfelder/customsorter-null' into 'master'
customsorter: Add missing nullable annotation

See merge request GNOME/gtk!2923
2020-12-04 23:39:48 +00:00
Jean Felder
4430314514 customsorter: Add missing nullable annotation 2020-12-05 00:04:36 +01:00
Emmanuele Bassi
4087055b18 Merge branch 'wip/chergert/gdk-macos-for-master' into 'master'
macos: fix GL renderer for macOS

Closes #3420

See merge request GNOME/gtk!2922
2020-12-04 22:37:00 +00:00
Christian Hergert
a47c0065fb macos: enable GL renderer by default
Now that the attribute locations are fixed for the GL renderer, we can
enable it by default on macOS.

Fixes #3420
2020-12-04 13:41:31 -08:00
Christian Hergert
6883c2214b gl: specify attribute locations for vUv and aPosition
These positions are not guaranteed to be in a specific order when linked
into the final GPU program. They need to be specified so that our code
in gskglrenderer.c can use known positions for them to match up with
our GskQuadVertex.

This fixes the GL renderer on macOS's OpenGL shader compiler.

Fixes #3420
2020-12-04 13:33:34 -08:00
Matthias Clasen
7f6fdd6e7b Merge branch 'matthiasc/for-master' into 'master'
emoji chooser: Fix incremental loading

Closes #3438

See merge request GNOME/gtk!2920
2020-12-04 17:21:56 +00:00
Matthias Clasen
24124452d5 docs: Fix up GtkPicture docs
These were missing proper linking.
2020-12-04 11:47:43 -05:00
Matthias Clasen
0dff89d9fb Revert "theme: Round all window corners"
This reverts commit e46522e4b5.
2020-12-04 11:13:26 -05:00
Matthias Clasen
f0f64f42ee emoji chooser: Fix incremental loading
This broke when we started using GDK_PROFILER_CURRENT_TIME for
timekeeping - that gets defined to 0 when we're building without
sysprof, so we can use it to make such determinations. Go back
to using g_get_monotonic_time().

Fixes: #3438
2020-12-04 11:09:43 -05:00
Matthias Clasen
d278afc85b Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2918
2020-12-04 04:12:41 +00:00
Matthias Clasen
423b8209a1 gtk-demo: Use a native filechooser in the words demo 2020-12-03 22:31:05 -05:00
Benjamin Otte
559f74e0c1 Merge branch 'picture-docs2' into 'master'
Add docs about sizing pictures

See merge request GNOME/gtk!2917
2020-12-04 02:04:19 +00:00
Benjamin Otte
66c3a43e96 Add docs about sizing pictures
Suggested by Christopher Davis.
2020-12-04 02:04:19 +00:00
Matthias Clasen
d83554121f gtk-demo: Use a native file chooser in the svg demo 2020-12-03 19:44:45 -05:00
Matthias Clasen
2688b94133 gtk-demo: Use a native filechooser in the video demo 2020-12-03 19:44:34 -05:00
Matthias Clasen
e035baee8a gtk-demo: Remove empty row in the pickers demo
The file chooser button is gone.
2020-12-03 19:25:04 -05:00
Emmanuele Bassi
f1ff8f9aad Merge branch 'wip/chergert/macos-decelerate' into 'master'
macos: fix typo when creating scroll events

Closes #3418

See merge request GNOME/gtk!2916
2020-12-03 22:54:46 +00:00
Christian Hergert
115ea624d9 macos: fix typo when creating scroll events
This fixes an issue where we would ignore events with Y delta
and no X delta while scrolling due to a typo when checking for
any delta.

This fixes deceleration of kinetic scrolling on the macOS backend.

Fixes #3418
2020-12-03 13:46:47 -08:00
Matthias Clasen
6ecae6c5f8 Merge branch 'wip/chergert/gdk-macos-for-master' into 'master'
macos: fix motion event delivery after closing transient window

Closes #3419

See merge request GNOME/gtk!2910
2020-12-03 20:07:16 +00:00
Matthias Clasen
6d76b587cf Merge branch 'wip/chergert/shadertoy-macos-fix' into 'master'
demos: make alienplanet demo work on macOS OpenGL

See merge request GNOME/gtk!2915
2020-12-03 19:00:39 +00:00
Christian Hergert
8e62ff50fe demos: make alienplanet demo work on macOS OpenGL
On the macOS OpenGL implementation, the use of noise2 as a
function within the glsl shader collides with the builtin noise2 of a
different signature.

This changes the name to something similar (noize2) so that we
do not risk colliding names when linking.

With this commit, the shadertoy alienplanet demo works on mac
OpenGL (albeit still with the Cairo renderer).
2020-12-03 10:23:13 -08:00
Matthias Clasen
0daa905a27 Merge branch 'wip/otte/conic' into 'master'
Implement a GL shader for conic gradients

See merge request GNOME/gtk!2913
2020-12-03 17:14:01 +00:00
Emmanuele Bassi
d1a4ad3db6 Merge branch 'wip/tintou/gdk-backends-header' into 'master'
build: Use the correct path to the header of the wayland and x11 backends

See merge request GNOME/gtk!2914
2020-12-03 12:32:24 +00:00
Benjamin Otte
2c1bd399d2 glrenderer: Implement a shader for conic gradients 2020-12-03 13:07:17 +01:00
Benjamin Otte
fac5fba0dc rendernode: Fix some wrong constants for conic gradients
copy/paste from other nodes left some wrong values in there and that
screwed things up quite a bit.
2020-12-03 13:07:17 +01:00
Benjamin Otte
c907ad83b0 glrenderer: Emit more useful error messages
Catch the error when it happens, so that we can emit a specific and more
helpful error message.

Also verify that all branches in the code now do indeed set a proper
GError when they fail, so that the final catch-all is no longer needed.
Instead, assert that the error is set so that we catch future code
additions early that do not set the GError.
2020-12-03 13:07:17 +01:00
Corentin Noël
585ba777c2 build: Use the correct path to the header of the wayland and x11 backends 2020-12-03 10:02:03 +01:00
Matthias Clasen
f8ee4cfea5 NEWS: Updates 2020-12-02 23:10:39 -05:00
Matthias Clasen
35d2cbefe6 Merge branch 'wip/otte/conic' into 'master'
Add support for conic gradients

See merge request GNOME/gtk!2911
2020-12-03 03:54:24 +00:00
Christian Hergert
004f0a6596 macos: plug leak of application windows
This ensures that we don't leak window references inside the action muxer.
Otherwise, we risk not disposing the windows upon gtk_window_destroy()
and blocking the main loop from quitting.

Fixes #3419
2020-12-02 19:44:02 -08:00
Christian Hergert
b68e0bb3fb muxer: add helper to get group by name
This is useful when you need to read a group back out of the muxer.
2020-12-02 19:44:02 -08:00
Christian Hergert
92f0216605 macos: ensure element is part of queue
We don't want to risk decrementing length field unless this is actually
part of the queue.
2020-12-02 19:44:02 -08:00
Christian Hergert
e317b9be00 macos: maintain GList element consistency
We need to keep this consistent so that we can look things up
faster in other places. Therefore, just take the hit here and clear
the entire list ensuring prev/next poniters are cleared.
2020-12-02 19:44:01 -08:00
Christian Hergert
2e52386be5 macos: send focus-out event to windowing 2020-12-02 19:44:01 -08:00
Christian Hergert
9431c70a6a macos: freeze updates until surface is mapped
This more closely matches the X11 backend in terms of freezing
updates on the surface initially until we get mapped.
2020-12-02 19:44:01 -08:00
Matthias Clasen
6e67d44aa3 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

Closes #3429

See merge request GNOME/gtk!2912
2020-12-03 03:43:19 +00:00
Benjamin Otte
e622013f7e css: Add support for conic-gradient()
This comes complete with animation support. For a good time, try:

@keyframes conic {
  100% { background-image: conic-gradient(from 1turn, red, lime, blue, yellow, red); }
}

window {
  background-image: conic-gradient(red, lime, blue, yellow, red);
  animation: conic infinite linear 5s;
}
2020-12-03 04:13:33 +01:00
Benjamin Otte
3886f0c530 Merge branch 'wip/otte/diediedie' into 'master'
Remove GtkFileChooserButton

See merge request GNOME/gtk!2909
2020-12-03 01:31:39 +00:00
Benjamin Otte
eb9c204535 gtk: Remove GtkFileChooserButton
... as discussed in the meeting.
2020-12-03 02:02:27 +01:00
Matthias Clasen
ab9e99218f docs: Remove mentions of <accelerator>
That is no longer supported, keyboard shortcuts
are done with GtkShortcut now.

Fixes: #3429
2020-12-02 19:59:44 -05:00
Matthias Clasen
714c610d6b gtk-demo: Add a search button
Easter eggs are great, but search shouldn't be one.
2020-12-02 19:53:55 -05:00
Benjamin Otte
8706d69e60 snapshot: Add gsk_snapshot_append_conic_gradient() 2020-12-03 01:15:53 +01:00
Benjamin Otte
55a242bd81 gsk: Add GskConicGradientNode 2020-12-03 00:47:54 +01:00
Matthias Clasen
61b40c47f9 Merge branch 'fix/keyboard-input' into 'master'
Gdk4/Win32: Correct calls to gdk_key_event_new()

See merge request GNOME/gtk!2903
2020-12-02 22:14:27 +00:00
Matthew Jakeman
710d0620a4 Gdk4/Win32: Correct call to gdk_key_event_new()
The keycode and modifier (state) parameters are in the wrong order
for gdk_key_event_new() in the gdk win32 backend, which causes
key up/down events to be populated incorrectly.
2020-12-02 22:14:27 +00:00
Benjamin Otte
71cb7c2063 rendernodeparser: Split out a function 2020-12-02 21:48:35 +01:00
Matthias Clasen
a482d870dd Merge branch 'wip/chergert/gdk-macos-for-master' into 'master'
Revert "macos: specify a window level for surfaces"

See merge request GNOME/gtk!2908
2020-12-02 20:15:51 +00:00
Emmanuele Bassi
bc4992fef9 Merge branch 'ebassi/doc-fixes' into 'master'
Ebassi/doc fixes

Closes #3428

See merge request GNOME/gtk!2906
2020-12-02 20:08:05 +00:00
Christian Hergert
b38d0d7d9e macos: resign main/key when hiding window
This isn't done automatically for us, so we need to synthesize it in
our hide helper.

With this commit, we properly re-focus the new main/key window after
we have closed a transient-for window.
2020-12-02 11:36:38 -08:00
Christian Hergert
853a9c7a8c macos: disconnect frame clock when destroying surface 2020-12-02 11:35:02 -08:00
Christian Hergert
26b9254ac7 macos: track grab serial like other backends
This is what is done elsewhere, so copy that here too now that we actually
generate serials for events.
2020-12-02 11:34:31 -08:00
Benjamin Otte
a51f11999a tests: Remove testsvg
That demo lives in gtk-demo now.
2020-12-02 20:17:28 +01:00
Christian Hergert
f11c23f407 Revert "macos: specify a window level for surfaces"
This reverts commit ca8b00e871.

This isn't needed and causes issues with other applications getting
stacked beneath our windows.
2020-12-02 11:15:57 -08:00
Emmanuele Bassi
0c8de4e561 Fix transfer of GtkTreeExpander.get_item()
We return a full reference to the item.

Fixes: #3428
2020-12-02 19:10:13 +00:00
Emmanuele Bassi
13f9993007 docs: Add missing fields to GtkTextBufferClass 2020-12-02 19:05:41 +00:00
Emmanuele Bassi
b2b451d762 docs: Hide private files/directories in the GTK reference 2020-12-02 19:05:41 +00:00
Emmanuele Bassi
2e146a56f7 docs: Mark GtkModelButton's section as private
The widget is not public any more.
2020-12-02 19:05:41 +00:00
Emmanuele Bassi
34197d4f8a docs: Add more symbols to the GDK reference 2020-12-02 19:05:41 +00:00
Emmanuele Bassi
39dbd91bb0 docs: Add yet another private header 2020-12-02 19:05:41 +00:00
Emmanuele Bassi
901d99d7c5 docs: More ignored files 2020-12-02 19:05:41 +00:00
Emmanuele Bassi
8f6e3848f6 docs: Remove duplicate symbol 2020-12-02 19:05:41 +00:00
Emmanuele Bassi
3548350dfa docs: Add missing GdkDragSurfaceInterface gtk-doc annotation 2020-12-02 19:05:41 +00:00
Emmanuele Bassi
caae240bc7 docs: Ignore harder
First of all, we must list *all* ignored headers. Since we have public
headers in the x11 and wayland directories, we must explicitly declare
all headers that we consider private under those directories.

The "quartz" subdirectory was renamed "macos", with the new macOS
backend. The "mir" directory was removed, so there's no need to ignore
it.

We are also missing a bunch of ignored headers in the top-level gdk
directory.

Finally, pass the list of ignored files to gtkdoc-mkdb, so we won't get
missing declaration warnings.
2020-12-02 19:05:41 +00:00
Emmanuele Bassi
f5f6ceece5 docs: Remove private symbols from the API reference 2020-12-02 19:05:41 +00:00
Emmanuele Bassi
4caceb5dd4 Remove gtk-doc annotation from private symbols
Keep the documentation, just tweak it so that gtk-doc won't try to find
the declarations of these private symbols.
2020-12-02 19:05:41 +00:00
Matthias Clasen
3da41b6021 Merge branch 'wip/chergert/gdk-macos-for-master' into 'master'
macos: fix window stacking

See merge request GNOME/gtk!2907
2020-12-02 18:38:14 +00:00
Christian Hergert
9b9fb4d7a3 macos: place above transient-for when presenting
We need to re-attach to the transient-for window whenever we present or
we risk getting placed behind the window by the display server. Apparently
that setting does not persist across a hide of the NSWindow.
2020-12-02 10:21:16 -08:00
Christian Hergert
ca8b00e871 macos: specify a window level for surfaces 2020-12-02 10:15:43 -08:00
Matthias Clasen
4434889e41 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2905
2020-12-02 15:57:39 +00:00
Bilal Elmoussaoui
475352fbc0 StringList: add missing nullability annotations 2020-12-02 10:36:29 -05:00
Bilal Elmoussaoui
ad30ac3932 Shortcut: add missing nullability annotations 2020-12-02 10:29:16 -05:00
Bilal Elmoussaoui
9d52ca1887 StringFilter: get_search fix nullable annotation 2020-12-02 10:28:07 -05:00
Bilal Elmoussaoui
ec537d75e4 Text: add missing nullability annotations 2020-12-02 10:28:07 -05:00
Bilal Elmoussaoui
b47ea9421f TextView: add missing nullability annotations 2020-12-02 10:28:07 -05:00
Bilal Elmoussaoui
845d2e5433 TreeModel: add missing nullability annotations 2020-12-02 10:28:07 -05:00
Bilal Elmoussaoui
50310f7b14 TreeView: add missing nullability annotations 2020-12-02 10:28:07 -05:00
Matthias Clasen
af944aa74c widget: Add a missing nullability annotation 2020-12-02 10:08:58 -05:00
Matthias Clasen
b5077d02ed Clarify the docs for gtk_widget_class_set_css_name
Reword, and mention the default css name.
2020-12-02 10:06:01 -05:00
Bilal Elmoussaoui
6a3bd1c4d1 window: default_icon_name can be null 2020-12-02 10:00:18 -05:00
Emmanuele Bassi
2fcd0e21bd Merge branch 'ebassi/for-master' into 'master'
Various documentation fixes

See merge request GNOME/gtk!2900
2020-12-02 13:40:25 +00:00
Daniel Mustieles
5127726bbc Updated Spanish translation 2020-12-02 13:54:32 +01:00
Daniel Mustieles
db456a70ee Updated Spanish translation 2020-12-02 09:26:08 +01:00
Emmanuele Bassi
770e848953 Merge branch 'wip/chergert/gdk-macos-for-master' into 'master'
macos: various macos improvements for GTK 4

See merge request GNOME/gtk!2902
2020-12-02 01:14:30 +00:00
Christian Hergert
9e1dd15e31 macos: use Cairo renderer by default
Until the GL renderer is working on macOS OpenGL, we need to default
to the Cairo renderer.
2020-12-01 16:24:15 -08:00
Christian Hergert
27b9a9e7ef macos: glFlush() when switching GL contexts
The Mac OpenGL programming guide suggests that you glFlush() before changing
contexts to ensure that the commands have been submitted.
2020-12-01 16:19:04 -08:00
Christian Hergert
a020c901ba macos: treat some toplevel NSWindow like document windows
This makes the window animate in by the window manager like other
application windows on macOS. Currently ignored for transient windows.
2020-12-01 16:19:04 -08:00
Emmanuele Bassi
cdad68e858 docs: Ignore generated Wayland protocol file 2020-12-01 18:03:31 +00:00
Emmanuele Bassi
ef36028526 docs: Ignore more private files 2020-12-01 18:01:33 +00:00
Emmanuele Bassi
69b1b19315 docs: Annotate missing symbols 2020-12-01 17:28:16 +00:00
Emmanuele Bassi
516f71bbdc Use the appropriate prefix for GtkBuilderClosureFlags
Facilitate the job of glib-mkenums, and ensure that the enumeration
nicknames are computed reliably.
2020-12-01 17:26:34 +00:00
Emmanuele Bassi
d820fea7a4 docs: Annotate GtkBuildableParser 2020-12-01 17:21:45 +00:00
Emmanuele Bassi
3e8d157118 docs: Hide GtkBitsetIter fields 2020-12-01 17:18:38 +00:00
Emmanuele Bassi
67f45940ce docs: Annotate GtkAssistant::escape action signal 2020-12-01 17:18:23 +00:00
Emmanuele Bassi
95400e6451 docs: Annotate GtkAppChooserButton::changed 2020-12-01 17:16:05 +00:00
Emmanuele Bassi
d46fe31f54 docs: Ignore more files 2020-12-01 15:51:52 +00:00
Emmanuele Bassi
4f67be1c8e docs: Add missing annotations for GtkTextTagTable 2020-12-01 15:51:52 +00:00
Emmanuele Bassi
c13e164f25 Make GtkCenterLayout accessors more idiomatic
Add argument validation, and emit a layout-changed signal whenever the
start, center, and end widgets change.
2020-12-01 15:51:52 +00:00
Emmanuele Bassi
eba8f36d4f docs: Fix annotations in GtkCenterLayout
Missing ':' separator.
2020-12-01 15:51:52 +00:00
Emmanuele Bassi
37f11ab77d docs: Annotate GskRenderer 2020-12-01 15:51:52 +00:00
Emmanuele Bassi
8b898818c2 docs: Annotate the GL shader objects 2020-12-01 15:51:52 +00:00
Emmanuele Bassi
0f62ab6c42 docs: Annotate all render node types 2020-12-01 15:51:52 +00:00
Emmanuele Bassi
c524b72d13 docs: Annotate structure types used by GskRenderNodes 2020-12-01 15:51:52 +00:00
Emmanuele Bassi
b5313dbd4d docs: Annotate GdkDeviceTool 2020-12-01 15:51:52 +00:00
Emmanuele Bassi
b9a1827da7 docs: Annotate GdkGLTexture 2020-12-01 13:48:07 +00:00
Emmanuele Bassi
1057189ea2 docs: Annotate GdkMemoryTexture 2020-12-01 13:47:56 +00:00
Emmanuele Bassi
879b2845ad docs: Annotate GdkPaintable
The dummy typedef needs a gtk-doc stanza, and the interface
documentation needs to be slightly clarified.
2020-12-01 13:44:51 +00:00
Emmanuele Bassi
ecce3756d4 docs: Annotate GdkPopup 2020-12-01 13:42:07 +00:00
Emmanuele Bassi
6e4dd5811d docs: Annotate GdkSnapshot 2020-12-01 13:41:28 +00:00
Emmanuele Bassi
598e1304f6 docs: Annotate the GdkToplevel interface 2020-12-01 13:39:48 +00:00
Emmanuele Bassi
e3fbc0ee9c docs: Fix typo in the GdkTolevelLayout annotation 2020-12-01 13:38:33 +00:00
Emmanuele Bassi
4021734047 docs: Annotate the GdkContentProviderClass structure 2020-12-01 13:38:12 +00:00
Emmanuele Bassi
5a307fa7f3 docs: Ignore more private headers 2020-12-01 13:37:59 +00:00
Matthias Clasen
617d12fd77 Merge branch 'sophie-h/gtk-nullables-2'
Merge Sophie's nullable annotations, with some documentation
fixups on top.
2020-11-30 23:43:44 -05:00
Matthias Clasen
837f398a9b columnviewcolumn: Improve docs
Mention what setting sorter to NULL means.
2020-11-30 23:40:03 -05:00
Matthias Clasen
e18211deca centerlayout: Improve docs
Explain what passing NULL does.
2020-11-30 23:36:23 -05:00
Jordi Mas
32a547cc3e Update Catalan translation 2020-11-30 22:35:47 +01:00
Matthias Clasen
365afa381a Merge branch 'arnaudb/annotate-set-title' into 'master'
Add "nullable" annotation.

See merge request GNOME/gtk!2895
2020-11-30 21:14:28 +00:00
Matthias Clasen
b7d3c073f8 NEWS: Updates 2020-11-30 14:00:26 -05:00
Matthias Clasen
56b0095622 Merge branch 'master' into 'master'
broadway: make header name parsing case-insensitve

Closes #3406

See merge request GNOME/gtk!2894
2020-11-30 17:55:27 +00:00
Matthias Clasen
39f0c48eb2 Apply 1 suggestion(s) to 1 file(s) 2020-11-30 17:44:30 +00:00
Matthias Clasen
7d24e1405e Apply 1 suggestion(s) to 1 file(s) 2020-11-30 17:42:39 +00:00
Matthias Clasen
3680ae220a Merge branch 'matthiasc/for-master' into 'master'
build: Use link_whole for linking our convenience libs

See merge request GNOME/gtk!2899
2020-11-30 15:49:25 +00:00
Matthias Clasen
f309fa21c9 build: Use link_whole for linking our convenience libs
Without this, we lose exported symbols from e.g. libgsk
that are not used elsewhere in the code.
2020-11-30 09:56:55 -05:00
Matthias Clasen
61e7326f22 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

Closes #3364

See merge request GNOME/gtk!2898
2020-11-30 14:44:15 +00:00
Timm Bäder
dc13ff97e2 modelbutton: Reset active menu item on pointer leave
We don't want to leave an active menu item behind if the pointer doesn't
enter another menu item.
This matches the old GtkMenu behavior
2020-11-30 09:23:03 -05:00
Timm Bäder
af28237569 popovermenu: Connect to right controller signal
leave is emitted before the new contains-pointer value is set, so the
signal handler wasn't working right.
2020-11-30 09:22:57 -05:00
Timm Bäder
ff8de0a93f eventcontrollermotion: Notify by pspec 2020-11-30 09:22:49 -05:00
Timm Bäder
aefabcc056 popovermenu: Pull variable declaration in closest scope 2020-11-30 09:22:41 -05:00
Timm Bäder
1d6c6fc3b8 shortcutcontroller: Separate trigger/action early returns
We take this early return in update_accel over 36k times when starting
the widget factory and always because the action is not a named action.
2020-11-30 09:22:34 -05:00
Timm Bäder
8645773fc6 shortcutcontroller: Pass the muxer to update_accel()
We only needed the widget to get its action muxer. And this way we don't
have to call gtk_widget_get_action_muxer() dozens of times, just once in
set_widget().
2020-11-30 09:22:29 -05:00
Timm Bäder
d663909159 shortcutcontroller: Use priv->shortcuts directly in set_widget()
Instead of treating the shortcut controller itself as a GListModel,
which just passes everything along from priv->shortcuts.
2020-11-30 09:22:21 -05:00
Timm Bäder
e3ff92bc87 shortcutcontroller: Save signal handler ID
gtk_shortcut_controller_finalize() used to take ~13.8% when closing the
complex listbox demo in gtk4-demo. Now it takes nothing.
2020-11-30 09:21:57 -05:00
Timm Bäder
2d43ecf8ca widget: root child before emitting child observer signals
Try to avoid the childen_observer signal handlers screwing up internal
state.

Fixes #3364
2020-11-30 09:21:52 -05:00
Timm Bäder
5f4beb711f widgetprivate: Remove unused function 2020-11-30 09:21:42 -05:00
Timm Bäder
da514187f5 gl renderer: Make minimal rounded rects more minimal 2020-11-30 09:21:34 -05:00
Matthias Clasen
6bd9ce7b55 docs: Ignore more generated Wayland protocol headers
These inject mysterious words like Airbrush, Lense and
Mouse into the list of undocumented apis. No need for that.
2020-11-30 09:21:24 -05:00
Matthias Clasen
ec21d354b9 gsk: doc fixups 2020-11-30 09:21:24 -05:00
Matthias Clasen
8cf4ce5d9e Merge branch 'ebassi/cell-renderer-get-size' into 'master'
Remove GtkCellRendererClass.get_size()

See merge request GNOME/gtk!2896
2020-11-30 14:09:03 +00:00
Emmanuele Bassi
09b6c37e1d Merge branch 'ebassi/for-master' into 'master'
Blend nodes might have NULL top/bottom nodes

See merge request GNOME/gtk!2891
2020-11-30 13:10:25 +00:00
Piotr Drąg
3161dbfff2 Update Polish translation 2020-11-29 12:11:26 +01:00
Yuri Chornoivan
8412928a14 Update Ukrainian translation 2020-11-29 07:53:56 +00:00
Emmanuele Bassi
60a7830ba5 Remove GtkCellRendererClass.get_size()
The get_size() vfuncs is deprecated in GTK3, and only used as a
fallback path for cell renderers that do not implement preferred
size virtual functions.
2020-11-28 19:21:24 +00:00
Emmanuele Bassi
ac473282a2 Port CellRendererGraph to preferred size vfuncs
Drop use of GtkCellRendererClass.get_size()
2020-11-28 19:21:24 +00:00
Emmanuele Bassi
20f9e0f144 Port GtkCellRendererProgress to preferred size vfuncs
Drop the use of GtkCellRendererClass.get_size()
2020-11-28 19:21:24 +00:00
Emmanuele Bassi
71a9e5d8c2 Port GtkCellRendererToggle to preferred size vfuncs
Drop the use of GtkCellRendererClass.get_size()
2020-11-28 19:21:24 +00:00
Emmanuele Bassi
a605fcc2bd Port GtkCellRendererSpinner to preferred size vfuncs
Drop the use of GtkCellRendererClass.get_size()
2020-11-28 19:21:23 +00:00
Emmanuele Bassi
3eaebf1e0b Port GtkCellRendererPixbuf to preferred size vfuncs
Drop the GtkCellRendererClass.get_size() override.
2020-11-28 19:21:23 +00:00
Аляксей
e540ccbd34 Update Belarusian translation 2020-11-28 14:30:43 +00:00
Arnaud Bonatti
55ce61d1a8 Add "nullable" annotation. 2020-11-28 12:15:38 +01:00
Jakub Steiner
8e14f43398 Merge branch 'wip/jimmac/dark-prelights' into 'master'
wip/jimmac/dark prelights

Closes #3380

See merge request GNOME/gtk!2892
2020-11-27 18:14:09 +00:00
Jakub Steiner
bbbcc72460 Adwaita,HC: use dark prelights
- increase :hover visibility by going darker rather than lighter
  puppies died.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3380
2020-11-27 18:17:12 +01:00
Anders Jonsson
c2b1b00e52 Update Swedish translation 2020-11-27 13:35:03 +00:00
Anders Jonsson
05c2e35c5d Update Swedish translation 2020-11-27 13:31:30 +00:00
Benjamin Beichler
8efde9c48c broadway: make header name parsing case-insensitve
since http RFC state that the header names should be processed case in-sensitive, broadway should not rely on the actual case. E.g. the go-language libraries tend to rewrite the header, which cause problems with e.g. Caddy

Fixes #3406
2020-11-27 12:05:51 +01:00
Emmanuele Bassi
247fc2e471 Blend nodes might have NULL top/bottom nodes
We have code in place to handle a NULL node in the state when dealing
with blend nodes, but we don't always check for NULL, which leads to
warnings in the CSS Blend modes demo.
2020-11-26 00:21:11 +00:00
Matthias Clasen
9d2ca90b4c popover: Fix a typo
s/Wether/Whether/

Fixes #3393
2020-11-25 13:59:16 -05:00
Emmanuele Bassi
3a5f8b6192 Merge branch 'ebassi/for-master' into 'master'
Ebassi/for master

Closes #3404 and #3403

See merge request GNOME/gtk!2890
2020-11-25 18:43:53 +00:00
Emmanuele Bassi
16b5a88097 a11y: Check before disconnecting Text signals
Use the same initial check for the accessible object type that we use
when connecting the signal, in case we try to disconnect signals on
different widgets. Additionally, check before accessing data that might
have already been removed.

Fixes: #3403
2020-11-25 18:15:04 +00:00
Emmanuele Bassi
fdf2e046c3 a11y: Check before disconnecting selection signals
If the selection data has already been cleared we should just bail out.

Fixes: #3404
2020-11-25 18:13:54 +00:00
Jakub Steiner
531d57f30c Merge branch 'wip/jimmac/menus-darker' into 'master'
Adwaita: darker selected menuitem + sidebars

Closes #3390

See merge request GNOME/gtk!2881
2020-11-25 13:42:55 +00:00
Jordi Mas i Hernandez
841bf67bb9 Update Catalan translation 2020-11-25 13:42:11 +00:00
Jakub Steiner
399b457f54 Adwaita: darker selected menuitem + sidebars
- without sacrificing the fg/bg contrast too much, increase
  selected item visibility

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3390
2020-11-25 14:28:19 +01:00
Sophie Herold
fed734edfc Fix some nullable return annotations 2 2020-11-24 19:27:33 +01:00
Matthias Clasen
c84c014536 Merge branch 'wip/chergert/for-master' into 'master'
textview: fix precondition assertions

Closes #3386

See merge request GNOME/gtk!2886
2020-11-24 17:14:53 +00:00
Christian Hergert
1e994419ee textview: fix precondition assertions
It is a programmer error to call this with a child widget that has not
been placed within the GtkTextView.

Fixes #3386
2020-11-24 08:29:52 -08:00
Matthias Clasen
7b22c44b39 Merge branch 'fix-integer-overflow' into 'master'
gdk/win32: fix integer overflow in monitor refresh rate calculation

Closes #3394

See merge request GNOME/gtk!2884
2020-11-24 16:22:49 +00:00
Anders Jonsson
2e744260e0 Update Swedish translation 2020-11-23 22:09:28 +00:00
Volker Rümelin
7190a31b5f gdk/win32: fix integer overflow in monitor refresh rate calculation
In gdk/win32/gdkmonitor-win32.c in function
populate_monitor_devices_from_display_config() refresh->Numerator * 1000
overflows for refresh->Numerator > 4294976.

Cast the factor 1000 to UINT64 to prevent the overflow.

Fixes #3394
2020-11-23 21:42:58 +01:00
Matthias Clasen
729f007379 Merge branch 'no-more-devel-headers' into 'master'
Drop devel styling from our windows

See merge request GNOME/gtk!2882
2020-11-23 19:01:44 +00:00
Matthias Clasen
b75b359f19 Drop devel styling from our windows
We are about to do a stable release. Time to get used
again to plain old, boring header bars.
2020-11-23 12:10:01 -05:00
Emmanuele Bassi
d7de720275 Merge branch 'ebassi/for-master' into 'master'
Ebassi/for master

See merge request GNOME/gtk!2876
2020-11-23 15:41:03 +00:00
Emmanuele Bassi
ef86e46238 a11y: Cache the accessibility bus address
Just check for it once; doing it every time we failed to create an
ATContext is just going to fill up the logs.
2020-11-23 14:34:46 +00:00
Emmanuele Bassi
0a46baeb56 a11y: Turn critical warnings into debug messages
The accessibility bus might not be available, and if it isn't the case,
it means something has failed at a level where the user can't do much
about it. There's no need to emit a critical warning.
2020-11-23 14:34:46 +00:00
Emmanuele Bassi
fd3a6299ce Merge branch 'ebassi/glib-min-version' into 'master'
Ebassi/glib min version

See merge request GNOME/gtk!2880
2020-11-23 14:33:20 +00:00
Emmanuele Bassi
803b147483 Disable deprecation warnings from GLib
We don't want to test the latest changes in GLib in our own build.
2020-11-23 13:04:11 +00:00
Emmanuele Bassi
1f44319588 Drop redundant dependencies
PangoCairo already depends on Pango; Cairo-gobject already depends on
Cairo.
2020-11-23 13:04:11 +00:00
Emmanuele Bassi
505478bc59 Drop GLib dependency from GTK's declared dependencies
We depend on GObject, which already depends on GLib; on older versions
of Meson, this ends up trying to depend on the system copy of GLib,
instead of the sub-project copy, in case the version of GLib we have
installed is too old.
2020-11-23 12:29:32 +00:00
Emmanuele Bassi
de7833b6a0 Use the right GLib macros for version checking
There's a typo in the name, and we never noticed.
2020-11-23 12:06:22 +00:00
Emmanuele Bassi
3a1b2083d6 Do not depend on GLib API introduced after 2.66
To avoid bleeding edge deprecations we use GLIB_VERSION_MIN_REQUIRED and
GLIB_VERSION_MAX_ALLOWED. Since we depend on GLib 2.66, we cannot use
API introduced in 2.67, even when conditionally compiled.
2020-11-23 12:06:22 +00:00
498 changed files with 86929 additions and 37627 deletions

View File

@@ -56,6 +56,12 @@ If the issue includes a crash, you should also include:
0. the eventual warnings printed on the terminal
0. a backtrace, obtained with tools such as GDB or LLDB
It is fine to include screenshots of screen recordings to demonstrate
an issue that is best to understand visually, but please don't just
dump screen recordings without further details into issues. It is
essential that the problem is described in enough detail to reproduce
it without watching a video.
For small issues, such as:
- spelling/grammar fixes in the documentation

138
NEWS
View File

@@ -1,3 +1,141 @@
Overview of Changes in GTK 4.0
==============================
* Fix problems with synthetic motion events affecting frame rates
* Fix problems with implicit grabs affecting widget states
* Fix problems with zoom mode on scales getting stuck
* Fix submenu closing by outside clicks
* Rename GtkWindow:fullscreen to :fullscreened to help
language bindings
* Bump the soname. Stable GTK 4 releases use libgtk-4.0.so.1.xxxx.y
* Adwaita:
- Reduce hover transition effects in lists
- Special-case header buttons
* Demos:
- Remove NoDisplay from desktop files
- Autoplay the video in widget-factory
* Translation updates:
Catalan
Norwegian Bokmål
Polish
Spanish
Swedish
Romanian
Ukrainian
Overview of Changes in 3.99.5
=============================
* Accessibility:
- Map presentation role according to Core-AAM
- Use presentation role for spacers in list views
- Set proper roles, relations and descriptions on more widgets
- Expand the documentation
- Use a single GTK_A11Y environment variable and document it
- Serveral memory leak and crash fixes
- Initialize AT contexts lazily
- Improve the API for storing lists in relations
- Implement more of the Component interface
- Implement the Cache interface
- Implement ScrollSubstringTo for GtkTextView
* Introspection:
- Add many missing annotations to APIs
- In particular, nullability annotation fixes for rust
* Touch support:
- Fix issues with text handles
- Fix interaction between touch scrolling and focus
- Fix active state updates for touch events
- Allow pressing buttons with multiple fingers
* GtkScrolledWindow:
- Accumulate velocity with kinetic scrolling
* GtkSearchEntry:
- Use a better clear icon
* GtkTreeView:
- Remove the deprecated GtkCellRendererClass.get_size vfunc
* GtkBuilder:
- Be stricter about <requires>
- Make gtk-builder-tool simplify update <requires>
* GtkFileChooser:
- Remove GtkFileChooserButton
* GtkWindow:
- Replace gtk_window_get_size with gtk_window_get_default_size
- Add maximized and fullscreen properties
* Make the inspector available in non-debug builds
* CSS:
- Support conic gradients
* Adwaita:
- Round all window corners
- Round submenus
- Remove the 'chin' on menus
- Industrial style menuitems
- Improved tooltip styling
- Unified sidebar styles
- Dark prelight
- Don't backdrop labels
* GSK:
- Rename render node apis from peek to get
* Make GLES work in the absence of GL_ARB_timer_query
* Rework the way size allocation is integrated in the
frame cycle
* Wayland:
- Support gtk_shell1 version 3 (startup notification
and activation)
- Implmement minimization
* OS X:
- Mostly working GL renderer
- Search engine updates
- Fix rendering artifacts with hover transitions
- Fix kinetic scrolling deceleration
* Windows:
- Fix key event generation, making text input work
* Documentation:
- Add missing enumerations, symbols and types
- Lots of smaller fixes
* Demos:
- Make the constraints demo more useful
- Make search more obvious
- Add a suggestion entry demo
- Consistency improvements
- Use native file choosers
- Drop 'devel' styling
* Translation updates:
Belarusian
Catalan
Polish
Spanish
Swedish
Ukrainian
Overview of Changes in 3.99.4
=============================

View File

@@ -17,7 +17,7 @@ license fees or royalties.
The official download location
- https://download.gnome.org/sources/gtk+
- https://download.gnome.org/sources/gtk/
The official web site
@@ -49,11 +49,11 @@ In order to build GTK you will need:
You will also need various dependencies, based on the platform you are
building for:
- [GLib](https://download.gnome.org/sources/glib)
- [GdkPixbuf](https://download.gnome.org/sources/gdk-pixbuf)
- [GObject-Introspection](https://download.gnome.org/sources/gobject-introspection)
- [Cairo](https://www.cairographics.org)
- [Pango](https://download.gnome.org/sources/pango)
- [GLib](https://download.gnome.org/sources/glib/)
- [GdkPixbuf](https://download.gnome.org/sources/gdk-pixbuf/)
- [GObject-Introspection](https://download.gnome.org/sources/gobject-introspection/)
- [Cairo](https://www.cairographics.org/)
- [Pango](https://download.gnome.org/sources/pango/)
- [Epoxy](https://github.com/anholt/libepoxy)
- [Graphene](https://github.com/ebassi/graphene)
- [Xkb-common](https://github.com/xkbcommon/libxkbcommon)

View File

@@ -1,20 +1,21 @@
#!/usr/bin/env python3
import os
import sys
import subprocess
if 'DESTDIR' not in os.environ:
gtk_api_version = sys.argv[1]
gtk_abi_version = sys.argv[2]
import os
import sys
import subprocess
if 'DESTDIR' not in os.environ:
gtk_api_version = sys.argv[1]
gtk_abi_version = sys.argv[2]
gtk_libdir = sys.argv[3]
gtk_datadir = sys.argv[4]
gtk_moduledir = os.path.join(gtk_libdir, 'gtk-' + gtk_api_version, gtk_abi_version)
gtk_printmodule_dir = os.path.join(gtk_moduledir, 'printbackends')
gtk_immodule_dir = os.path.join(gtk_moduledir, 'immodules')
print('Compiling GSettings schemas...')
gtk_bindir = sys.argv[5]
gtk_moduledir = os.path.join(gtk_libdir, 'gtk-' + gtk_api_version, gtk_abi_version)
gtk_printmodule_dir = os.path.join(gtk_moduledir, 'printbackends')
gtk_immodule_dir = os.path.join(gtk_moduledir, 'immodules')
print('Compiling GSettings schemas...')
glib_compile_schemas = subprocess.check_output(['pkg-config',
'--variable=glib_compile_schemas',
'gio-2.0']).strip()
@@ -22,13 +23,14 @@ if 'DESTDIR' not in os.environ:
# pkg-config variables only available since GLib 2.62.0.
glib_compile_schemas = 'glib-compile-schemas'
subprocess.call([glib_compile_schemas,
os.path.join(gtk_datadir, 'glib-2.0', 'schemas')])
print('Updating icon cache...')
subprocess.call(['gtk4-update-icon-cache', '-q', '-t' ,'-f',
os.path.join(gtk_datadir, 'icons', 'hicolor')])
print('Updating module cache for print backends...')
os.path.join(gtk_datadir, 'glib-2.0', 'schemas')])
print('Updating icon cache...')
update_icon_cache = os.path.join(gtk_bindir, 'gtk4-update-icon-cache')
subprocess.call([update_icon_cache, '-q', '-t' ,'-f',
os.path.join(gtk_datadir, 'icons', 'hicolor')])
print('Updating module cache for print backends...')
os.makedirs(gtk_printmodule_dir, exist_ok=True)
gio_querymodules = subprocess.check_output(['pkg-config',
'--variable=gio_querymodules',
@@ -37,7 +39,7 @@ if 'DESTDIR' not in os.environ:
# pkg-config variables only available since GLib 2.62.0.
gio_querymodules = 'gio-querymodules'
subprocess.call([gio_querymodules, gtk_printmodule_dir])
print('Updating module cache for input methods...')
print('Updating module cache for input methods...')
os.makedirs(gtk_immodule_dir, exist_ok=True)
subprocess.call([gio_querymodules, gtk_immodule_dir])

View File

@@ -1,9 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<template class="ConstraintEditorWindow" parent="GtkApplicationWindow">
<style>
<class name="devel"/>
</style>
<property name="title" translatable="yes">GTK Constraint Editor</property>
<property name="default-width">1024</property>
<property name="default-height">768</property>

View File

@@ -8,14 +8,16 @@ constraint_editor_sources = [
]
constraint_editor_resources = gnome.compile_resources('constraint_editor_resources',
'constraint-editor.gresource.xml',
source_dir: '.')
'constraint-editor.gresource.xml',
source_dir: '.',
)
executable('gtk4-constraint-editor',
constraint_editor_sources, constraint_editor_resources,
c_args: common_cflags,
dependencies: libgtk_dep,
include_directories: confinc,
gui_app: true,
link_args: extra_demo_ldflags,
install: false)
sources: [ constraint_editor_sources, constraint_editor_resources, ],
c_args: common_cflags,
dependencies: libgtk_dep,
include_directories: confinc,
gui_app: true,
link_args: extra_demo_ldflags,
install: false,
)

View File

@@ -67,7 +67,7 @@ vec2 raySphere(vec3 ro, vec3 rd, vec4 sphere) {
return vec2(t0, t1);
}
float noise1(vec2 p) {
float noize1(vec2 p) {
vec2 n = mod2(p, vec2(cellWidth));
vec2 hh = hash(sqrt(2.0)*(n+1000.0));
hh.x *= hh.y;
@@ -81,7 +81,7 @@ float noise1(vec2 p) {
return h*0.25;
}
float noise2(vec2 p) {
float noize2(vec2 p) {
vec2 n = mod2(p, vec2(cellWidth));
vec2 hh = hash(sqrt(2.0)*(n+1000.0));
hh.x *= hh.y;
@@ -114,7 +114,7 @@ float height(vec2 p, float dd, int mx) {
int i = 0;
for (; i < 4;++i) {
float nn = a*noise2(p);
float nn = a*noize2(p);
s += nn;
d += abs(a);
p += o;
@@ -130,7 +130,7 @@ float height(vec2 p, float dd, int mx) {
mx = int(mix(float(4), float(mx), step(rdd, far)));
for (; i < mx; ++i) {
float nn = a*noise1(p);
float nn = a*noize1(p);
s += nn;
d += abs(a);
p += o;

View File

@@ -465,7 +465,7 @@ demo_application_window_size_allocate (GtkWidget *widget,
baseline);
if (!window->maximized && !window->fullscreen)
gtk_window_get_size (GTK_WINDOW (window), &window->width, &window->height);
gtk_window_get_default_size (GTK_WINDOW (window), &window->width, &window->height);
}
static void

View File

@@ -20,7 +20,7 @@ mainImage(out vec4 fragColor, in vec2 fragCoord, in vec2 resolution, in vec2 uv)
float b = 1.0/distance (pos, p2);
float sum = r + g + b;
float alpha = 1.0 - pow (1.0/(sum), 40)*pow (10.0, 40*0.7);
float alpha = 1.0 - pow (1.0/(sum), 40.0)*pow (10.0, 40.0*0.7);
fragColor = vec4 (r*0.5, g*0.5, b*0.5, 1.0) * alpha;
}

View File

@@ -177,7 +177,7 @@ float ccell2(vec2 p, float r) {
float df(vec2 p, float scale, inout vec2 nn) {
p /= scale;
nn = hextile(p);
nn = round(nn);
nn = floor(nn + 0.5);
float r = hash(nn);
float d;;

View File

@@ -179,7 +179,7 @@ float ccell2(vec2 p, float r) {
float df(vec2 p, float scale, inout vec2 nn) {
p /= scale;
nn = hextile(p);
nn = round(nn);
nn = floor(nn + 0.5);
float r = hash(nn);
float d;;

View File

@@ -319,6 +319,9 @@
<file>paintable_svg.c</file>
<file>panes.c</file>
<file>password_entry.c</file>
<file>path_fill.c</file>
<file>path_maze.c</file>
<file>path_text.c</file>
<file>peg_solitaire.c</file>
<file>pickers.c</file>
<file>printing.c</file>
@@ -403,6 +406,9 @@
<gresource prefix="/fontrendering">
<file>fontrendering.ui</file>
</gresource>
<gresource prefix="/path_text">
<file>path_text.ui</file>
</gresource>
<gresource prefix="/org/gtk/Demo4">
<file>icons/16x16/actions/application-exit.png</file>
<file>icons/16x16/actions/document-new.png</file>

View File

@@ -97,9 +97,9 @@ demo3_widget_size_allocate (GtkWidget *widget,
/* Since we are not using a layout manager (who would do this
* for us), we need to allocate a size for our menu by calling
* gtk_native_check_resize().
* gtk_popover_present().
*/
gtk_native_check_resize (GTK_NATIVE (self->menu));
gtk_popover_present (GTK_POPOVER (self->menu));
}
static void

View File

@@ -142,16 +142,39 @@ load_file (GtkStringList *list,
}
static void
file_selected_cb (GtkWidget *button,
GtkStringList *stringlist)
open_response_cb (GtkNativeDialog *dialog,
int response,
GtkStringList *stringlist)
{
GFile *file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (button));
gtk_native_dialog_hide (dialog);
if (file)
if (response == GTK_RESPONSE_ACCEPT)
{
GFile *file;
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
load_file (stringlist, file);
g_object_unref (file);
}
gtk_native_dialog_destroy (dialog);
}
static void
file_open_cb (GtkWidget *button,
GtkStringList *stringlist)
{
GtkFileChooserNative *dialog;
dialog = gtk_file_chooser_native_new ("Open file",
GTK_WINDOW (gtk_widget_get_root (button)),
GTK_FILE_CHOOSER_ACTION_OPEN,
"_Load",
"_Cancel");
gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (dialog), TRUE);
g_signal_connect (dialog, "response", G_CALLBACK (open_response_cb), stringlist);
gtk_native_dialog_show (GTK_NATIVE_DIALOG (dialog));
}
GtkWidget *
@@ -189,8 +212,8 @@ do_listview_words (GtkWidget *do_widget)
header = gtk_header_bar_new ();
gtk_header_bar_set_show_title_buttons (GTK_HEADER_BAR (header), TRUE);
open_button = gtk_file_chooser_button_new ("_Open", GTK_FILE_CHOOSER_ACTION_OPEN);
g_signal_connect (open_button, "file-set", G_CALLBACK (file_selected_cb), stringlist);
open_button = gtk_button_new_with_mnemonic ("_Open");
g_signal_connect (open_button, "clicked", G_CALLBACK (file_open_cb), stringlist);
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), open_button);
gtk_window_set_titlebar (GTK_WINDOW (window), header);

View File

@@ -17,9 +17,6 @@
</section>
</menu>
<object class="GtkApplicationWindow" id="window">
<style>
<class name="devel"/>
</style>
<property name="default-width">800</property>
<property name="default-height">600</property>
<child type="titlebar">
@@ -31,6 +28,16 @@
<property name="label" translatable="yes">Run</property>
</object>
</child>
<child>
<object class="GtkToggleButton">
<property name="icon-name">edit-find-symbolic</property>
<property name="valign">center</property>
<property name="active" bind-source="searchbar" bind-property="search-mode-enabled" bind-flags="bidirectional|sync-create"/>
<accessibility>
<property name="label" translatable="yes">Search</property>
</accessibility>
</object>
</child>
<child type="end">
<object class="GtkMenuButton" id="gear_menu_button">
<property name="valign">center</property>
@@ -46,31 +53,30 @@
<child>
<object class="GtkBox">
<child>
<object class="GtkScrolledWindow">
<style>
<class name="sidebar"/>
</style>
<property name="width-request">120</property>
<property name="hscrollbar-policy">never</property>
<property name="min-content-width">150</property>
<object class="GtkBox">
<property name="width-request">220</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="width-request">220</property>
<property name="orientation">vertical</property>
<object class="GtkSearchBar" id="searchbar">
<property name="key-capture-widget">window</property>
<child>
<object class="GtkSearchBar" id="searchbar">
<property name="key-capture-widget">window</property>
<child>
<object class="GtkSearchEntry" id="search-entry">
<accessibility>
<relation name="controls">listview</relation>
</accessibility>
</object>
</child>
<object class="GtkSearchEntry" id="search-entry">
<accessibility>
<relation name="controls">listview</relation>
</accessibility>
</object>
</child>
</object>
</child>
<child>
<object class="GtkScrolledWindow">
<style>
<class name="sidebar"/>
</style>
<property name="width-request">120</property>
<property name="hscrollbar-policy">never</property>
<property name="min-content-width">150</property>
<property name="vexpand">1</property>
<child>
<object class="GtkListView" id="listview">
<style>
@@ -87,7 +93,6 @@
</accessibility>
</object>
</child>
</object>
</child>
</object>

View File

@@ -68,6 +68,9 @@ demos = files([
'paintable_mediastream.c',
'panes.c',
'password_entry.c',
'path_fill.c',
'path_maze.c',
'path_text.c',
'peg_solitaire.c',
'pickers.c',
'printing.c',
@@ -100,31 +103,33 @@ demos = files([
gtkdemo_deps = [ libgtk_dep, ]
extra_demo_sources = files(['main.c',
'fontify.c',
'gtkfishbowl.c',
'fontplane.c',
'gtkgears.c',
'gtkshaderbin.c',
'gtkshadertoy.c',
'gtkshaderstack.c',
'gskshaderpaintable.c',
'puzzlepiece.c',
'bluroverlay.c',
'demoimage.c',
'demotaggedentry.c',
'demochild.c',
'demolayout.c',
'demowidget.c',
'demo2layout.c',
'singular_value_decomposition.c',
'four_point_transform.c',
'demo2widget.c',
'demo3widget.c',
'pixbufpaintable.c',
'script-names.c',
'unicode-names.c',
'suggestionentry.c'])
extra_demo_sources = files([
'main.c',
'fontify.c',
'gtkfishbowl.c',
'fontplane.c',
'gtkgears.c',
'gtkshaderbin.c',
'gtkshadertoy.c',
'gtkshaderstack.c',
'gskshaderpaintable.c',
'puzzlepiece.c',
'bluroverlay.c',
'demoimage.c',
'demotaggedentry.c',
'demochild.c',
'demolayout.c',
'demowidget.c',
'demo2layout.c',
'singular_value_decomposition.c',
'four_point_transform.c',
'demo2widget.c',
'demo3widget.c',
'pixbufpaintable.c',
'script-names.c',
'unicode-names.c',
'suggestionentry.c',
])
if harfbuzz_dep.found() and pangoft_dep.found()
demos += files(['font_features.c'])
@@ -147,14 +152,17 @@ endif
gtkdemo_args = [ '-DGDK_DISABLE_DEPRECATED', '-DGTK_DISABLE_DEPRECATED', ]
demos_h = custom_target('gtk4 demo header',
output: 'demos.h',
input: demos,
command: [ find_program('geninclude.py'), '@OUTPUT@', '@INPUT@' ])
output: 'demos.h',
input: demos,
command: [ find_program('geninclude.py'), '@OUTPUT@', '@INPUT@' ],
)
gtkdemo_resources = gnome.compile_resources('gtkdemo_resources',
'demo.gresource.xml',
source_dir: '.')
'demo.gresource.xml',
source_dir: '.',
)
# Use a subset of compiler flags
demo_cflags = []
foreach flag: common_cflags
if flag not in ['-Werror=missing-prototypes', '-Werror=missing-declarations', '-fvisibility=hidden']
@@ -163,30 +171,30 @@ foreach flag: common_cflags
endforeach
executable('gtk4-demo',
demos, demos_h, extra_demo_sources, gtkdemo_resources,
c_args: gtkdemo_args + demo_cflags,
dependencies: gtkdemo_deps,
include_directories: confinc,
gui_app: true,
link_args: extra_demo_ldflags,
install: true)
sources: [demos, demos_h, extra_demo_sources, gtkdemo_resources],
c_args: gtkdemo_args + demo_cflags,
dependencies: gtkdemo_deps,
include_directories: confinc,
gui_app: true,
link_args: extra_demo_ldflags,
install: true,
)
executable('gtk4-demo-application',
'application.c', gtkdemo_resources,
c_args: gtkdemo_args + common_cflags,
dependencies: gtkdemo_deps,
include_directories: confinc,
gui_app: true,
link_args: extra_demo_ldflags,
install: true)
sources: ['application.c', gtkdemo_resources],
c_args: gtkdemo_args + common_cflags,
dependencies: gtkdemo_deps,
include_directories: confinc,
gui_app: true,
link_args: extra_demo_ldflags,
install: true,
)
# icons
icontheme_dir = join_paths(gtk_datadir, 'icons/hicolor')
foreach size: ['scalable', 'symbolic']
install_subdir('data/' + size,
install_dir: icontheme_dir
)
install_subdir('data/' + size, install_dir: icontheme_dir)
endforeach
# desktop file

View File

@@ -7,4 +7,3 @@ Terminal=false
Type=Application
StartupNotify=true
Categories=Development;GTK;
NoDisplay=true

View File

@@ -13,19 +13,46 @@
static void
file_set (GtkFileChooserButton *button,
GtkWidget *picture)
open_response_cb (GtkNativeDialog *dialog,
int response,
GtkPicture *picture)
{
GFile *file;
GdkPaintable *paintable;
gtk_native_dialog_hide (dialog);
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (button));
if (response == GTK_RESPONSE_ACCEPT)
{
GFile *file;
GdkPaintable *paintable;
paintable = svg_paintable_new (file);
gtk_picture_set_paintable (GTK_PICTURE (picture), paintable);
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
paintable = svg_paintable_new (file);
gtk_picture_set_paintable (GTK_PICTURE (picture), paintable);
g_object_unref (paintable);
g_object_unref (file);
}
g_object_unref (paintable);
g_object_unref (file);
gtk_native_dialog_destroy (dialog);
}
static void
show_file_open (GtkWidget *button,
GtkPicture *picture)
{
GtkFileFilter *filter;
GtkFileChooserNative *dialog;
dialog = gtk_file_chooser_native_new ("Open node file",
GTK_WINDOW (gtk_widget_get_root (button)),
GTK_FILE_CHOOSER_ACTION_OPEN,
"_Load",
"_Cancel");
filter = gtk_file_filter_new ();
gtk_file_filter_add_mime_type (filter, "image/svg+xml");
gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filter);
gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (dialog), TRUE);
g_signal_connect (dialog, "response", G_CALLBACK (open_response_cb), picture);
gtk_native_dialog_show (GTK_NATIVE_DIALOG (dialog));
}
static GtkWidget *window;
@@ -35,7 +62,6 @@ do_paintable_svg (GtkWidget *do_widget)
{
GtkWidget *header;
GtkWidget *picture;
GtkFileFilter *filter;
GtkWidget *button;
GFile *file;
GdkPaintable *paintable;
@@ -49,17 +75,14 @@ do_paintable_svg (GtkWidget *do_widget)
gtk_window_set_title (GTK_WINDOW (window), "PaintableSVG");
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
button = gtk_file_chooser_button_new ("Select an SVG file", GTK_FILE_CHOOSER_ACTION_OPEN);
filter = gtk_file_filter_new ();
gtk_file_filter_add_mime_type (filter, "image/svg+xml");
gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (button), filter);
button = gtk_button_new_with_mnemonic ("_Open");
gtk_header_bar_pack_start (GTK_HEADER_BAR (header), button);
picture = gtk_picture_new ();
gtk_picture_set_can_shrink (GTK_PICTURE (picture), TRUE);
gtk_widget_set_size_request (picture, 16, 16);
g_signal_connect (button, "file-set", G_CALLBACK (file_set), picture);
g_signal_connect (button, "clicked", G_CALLBACK (show_file_open), picture);
gtk_window_set_child (GTK_WINDOW (window), picture);

359
demos/gtk-demo/path_fill.c Normal file
View File

@@ -0,0 +1,359 @@
/* Path/Fill
*
* This demo shows how to use PangoCairo to draw text with more than
* just a single color.
*/
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include "paintable.h"
#include "gsk/gskpathdashprivate.h"
#define GTK_TYPE_PATH_PAINTABLE (gtk_path_paintable_get_type ())
G_DECLARE_FINAL_TYPE (GtkPathPaintable, gtk_path_paintable, GTK, PATH_PAINTABLE, GObject)
struct _GtkPathPaintable
{
GObject parent_instance;
int width;
int height;
GskPath *path;
GdkPaintable *background;
};
struct _GtkPathPaintableClass
{
GObjectClass parent_class;
};
static int
gtk_path_paintable_get_intrinsic_width (GdkPaintable *paintable)
{
GtkPathPaintable *self = GTK_PATH_PAINTABLE (paintable);
if (self->background)
return MAX (gdk_paintable_get_intrinsic_width (self->background), self->width);
else
return self->width;
}
static int
gtk_path_paintable_get_intrinsic_height (GdkPaintable *paintable)
{
GtkPathPaintable *self = GTK_PATH_PAINTABLE (paintable);
if (self->background)
return MAX (gdk_paintable_get_intrinsic_height (self->background), self->height);
else
return self->height;
}
static void
gtk_path_paintable_snapshot (GdkPaintable *paintable,
GdkSnapshot *snapshot,
double width,
double height)
{
GtkPathPaintable *self = GTK_PATH_PAINTABLE (paintable);
#if 0
gtk_snapshot_push_fill (snapshot, self->path, GSK_FILL_RULE_WINDING);
#else
GskStroke *stroke = gsk_stroke_new (2.0);
gtk_snapshot_push_stroke (snapshot, self->path, stroke);
gsk_stroke_free (stroke);
#endif
if (self->background)
{
gdk_paintable_snapshot (self->background, snapshot, width, height);
}
else
{
gtk_snapshot_append_linear_gradient (snapshot,
&GRAPHENE_RECT_INIT (0, 0, width, height),
&GRAPHENE_POINT_INIT (0, 0),
&GRAPHENE_POINT_INIT (width, height),
(GskColorStop[8]) {
{ 0.0, { 1.0, 0.0, 0.0, 1.0 } },
{ 0.2, { 1.0, 0.0, 0.0, 1.0 } },
{ 0.3, { 1.0, 1.0, 0.0, 1.0 } },
{ 0.4, { 0.0, 1.0, 0.0, 1.0 } },
{ 0.6, { 0.0, 1.0, 1.0, 1.0 } },
{ 0.7, { 0.0, 0.0, 1.0, 1.0 } },
{ 0.8, { 1.0, 0.0, 1.0, 1.0 } },
{ 1.0, { 1.0, 0.0, 1.0, 1.0 } }
},
8);
}
gtk_snapshot_pop (snapshot);
}
static GdkPaintableFlags
gtk_path_paintable_get_flags (GdkPaintable *paintable)
{
GtkPathPaintable *self = GTK_PATH_PAINTABLE (paintable);
if (self->background)
return gdk_paintable_get_flags (self->background);
else
return GDK_PAINTABLE_STATIC_CONTENTS | GDK_PAINTABLE_STATIC_SIZE;
}
static void
gtk_path_paintable_paintable_init (GdkPaintableInterface *iface)
{
iface->get_intrinsic_width = gtk_path_paintable_get_intrinsic_width;
iface->get_intrinsic_height = gtk_path_paintable_get_intrinsic_height;
iface->snapshot = gtk_path_paintable_snapshot;
iface->get_flags = gtk_path_paintable_get_flags;
}
/* When defining the GType, we need to implement the GdkPaintable interface */
G_DEFINE_TYPE_WITH_CODE (GtkPathPaintable, gtk_path_paintable, G_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (GDK_TYPE_PAINTABLE,
gtk_path_paintable_paintable_init))
/* Here's the boilerplate for the GObject declaration.
* We don't need to do anything special here, because we keep no
* data of our own.
*/
static void
gtk_path_paintable_class_init (GtkPathPaintableClass *klass)
{
}
static void
gtk_path_paintable_init (GtkPathPaintable *self)
{
}
/* And finally, we add a simple constructor.
* It is declared in the header so that the other examples
* can use it.
*/
GdkPaintable *
gtk_path_paintable_new (GskPath *path,
GdkPaintable *background,
int width,
int height)
{
GtkPathPaintable *self;
self = g_object_new (GTK_TYPE_PATH_PAINTABLE, NULL);
self->path = path;
self->background = background;
if (self->background)
{
g_signal_connect_swapped (self->background, "invalidate-contents", G_CALLBACK (gdk_paintable_invalidate_contents), self);
g_signal_connect_swapped (self->background, "invalidate-size", G_CALLBACK (gdk_paintable_invalidate_size), self);
}
self->width = width;
self->height = height;
return GDK_PAINTABLE (self);
}
void
gtk_path_paintable_set_path (GtkPathPaintable *self,
GskPath *path)
{
g_clear_pointer (&self->path, gsk_path_unref);
self->path = gsk_path_ref (path);
gdk_paintable_invalidate_contents (GDK_PAINTABLE (self));
}
static GskPath *
create_hexagon (GtkWidget *widget)
{
GskPathBuilder *builder;
builder = gsk_path_builder_new ();
gsk_path_builder_move_to (builder, 120, 0);
gsk_path_builder_line_to (builder, 360, 0);
gsk_path_builder_line_to (builder, 480, 208);
gsk_path_builder_line_to (builder, 360, 416);
gsk_path_builder_line_to (builder, 120, 416);
gsk_path_builder_line_to (builder, 0, 208);
gsk_path_builder_close (builder);
return gsk_path_builder_free_to_path (builder);
}
static GskPath *
create_path_from_text (GtkWidget *widget)
{
cairo_surface_t *surface;
cairo_t *cr;
cairo_path_t *path;
PangoLayout *layout;
PangoFontDescription *desc;
GskPath *result;
surface = cairo_recording_surface_create (CAIRO_CONTENT_COLOR_ALPHA, NULL);
cr = cairo_create (surface);
layout = gtk_widget_create_pango_layout (widget, "Pango power!\nPango power!\nPango power!");
desc = pango_font_description_from_string ("sans bold 36");
pango_layout_set_font_description (layout, desc);
pango_font_description_free (desc);
pango_cairo_layout_path (cr, layout);
path = cairo_copy_path_flat (cr);
result = gsk_path_new_from_cairo (path);
cairo_path_destroy (path);
g_object_unref (layout);
cairo_destroy (cr);
cairo_surface_destroy (surface);
return result;
}
static gboolean
build_path (GskPathOperation op,
const graphene_point_t *pts,
gsize n_pts,
float weight,
gpointer user_data)
{
GskPathBuilder *builder = user_data;
switch (op)
{
case GSK_PATH_MOVE:
gsk_path_builder_move_to (builder, pts[0].x, pts[0].y);
break;
case GSK_PATH_CLOSE:
gsk_path_builder_close (builder);
break;
case GSK_PATH_LINE:
gsk_path_builder_line_to (builder, pts[1].x, pts[1].y);
break;
case GSK_PATH_CURVE:
gsk_path_builder_curve_to (builder, pts[1].x, pts[1].y, pts[2].x, pts[2].y, pts[3].x, pts[3].y);
break;
case GSK_PATH_CONIC:
gsk_path_builder_conic_to (builder, pts[1].x, pts[1].y, pts[2].x, pts[2].y, weight);
break;
default:
g_assert_not_reached ();
break;
}
return TRUE;
}
static gboolean
update_path (GtkWidget *widget,
GdkFrameClock *frame_clock,
gpointer measure)
{
float progress = gdk_frame_clock_get_frame_time (frame_clock) % (60 * G_USEC_PER_SEC) / (float) (30 * G_USEC_PER_SEC);
GskPathBuilder *builder;
GskPath *path;
graphene_point_t pos;
graphene_vec2_t tangent;
GskStroke *stroke;
builder = gsk_path_builder_new ();
gsk_path_builder_add_segment (builder,
measure,
#if 1
0.0, gsk_path_measure_get_length (measure));
#else
progress > 1 ? (progress - 1) * gsk_path_measure_get_length (measure) : 0.0,
(progress < 1 ? progress : 1.0) * gsk_path_measure_get_length (measure));
#endif
path = gsk_path_builder_free_to_path (builder);
stroke = gsk_stroke_new (1);
gsk_stroke_set_dash (stroke, (float[2]) { 10, 5 }, 2);
gsk_stroke_set_dash_offset (stroke, - (gdk_frame_clock_get_frame_time (frame_clock) % G_USEC_PER_SEC) * 15. / G_USEC_PER_SEC);
builder = gsk_path_builder_new ();
gsk_path_dash (path, stroke, 0.2, build_path, builder);
gsk_path_unref (path);
gsk_path_measure_get_point (measure,
(progress > 1 ? (progress - 1) : progress) * gsk_path_measure_get_length (measure),
&pos,
&tangent);
gsk_path_builder_move_to (builder, pos.x + 5 * graphene_vec2_get_x (&tangent), pos.y + 5 * graphene_vec2_get_y (&tangent));
gsk_path_builder_line_to (builder, pos.x + 3 * graphene_vec2_get_y (&tangent), pos.y + 3 * graphene_vec2_get_x (&tangent));
gsk_path_builder_line_to (builder, pos.x - 3 * graphene_vec2_get_y (&tangent), pos.y - 3 * graphene_vec2_get_x (&tangent));
gsk_path_builder_close (builder);
path = gsk_path_builder_free_to_path (builder);
gtk_path_paintable_set_path (GTK_PATH_PAINTABLE (gtk_picture_get_paintable (GTK_PICTURE (widget))),
path);
gsk_path_unref (path);
return G_SOURCE_CONTINUE;
}
GtkWidget *
do_path_fill (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
if (!window)
{
GtkWidget *picture;
GdkPaintable *paintable;
GtkMediaStream *stream;
GskPath *path;
graphene_rect_t bounds;
GskPathMeasure *measure;
window = gtk_window_new ();
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
gtk_window_set_title (GTK_WINDOW (window), "Path Fill");
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
#if 0
stream = gtk_media_file_new_for_resource ("/images/gtk-logo.webm");
#else
stream = gtk_nuclear_media_stream_new ();
#endif
gtk_media_stream_play (stream);
gtk_media_stream_set_loop (stream, TRUE);
path = create_hexagon (window);
path = create_path_from_text (window);
gsk_path_get_bounds (path, &bounds);
paintable = gtk_path_paintable_new (path,
GDK_PAINTABLE (stream),
bounds.origin.x + bounds.size.width,
bounds.origin.y + bounds.size.height);
picture = gtk_picture_new_for_paintable (paintable);
measure = gsk_path_measure_new (path);
gtk_widget_add_tick_callback (picture, update_path, measure, (GDestroyNotify) gsk_path_measure_unref);
gtk_picture_set_keep_aspect_ratio (GTK_PICTURE (picture), FALSE);
gtk_picture_set_can_shrink (GTK_PICTURE (picture), FALSE);
g_object_unref (paintable);
gtk_window_set_child (GTK_WINDOW (window), picture);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

338
demos/gtk-demo/path_maze.c Normal file
View File

@@ -0,0 +1,338 @@
/* Path/Maze
*
* This demo shows how to use a GskPath to create a maze and use
* gsk_path_measure_get_closest_point() to check the mouse stays
* on the path.
*
* It also shows off the performance of GskPath (or not) as this
* is a rather complex path.
*/
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include "paintable.h"
#define MAZE_GRID_SIZE 20
#define MAZE_STROKE_SIZE_ACTIVE (MAZE_GRID_SIZE - 4)
#define MAZE_STROKE_SIZE_INACTIVE (MAZE_GRID_SIZE - 12)
#define MAZE_WIDTH 31
#define MAZE_HEIGHT 21
#define GTK_TYPE_MAZE (gtk_maze_get_type ())
G_DECLARE_FINAL_TYPE (GtkMaze, gtk_maze, GTK, MAZE, GtkWidget)
struct _GtkMaze
{
GtkWidget parent_instance;
int width;
int height;
GskPath *path;
GskPathMeasure *measure;
GdkPaintable *background;
gboolean active;
};
struct _GtkMazeClass
{
GtkWidgetClass parent_class;
};
G_DEFINE_TYPE (GtkMaze, gtk_maze, GTK_TYPE_WIDGET)
static void
gtk_maze_measure (GtkWidget *widget,
GtkOrientation orientation,
int for_size,
int *minimum,
int *natural,
int *minimum_baseline,
int *natural_baseline)
{
GtkMaze *self = GTK_MAZE (widget);
if (orientation == GTK_ORIENTATION_HORIZONTAL)
*minimum = *natural = self->width;
else
*minimum = *natural = self->height;
}
static void
gtk_maze_snapshot (GtkWidget *widget,
GdkSnapshot *snapshot)
{
GtkMaze *self = GTK_MAZE (widget);
double width = gtk_widget_get_width (widget);
double height = gtk_widget_get_height (widget);
GskStroke *stroke;
stroke = gsk_stroke_new (MAZE_STROKE_SIZE_INACTIVE);
if (self->active)
gsk_stroke_set_line_width (stroke, MAZE_STROKE_SIZE_ACTIVE);
gsk_stroke_set_line_join (stroke, GSK_LINE_JOIN_ROUND);
gsk_stroke_set_line_cap (stroke, GSK_LINE_CAP_ROUND);
gtk_snapshot_push_stroke (snapshot, self->path, stroke);
gsk_stroke_free (stroke);
if (self->background)
{
gdk_paintable_snapshot (self->background, snapshot, width, height);
}
else
{
gtk_snapshot_append_linear_gradient (snapshot,
&GRAPHENE_RECT_INIT (0, 0, width, height),
&GRAPHENE_POINT_INIT (0, 0),
&GRAPHENE_POINT_INIT (width, height),
(GskColorStop[8]) {
{ 0.0, { 1.0, 0.0, 0.0, 1.0 } },
{ 0.2, { 1.0, 0.0, 0.0, 1.0 } },
{ 0.3, { 1.0, 1.0, 0.0, 1.0 } },
{ 0.4, { 0.0, 1.0, 0.0, 1.0 } },
{ 0.6, { 0.0, 1.0, 1.0, 1.0 } },
{ 0.7, { 0.0, 0.0, 1.0, 1.0 } },
{ 0.8, { 1.0, 0.0, 1.0, 1.0 } },
{ 1.0, { 1.0, 0.0, 1.0, 1.0 } }
},
8);
}
gtk_snapshot_pop (snapshot);
}
static void
gtk_maze_dispose (GObject *object)
{
GtkMaze *self = GTK_MAZE (object);
g_clear_pointer (&self->path, gsk_path_unref);
g_clear_pointer (&self->measure, gsk_path_measure_unref);
if (self->background)
{
g_signal_handlers_disconnect_matched (self->background, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, self);
g_clear_object (&self->background);
}
G_OBJECT_CLASS (gtk_maze_parent_class)->dispose (object);
}
static void
gtk_maze_class_init (GtkMazeClass *klass)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->dispose = gtk_maze_dispose;
widget_class->measure = gtk_maze_measure;
widget_class->snapshot = gtk_maze_snapshot;
}
static void
pointer_motion (GtkEventControllerMotion *controller,
double x,
double y,
GtkMaze *self)
{
if (!self->active)
return;
if (gsk_path_measure_get_closest_point (self->measure, &GRAPHENE_POINT_INIT (x, y), NULL) <= MAZE_STROKE_SIZE_ACTIVE / 2.0f)
return;
self->active = FALSE;
gtk_widget_queue_draw (GTK_WIDGET (self));
}
static void
pointer_leave (GtkEventControllerMotion *controller,
GtkMaze *self)
{
if (!self->active)
{
self->active = TRUE;
gtk_widget_queue_draw (GTK_WIDGET (self));
}
}
static void
gtk_maze_init (GtkMaze *self)
{
GtkEventController *controller;
controller = GTK_EVENT_CONTROLLER (gtk_event_controller_motion_new ());
g_signal_connect (controller, "motion", G_CALLBACK (pointer_motion), self);
g_signal_connect (controller, "leave", G_CALLBACK (pointer_leave), self);
gtk_widget_add_controller (GTK_WIDGET (self), controller);
self->active = TRUE;
}
static void
gtk_maze_set_path (GtkMaze *self,
GskPath *path)
{
g_clear_pointer (&self->path, gsk_path_unref);
g_clear_pointer (&self->measure, gsk_path_measure_unref);
self->path = gsk_path_ref (path);
self->measure = gsk_path_measure_new (path);
gtk_widget_queue_draw (GTK_WIDGET (self));
}
GtkWidget *
gtk_maze_new (GskPath *path,
GdkPaintable *background,
int width,
int height)
{
GtkMaze *self;
self = g_object_new (GTK_TYPE_MAZE, NULL);
gtk_maze_set_path (self, path);
gsk_path_unref (path);
self->background = background;
if (self->background)
{
g_signal_connect_swapped (self->background, "invalidate-contents", G_CALLBACK (gtk_widget_queue_draw), self);
g_signal_connect_swapped (self->background, "invalidate-size", G_CALLBACK (gtk_widget_queue_resize), self);
}
self->width = width;
self->height = height;
return GTK_WIDGET (self);
}
static void
add_point_to_maze (GtkBitset *maze,
GskPathBuilder *builder,
guint x,
guint y)
{
gboolean set[4] = { };
guint dir;
gtk_bitset_add (maze, y * MAZE_WIDTH + x);
while (TRUE)
{
set[0] = set[0] || x == 0 || gtk_bitset_contains (maze, y * MAZE_WIDTH + x - 1);
set[1] = set[1] || y == 0 || gtk_bitset_contains (maze, (y - 1) * MAZE_WIDTH + x);
set[2] = set[2] || x + 1 == MAZE_WIDTH || gtk_bitset_contains (maze, y * MAZE_WIDTH + x + 1);
set[3] = set[3] || y + 1 == MAZE_HEIGHT || gtk_bitset_contains (maze, (y + 1) * MAZE_WIDTH + x);
if (set[0] && set[1] && set[2] && set[3])
return;
do
{
dir = g_random_int_range (0, 4);
}
while (set[dir]);
switch (dir)
{
case 0:
gsk_path_builder_move_to (builder, (x + 0.5) * MAZE_GRID_SIZE, (y + 0.5) * MAZE_GRID_SIZE);
gsk_path_builder_line_to (builder, (x - 0.5) * MAZE_GRID_SIZE, (y + 0.5) * MAZE_GRID_SIZE);
add_point_to_maze (maze, builder, x - 1, y);
break;
case 1:
gsk_path_builder_move_to (builder, (x + 0.5) * MAZE_GRID_SIZE, (y + 0.5) * MAZE_GRID_SIZE);
gsk_path_builder_line_to (builder, (x + 0.5) * MAZE_GRID_SIZE, (y - 0.5) * MAZE_GRID_SIZE);
add_point_to_maze (maze, builder, x, y - 1);
break;
case 2:
gsk_path_builder_move_to (builder, (x + 0.5) * MAZE_GRID_SIZE, (y + 0.5) * MAZE_GRID_SIZE);
gsk_path_builder_line_to (builder, (x + 1.5) * MAZE_GRID_SIZE, (y + 0.5) * MAZE_GRID_SIZE);
add_point_to_maze (maze, builder, x + 1, y);
break;
case 3:
gsk_path_builder_move_to (builder, (x + 0.5) * MAZE_GRID_SIZE, (y + 0.5) * MAZE_GRID_SIZE);
gsk_path_builder_line_to (builder, (x + 0.5) * MAZE_GRID_SIZE, (y + 1.5) * MAZE_GRID_SIZE);
add_point_to_maze (maze, builder, x, y + 1);
break;
default:
g_assert_not_reached ();
break;
}
}
}
static GskPath *
create_path_for_maze (GtkWidget *widget)
{
GskPathBuilder *builder;
GtkBitset *maze;
builder = gsk_path_builder_new ();
maze = gtk_bitset_new_empty ();
/* make sure the outer lines are unreachable:
* Set the full range, then remove the center again. */
gtk_bitset_add_range (maze, 0, MAZE_WIDTH * MAZE_HEIGHT);
gtk_bitset_remove_rectangle (maze, MAZE_WIDTH + 1, MAZE_WIDTH - 2, MAZE_HEIGHT - 2, MAZE_WIDTH);
/* Fill the maze */
add_point_to_maze (maze, builder, MAZE_WIDTH / 2, MAZE_HEIGHT / 2);
/* Add start and stop lines */
gsk_path_builder_move_to (builder, 1.5 * MAZE_GRID_SIZE, -0.5 * MAZE_GRID_SIZE);
gsk_path_builder_line_to (builder, 1.5 * MAZE_GRID_SIZE, 1.5 * MAZE_GRID_SIZE);
gsk_path_builder_move_to (builder, (MAZE_WIDTH - 1.5) * MAZE_GRID_SIZE, (MAZE_HEIGHT - 1.5) * MAZE_GRID_SIZE);
gsk_path_builder_line_to (builder, (MAZE_WIDTH - 1.5) * MAZE_GRID_SIZE, (MAZE_HEIGHT + 0.5) * MAZE_GRID_SIZE);
gtk_bitset_unref (maze);
return gsk_path_builder_free_to_path (builder);
}
GtkWidget *
do_path_maze (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
if (!window)
{
GtkWidget *maze;
GtkMediaStream *stream;
GskPath *path;
window = gtk_window_new ();
gtk_window_set_resizable (GTK_WINDOW (window), TRUE);
gtk_window_set_title (GTK_WINDOW (window), "Follow the maze with the mouse");
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
#if 0
stream = gtk_media_file_new_for_resource ("/images/gtk-logo.webm");
#else
stream = gtk_nuclear_media_stream_new ();
#endif
gtk_media_stream_play (stream);
gtk_media_stream_set_loop (stream, TRUE);
path = create_path_for_maze (window);
maze = gtk_maze_new (path,
GDK_PAINTABLE (stream),
MAZE_WIDTH * MAZE_GRID_SIZE,
MAZE_HEIGHT * MAZE_GRID_SIZE);
gtk_window_set_child (GTK_WINDOW (window), maze);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

590
demos/gtk-demo/path_text.c Normal file
View File

@@ -0,0 +1,590 @@
/* Path/Text
*
* This demo shows how to use GskPath to animate a path along another path.
*/
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#define GTK_TYPE_PATH_WIDGET (gtk_path_widget_get_type ())
G_DECLARE_FINAL_TYPE (GtkPathWidget, gtk_path_widget, GTK, PATH_WIDGET, GtkWidget)
#define POINT_SIZE 8
enum {
PROP_0,
PROP_TEXT,
PROP_EDITABLE,
N_PROPS
};
struct _GtkPathWidget
{
GtkWidget parent_instance;
char *text;
gboolean editable;
graphene_point_t points[4];
guint active_point;
float line_closest;
GskPath *line_path;
GskPathMeasure *line_measure;
GskPath *text_path;
GdkPaintable *background;
};
struct _GtkPathWidgetClass
{
GtkWidgetClass parent_class;
};
static GParamSpec *properties[N_PROPS] = { NULL, };
G_DEFINE_TYPE (GtkPathWidget, gtk_path_widget, GTK_TYPE_WIDGET)
static GskPath *
create_path_from_text (GtkWidget *widget,
const char *text)
{
cairo_surface_t *surface;
cairo_t *cr;
cairo_path_t *path;
PangoLayout *layout;
PangoFontDescription *desc;
GskPath *result;
surface = cairo_recording_surface_create (CAIRO_CONTENT_COLOR_ALPHA, NULL);
cr = cairo_create (surface);
layout = gtk_widget_create_pango_layout (widget, text);
desc = pango_font_description_from_string ("sans bold 36");
pango_layout_set_font_description (layout, desc);
pango_font_description_free (desc);
cairo_move_to (cr, 0, - pango_layout_get_baseline (layout) / (double) PANGO_SCALE);
pango_cairo_layout_path (cr, layout);
path = cairo_copy_path_flat (cr);
result = gsk_path_new_from_cairo (path);
cairo_path_destroy (path);
g_object_unref (layout);
cairo_destroy (cr);
cairo_surface_destroy (surface);
return result;
}
typedef struct
{
GskPathMeasure *measure;
GskPathBuilder *builder;
double scale;
} GtkPathTransform;
static void
gtk_path_transform_point (GskPathMeasure *measure,
const graphene_point_t *pt,
float scale,
graphene_point_t *res)
{
graphene_vec2_t tangent;
gsk_path_measure_get_point (measure, pt->x * scale, res, &tangent);
res->x -= pt->y * scale * graphene_vec2_get_y (&tangent);
res->y += pt->y * scale * graphene_vec2_get_x (&tangent);
}
static gboolean
gtk_path_transform_op (GskPathOperation op,
const graphene_point_t *pts,
gsize n_pts,
float weight,
gpointer data)
{
GtkPathTransform *transform = data;
switch (op)
{
case GSK_PATH_MOVE:
{
graphene_point_t res;
gtk_path_transform_point (transform->measure, &pts[0], transform->scale, &res);
gsk_path_builder_move_to (transform->builder, res.x, res.y);
}
break;
case GSK_PATH_LINE:
{
graphene_point_t res;
gtk_path_transform_point (transform->measure, &pts[1], transform->scale, &res);
gsk_path_builder_line_to (transform->builder, res.x, res.y);
}
break;
case GSK_PATH_CURVE:
{
graphene_point_t res[3];
gtk_path_transform_point (transform->measure, &pts[1], transform->scale, &res[0]);
gtk_path_transform_point (transform->measure, &pts[2], transform->scale, &res[1]);
gtk_path_transform_point (transform->measure, &pts[3], transform->scale, &res[2]);
gsk_path_builder_curve_to (transform->builder, res[0].x, res[0].y, res[1].x, res[1].y, res[2].x, res[2].y);
}
break;
case GSK_PATH_CONIC:
{
graphene_point_t res[2];
gtk_path_transform_point (transform->measure, &pts[1], transform->scale, &res[0]);
gtk_path_transform_point (transform->measure, &pts[2], transform->scale, &res[1]);
gsk_path_builder_conic_to (transform->builder, res[0].x, res[0].y, res[1].x, res[1].y, weight);
}
break;
case GSK_PATH_CLOSE:
gsk_path_builder_close (transform->builder);
break;
default:
g_assert_not_reached();
return FALSE;
}
return TRUE;
}
static GskPath *
gtk_path_transform (GskPathMeasure *measure,
GskPath *path)
{
GtkPathTransform transform = { measure, gsk_path_builder_new () };
graphene_rect_t bounds;
gsk_path_get_bounds (path, &bounds);
if (bounds.origin.x + bounds.size.width > 0)
transform.scale = gsk_path_measure_get_length (measure) / (bounds.origin.x + bounds.size.width);
else
transform.scale = 1.0f;
gsk_path_foreach (path, GSK_PATH_FOREACH_ALLOW_CURVE, gtk_path_transform_op, &transform);
return gsk_path_builder_free_to_path (transform.builder);
}
static void
gtk_path_widget_clear_text_path (GtkPathWidget *self)
{
g_clear_pointer (&self->text_path, gsk_path_unref);
}
static void
gtk_path_widget_clear_paths (GtkPathWidget *self)
{
gtk_path_widget_clear_text_path (self);
g_clear_pointer (&self->line_path, gsk_path_unref);
g_clear_pointer (&self->line_measure, gsk_path_measure_unref);
}
static void
gtk_path_widget_create_text_path (GtkPathWidget *self)
{
GskPath *path;
gtk_path_widget_clear_text_path (self);
if (self->line_measure == NULL)
return;
path = create_path_from_text (GTK_WIDGET (self), self->text);
self->text_path = gtk_path_transform (self->line_measure, path);
gsk_path_unref (path);
}
static void
gtk_path_widget_create_paths (GtkPathWidget *self)
{
double width = gtk_widget_get_width (GTK_WIDGET (self));
double height = gtk_widget_get_height (GTK_WIDGET (self));
GskPathBuilder *builder;
gtk_path_widget_clear_paths (self);
if (width <= 0 || height <= 0)
return;
builder = gsk_path_builder_new ();
gsk_path_builder_move_to (builder,
self->points[0].x * width, self->points[0].y * height);
gsk_path_builder_curve_to (builder,
self->points[1].x * width, self->points[1].y * height,
self->points[2].x * width, self->points[2].y * height,
self->points[3].x * width, self->points[3].y * height);
self->line_path = gsk_path_builder_free_to_path (builder);
self->line_measure = gsk_path_measure_new (self->line_path);
gtk_path_widget_create_text_path (self);
}
static void
gtk_path_widget_allocate (GtkWidget *widget,
int width,
int height,
int baseline)
{
GtkPathWidget *self = GTK_PATH_WIDGET (widget);
GTK_WIDGET_CLASS (gtk_path_widget_parent_class)->size_allocate (widget, width, height, baseline);
gtk_path_widget_create_paths (self);
}
static void
gtk_path_widget_snapshot (GtkWidget *widget,
GtkSnapshot *snapshot)
{
GtkPathWidget *self = GTK_PATH_WIDGET (widget);
double width = gtk_widget_get_width (widget);
double height = gtk_widget_get_height (widget);
GskPath *path;
GskStroke *stroke;
gsize i;
/* frosted glass the background */
gtk_snapshot_push_blur (snapshot, 100);
gdk_paintable_snapshot (self->background, snapshot, width, height);
gtk_snapshot_append_color (snapshot, &(GdkRGBA) { 1, 1, 1, 0.6 }, &GRAPHENE_RECT_INIT (0, 0, width, height));
gtk_snapshot_pop (snapshot);
/* draw the text */
if (self->text_path)
{
gtk_snapshot_push_fill (snapshot, self->text_path, GSK_FILL_RULE_WINDING);
gdk_paintable_snapshot (self->background, snapshot, width, height);
/* ... with an emboss effect */
stroke = gsk_stroke_new (2.0);
gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT(1, 1));
gtk_snapshot_push_stroke (snapshot, self->text_path, stroke);
gtk_snapshot_append_color (snapshot, &(GdkRGBA) { 0, 0, 0, 0.2 }, &GRAPHENE_RECT_INIT (0, 0, width, height));
gsk_stroke_free (stroke);
gtk_snapshot_pop (snapshot);
gtk_snapshot_pop (snapshot);
}
if (self->editable && self->line_path)
{
GskPathBuilder *builder;
/* draw the control line */
stroke = gsk_stroke_new (1.0);
gtk_snapshot_push_stroke (snapshot, self->line_path, stroke);
gsk_stroke_free (stroke);
gtk_snapshot_append_color (snapshot, &(GdkRGBA) { 0, 0, 0, 1 }, &GRAPHENE_RECT_INIT (0, 0, width, height));
gtk_snapshot_pop (snapshot);
/* draw the points */
builder = gsk_path_builder_new ();
for (i = 0; i < 4; i++)
{
gsk_path_builder_add_circle (builder, &GRAPHENE_POINT_INIT (self->points[i].x * width, self->points[i].y * height), POINT_SIZE);
}
path = gsk_path_builder_free_to_path (builder);
gtk_snapshot_push_fill (snapshot, path, GSK_FILL_RULE_WINDING);
gtk_snapshot_append_color (snapshot, &(GdkRGBA) { 1, 1, 1, 1 }, &GRAPHENE_RECT_INIT (0, 0, width, height));
gtk_snapshot_pop (snapshot);
stroke = gsk_stroke_new (1.0);
gtk_snapshot_push_stroke (snapshot, path, stroke);
gsk_stroke_free (stroke);
gtk_snapshot_append_color (snapshot, &(GdkRGBA) { 0, 0, 0, 1 }, &GRAPHENE_RECT_INIT (0, 0, width, height));
gtk_snapshot_pop (snapshot);
gsk_path_unref (path);
}
if (self->line_closest >= 0)
{
GskPathBuilder *builder;
graphene_point_t closest;
builder = gsk_path_builder_new ();
gsk_path_measure_get_point (self->line_measure, self->line_closest, &closest, NULL);
gsk_path_builder_add_circle (builder, &closest, POINT_SIZE);
path = gsk_path_builder_free_to_path (builder);
gtk_snapshot_push_fill (snapshot, path, GSK_FILL_RULE_WINDING);
gtk_snapshot_append_color (snapshot, &(GdkRGBA) { 0, 0, 1, 1 }, &GRAPHENE_RECT_INIT (0, 0, width, height));
gtk_snapshot_pop (snapshot);
gsk_path_unref (path);
}
}
static void
gtk_path_widget_set_text (GtkPathWidget *self,
const char *text)
{
if (g_strcmp0 (self->text, text) == 0)
return;
g_free (self->text);
self->text = g_strdup (text);
gtk_path_widget_create_paths (self);
gtk_widget_queue_draw (GTK_WIDGET (self));
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_TEXT]);
}
static void
gtk_path_widget_set_editable (GtkPathWidget *self,
gboolean editable)
{
if (self->editable == editable)
return;
self->editable = editable;
gtk_widget_queue_draw (GTK_WIDGET (self));
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_EDITABLE]);
}
static void
gtk_path_widget_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
GtkPathWidget *self = GTK_PATH_WIDGET (object);
switch (prop_id)
{
case PROP_TEXT:
gtk_path_widget_set_text (self, g_value_get_string (value));
break;
case PROP_EDITABLE:
gtk_path_widget_set_editable (self, g_value_get_boolean (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gtk_path_widget_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
GtkPathWidget *self = GTK_PATH_WIDGET (object);
switch (prop_id)
{
case PROP_TEXT:
g_value_set_string (value, self->text);
break;
case PROP_EDITABLE:
g_value_set_boolean (value, self->editable);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
gtk_path_widget_dispose (GObject *object)
{
GtkPathWidget *self = GTK_PATH_WIDGET (object);
gtk_path_widget_clear_paths (self);
G_OBJECT_CLASS (gtk_path_widget_parent_class)->dispose (object);
}
static void
gtk_path_widget_class_init (GtkPathWidgetClass *klass)
{
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->dispose = gtk_path_widget_dispose;
object_class->set_property = gtk_path_widget_set_property;
object_class->get_property = gtk_path_widget_get_property;
widget_class->size_allocate = gtk_path_widget_allocate;
widget_class->snapshot = gtk_path_widget_snapshot;
properties[PROP_TEXT] =
g_param_spec_string ("text",
"text",
"Text transformed along a path",
NULL,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
properties[PROP_EDITABLE] =
g_param_spec_boolean ("editable",
"editable",
"If the path can be edited by the user",
FALSE,
G_PARAM_READWRITE | G_PARAM_EXPLICIT_NOTIFY | G_PARAM_STATIC_STRINGS);
g_object_class_install_properties (object_class, N_PROPS, properties);
}
static void
drag_begin (GtkGestureDrag *gesture,
double x,
double y,
GtkPathWidget *self)
{
graphene_point_t mouse = GRAPHENE_POINT_INIT (x, y);
double width = gtk_widget_get_width (GTK_WIDGET (self));
double height = gtk_widget_get_height (GTK_WIDGET (self));
gsize i;
for (i = 0; i < 4; i++)
{
if (graphene_point_distance (&GRAPHENE_POINT_INIT (self->points[i].x * width, self->points[i].y * height), &mouse, NULL, NULL) <= POINT_SIZE)
{
self->active_point = i;
break;
}
}
if (i == 4)
{
gtk_gesture_set_state (GTK_GESTURE (gesture), GTK_EVENT_SEQUENCE_DENIED);
return;
}
gtk_widget_queue_draw (GTK_WIDGET (self));
}
static void
drag_update (GtkGestureDrag *drag,
double offset_x,
double offset_y,
GtkPathWidget *self)
{
double width = gtk_widget_get_width (GTK_WIDGET (self));
double height = gtk_widget_get_height (GTK_WIDGET (self));
double start_x, start_y;
gtk_gesture_drag_get_start_point (drag, &start_x, &start_y);
self->points[self->active_point] = GRAPHENE_POINT_INIT ((start_x + offset_x) / width,
(start_y + offset_y) / height);
self->points[self->active_point].x = CLAMP (self->points[self->active_point].x, 0, 1);
self->points[self->active_point].y = CLAMP (self->points[self->active_point].y, 0, 1);
gtk_path_widget_create_paths (self);
gtk_widget_queue_draw (GTK_WIDGET (self));
}
static void
pointer_motion (GtkEventControllerMotion *controller,
double x,
double y,
GtkPathWidget *self)
{
gsk_path_measure_get_closest_point_full (self->line_measure,
&GRAPHENE_POINT_INIT (x, y),
INFINITY,
&self->line_closest,
NULL, NULL, NULL);
gtk_widget_queue_draw (GTK_WIDGET (self));
}
static void
pointer_leave (GtkEventControllerMotion *controller,
GtkPathWidget *self)
{
self->line_closest = -1;
gtk_widget_queue_draw (GTK_WIDGET (self));
}
static void
gtk_path_widget_init (GtkPathWidget *self)
{
GtkEventController *controller;
controller = GTK_EVENT_CONTROLLER (gtk_gesture_drag_new ());
g_signal_connect (controller, "drag-begin", G_CALLBACK (drag_begin), self);
g_signal_connect (controller, "drag-update", G_CALLBACK (drag_update), self);
g_signal_connect (controller, "drag-end", G_CALLBACK (drag_update), self);
gtk_widget_add_controller (GTK_WIDGET (self), controller);
controller = GTK_EVENT_CONTROLLER (gtk_event_controller_motion_new ());
g_signal_connect (controller, "enter", G_CALLBACK (pointer_motion), self);
g_signal_connect (controller, "motion", G_CALLBACK (pointer_motion), self);
g_signal_connect (controller, "leave", G_CALLBACK (pointer_leave), self);
gtk_widget_add_controller (GTK_WIDGET (self), controller);
self->line_closest = -1;
self->points[0] = GRAPHENE_POINT_INIT (0.1, 0.9);
self->points[1] = GRAPHENE_POINT_INIT (0.3, 0.1);
self->points[2] = GRAPHENE_POINT_INIT (0.7, 0.1);
self->points[3] = GRAPHENE_POINT_INIT (0.9, 0.9);
self->background = GDK_PAINTABLE (gdk_texture_new_from_resource ("/sliding_puzzle/portland-rose.jpg"));
gtk_path_widget_set_text (self, "It's almost working");
}
GtkWidget *
gtk_path_widget_new (void)
{
GtkPathWidget *self;
self = g_object_new (GTK_TYPE_PATH_WIDGET, NULL);
return GTK_WIDGET (self);
}
GtkWidget *
do_path_text (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
if (!window)
{
GtkBuilder *builder;
g_type_ensure (GTK_TYPE_PATH_WIDGET);
builder = gtk_builder_new_from_resource ("/path_text/path_text.ui");
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *) &window);
g_object_unref (builder);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow" id="window">
<property name="title" translatable="yes">Text along a Path</property>
<child type="titlebar">
<object class="GtkHeaderBar">
<child type="end">
<object class="GtkToggleButton" id="edit-toggle">
<property name="icon-name">document-edit-symbolic</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<child>
<object class="GtkRevealer">
<property name="reveal-child" bind-source="edit-toggle" bind-property="active" bind-flags="sync-create"></property>
<child>
<object class="GtkEntry" id="text">
<property name="text">Through the looking glass</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkPathWidget" id="view">
<property name="editable" bind-source="edit-toggle" bind-property="active" bind-flags="sync-create"></property>
<property name="text" bind-source="text" bind-property="text" bind-flags="sync-create"></property>
<property name="hexpand">true</property>
<property name="vexpand">true</property>
</object>
</child>
</object>
</child>
</object>
</interface>

View File

@@ -1,9 +1,8 @@
/* Pickers
* #Keywords: GtkColorChooser, GtkFontChooser, GtkFileChooser,
* #Keywords: GtkApplicationChooser
* #Keywords: GtkColorChooser, GtkFontChooser, GtkApplicationChooser
*
* These widgets are mainly intended for use in preference dialogs.
* They allow to select colors, fonts, files, directories and applications.
* They allow to select colors, fonts, directories and applications.
*
* This demo shows both the default appearance for these dialogs,
* as well as some of the customizations that are possible.
@@ -63,9 +62,6 @@ do_pickers (GtkWidget *do_widget)
if (!window)
{
char *dir;
GFile *file;
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
@@ -123,55 +119,14 @@ do_pickers (GtkWidget *do_widget)
gtk_grid_attach (GTK_GRID (table), picker, 2, 1, 1, 1);
label = gtk_label_new ("File:");
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_widget_set_hexpand (label, TRUE);
gtk_grid_attach (GTK_GRID (table), label, 0, 2, 1, 1);
picker = gtk_file_chooser_button_new ("Pick a File",
GTK_FILE_CHOOSER_ACTION_OPEN);
gtk_grid_attach (GTK_GRID (table), picker, 1, 2, 1, 1);
picker = gtk_file_chooser_button_new ("Pick a File",
GTK_FILE_CHOOSER_ACTION_OPEN);
dir = g_get_current_dir ();
file = g_file_new_for_path (dir);
gtk_file_chooser_add_shortcut_folder (GTK_FILE_CHOOSER (picker), file, NULL);
g_object_unref (file);
g_free (dir);
gtk_file_chooser_add_choice (GTK_FILE_CHOOSER (picker),
"choice",
"Encoding",
(const char *[]) { "option1", "option2", NULL },
(const char *[]) { "UTF-8", "Other Encoding", NULL });
gtk_file_chooser_set_choice (GTK_FILE_CHOOSER (picker), "choice", "option1");
gtk_file_chooser_add_choice (GTK_FILE_CHOOSER (picker),
"check",
"Read backwards",
NULL, NULL);
gtk_file_chooser_set_choice (GTK_FILE_CHOOSER (picker), "check", "false");
gtk_grid_attach (GTK_GRID (table), picker, 2, 2, 1, 1);
label = gtk_label_new ("Folder:");
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
picker = gtk_file_chooser_button_new ("Pick a Folder",
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
gtk_grid_attach (GTK_GRID (table), label, 0, 3, 1, 1);
gtk_grid_attach (GTK_GRID (table), picker, 1, 3, 1, 1);
label = gtk_label_new ("Mail:");
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_widget_set_hexpand (label, TRUE);
picker = gtk_app_chooser_button_new ("x-scheme-handler/mailto");
gtk_app_chooser_button_set_show_dialog_item (GTK_APP_CHOOSER_BUTTON (picker), TRUE);
gtk_grid_attach (GTK_GRID (table), label, 0, 4, 1, 1);
gtk_grid_attach (GTK_GRID (table), picker, 1, 4, 1, 1);
gtk_grid_attach (GTK_GRID (table), label, 0, 3, 1, 1);
gtk_grid_attach (GTK_GRID (table), picker, 1, 3, 1, 1);
}
if (!gtk_widget_get_visible (window))

View File

@@ -31,7 +31,7 @@ void mainImage(out vec4 fragColor, in vec2 fragCoord, in vec2 resolution, in vec
float propagation_length = time * wave_speed;
float t = (propagation_length - distance_from_center) / wave_length;
float offset_magnitude = 0;
float offset_magnitude = 0.0;
if (t > 0.0)
offset_magnitude = decay(wave_height * sin(t * 2.0 * PI), t);

View File

@@ -474,7 +474,7 @@ suggestion_entry_size_allocate (GtkWidget *widget,
gtk_widget_set_size_request (self->popup, gtk_widget_get_allocated_width (GTK_WIDGET (self)), -1);
gtk_widget_queue_resize (self->popup);
gtk_native_check_resize (GTK_NATIVE (self->popup));
gtk_popover_present (GTK_POPOVER (self->popup));
}
static gboolean

View File

@@ -1,6 +1,6 @@
/* Benchmark/Themes
*
* This demo switches themes like a maniac, like some of you.
* This demo continuously switches themes, like some of you.
*
* Warning: This demo involves rapidly flashing changes and may
* be hazardous to photosensitive viewers.

View File

@@ -10,11 +10,11 @@
static GtkWidget *window = NULL;
static void
open_dialog_response_cb (GtkWidget *dialog,
int response,
GtkWidget *video)
open_dialog_response_cb (GtkNativeDialog *dialog,
int response,
GtkWidget *video)
{
gtk_widget_hide (dialog);
gtk_native_dialog_hide (dialog);
if (response == GTK_RESPONSE_ACCEPT)
{
@@ -25,32 +25,30 @@ open_dialog_response_cb (GtkWidget *dialog,
g_object_unref (file);
}
gtk_window_destroy (GTK_WINDOW (dialog));
gtk_native_dialog_destroy (dialog);
}
static void
open_clicked_cb (GtkWidget *button,
GtkWidget *video)
{
GtkWidget *dialog;
GtkFileChooserNative *dialog;
GtkFileFilter *filter;
dialog = gtk_file_chooser_dialog_new ("Select a video",
dialog = gtk_file_chooser_native_new ("Select a video",
GTK_WINDOW (gtk_widget_get_root (button)),
GTK_FILE_CHOOSER_ACTION_OPEN,
"_Cancel", GTK_RESPONSE_CANCEL,
"_Open", GTK_RESPONSE_ACCEPT,
NULL);
"_Open",
"_Cancel");
filter = gtk_file_filter_new ();
gtk_file_filter_add_mime_type (filter, "video/*");
gtk_file_filter_set_name (filter, "Video");
gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filter);
g_object_unref (filter);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (dialog), TRUE);
g_signal_connect (dialog, "response", G_CALLBACK (open_dialog_response_cb), video);
gtk_widget_show (dialog);
gtk_native_dialog_show (GTK_NATIVE_DIALOG (dialog));
}
static void

View File

@@ -7,25 +7,25 @@ iconbrowser_sources = [
]
iconbrowser_resources = gnome.compile_resources('iconbrowser_resources',
'iconbrowser.gresource.xml',
source_dir: '.')
'iconbrowser.gresource.xml',
source_dir: '.',
)
executable('gtk4-icon-browser',
iconbrowser_sources, iconbrowser_resources,
c_args: common_cflags,
dependencies: libgtk_dep,
include_directories: confinc,
gui_app: true,
link_args: extra_demo_ldflags,
install: true)
sources: [iconbrowser_sources, iconbrowser_resources],
c_args: common_cflags,
dependencies: libgtk_dep,
include_directories: confinc,
gui_app: true,
link_args: extra_demo_ldflags,
install: true,
)
# icons
icontheme_dir = join_paths(gtk_datadir, 'icons/hicolor')
foreach size: ['scalable', 'symbolic']
install_subdir('data/' + size,
install_dir: icontheme_dir
)
install_subdir('data/' + size, install_dir: icontheme_dir)
endforeach
# desktop file

View File

@@ -7,4 +7,3 @@ Terminal=false
Type=Application
StartupNotify=true
Categories=Development;GTK;
NoDisplay=true

View File

@@ -13,9 +13,6 @@
</section>
</menu>
<template class="IconBrowserWindow" parent="GtkApplicationWindow">
<style>
<class name="devel"/>
</style>
<property name="title" translatable="yes">Icon Browser</property>
<property name="default-width">1024</property>
<property name="default-height">768</property>

View File

@@ -1,9 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow" id="window">
<style>
<class name="devel"/>
</style>
<property name="title" translatable="yes">Help</property>
<property name="default-width">720</property>
<property name="default-height">520</property>

View File

@@ -6,25 +6,25 @@ node_editor_sources = [
]
node_editor_resources = gnome.compile_resources('node_editor_resources',
'node-editor.gresource.xml',
source_dir: '.')
'node-editor.gresource.xml',
source_dir: '.',
)
executable('gtk4-node-editor',
node_editor_sources, node_editor_resources,
dependencies: libgtk_dep,
include_directories: confinc,
c_args: [
'-DNODE_EDITOR_SOURCE_DIR="@0@/../../testsuite/gsk/compare/"'.format(meson.current_source_dir())
] + common_cflags,
gui_app: true,
link_args: extra_demo_ldflags,
install: false)
sources: [node_editor_sources, node_editor_resources],
dependencies: libgtk_dep,
include_directories: confinc,
c_args: [
'-DNODE_EDITOR_SOURCE_DIR="@0@/../../testsuite/gsk/compare/"'.format(meson.current_source_dir())
] + common_cflags,
gui_app: true,
link_args: extra_demo_ldflags,
install: false,
)
# icons, don't install them until we decide to install gtk4-node-editor
#icontheme_dir = join_paths(gtk_datadir, 'icons/hicolor')
#foreach size: ['scalable', 'symbolic']
# install_subdir('data/' + size,
# install_dir: icontheme_dir
# )
# install_subdir('data/' + size, install_dir: icontheme_dir)
#endforeach

View File

@@ -94,9 +94,6 @@
</object>
<template class="NodeEditorWindow" parent="GtkApplicationWindow">
<style>
<class name="devel"/>
</style>
<property name="title" translatable="yes">GTK Node Editor</property>
<property name="default-width">1024</property>
<property name="default-height">768</property>

View File

@@ -23,7 +23,7 @@ The **container** node is a special node that allows specifying a list of child
| property | syntax | default | printed |
| -------- | ---------------- | ---------------------- | ----------- |
| bottom | `<node>` | color { color: #AF0; } | always |
| bottom | `<node>` | color { } | always |
| mode | `<blend-mode>` | normal | non-default |
| top | `<node>` | color { } | always |
@@ -48,7 +48,22 @@ Creates a node like `gsk_blur_node_new()` with the given properties.
Creates a node like `gsk_border_node_new()` with the given properties.
For the color and width properties, the values follow the typical CSS order of top, right, bottom, left. If the last/left value isn't given, the 2nd/right value is used. If the 3rd/bottom value isn't given, the 1st/top value is used. And if the 2nd/right value also isn't given, the 1st/top value is used for every 4 values.
For the color and width properties, the values follow the typical CSS order
of top, right, bottom, left. If the last/left value isn't given, the 2nd/right
value is used. If the 3rd/bottom value isn't given, the 1st/top value is used.
And if the 2nd/right value also isn't given, the 1st/top value is used for
every 4 values.
### cairo
| property | syntax | default | printed |
| -------- | ---------------- | ---------------------- | ----------- |
| bounds | `<rect>` | none | always |
| pixels | `<url>` | none | non-default |
| script | `<url>` | none | non-default |
The pixels are a base64-encoded data url of png data. The script is
a base64-encoded data url of a cairo script.
### clip
@@ -59,7 +74,9 @@ For the color and width properties, the values follow the typical CSS order of t
Creates a node like `gsk_clip_node_new()` with the given properties.
As an extension, this node allows specifying a rounded rectangle for the clip property. If that rectangle is indeed rounded, a node like `gsk_rounded_clip_node_new()` will be created instead.
As an extension, this node allows specifying a rounded rectangle for the
clip property. If that rectangle is indeed rounded, a node like
`gsk_rounded_clip_node_new()` will be created instead.
### color
@@ -70,7 +87,8 @@ As an extension, this node allows specifying a rounded rectangle for the clip pr
Creates a node like `gsk_color_node_new()` with the given properties.
The color is chosen as an error pink so it is visible while also reminding people to change it.
The color is chosen as an error pink so it is visible while also reminding
people to change it.
### color-matrix
@@ -82,7 +100,21 @@ The color is chosen as an error pink so it is visible while also reminding peopl
Creates a node like `gsk_color_matrix_node_new()` with the given properties.
The matrix property accepts a <transform> for compatibility purposes, but you should be aware that the allowed values are meant to be used on 3D transformations, so their naming might appear awkward. However, it is always possible to use the matrix3d() production to specify all 16 values individually.
The matrix property accepts a <transform> for compatibility purposes, but you
should be aware that the allowed values are meant to be used on 3D transformations,
so their naming might appear awkward. However, it is always possible to use the
matrix3d() production to specify all 16 values individually.
### conic-gradient
| property | syntax | default | printed |
| -------- | ---------------- | ---------------------- | ----------- |
| bounds | `<rect>` | 50 | always |
| center | `<point>` | 25, 25 | always |
| rotation | `<number>` | 0 | always |
| stops | `<color-stop>` | 0 #AF0, 1 #F0C | always |
Creates a node like `gsk_conic_gradient_node_new()` with the given properties.
### cross-fade
@@ -90,7 +122,7 @@ The matrix property accepts a <transform> for compatibility purposes, but you sh
| -------- | ---------------- | ---------------------- | ----------- |
| end | `<node>` | color { } | always |
| mode | `<number>` | 0.5 | non-default |
| start | `<node>` | color { color: #AF0; } | always |
| start | `<node>` | color { } | always |
Creates a node like `gsk_cross_fade_node_new()` with the given properties.
@@ -121,8 +153,8 @@ Creates a node like `gsk_inset_shadow_node_new()` with the given properties.
| property | syntax | default | printed |
| -------- | ---------------- | ---------------------- | ----------- |
| bounds | `<rect>` | 50 | always |
| end | `<point>` | 0 50 | always |
| start | `<point>` | 0 0 | always |
| end | `<point>` | 0 50 | always |
| stops | `<color-stop>` | 0 #AF0, 1 #F0C | always |
Creates a node like `gsk_linear_gradient_node_new()` with the given properties.
@@ -149,16 +181,57 @@ Creates a node like `gsk_transform_node_new()` with the given properties.
Creates a node like `gsk_outset_shadow_node_new()` with the given properties.
### repeat
### radial-gradient
| property | syntax | default | printed |
| -------- | ---------------- | ---------------------- | ----------- |
| bounds | `<rect>` | *bounds of child node* | non-default |
| child | `<node>` | color { } | always |
| child-bounds| `<rect>` | *bounds of child node* | non-default |
| bounds | `<rect>` | 50 | always |
| center | `<point>` | 25 25 | always |
| hradius | `<number>` | 25 | always |
| vradius | `<number>` | 25 | always |
| start | `<number>` | 0 | always |
| end | `<number>` | 1 | always |
| stops | `<color-stop>` | 0 #AF0, 1 #F0C | always |
Creates a node like `gsk_radial_gradient_node_new()` with the given properties.
### repeat
| property | syntax | default | printed |
| ----------- | ---------------- | ---------------------- | ----------- |
| bounds | `<rect>` | *bounds of child node* | non-default |
| child | `<node>` | color { } | always |
| child-bounds| `<rect>` | *bounds of child node* | non-default |
Creates a node like `gsk_repeat_node_new()` with the given properties.
### repeating-linear-gradient
| property | syntax | default | printed |
| -------- | ---------------- | ---------------------- | ----------- |
| bounds | `<rect>` | 50 | always |
| start | `<point>` | 0 0 | always |
| end | `<point>` | 0 50 | always |
| stops | `<color-stop>` | 0 #AF0, 1 #F0C | always |
Creates a node like `gsk_repeating_linear_gradient_node_new()` with the given
properties.
### repeating radial-gradient
| property | syntax | default | printed |
| -------- | ---------------- | ---------------------- | ----------- |
| bounds | `<rect>` | 50 | always |
| center | `<point>` | 25 25 | always |
| hradius | `<number>` | 25 | always |
| vradius | `<number>` | 25 | always |
| start | `<number>` | 0 | always |
| end | `<number>` | 1 | always |
| stops | `<color-stop>` | 0 #AF0, 1 #F0C | always |
Creates a node like `gsk_repeating_radial_gradient_node_new()` with the given
properties.
### rounded-clip
| property | syntax | default | printed |
@@ -188,7 +261,8 @@ Creates a node like `gsk_shadow_node_new()` with the given properties.
Creates a node like `gsk_text_node_new()` with the given properties.
If the given font does not exist or the given glyphs are invalid for the given font, an error node will be returned.
If the given font does not exist or the given glyphs are invalid for the given
font, an error node will be returned.
### texture
@@ -199,7 +273,9 @@ If the given font does not exist or the given glyphs are invalid for the given f
Creates a node like `gsk_texture_node_new()` with the given properties.
The default texture is a 10x10 checkerboard with the top left and bottom right 5x5 being in the color #FF00CC and the other part being transparent. A possible representation for this texture is `url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABmJLR0QA/wD/AP+gvaeTAAAAKUlEQVQYlWP8z3DmPwMaYGQwYUQXY0IXwAUGUCGGoxkYGBiweXAoeAYAz44F3e3U1xUAAAAASUVORK5CYII=")
The default texture is a 10x10 checkerboard with the top left and bottom right
5x5 being in the color #FF00CC and the other part being transparent. A possible
representation for this texture is `url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAABmJLR0QA/wD/AP+gvaeTAAAAKUlEQVQYlWP8z3DmPwMaYGQwYUQXY0IXwAUGUCGGoxkYGBiweXAoeAYAz44F3e3U1xUAAAAASUVORK5CYII=")
`.
### transform
@@ -211,3 +287,19 @@ The default texture is a 10x10 checkerboard with the top left and bottom right 5
Creates a node like `gsk_transform_node_new()` with the given properties.
### glshader
| property | syntax | default | printed |
| ---------- | ------------------ | ---------------------- | ----------- |
| bounds | `<rect>` | 50 | always |
| sourcecode | `<string>` | "" | always |
| args | `<uniform values>` | none | non-default |
| child1 | `<node>` | none | non-default |
| child2 | `<node>` | none | non-default |
| child3 | `<node>` | none | non-default |
| child4 | `<node>` | none | non-default |
Creates a GLShader node. The `sourcecode` must be a GLSL fragment shader.
The `args` must match the uniforms of simple types declared in that shader,
in order and comma-separated. The `child` properties must match the sampler
uniforms in the shader.

View File

@@ -1,11 +1,12 @@
executable('gtk4-print-editor',
['print-editor.c'],
c_args: common_cflags,
dependencies: libgtk_dep,
include_directories: confinc,
gui_app: true,
link_args: extra_demo_ldflags,
install: true)
sources: ['print-editor.c'],
c_args: common_cflags,
dependencies: libgtk_dep,
include_directories: confinc,
gui_app: true,
link_args: extra_demo_ldflags,
install: true,
)
# desktop file
install_data('org.gtk.PrintEditor4.desktop', install_dir: gtk_applicationsdir)
@@ -17,7 +18,5 @@ install_data('org.gtk.PrintEditor4.appdata.xml', install_dir: gtk_appdatadir)
icontheme_dir = join_paths(gtk_datadir, 'icons/hicolor')
foreach size: ['scalable', 'symbolic']
install_subdir('data/' + size,
install_dir: icontheme_dir
)
install_subdir('data/' + size, install_dir: icontheme_dir)
endforeach

View File

@@ -7,4 +7,3 @@ Terminal=false
Type=Application
StartupNotify=true
Categories=Development;GTK;
NoDisplay=true

View File

@@ -812,8 +812,6 @@ activate (GApplication *app)
gtk_application_window_set_show_menubar (GTK_APPLICATION_WINDOW (main_window), TRUE);
update_title (GTK_WINDOW (main_window));
gtk_widget_add_css_class (main_window, "devel");
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_window_set_child (GTK_WINDOW (main_window), box);

View File

@@ -1,17 +1,19 @@
# demos/widget-factory
widgetfactory_resources = gnome.compile_resources('widgetfactory_resources',
'widget-factory.gresource.xml',
source_dir: '.')
'widget-factory.gresource.xml',
source_dir: '.',
)
executable('gtk4-widget-factory',
'widget-factory.c', widgetfactory_resources,
c_args: common_cflags,
dependencies: libgtk_dep,
include_directories: confinc,
gui_app: true,
link_args: extra_demo_ldflags,
install: true)
sources: ['widget-factory.c', widgetfactory_resources],
c_args: common_cflags,
dependencies: libgtk_dep,
include_directories: confinc,
gui_app: true,
link_args: extra_demo_ldflags,
install: true,
)
# desktop file
install_data('org.gtk.WidgetFactory4.desktop', install_dir: gtk_applicationsdir)
@@ -20,9 +22,7 @@ install_data('org.gtk.WidgetFactory4.desktop', install_dir: gtk_applicationsdir)
icontheme_dir = join_paths(gtk_datadir, 'icons/hicolor')
foreach size: ['scalable', 'symbolic']
install_subdir('data/' + size,
install_dir: icontheme_dir
)
install_subdir('data/' + size, install_dir: icontheme_dir)
endforeach
# appdata

View File

@@ -7,4 +7,3 @@ Terminal=false
Type=Application
StartupNotify=true
Categories=Development;GTK;
NoDisplay=true

View File

@@ -433,9 +433,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
</columns>
</object>
<object class="GtkApplicationWindow" id="window">
<style>
<class name="devel"/>
</style>
<property name="title">GTK Widget Factory</property>
<child type="titlebar">
<object class="GtkHeaderBar" id="headerbar1">
@@ -881,9 +878,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="use-alpha">1</property>
</object>
</child>
<child>
<object class="GtkFileChooserButton" id="filechooserbutton1"/>
</child>
<child>
<object class="GtkLinkButton" id="linkbutton1">
<property name="label" translatable="yes">link button</property>
@@ -1078,7 +1072,7 @@ Suspendisse feugiat quam quis dolor accumsan cursus.</property>
<property name="margin-end">6</property>
<property name="margin-top">6</property>
<property name="margin-bottom">6</property>
<property name="autoplay">0</property>
<property name="autoplay">1</property>
<property name="loop">1</property>
<property name="file">resource:///org/gtk/WidgetFactory4/gtk-logo.webm</property>
</object>

View File

@@ -70,3 +70,8 @@ gtk/inspector @otte @matthiasc
# Layout managers
gtk/gtklayout* @ebassi
gtk/gtkconstraint* @ebassi
# Accessibility
gtk/gtkaccessible*.[ch] @ebassi
gtk/gtkatcontext*.[ch] @ebassi
gtk/a11y @ebassi

View File

@@ -1,4 +1,3 @@
<INCLUDE>gdk/gdk.h</INCLUDE>
<SECTION>
@@ -11,6 +10,11 @@ GDK_WINDOWING_WIN32
GDK_WINDOWING_MACOS
GDK_WINDOWING_WAYLAND
<SUBSECTION>
GDK_MAJOR_VERSION
GDK_MICRO_VERSION
GDK_MINOR_VERSION
<SUBSECTION>
GDK_VERSION_4_0
GDK_VERSION_MIN_REQUIRED
@@ -24,6 +28,9 @@ GDK_TYPE_GRAB_STATUS
GDK_TYPE_STATUS
GdkStatus
GDKVAR
GDK_EXTERN_VAR
_GDK_EXTERN
GDK_DECLARE_INTERNAL_TYPE
gdk_axis_use_get_type
gdk_byte_order_get_type
gdk_crossing_mode_get_type
@@ -189,6 +196,7 @@ gdk_surface_create_cairo_context
<SUBSECTION>
gdk_surface_queue_render
gdk_surface_get_frame_clock
gdk_surface_request_layout
<SUBSECTION>
gdk_surface_set_cursor
@@ -196,7 +204,6 @@ gdk_surface_get_cursor
gdk_surface_set_input_region
gdk_surface_get_width
gdk_surface_get_height
gdk_surface_set_shadow_width
gdk_surface_get_device_position
GdkModifierType
GDK_MODIFIER_MASK
@@ -368,6 +375,7 @@ gdk_device_tool_get_hardware_id
gdk_device_tool_get_axes
<SUBSECTION Standard>
GDK_TYPE_AXIS_FLAGS
GDK_TYPE_AXIS_USE
GDK_TYPE_EXTENSION_MODE
GDK_TYPE_INPUT_MODE
@@ -440,6 +448,7 @@ gdk_seat_capabilities_get_type
<FILE>events</FILE>
GdkEvent
GdkEventType
GdkKeymapKey
GdkKeyMatch
GdkTouchpadGesturePhase
GdkScrollDirection
@@ -475,10 +484,14 @@ gdk_event_get_axis
gdk_event_get_history
gdk_event_get_pointer_emulated
gdk_event_triggers_context_menu
GdkButtonEvent
gdk_button_event_get_button
GdkScrollEvent
gdk_scroll_event_get_direction
gdk_scroll_event_get_deltas
gdk_scroll_event_is_stop
GdkMotionEvent
GdkKeyEvent
gdk_key_event_get_keyval
gdk_key_event_get_keycode
gdk_key_event_get_consumed_modifiers
@@ -487,23 +500,31 @@ gdk_key_event_get_level
gdk_key_event_is_modifier
gdk_key_event_matches
gdk_key_event_get_match
GdkFocusEvent
gdk_focus_event_get_in
gdk_touch_event_get_emulating_pointer
GdkCrossingEvent
gdk_crossing_event_get_mode
gdk_crossing_event_get_detail
gdk_crossing_event_get_focus
GdkGrabBrokenEvent
gdk_grab_broken_event_get_grab_surface
gdk_grab_broken_event_get_implicit
GdkDeleteEvent
GdkDNDEvent
gdk_dnd_event_get_drop
gdk_configure_event_get_size
GdkTouchEvent
GdkTouchpadEvent
gdk_touchpad_event_get_gesture_phase
gdk_touchpad_event_get_n_fingers
gdk_touchpad_event_get_deltas
gdk_touchpad_event_get_pinch_angle_delta
gdk_touchpad_event_get_pinch_scale
GdkPadEvent
gdk_pad_event_get_axis_value
gdk_pad_event_get_button
gdk_pad_event_get_group_mode
GdkProximityEvent
<SUBSECTION>
gdk_events_get_angle
@@ -511,6 +532,7 @@ gdk_events_get_center
gdk_events_get_distance
<SUBSECTION Standard>
GDK_EVENT
GDK_TYPE_EVENT
GDK_TYPE_EVENT_MASK
GDK_TYPE_EVENT_TYPE
@@ -518,11 +540,24 @@ GDK_TYPE_CROSSING_MODE
GDK_TYPE_SCROLL_DIRECTION
GDK_TYPE_NOTIFY_TYPE
GDK_IS_EVENT
GDK_IS_EVENT_TYPE
GDK_TYPE_BUTTON_EVENT
GDK_TYPE_CROSSING_EVENT
GDK_TYPE_DELETE_EVENT
GDK_TYPE_DND_EVENT
GDK_TYPE_FOCUS_EVENT
GDK_TYPE_GRAB_BROKEN_EVENT
GDK_TYPE_KEY_EVENT
GDK_TYPE_MOTION_EVENT
GDK_TYPE_PAD_EVENT
GDK_TYPE_PROXIMITY_EVENT
GDK_TYPE_SCROLL_EVENT
GDK_TYPE_TOUCH_EVENT
GDK_TYPE_TOUCHPAD_EVENT
gdk_event_get_type
gdk_event_sequence_get_type
gdk_button_event_get_type
gdk_configure_event_get_type
gdk_crossing_event_get_type
gdk_delete_event_get_type
gdk_dnd_event_get_type
@@ -640,6 +675,7 @@ GdkToplevelSize
gdk_toplevel_size_get_bounds
gdk_toplevel_size_set_size
gdk_toplevel_size_set_min_size
gdk_toplevel_size_set_shadow_width
<SUBSECTION Standard>
GDK_TYPE_TOPLEVEL_SIZE
gdk_toplevel_size_get_type
@@ -827,11 +863,14 @@ gdk_x11_display_error_trap_pop_ignored
gdk_x11_display_set_cursor_theme
gdk_x11_display_set_surface_scale
gdk_x11_display_get_glx_version
gdk_x11_display_get_primary_monitor
gdk_x11_display_get_screen
gdk_x11_monitor_get_output
gdk_x11_monitor_get_workarea
gdk_x11_screen_get_screen_number
gdk_x11_screen_get_xscreen
gdk_x11_screen_get_window_manager_name
gdk_x11_screen_get_monitor_output
gdk_x11_screen_lookup_visual
gdk_x11_screen_supports_net_wm_hint
gdk_x11_screen_get_number_of_desktops
gdk_x11_screen_get_current_desktop
@@ -846,9 +885,9 @@ gdk_x11_surface_set_utf8_property
gdk_x11_surface_set_frame_sync_enabled
gdk_x11_surface_set_group
gdk_x11_surface_get_group
gdk_x11_keymap_get_group_for_state
gdk_x11_keymap_key_is_modifier
gdk_x11_visual_get_xvisual
gdk_x11_surface_set_skip_pager_hint
gdk_x11_surface_set_skip_taskbar_hint
gdk_x11_surface_set_urgency_hint
gdk_x11_get_xatom_by_name_for_display
gdk_x11_get_xatom_name_for_display
gdk_x11_set_sm_client_id
@@ -901,29 +940,18 @@ GDK_X11_DRAG_CONTEXT_CLASS
GDK_IS_X11_DRAG_CONTEXT
GDK_IS_X11_DRAG_CONTEXT_CLASS
GDK_X11_DRAG_CONTEXT_GET_CLASS
GDK_TYPE_X11_KEYMAP
GDK_X11_KEYMAP
GDK_X11_KEYMAP_CLASS
GDK_IS_X11_KEYMAP
GDK_IS_X11_KEYMAP_CLASS
GDK_X11_KEYMAP_GET_CLASS
GDK_TYPE_X11_GL_CONTEXT
GDK_X11_GL_CONTEXT
GDK_X11_GL_CONTEXT_CLASS
GDK_IS_X11_GL_CONTEXT
GDK_IS_X11_GL_CONTEXT_CLASS
GDK_TYPE_X11_SCREEN
GDK_X11_SCREEN
GDK_X11_SCREEN_CLASS
GDK_IS_X11_SCREEN
GDK_IS_X11_SCREEN_CLASS
GDK_X11_SCREEN_GET_CLASS
GDK_TYPE_X11_VISUAL
GDK_X11_VISUAL
GDK_X11_VISUAL_CLASS
GDK_IS_X11_VISUAL
GDK_IS_X11_VISUAL_CLASS
GDK_X11_VISUAL_GET_CLASS
GDK_TYPE_X11_DRAG
GDK_X11_DRAG
GDK_IS_X11_DRAG
GDK_IS_X11_DRAG_CLASS
GDK_TYPE_X11_MONITOR
GDK_X11_MONITOR
GDK_IS_X11_MONITOR
GDK_TYPE_X11_SURFACE
GDK_X11_SURFACE
GDK_X11_SURFACE_CLASS
@@ -941,9 +969,10 @@ gdk_x11_device_xi_get_type
gdk_x11_display_get_type
gdk_x11_display_manager_get_type
gdk_x11_drag_context_get_type
gdk_x11_keymap_get_type
gdk_x11_drag_get_type
gdk_x11_gl_context_get_type
gdk_x11_monitor_get_type
gdk_x11_screen_get_type
gdk_x11_visual_get_type
gdk_x11_surface_get_type
gdk_surface_impl_x11_get_type
</SECTION>
@@ -958,7 +987,6 @@ gdk_wayland_display_query_registry
gdk_wayland_display_set_cursor_theme
gdk_wayland_display_get_startup_notification_id
gdk_wayland_display_set_startup_notification_id
gdk_wayland_display_query_registry
<SUBSECTION Device>
gdk_wayland_seat_get_wl_seat
@@ -1008,8 +1036,12 @@ GDK_IS_WAYLAND_SURFACE_CLASS
gdk_wayland_device_get_type
gdk_wayland_display_get_type
gdk_wayland_display_manager_get_type
gdk_wayland_gl_context_get_type
gdk_wayland_monitor_get_type
gdk_wayland_popup_get_type
gdk_wayland_seat_get_type
gdk_wayland_surface_get_type
gdk_wayland_toplevel_get_type
</SECTION>
<SECTION>
@@ -1171,6 +1203,10 @@ GdkCairoContext
gdk_cairo_context_cairo_create
<SUBSECTION Standard>
GDK_CAIRO_CONTEXT
GDK_IS_CAIRO_CONTEXT
GDK_TYPE_CAIRO_CONTEXT
GDK_CAIRO_ERROR
gdk_cairo_context_get_type
</SECTION>
@@ -1190,6 +1226,11 @@ gdk_vulkan_context_get_queue
gdk_vulkan_context_get_queue_family_index
<SUBSECTION Standard>
GDK_VULKAN_CONTEXT
GDK_IS_VULKAN_CONTEXT
GDK_TYPE_VULKAN_CONTEXT
GDK_RENDERING_VULKAN
GDK_VULKAN_ERROR
gdk_vulkan_context_get_type
gdk_vulkan_error_quark
gdk_vulkan_strerror

View File

@@ -1,21 +1,22 @@
private_headers = [
'gdkintl.h',
'gdkmarshalers.h',
'gdkkeysyms.h',
'gdkinternals.h',
'gdk-autocleanup.h',
'gdk-private.h',
'gdkapplaunchcontextprivate.h',
'gdkcairocontextprivate.h',
'gdkcairoprivate.h',
'gdkclipboardprivate.h',
'gdkcontentformatsprivate.h',
'gdkcontentproviderprivate.h',
'gdkcursorprivate.h',
'gdkdeviceprivate.h',
'gdkdebug.h',
'gdkdevicepadprivate.h',
'gdkdeviceprivate.h',
'gdkdevicetoolprivate.h',
'gdkdisplaymanagerprivate.h',
'gdkdisplayprivate.h',
'gdkdndprivate.h',
'gdkdragprivate.h',
'gdkdragsurfaceprivate.h',
'gdkdrawcontextprivate.h',
'gdkdropprivate.h',
'gdkeventsprivate.h',
@@ -23,12 +24,17 @@ private_headers = [
'gdkframeclockprivate.h',
'gdkglcontextprivate.h',
'gdkgltextureprivate.h',
'gdkinternals.h',
'gdkintl.h',
'gdkkeysprivate.h',
'gdkmonitorprivate.h',
'gdkkeysyms.h',
'gdkmarshalers.h',
'gdkmemorytextureprivate.h',
'gdkmonitorprivate.h',
'gdkpipeiostreamprivate.h',
'gdkpopupprivate.h',
'gdkprofilerprivate.h',
'gdkrgbaprivate.h',
'gdkscreenprivate.h',
'gdkseatdefaultprivate.h',
'gdkseatprivate.h',
@@ -37,22 +43,71 @@ private_headers = [
'gdksurfaceprivate.h',
'gdktextureprivate.h',
'gdktoplevelprivate.h',
'gdktoplevelsizeprivate.h',
'gdkvulkancontextprivate.h',
'filetransferportalprivate.h',
'gdkconstructor.h',
'keyname-table.h',
'x11/gdkprivate-x11.h',
'x11/gdkeventsource.h',
# gdk/x11
'gdkasync.h',
'gdkcairocontext-x11.h',
'gdkclipboard-x11.h',
'gdkdevice-xi2-private.h',
'gdkdevicemanagerprivate-core.h',
'gdkdisplay-x11.h',
'gdkeventsource.h',
'gdkeventtranslator.h',
'gdkglcontext-x11.h',
'gdkkeys-x11.h',
'gdkmonitor-x11.h',
'gdkprivate-x11.h',
'gdkscreen-x11.h',
'gdkselectioninputstream-x11.h',
'gdkselectionoutputstream-x11.h',
'gdksurface-x11.h',
'gdktextlistconverter-x11.h',
'gdkvisual-x11.h',
'gdkvulkancontext-x11.h',
'gdkx-autocleanups.h',
'MwmUtil.h',
'xsettings-client.h',
# gdk/wayland
'gdkcairocontext-wayland.h',
'gdkclipboard-wayland.h',
'gdkdevice-wayland-private.h',
'gdkdisplay-wayland.h',
'gdkglcontext-wayland.h',
'gdkmonitor-wayland.h',
'gdkprimary-wayland.h',
'gdkprivate-wayland.h',
'gdkseat-wayland.h',
'gdksurface-wayland.h',
'gdkvulkancontext-wayland.h',
'wm-button-layout-translation.h',
'gtk-primary-selection-client-protocol.h',
'gtk-shell-client-protocol.h',
'idle-inhibit-unstable-v1-client-protocol.h',
'keyboard-shortcuts-inhibit-unstable-v1-client-protocol.h',
'pointer-gestures-unstable-v1-client-protocol.h',
'primary-selection-unstable-v1-client-protocol.h',
'server-decoration-client-protocol.h',
'tablet-unstable-v2-client-protocol.h',
'xdg-foreign-unstable-v1-client-protocol.h',
'xdg-shell-unstable-v6-client-protocol.h',
'win32',
'quartz',
'xdg-output-unstable-v1-client-protocol.h',
'xdg-shell-client-protocol.h',
'xdg-shell-unstable-v6-client-protocol.h',
'wayland-cursor.h',
'os-compatibility.h',
'xcursor.h',
'broadway',
'mir'
'wayland/cursor',
'macos',
'win32',
]
images = [
@@ -107,22 +162,26 @@ if get_option('gtk_doc')
configure_file(input: 'version.xml.in', output: 'version.xml', configuration: version_conf)
gnome.gtkdoc('gdk4',
mode: 'none',
main_xml: 'gdk4-docs.xml',
src_dir: src_dir,
dependencies: libgtk_dep,
gobject_typesfile: join_paths(meson.current_source_dir(), 'gdk4.types'),
scan_args: [
'--ignore-decorators=_GDK_EXTERN|G_GNUC_WARN_UNUSED_RESULT',
'--ignore-headers=' + ' '.join(private_headers),
],
fixxref_args: [
'--html-dir=@0@'.format(docpath),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'glib')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gobject')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gio')),
'--extra-dir=@0@'.format(cairo_docpath),
],
html_assets: images,
install: true)
mode: 'none',
main_xml: 'gdk4-docs.xml',
src_dir: src_dir,
dependencies: libgtk_dep,
gobject_typesfile: join_paths(meson.current_source_dir(), 'gdk4.types'),
scan_args: [
'--ignore-decorators=_GDK_EXTERN|G_GNUC_WARN_UNUSED_RESULT',
'--ignore-headers=' + ' '.join(private_headers),
],
mkdb_args: [
'--ignore-files=' + ' '.join(private_headers),
],
fixxref_args: [
'--html-dir=@0@'.format(docpath),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'glib')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gobject')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gio')),
'--extra-dir=@0@'.format(cairo_docpath),
],
html_assets: images,
install: true,
)
endif

View File

@@ -23,6 +23,14 @@
<xi:include href="xml/GskGLShader.xml" />
</reference>
<part id="paths">
<title>Paths</title>
<xi:include href="xml/GskPath.xml" />
<xi:include href="xml/GskPathBuilder.xml" />
<xi:include href="xml/GskPathMeasure.xml" />
<xi:include href="xml/GskStroke.xml" />
</part>
<index id="api-index-full">
<title>Index of all symbols</title>
<xi:include href="xml/api-index-full.xml"><xi:fallback /></xi:include>

View File

@@ -20,6 +20,40 @@ GSK_TYPE_RENDERER
GskRendererClass
gsk_renderer_get_type
GSK_TYPE_SCALING_FILTER
GSK_BROADWAY_RENDERER
GSK_BROADWAY_RENDERER_CLASS
GSK_BROADWAY_RENDERER_GET_CLASS
GSK_IS_BROADWAY_RENDERER
GSK_IS_BROADWAY_RENDERER_CLASS
GSK_TYPE_BROADWAY_RENDERER
GskBroadwayRenderer
GskBroadwayRendererClass
GSK_CAIRO_RENDERER
GSK_CAIRO_RENDERER_CLASS
GSK_CAIRO_RENDERER_GET_CLASS
GSK_IS_CAIRO_RENDERER
GSK_IS_CAIRO_RENDERER_CLASS
GSK_TYPE_CAIRO_RENDERER
GskCairoRenderer
GskCairoRendererClass
GSK_GL_RENDERER
GSK_GL_RENDERER_CLASS
GSK_GL_RENDERER_GET_CLASS
GSK_IS_GL_RENDERER
GSK_IS_GL_RENDERER_CLASS
GSK_TYPE_GL_RENDERER
GskGLRenderer
GskGLRendererClass
gsk_gl_renderer_get_type
GSK_VULKAN_RENDERER
GSK_VULKAN_RENDERER_CLASS
GSK_VULKAN_RENDERER_GET_CLASS
GSK_IS_VULKAN_RENDERER
GSK_IS_VULKAN_RENDERER_CLASS
GSK_TYPE_VULKAN_RENDERER
GskVulkanRenderer
GskVulkanRendererClass
gsk_vulkan_renderer_get_type
</SECTION>
<SECTION>
@@ -32,6 +66,7 @@ GskCairoNode
GskClipNode
GskColorMatrixNode
GskColorNode
GskConicGradientNode
GskContainerNode
GskCrossFadeNode
GskDebugNode
@@ -56,25 +91,29 @@ gsk_render_node_get_node_type
gsk_render_node_draw
GskSerializationError
GskParseErrorFunc
GskParseLocation
gsk_render_node_serialize
gsk_render_node_deserialize
gsk_render_node_write_to_file
GskScalingFilter
gsk_render_node_get_bounds
<SUBSECTION Nodes>
<SUBSECTION>
gsk_color_node_new
gsk_color_node_get_color
gsk_texture_node_new
gsk_texture_node_get_texture
<SUBSECTION>
GskColorStop
gsk_linear_gradient_node_new
gsk_repeating_linear_gradient_node_new
gsk_linear_gradient_node_get_start
gsk_linear_gradient_node_get_end
gsk_linear_gradient_node_get_n_color_stops
gsk_linear_gradient_node_get_color_stops
gsk_repeating_linear_gradient_node_new
<SUBSECTION>
gsk_radial_gradient_node_new
gsk_repeating_radial_gradient_node_new
gsk_radial_gradient_node_get_n_color_stops
gsk_radial_gradient_node_get_color_stops
gsk_radial_gradient_node_get_start
@@ -82,11 +121,18 @@ gsk_radial_gradient_node_get_end
gsk_radial_gradient_node_get_hradius
gsk_radial_gradient_node_get_vradius
gsk_radial_gradient_node_get_center
gsk_repeating_radial_gradient_node_new
<SUBSECTION>
gsk_conic_gradient_node_new
gsk_conic_gradient_node_get_n_color_stops
gsk_conic_gradient_node_get_color_stops
gsk_conic_gradient_node_get_center
gsk_conic_gradient_node_get_rotation
<SUBSECTION>
gsk_border_node_new
gsk_border_node_get_outline
gsk_border_node_get_widths
gsk_border_node_get_colors
<SUBSECTION>
gsk_inset_shadow_node_new
gsk_inset_shadow_node_get_outline
gsk_inset_shadow_node_get_color
@@ -94,6 +140,7 @@ gsk_inset_shadow_node_get_dx
gsk_inset_shadow_node_get_dy
gsk_inset_shadow_node_get_spread
gsk_inset_shadow_node_get_blur_radius
<SUBSECTION>
gsk_outset_shadow_node_new
gsk_outset_shadow_node_get_outline
gsk_outset_shadow_node_get_color
@@ -101,45 +148,63 @@ gsk_outset_shadow_node_get_dx
gsk_outset_shadow_node_get_dy
gsk_outset_shadow_node_get_spread
gsk_outset_shadow_node_get_blur_radius
<SUBSECTION>
gsk_cairo_node_new
gsk_cairo_node_get_draw_context
gsk_cairo_node_get_surface
<SUBSECTION>
gsk_container_node_new
gsk_container_node_get_n_children
gsk_container_node_get_child
<SUBSECTION>
gsk_transform_node_new
gsk_transform_node_get_child
gsk_transform_node_get_transform
<SUBSECTION>
gsk_opacity_node_new
gsk_opacity_node_get_child
gsk_opacity_node_get_opacity
<SUBSECTION>
gsk_color_matrix_node_new
gsk_color_matrix_node_get_child
gsk_color_matrix_node_get_color_matrix
gsk_color_matrix_node_get_color_offset
<SUBSECTION>
gsk_repeat_node_new
gsk_repeat_node_get_child
gsk_repeat_node_get_child_bounds
<SUBSECTION>
gsk_clip_node_new
gsk_clip_node_get_child
gsk_clip_node_get_clip
<SUBSECTION>
gsk_rounded_clip_node_new
gsk_rounded_clip_node_get_child
gsk_rounded_clip_node_get_clip
<SUBSECTION>
GskFillRule
gsk_fill_node_new
gsk_fill_node_get_child
gsk_fill_node_get_path
gsk_fill_node_get_fill_rule
<SUBSECTION>
GskShadow
gsk_shadow_node_new
gsk_shadow_node_get_shadow
gsk_shadow_node_get_n_shadows
gsk_shadow_node_get_child
<SUBSECTION>
GskBlendMode
gsk_blend_node_new
gsk_blend_node_get_bottom_child
gsk_blend_node_get_top_child
gsk_blend_node_get_blend_mode
<SUBSECTION>
gsk_cross_fade_node_new
gsk_cross_fade_node_get_start_child
gsk_cross_fade_node_get_end_child
gsk_cross_fade_node_get_progress
<SUBSECTION>
gsk_text_node_new
gsk_text_node_get_font
gsk_text_node_get_glyphs
@@ -147,12 +212,15 @@ gsk_text_node_get_color
gsk_text_node_has_color_glyphs
gsk_text_node_get_num_glyphs
gsk_text_node_get_offset
<SUBSECTION>
gsk_blur_node_new
gsk_blur_node_get_child
gsk_blur_node_get_radius
<SUBSECTION>
gsk_debug_node_new
gsk_debug_node_get_child
gsk_debug_node_get_message
<SUBSECTION>
gsk_gl_shader_node_new
gsk_gl_shader_node_get_n_children
gsk_gl_shader_node_get_child
@@ -170,13 +238,18 @@ GSK_TYPE_CLIP_NODE
GSK_TYPE_COLOR_MATRIX_NODE
GSK_TYPE_COLOR_NODE
GSK_TYPE_CONTAINER_NODE
GSK_TYPE_CONIC_GRADIENT_NODE
GSK_TYPE_CROSS_FADE_NODE
GSK_TYPE_DEBUG_NODE
GSK_TYPE_FILL_NODE
GSK_TYPE_GL_SHADER_NODE
GSK_TYPE_INSET_SHADOW_NODE
GSK_TYPE_LINEAR_GRADIENT_NODE
GSK_TYPE_OPACITY_NODE
GSK_TYPE_OUTSET_SHADOW_NODE
GSK_TYPE_RADIAL_GRADIENT_NODE
GSK_TYPE_REPEATING_LINEAR_GRADIENT_NODE
GSK_TYPE_REPEATING_RADIAL_GRADIENT_NODE
GSK_TYPE_REPEAT_NODE
GSK_TYPE_ROUNDED_CLIP_NODE
GSK_TYPE_SHADOW_NODE
@@ -184,6 +257,7 @@ GSK_TYPE_TEXT_NODE
GSK_TYPE_TEXTURE_NODE
GSK_TYPE_TRANSFORM_NODE
GSK_TYPE_GLSHADER_NODE
GSK_TYPE_RENDER_NODE_TYPE
GskRenderNodeClass
gsk_blend_node_get_type
gsk_blur_node_get_type
@@ -194,22 +268,26 @@ gsk_cairo_renderer_get_type
gsk_clip_node_get_type
gsk_color_matrix_node_get_type
gsk_color_node_get_type
gsk_conic_gradient_node_get_type
gsk_container_node_get_type
gsk_cross_fade_node_get_type
gsk_debug_node_get_type
gsk_fill_node_get_type
gsk_gl_shader_node_get_type
gsk_inset_shadow_node_get_type
gsk_linear_gradient_node_get_type
gsk_opacity_node_get_type
gsk_outset_shadow_node_get_type
gsk_radial_gradient_node_get_type
gsk_render_node_get_type
gsk_repeating_linear_gradient_node_get_type
gsk_repeating_radial_gradient_node_get_type
gsk_repeat_node_get_type
gsk_rounded_clip_node_get_type
gsk_shadow_node_get_type
gsk_text_node_get_type
gsk_texture_node_get_type
gsk_transform_node_get_type
gsk_gl_shader_node_get_type
GSK_TYPE_BLEND_MODE
<SUBSECTION Standard>
gsk_serialization_error_quark
@@ -232,6 +310,116 @@ gsk_rounded_rect_is_rectilinear
gsk_rounded_rect_contains_point
gsk_rounded_rect_contains_rect
gsk_rounded_rect_intersects_rect
<SUBSECTION Standard>
GSK_TYPE_CORNER
</SECTION>
<SECTION>
<FILE>GskPath</FILE>
<SUBSECTION>
GskPath
gsk_path_ref
gsk_path_unref
gsk_path_new_rect
gsk_path_new_from_cairo
gsk_path_parse
<SUBSECTION>
gsk_path_print
gsk_path_to_string
gsk_path_to_cairo
<SUBSECTION>
gsk_path_is_empty
gsk_path_get_bounds
gsk_path_get_stroke_bounds
<SUBSECTION>
GskPathOperation
GskPathForeachFlags
GskPathForeachFunc
gsk_path_foreach
<SUBSECTION Private>
GSK_TYPE_PATH
gsk_path_get_type
</SECTION>
<SECTION>
<FILE>GskPathBuilder</FILE>
GskPathBuilder
gsk_path_builder_new
gsk_path_builder_ref
gsk_path_builder_unref
gsk_path_builder_to_path
gsk_path_builder_free_to_path
<SUBSECTION>
gsk_path_builder_get_current_point
<SUBSECTION>
gsk_path_builder_add_rect
gsk_path_builder_add_rounded_rect
gsk_path_builder_add_circle
gsk_path_builder_add_ellipse
gsk_path_builder_add_path
gtk_path_builder_add_segment
<SUBSECTION>
gsk_path_builder_move_to
gsk_path_builder_rel_move_to
gsk_path_builder_line_to
gsk_path_builder_rel_line_to
gsk_path_builder_curve_to
gsk_path_builder_rel_curve_to
gsk_path_builder_conic_to
gsk_path_builder_rel_conic_to
gsk_path_builder_close
<SUBSECTION Private>
GSK_TYPE_PATH_BUILDER
gsk_path_builder_get_type
</SECTION>
<SECTION>
<FILE>GskPathMeasure</FILE>
GskPathMeasure
gsk_path_measure_new
gsk_path_measure_new_with_tolerance
gsk_path_measure_ref
gsk_path_measure_unref
<SUBSECTION>
gsk_path_measure_get_path
gsk_path_measure_get_tolerance
gsk_path_measure_get_n_contours
gsk_path_measure_restrict_to_contour
<SUBSECTION>
gsk_path_measure_get_length
gsk_path_measure_is_closed
gsk_path_measure_get_point
gsk_path_measure_get_closest_point
gsk_path_measure_get_closest_point_full
gsk_path_measure_in_fill
<SUBSECTION Private>
GSK_TYPE_PATH_MEASURE
gsk_path_measure_get_type
</SECTION>
<SECTION>
<FILE>GskStroke</FILE>
GskLineCap
GskLineJoin
gsk_stroke_new
gsk_stroke_copy
gsk_stroke_free
gsk_stroke_equal
gsk_stroke_set_line_width
gsk_stroke_get_line_width
gsk_stroke_set_line_join
gsk_stroke_get_line_join
gsk_stroke_set_line_cap
gsk_stroke_get_line_cap
gsk_stroke_set_miter_limit
gsk_stroke_get_miter_limit
gsk_stroke_set_dash
gsk_stroke_get_dash
gsk_stroke_set_dash_offset
gsk_stroke_get_dash_offset
<SUBSECTION Private>
GSK_TYPE_STROKE
gsk_stroke_get_type
</SECTION>
<SECTION>
@@ -281,10 +469,12 @@ gsk_gl_shader_new_from_bytes
gsk_gl_shader_new_from_resource
gsk_gl_shader_compile
gsk_gl_shader_get_source
gsk_gl_shader_get_resource
gsk_gl_shader_get_n_textures
gsk_gl_shader_get_n_uniforms
gsk_gl_shader_get_uniform_name
gsk_gl_shader_find_uniform_by_name
GskGLUniformType
gsk_gl_shader_get_uniform_type
gsk_gl_shader_get_uniform_offset
gsk_gl_shader_get_args_size
@@ -316,4 +506,10 @@ gsk_shader_args_builder_set_bool
gsk_shader_args_builder_set_vec2
gsk_shader_args_builder_set_vec3
gsk_shader_args_builder_set_vec4
<SUBSECTION Private>
GSK_TYPE_GL_SHADER
GSK_TYPE_GL_UNIFORM_TYPE
GSK_TYPE_SHADER_ARGS_BUILDER
gsk_shader_args_builder_get_type
</SECTION>

View File

@@ -1,27 +1,48 @@
private_headers = [
'gsk-autocleanup.h',
'gskcairoblurprivate.h',
'gskcairorendererprivate.h',
'gskdebugprivate.h',
'gskgldriverprivate.h',
'gskglprofilerprivate.h',
'gskglrendererprivate.h',
'gskdiffprivate.h',
'gskglshaderprivate.h',
'gskprivate.h',
'gskprofilerprivate.h',
'gskrendererprivate.h',
'gskrendernodeprivate.h',
'gskrendernodeparserprivate.h',
'gskroundedrectprivate.h',
'gskshaderbuilderprivate.h',
'gsktextureprivate.h',
'gsktransformprivate.h',
'gskvulkanblendpipelineprivate.h',
# gsk/gl
'glutilsprivate.h',
'gskgldriverprivate.h',
'gskglglyphcacheprivate.h',
'gskgliconcacheprivate.h',
'gskglimageprivate.h',
'gskglnodesampleprivate.h',
'gskglprofilerprivate.h',
'gskglrendererprivate.h',
'gskglrenderopsprivate.h',
'gskglshaderbuilderprivate.h',
'gskglshadowcacheprivate.h',
'gskgltextureatlasprivate.h',
'opbuffer.h',
'stb_rect_pack.h',
# gsk/vulkan
'gskvulkanblendmodepipelineprivate.h',
'gskvulkanblurpipelineprivate.h',
'gskvulkanborderpipelineprivate.h',
'gskvulkanboxshadowpipelineprivate.h',
'gskvulkanbufferprivate.h',
'gskvulkanclipprivate.h',
'gskvulkancolorpipelineprivate.h',
'gskvulkancolortextpipelineprivate.h',
'gskvulkancommandpoolprivate.h',
'gskvulkancrossfadepipelineprivate.h',
'gskvulkaneffectpipelineprivate.h',
'gskvulkanglyphcacheprivate.h',
'gskvulkanimageprivate.h',
'gskvulkanlineargradientpipelineprivate.h',
'gskvulkanmemoryprivate.h',
@@ -31,6 +52,8 @@ private_headers = [
'gskvulkanrenderpassprivate.h',
'gskvulkanrenderprivate.h',
'gskvulkanshaderprivate.h',
'gskvulkantextpipelineprivate.h',
'gskvulkantexturepipelineprivate.h',
]
images = [
@@ -40,25 +63,29 @@ if get_option('gtk_doc')
configure_file(input: 'version.xml.in', output: 'version.xml', configuration: version_conf)
gnome.gtkdoc('gsk4',
mode: 'none',
main_xml: 'gsk4-docs.xml',
src_dir: [
gskinc,
],
dependencies: libgtk_dep,
gobject_typesfile: join_paths(meson.current_source_dir(), 'gsk4.types'),
scan_args: [
'--ignore-decorators=_GDK_EXTERN',
'--ignore-headers=' + ' '.join(private_headers),
],
fixxref_args: [
'--html-dir=@0@'.format(docpath),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'glib')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gobject')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gio')),
'--extra-dir=@0@'.format(cairo_docpath),
'--extra-dir=../gdk',
],
html_assets: images,
install: true)
mode: 'none',
main_xml: 'gsk4-docs.xml',
src_dir: [
gskinc,
],
dependencies: libgtk_dep,
gobject_typesfile: join_paths(meson.current_source_dir(), 'gsk4.types'),
scan_args: [
'--ignore-decorators=_GDK_EXTERN',
'--ignore-headers=' + ' '.join(private_headers),
],
mkdb_args: [
'--ignore-files=' + ' '.join(private_headers),
],
fixxref_args: [
'--html-dir=@0@'.format(docpath),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'glib')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gobject')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gio')),
'--extra-dir=@0@'.format(cairo_docpath),
'--extra-dir=../gdk',
],
html_assets: images,
install: true,
)
endif

View File

@@ -283,7 +283,6 @@
<xi:include href="xml/gtkcolorchooserwidget.xml" />
<xi:include href="xml/gtkcolorchooserdialog.xml" />
<xi:include href="xml/gtkfilechooser.xml" />
<xi:include href="xml/gtkfilechooserbutton.xml" />
<xi:include href="xml/gtkfilechoosernative.xml" />
<xi:include href="xml/gtkfilechooserdialog.xml" />
<xi:include href="xml/gtkfilechooserwidget.xml" />

View File

@@ -618,6 +618,14 @@ GtkBuildable
GtkBuildableIface
GtkBuildableParser
gtk_buildable_get_buildable_id
<SUBSECTION Parser>
gtk_buildable_parse_context_get_element
gtk_buildable_parse_context_get_element_stack
gtk_buildable_parse_context_get_position
gtk_buildable_parse_context_pop
gtk_buildable_parse_context_push
<SUBSECTION Standard>
GTK_BUILDABLE
GTK_IS_BUILDABLE
@@ -835,6 +843,8 @@ gtk_combo_box_get_active_id
gtk_combo_box_set_active_id
gtk_combo_box_get_model
gtk_combo_box_set_model
gtk_combo_box_popup
gtk_combo_box_popup_for_device
gtk_combo_box_popdown
gtk_combo_box_get_row_separator_func
gtk_combo_box_set_row_separator_func
@@ -1001,7 +1011,6 @@ gtk_editable_label_get_type
<FILE>gtktext</FILE>
<TITLE>GtkText</TITLE>
GtkText
GtkTextClass
gtk_text_new
gtk_text_new_with_buffer
gtk_text_set_buffer
@@ -1339,31 +1348,6 @@ gtk_file_chooser_widget_get_type
GtkFileChooserWidgetPrivate
</SECTION>
<SECTION>
<FILE>gtkfilechooserbutton</FILE>
<TITLE>GtkFileChooserButton</TITLE>
GtkFileChooserButton
gtk_file_chooser_button_new
gtk_file_chooser_button_new_with_dialog
gtk_file_chooser_button_get_title
gtk_file_chooser_button_set_title
gtk_file_chooser_button_get_width_chars
gtk_file_chooser_button_set_width_chars
gtk_file_chooser_button_get_modal
gtk_file_chooser_button_set_modal
<SUBSECTION Standard>
GTK_FILE_CHOOSER_BUTTON
GTK_IS_FILE_CHOOSER_BUTTON
GTK_TYPE_FILE_CHOOSER_BUTTON
GTK_FILE_CHOOSER_BUTTON_CLASS
GTK_IS_FILE_CHOOSER_BUTTON_CLASS
GTK_FILE_CHOOSER_BUTTON_GET_CLASS
<SUBSECTION Private>
gtk_file_chooser_button_get_type
GtkFileChooserButtonPrivate
</SECTION>
<SECTION>
<FILE>gtkfilefilter</FILE>
GtkFileFilter
@@ -2782,7 +2766,6 @@ gtk_sort_list_model_get_type
GtkSpinButton
GtkSpinButtonUpdatePolicy
GtkSpinType
gtk_spin_button_configure
gtk_spin_button_new
gtk_spin_button_new_with_range
gtk_spin_button_set_adjustment
@@ -2806,6 +2789,7 @@ gtk_spin_button_set_snap_to_ticks
gtk_spin_button_get_snap_to_ticks
gtk_spin_button_set_climb_rate
gtk_spin_button_get_climb_rate
gtk_spin_button_configure
gtk_spin_button_spin
gtk_spin_button_update
GTK_INPUT_ERROR
@@ -2854,6 +2838,7 @@ gtk_statusbar_push
gtk_statusbar_pop
gtk_statusbar_remove
gtk_statusbar_remove_all
gtk_statusbar_get_message
<SUBSECTION Standard>
GTK_STATUSBAR
GTK_IS_STATUSBAR
@@ -2988,6 +2973,8 @@ GTK_TEXT_BUFFER_GET_CLASS
gtk_text_buffer_get_type
<SUBSECTION Private>
GtkTextBufferPrivate
gtk_text_byte_begins_utf8_char
gtk_text_unknown_char_utf8_gtk_tests_only
</SECTION>
<SECTION>
@@ -4027,6 +4014,10 @@ gtk_cell_renderer_get_padding
gtk_cell_renderer_set_padding
gtk_cell_renderer_get_state
gtk_cell_renderer_is_activatable
gtk_cell_renderer_get_is_expanded
gtk_cell_renderer_get_is_expander
gtk_cell_renderer_set_is_expanded
gtk_cell_renderer_set_is_expander
<SUBSECTION Width-for-height>
gtk_cell_renderer_get_preferred_height
@@ -4304,6 +4295,8 @@ gtk_snapshot_push_color_matrix
gtk_snapshot_push_repeat
gtk_snapshot_push_clip
gtk_snapshot_push_rounded_clip
gtk_snapshot_push_fill
gtk_snapshot_push_stroke
gtk_snapshot_push_cross_fade
gtk_snapshot_push_blend
gtk_snapshot_push_blur
@@ -4311,6 +4304,7 @@ gtk_snapshot_push_shadow
gtk_snapshot_push_debug
gtk_snapshot_push_gl_shader
gtk_snapshot_pop
gtk_snapshot_gl_shader_pop_texture
gtk_snapshot_save
gtk_snapshot_restore
gtk_snapshot_transform
@@ -4329,9 +4323,13 @@ gtk_snapshot_append_color
gtk_snapshot_append_layout
gtk_snapshot_append_linear_gradient
gtk_snapshot_append_repeating_linear_gradient
gtk_snapshot_append_conic_gradient
gtk_snapshot_append_border
gtk_snapshot_append_inset_shadow
gtk_snapshot_append_outset_shadow
gtk_snapshot_append_radial_gradient
gtk_snapshot_append_repeating_radial_gradient
gtk_snapshot_render_insertion_cursor
gtk_snapshot_render_background
gtk_snapshot_render_frame
gtk_snapshot_render_focus
@@ -4390,6 +4388,9 @@ gtk_widget_class_add_binding_signal
gtk_widget_class_add_binding_action
gtk_widget_class_set_layout_manager_type
gtk_widget_class_get_layout_manager_type
gtk_widget_class_set_activate_signal
gtk_widget_class_set_activate_signal_from_name
gtk_widget_class_get_activate_signal
gtk_widget_activate
gtk_widget_is_focus
gtk_widget_grab_focus
@@ -4463,6 +4464,7 @@ gtk_widget_get_focusable
gtk_widget_set_focusable
gtk_widget_get_focus_on_click
gtk_widget_set_focus_on_click
gtk_widget_get_focus_child
gtk_widget_set_focus_child
gtk_widget_get_can_target
gtk_widget_set_can_target
@@ -4613,6 +4615,7 @@ gtk_window_set_destroy_with_parent
gtk_window_set_display
gtk_window_is_active
gtk_window_is_maximized
gtk_window_is_fullscreen
gtk_window_get_toplevels
gtk_window_list_toplevels
gtk_window_get_focus
@@ -4639,12 +4642,10 @@ gtk_window_get_default_size
gtk_window_get_destroy_with_parent
gtk_window_get_icon_name
gtk_window_get_modal
gtk_window_get_size
gtk_window_get_title
gtk_window_get_transient_for
gtk_window_get_group
gtk_window_has_group
gtk_window_resize
gtk_window_set_default_icon_name
gtk_window_set_icon_name
gtk_window_set_auto_startup_notification
@@ -5127,6 +5128,34 @@ GTK_PRINTER_GET_CLASS
<SUBSECTION Private>
GtkPrinterPrivate
gtk_printer_get_type
GtkPrinterOption
gtk_printer_option_allocate_choices
gtk_printer_option_choices_from_array
gtk_printer_option_clear_has_conflict
gtk_printer_option_get_activates_default
gtk_printer_option_get_type
gtk_printer_option_has_choice
gtk_printer_option_new
gtk_printer_option_set
gtk_printer_option_set_activates_default
gtk_printer_option_set_add
gtk_printer_option_set_boolean
gtk_printer_option_set_clear_conflicts
gtk_printer_option_set_foreach
gtk_printer_option_set_foreach_in_group
gtk_printer_option_set_get_groups
gtk_printer_option_set_get_type
gtk_printer_option_set_has_conflict
gtk_printer_option_set_lookup
gtk_printer_option_set_new
gtk_printer_option_set_remove
GtkPrinterOptionWidget
gtk_printer_option_widget_get_external_label
gtk_printer_option_widget_get_type
gtk_printer_option_widget_get_value
gtk_printer_option_widget_has_external_label
gtk_printer_option_widget_new
gtk_printer_option_widget_set_source
</SECTION>
@@ -5319,6 +5348,7 @@ GtkCustomPaperUnixDialogClass
<SUBSECTION Private>
gtk_paper_size_get_type
gtk_custom_paper_unix_dialog_get_type
gtk_print_load_custom_papers
GtkCustomPaperUnixDialogPrivate
</SECTION>
@@ -5474,6 +5504,20 @@ gtk_test_init
gtk_test_list_all_types
gtk_test_register_all_types
gtk_test_widget_wait_for_draw
<SUBSECTION Accessibility>
gtk_test_accessible_assert_property
gtk_test_accessible_assert_relation
gtk_test_accessible_assert_role
gtk_test_accessible_assert_state
gtk_test_accessible_check_property
gtk_test_accessible_check_relation
gtk_test_accessible_check_state
gtk_test_accessible_has_property
gtk_test_accessible_has_relation
gtk_test_accessible_has_role
gtk_test_accessible_has_state
<SECTION Private>
gtk_test_accessible_assertion_message_role
</SECTION>
<SECTION>
@@ -6137,6 +6181,7 @@ GtkPopover
gtk_popover_new
gtk_popover_popup
gtk_popover_popdown
gtk_popover_present
gtk_popover_set_child
gtk_popover_get_child
gtk_popover_set_pointing_to
@@ -6152,6 +6197,8 @@ gtk_popover_get_offset
gtk_popover_set_default_widget
gtk_popover_set_cascade_popdown
gtk_popover_get_cascade_popdown
gtk_popover_get_mnemonics_visible
gtk_popover_set_mnemonics_visible
<SUBSECTION Standard>
GTK_TYPE_POPOVER
GTK_IS_POPOVER
@@ -6994,8 +7041,9 @@ GtkNative
gtk_native_get_for_surface
gtk_native_get_surface
gtk_native_get_renderer
gtk_native_check_resize
gtk_native_get_surface_transform
gtk_native_realize
gtk_native_unrealize
<SUBSECTION Private>
gtk_native_get_type
@@ -7536,6 +7584,9 @@ gtk_accessible_reset_property
gtk_accessible_update_relation
gtk_accessible_update_relation_value
gtk_accessible_reset_relation
gtk_accessible_property_init_value
gtk_accessible_relation_init_value
gtk_accessible_state_init_value
<SUBSECTION Standard>
GTK_TYPE_ACCESSIBLE

View File

@@ -19,8 +19,8 @@ gtk_assistant_page_get_type
gtk_at_context_get_type
gtk_bin_layout_get_type
gtk_bitset_get_type
gtk_expression_get_type
gtk_bookmark_list_get_type
gtk_bool_filter_get_type
gtk_box_get_type
gtk_box_layout_get_type
gtk_buildable_get_type
@@ -46,6 +46,7 @@ gtk_cell_renderer_spinner_get_type
gtk_cell_renderer_text_get_type
gtk_cell_renderer_toggle_get_type
gtk_cell_view_get_type
gtk_center_box_get_type
gtk_center_layout_get_type
gtk_check_button_get_type
gtk_closure_expression_get_type
@@ -65,14 +66,16 @@ gtk_constraint_target_get_type
gtk_css_provider_get_type
gtk_custom_filter_get_type
gtk_custom_sorter_get_type
gtk_custom_layout_get_type
gtk_dialog_get_type
gtk_directory_list_get_type
gtk_drag_icon_get_type
gtk_drag_source_get_type
gtk_drawing_area_get_type
gtk_drop_target_get_type
gtk_drop_target_async_get_type
gtk_drop_controller_motion_get_type
gtk_drop_down_get_type
gtk_drop_target_async_get_type
gtk_drop_target_get_type
gtk_editable_get_type
gtk_editable_label_get_type
gtk_emoji_chooser_get_type
@@ -87,7 +90,7 @@ gtk_event_controller_motion_get_type
gtk_event_controller_scroll_get_type
gtk_every_filter_get_type
gtk_expander_get_type
gtk_file_chooser_button_get_type
gtk_expression_get_type
gtk_file_chooser_dialog_get_type
gtk_file_chooser_get_type
gtk_file_chooser_native_get_type
@@ -251,6 +254,7 @@ gtk_video_get_type
gtk_viewport_get_type
gtk_volume_button_get_type
gtk_widget_get_type
gtk_widget_paintable_get_type
gtk_window_get_type
gtk_window_controls_get_type
gtk_window_group_get_type

View File

@@ -119,21 +119,18 @@ around or to activate a widget that does not currently have the focus.
GTK has traditionally supported different kinds of shortcuts:
Accelerators
: Accelerators are any other shortcuts that can be activated regardless
of where the focus is, and typically trigger global actions, such as
Ctrl-Q to quit an application.
Mnmemonics
: Mnemonics are usually triggered using Alt as a modifier for a letter.
They are used in places where a label is associated with a control,
and are indicated by underlining the letter in the label. As a special
case, inside menus (i.e. inside #GtkPopoverMenu), mnemonics can be
triggered without the modifier.
Key bindings
: Key bindings are specific to individual widgets, such as Ctrl-C or
Ctrl-V in an entry copy to or paste from the clipboard. They are only
triggered when the widget has focus.
- Accelerators are any other shortcuts that can be activated regardless
of where the focus is, and typically trigger global actions, such as
Ctrl-Q to quit an application.
- Mnemonics are usually triggered using Alt as a modifier for a letter.
They are used in places where a label is associated with a control,
and are indicated by underlining the letter in the label. As a special
case, inside menus (i.e. inside #GtkPopoverMenu), mnemonics can be
triggered without the modifier.
- Key bindings are specific to individual widgets, such as Ctrl-C or
Ctrl-V in an entry copy to or paste from the clipboard. They are only
triggered when the widget has focus.
GTK handles accelerators and mnemonics in a global scope, during the
capture phase, and key bindings locally, during the target phase.

View File

@@ -1,9 +1,6 @@
fs = import('fs')
private_headers = [
'imm-extra.h',
'gtkbitmaskprivateimpl.h',
'gdkpixbufutilsprivate.h',
'gtkaccelgroupprivate.h',
'gtkaccelmapprivate.h',
'gtkaccessibleattributesetprivate.h',
@@ -21,14 +18,21 @@ private_headers = [
'gtkapplicationprivate.h',
'gtkatcontextprivate.h',
'gtkbindingsprivate.h',
'gtkbitmaskprivateimpl.h',
'gtkbitmaskprivate.h',
'gtkbuildableprivate.h',
'gtkbuilderprivate.h',
'gtkbuilderscopeprivate.h',
'gtkbuiltiniconprivate.h',
'gtkbuttonprivate.h',
'gtkcellareaboxcontextprivate.h',
'gtkcheckbuttonprivate.h',
'gtkcolorchooserprivate.h',
'gtkcoloreditorprivate.h',
'gtkcolorpickerkwinprivate.h',
'gtkcolorpickerportalprivate.h',
'gtkcolorpickerprivate.h',
'gtkcolorpickershellprivate.h',
'gtkcolorplaneprivate.h',
'gtkcolorscaleprivate.h',
'gtkcolorswatchprivate.h',
@@ -40,6 +44,7 @@ private_headers = [
'gtkcolumnviewsorterprivate.h',
'gtkcolumnviewtitleprivate.h',
'gtkcomboboxprivate.h',
'gtkcomposetable.h',
'gtkconstraintexpressionprivate.h',
'gtkconstraintguideprivate.h',
'gtkconstraintlayoutprivate.h',
@@ -47,6 +52,7 @@ private_headers = [
'gtkconstraintsolverprivate.h',
'gtkconstrainttypesprivate.h',
'gtkconstraintvflparserprivate.h',
'gtkcountingbloomfilterprivate.h',
'gtkcssanimatedstyleprivate.h',
'gtkcssanimationprivate.h',
'gtkcssarrayvalueprivate.h',
@@ -57,6 +63,7 @@ private_headers = [
'gtkcsscalcvalueprivate.h',
'gtkcsscolorvalueprivate.h',
'gtkcsscornervalueprivate.h',
'gtkcssdataurlprivate.h',
'gtkcssdimensionvalueprivate.h',
'gtkcssdynamicprivate.h',
'gtkcsseasevalueprivate.h',
@@ -65,6 +72,7 @@ private_headers = [
'gtkcssfontfeaturesvalueprivate.h',
'gtkcssfontvariationsvalueprivate.h',
'gtkcssiconthemevalueprivate.h',
'gtkcssimageconicprivate.h',
'gtkcssimagecrossfadeprivate.h',
'gtkcssimagefallbackprivate.h',
'gtkcssimageiconthemeprivate.h',
@@ -81,6 +89,7 @@ private_headers = [
'gtkcssinheritvalueprivate.h',
'gtkcssinitialvalueprivate.h',
'gtkcsskeyframesprivate.h',
'gtkcsslocationprivate.h',
'gtkcsslookupprivate.h',
'gtkcssmatcherprivate.h',
'gtkcssnodedeclarationprivate.h',
@@ -96,6 +105,7 @@ private_headers = [
'gtkcssrgbavalueprivate.h',
'gtkcsssectionprivate.h',
'gtkcssselectorprivate.h',
'gtkcssserializerprivate.h',
'gtkcssshadowsvalueprivate.h',
'gtkcssshadowvalueprivate.h',
'gtkcssshorthandpropertyprivate.h',
@@ -104,6 +114,7 @@ private_headers = [
'gtkcssstylechangeprivate.h',
'gtkcssstyleprivate.h',
'gtkcssstylepropertyprivate.h',
'gtkcsstokenizerprivate.h',
'gtkcsstransformvalueprivate.h',
'gtkcsstransientnodeprivate.h',
'gtkcsstransitionprivate.h',
@@ -113,6 +124,9 @@ private_headers = [
'gtkcsswidgetnodeprivate.h',
'gtkcsswin32sizevalueprivate.h',
'gtkdialogprivate.h',
'gtkdragdestprivate.h',
'gtkdropprivate.h',
'gtkemojicompletion.h',
'gtkentryprivate.h',
'gtkeventcontrollerlegacyprivate.h',
'gtkeventcontrollerprivate.h',
@@ -121,6 +135,7 @@ private_headers = [
'gtkfilechooserprivate.h',
'gtkfilechooserwidgetprivate.h',
'gtkfilefilterprivate.h',
'gtkflowboxprivate.h',
'gtkfontchooserprivate.h',
'gtkfontchooserwidgetprivate.h',
'gtkgesturedragprivate.h',
@@ -144,15 +159,25 @@ private_headers = [
'gtkiconviewprivate.h',
'gtkimagedefinitionprivate.h',
'gtkimageprivate.h',
'gtkimcontextbroadway.h',
'gtkimcontextime.h',
'gtkimcontextquartz.h',
'gtkimcontextsimpleprivate.h',
'gtkimcontextsimpleseqs.h',
'gtkimcontextwayland.h',
'gtkimmoduleprivate.h',
'gtkimmodule.h',
'gtkintl.h',
'gtkistringprivate.h',
'gtkkineticscrollingprivate.h',
'gtklabelprivate.h',
'gtklayoutmanagerprivate.h',
'gtklistbaseprivate.h',
'gtklistitemprivate.h',
'gtklistitemfactoryprivate.h',
'gtklistitemmanagerprivate.h',
'gtklistitemwidgetprivate.h',
'gtklistlistmodelprivate.h',
'gtklockbuttonprivate.h',
'gtkmagnifierprivate.h',
'gtkmediafileprivate.h',
@@ -160,20 +185,33 @@ private_headers = [
'gtkmenusectionboxprivate.h',
'gtkmenutrackeritemprivate.h',
'gtkmenutrackerprivate.h',
'gtkmodelbuttonprivate.h',
'gtkmodulesprivate.h',
'gtkmountoperationprivate.h',
'gtknativedialogprivate.h',
'gtknativeprivate.h',
'gtknomediafileprivate.h',
'gtkpango.h',
'gtkpasswordentrybufferprivate.h',
'gtkpasswordentryprivate.h',
'gtkpathbar.h',
'gdkpixbufutilsprivate.h',
'gtkplacessidebarprivate.h',
'gtkplacesviewprivate.h',
'gtkplacesviewrowprivate.h',
'gtkpointerfocusprivate.h',
'gtkpopcountprivate.h',
'gtkpopovermenubarprivate.h',
'gtkpopovermenuprivate.h',
'gtkpopoverprivate.h',
'gtkprintbackendprivate.h',
'gtkprinterprivate.h',
'gtkprintoperation-portal.h',
'gtkprintoperation-private.h',
'gtkprintutils.h',
'gtkprivate.h',
'gtkprogresstrackerprivate.h',
'gtkpropertylookuplistmodelprivate.h',
'gtkquery.h',
'gtkrangeprivate.h',
'gtkrbtreeprivate.h',
@@ -181,22 +219,35 @@ private_headers = [
'gtkrenderborderprivate.h',
'gtkrendericonprivate.h',
'gtkrendernodepaintableprivate.h',
'gtkrootprivate.h',
'gtkroundedboxprivate.h',
'gtkscalerprivate.h',
'gtksearchengine.h',
'gtksearchenginemodel.h',
'gtksearchenginequartz.h',
'gtksearchenginetracker3.h',
'gtksearchentryprivate.h',
'gtksecurememoryprivate.h',
'gtksettingsprivate.h',
'gtkshortcutactionprivate.h',
'gtkshortcutcontrollerprivate.h',
'gtkshortcutmanagerprivate.h',
'gtkshortcutsshortcutprivate.h',
'gtkshortcutswindowprivate.h',
'gtksidebarrowprivate.h',
'gtksizegroup-private.h',
'gtksizerequestcacheprivate.h',
'gtksnapshotprivate.h',
'gtksorterprivate.h',
'gtksortkeysprivate.h',
'gtkspinbuttonprivate.h',
'gtkstyleanimationprivate.h',
'gtkstylecascadeprivate.h',
'gtkstylecontextprivate.h',
'gtkstylepropertyprivate.h',
'gtkstyleproviderprivate.h',
'gtktestatcontextprivate.h',
'gtktextattributes.h',
'gtktextbufferprivate.h',
'gtktextchildprivate.h',
'gtktextdisplayprivate.h',
@@ -206,12 +257,17 @@ private_headers = [
'gtktextlayoutprivate.h',
'gtktextlinedisplaycacheprivate.h',
'gtktextmarkprivate.h',
'gtktextprivate.h',
'gtktextsegment.h',
'gtktexttagprivate.h',
'gtktextutil.h',
'gtktextviewchildprivate.h',
'gtktextviewprivate.h',
'gtktogglebuttonprivate.h',
'gtktoolbarprivate.h',
'gtktooltipprivate.h',
'gtktooltipwindowprivate.h',
'gtktreedatalist.h',
'gtktreepopoverprivate.h',
'gtktreeprivate.h',
'gtktreerbtreeprivate.h',
@@ -222,8 +278,21 @@ private_headers = [
'gtkwin32drawprivate.h',
'gtkwin32themeprivate.h',
'gtkwindowprivate.h',
'gtk-text-input-client-protocol.h',
'roaring.h',
'gsettings-mapping.h',
'gskpango.h',
'gtkdbusgenerated.h',
'imm-extra.h',
'language-names.h',
'open-type-layout.h',
'script-names.h',
'text-input-unstable-v3-client-protocol.h',
'a11y',
'inspector',
'roaring',
'timsort',
'tools',
]
images = [
@@ -448,43 +517,46 @@ if get_option('gtk_doc')
expand_md_targets = []
foreach t : expand_content_md_files
expand_md_targets += custom_target(t,
input: [ t ],
output: [ fs.replace_suffix(t, '.xml') ],
command: [ expand_md, '@INPUT@', '@OUTPUT@'])
input: [ t ],
output: [ fs.replace_suffix(t, '.xml') ],
command: [ expand_md, '@INPUT@', '@OUTPUT@'],
)
endforeach
gnome.gtkdoc('gtk4',
mode: 'none',
main_xml: 'gtk4-docs.xml',
src_dir: [
gtkinc,
],
dependencies: libgtk_dep,
gobject_typesfile: configure_file(
input: 'gtk4.types.in',
output: 'gtk4.types',
configuration: types_conf,
),
scan_args: [
'--ignore-decorators=_GDK_EXTERN|G_GNUC_WARN_UNUSED_RESULT',
'--ignore-headers=' + ' '.join(private_headers),
],
mkdb_args: [
'--default-includes=gtk/gtk.h',
],
fixxref_args: [
'--html-dir=@0@'.format(docpath),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'glib')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gobject')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gio')),
'--extra-dir=@0@'.format(cairo_docpath),
'--extra-dir=@0@'.format(gdkpixbuf_docpath),
'--extra-dir=../gdk',
'--extra-dir=../gsk',
],
content_files: content_files + expand_md_targets,
html_assets: images,
install: true)
mode: 'none',
main_xml: 'gtk4-docs.xml',
src_dir: [
gtkinc,
],
dependencies: libgtk_dep,
gobject_typesfile: configure_file(
input: 'gtk4.types.in',
output: 'gtk4.types',
configuration: types_conf,
),
scan_args: [
'--ignore-decorators=_GDK_EXTERN|G_GNUC_WARN_UNUSED_RESULT',
'--ignore-headers=' + ' '.join(private_headers),
],
mkdb_args: [
'--default-includes=gtk/gtk.h',
'--ignore-files=' + ' '.join(private_headers),
],
fixxref_args: [
'--html-dir=@0@'.format(docpath),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'glib')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gobject')),
'--extra-dir=@0@'.format(join_paths(glib_docpath, 'gio')),
'--extra-dir=@0@'.format(cairo_docpath),
'--extra-dir=@0@'.format(gdkpixbuf_docpath),
'--extra-dir=../gdk',
'--extra-dir=../gsk',
],
content_files: content_files + expand_md_targets,
html_assets: images,
install: true,
)
endif
xsltproc = find_program('xsltproc', required: false)
@@ -519,16 +591,17 @@ if get_option('man-pages') and xsltproc.found()
man_name = man.get(0)
man_section = man.get(1, '1')
custom_target('@0@.@1@'.format(man_name, man_section),
input: '@0@.xml'.format(man_name),
output: '@0@.@1@'.format(man_name, man_section),
command: [
xsltproc,
xlstproc_flags,
'-o', '@OUTPUT@',
'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl',
'@INPUT@',
],
install: true,
install_dir: join_paths(get_option('mandir'), 'man@0@'.format(man_section)))
input: '@0@.xml'.format(man_name),
output: '@0@.@1@'.format(man_name, man_section),
command: [
xsltproc,
xlstproc_flags,
'-o', '@OUTPUT@',
'http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl',
'@INPUT@',
],
install: true,
install_dir: join_paths(get_option('mandir'), 'man@0@'.format(man_section)),
)
endforeach
endif

View File

@@ -165,7 +165,7 @@ for this change.
| ::key-release-event | #GtkEventControllerKey |
| ::enter-notify-event | #GtkEventControllerMotion |
| ::leave-notify-event | #GtkEventControllerMotion |
| ::configure-event | replaced by #GdkSurface::size-changed |
| ::configure-event | replaced by #GdkSurface::layout |
| ::focus-in-event | #GtkEventControllerFocus |
| ::focus-out-event | #GtkEventControllerFocus |
| ::map-event | replaced by #GdkSurface:mapped |
@@ -510,9 +510,14 @@ gtk_window_set_gravity(), gtk_window_move(), gtk_window_parse_geometry(),
gtk_window_set_keep_above(), gtk_window_set_keep_below(),
gtk_window_begin_resize_drag(), gtk_window_begin_move_drag().
Most likely, you should just stop using them. In some cases, you can
fall back to using the underlying #GdkToplevel APIS (for example,
fall back to using the underlying #GdkToplevel APIs (for example,
gdk_toplevel_begin_resize()).
The APIs for controlling GtkWindow size have changed to be better aligned
with the way size changes are integrated in the frame cycle. gtk_window_resize()
and gtk_window_get_size() have been removed. Instead, use
gtk_window_set_default_size() and gtk_window_get_default_size().
### Adapt to GtkHeaderBar and GtkActionBar API changes
The gtk_header_bar_set_show_close_button() function has been renamed to
@@ -1057,7 +1062,7 @@ to start a drag manually, call gdk_drag_begin().
The ::drag-data-get signal has been replaced by the #GtkDragSource::prepare
signal, which returns a #GdkContentProvider for the drag operation.
The destination-side Drag-and-Drop apis in GTK 4 have also been changed
The destination-side Drag-and-Drop API in GTK 4 have also been changed
to use an event controller, #GtkDropTarget. Instead of calling
gtk_drag_dest_set() and connecting to #GtkWidget signals, you create
a #GtkDropTarget object, attach it to the widget with
@@ -1144,6 +1149,19 @@ pointer coordinates as inout arguments any more, but as normal in ones.
See: gtk_tree_view_get_tooltip_context(), gtk_icon_view_get_tooltip_context()
### Stop using GtkFileChooserButton
The `GtkFileChooserButton` widget was removed, due to its shortcomings in
the user interaction. You can replace it with a simple #GtkButton that
shows a #GtkFileChooserNative dialog when clicked; once the file selection
has completed, you can update the label of the #GtkButton with the selected
file.
### Adapt to changed GtkSettings properties
In GTK 3 the #GtkSettings:gtk-cursor-aspect-ratio property of #GtkSettings was
a float. In GTK 4 this has been changed to a double.
## Changes to consider after the switch
GTK 4 has a number of new features that you may want to take

View File

@@ -97,11 +97,11 @@ the question you have, this list is a good place to start.
#define N_(x) x
#define C_(ctx,x) pgettext (ctx, x)
You use N_() (N stands for no-op) to mark a string for translation in
You use `N_()` (N stands for no-op) to mark a string for translation in
a location where a function call to gettext() is not allowed, such as
in an array initializer. You eventually have to call gettext() on the
string to actually fetch the translation. _() both marks the string for
translation and actually translates it. The C_() macro (C stands for
string to actually fetch the translation. `_()` both marks the string for
translation and actually translates it. The `C_()` macro (C stands for
context) adds an additional context to the string that is marked for
translation, which can help to disambiguate short strings that might
need different translations in different parts of your program.
@@ -190,7 +190,7 @@ the question you have, this list is a good place to start.
encode string literals in UTF-8 by using octal or hexadecimal escapes
like `\212` or `\xa8` to encode each byte. This is portable, but
modifying the escaped strings is not very convenient. Be careful when
mixing hexadecimal escapes with ordinary text; `"\xa8abcd" is a string
mixing hexadecimal escapes with ordinary text; `"\xa8abcd"` is a string
of length 1 !
- Runtime conversion

View File

@@ -12,13 +12,6 @@ gtk_widget_set_size_request():
we use 1x1 for implementation convenience)
- causes notifies on width_request, height_request properties
gtk_window_resize():
- causes a configure request in all cases if the window is mapped,
unless the new size is the same as the old size
- overrides the default size on map if the window is unmapped
- allows size of 0, equivalent to 1
- clamped to geometry hints
gtk_window_set_default_size():
- has no effect after the window has been mapped the first time,
unless the window has been unrealized in which case it should
@@ -26,7 +19,6 @@ gtk_window_set_default_size():
- allows size of 0, equivalent to 1
- allows size of -1 to unset the default size
- clamped to geometry hints
- gtk_window_resize() overrides it
- causes notifies on default_width, default_height properties
gtk_window_get_default_size():

View File

@@ -615,51 +615,6 @@ create_font_button (void)
return new_widget_info ("font-button", vbox, SMALL);
}
static WidgetInfo *
create_file_button (void)
{
GtkWidget *vbox;
GtkWidget *vbox2;
GtkWidget *picker;
char *path;
GFile *file;
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
picker = gtk_file_chooser_button_new ("File Chooser Button",
GTK_FILE_CHOOSER_ACTION_OPEN);
gtk_widget_set_size_request (picker, 150, -1);
gtk_widget_set_halign (picker, GTK_ALIGN_CENTER);
gtk_widget_set_valign (picker, GTK_ALIGN_CENTER);
gtk_box_append (GTK_BOX (vbox2), picker);
gtk_box_append (GTK_BOX (vbox2),
gtk_label_new ("File Button (Files)"));
gtk_box_append (GTK_BOX (vbox),
vbox2);
gtk_box_append (GTK_BOX (vbox),
gtk_separator_new (GTK_ORIENTATION_HORIZONTAL));
vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
picker = gtk_file_chooser_button_new ("File Chooser Button",
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
gtk_widget_set_size_request (picker, 150, -1);
path = g_build_filename (g_get_home_dir (), "Documents", NULL);
file = g_file_new_for_path (path);
gtk_file_chooser_set_file (GTK_FILE_CHOOSER (picker), file, NULL);
g_free (path);
g_object_unref (file);
gtk_widget_set_halign (picker, GTK_ALIGN_CENTER);
gtk_widget_set_valign (picker, GTK_ALIGN_CENTER);
gtk_box_append (GTK_BOX (vbox2), picker);
gtk_box_append (GTK_BOX (vbox2), gtk_label_new ("File Button (Select Folder)"));
gtk_box_append (GTK_BOX (vbox), vbox2);
add_margin (vbox);
return new_widget_info ("file-button", vbox, MEDIUM);
}
static WidgetInfo *
create_editable_label (void)
{
@@ -2144,7 +2099,6 @@ get_all_widgets (void)
retval = g_list_prepend (retval, create_combo_box_entry ());
retval = g_list_prepend (retval, create_combo_box_text ());
retval = g_list_prepend (retval, create_entry ());
retval = g_list_prepend (retval, create_file_button ());
retval = g_list_prepend (retval, create_font_button ());
retval = g_list_prepend (retval, create_frame ());
retval = g_list_prepend (retval, create_icon_view ());

View File

@@ -1022,7 +1022,7 @@ parse_line (const char *line, const char *key)
{
const char *p;
if (!g_str_has_prefix (line, key))
if (g_ascii_strncasecmp (line, key, strlen (key)) != 0)
return NULL;
p = line + strlen (key);
if (*p != ':')

View File

@@ -280,12 +280,7 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
surface = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->configure_notify.id));
if (surface)
{
event = gdk_configure_event_new (surface,
message->configure_notify.width,
message->configure_notify.height);
node = _gdk_event_queue_append (display, event);
_gdk_windowing_got_event (display, node, event, message->base.serial);
gdk_surface_request_layout (surface);
if (surface->resize_count >= 1)
{

View File

@@ -558,6 +558,7 @@ gdk_broadway_surface_layout_popup (GdkSurface *surface,
int height,
GdkPopupLayout *layout)
{
GdkBroadwaySurface *impl = GDK_BROADWAY_SURFACE (surface);
GdkMonitor *monitor;
GdkRectangle bounds;
GdkRectangle final_rect;
@@ -570,6 +571,10 @@ gdk_broadway_surface_layout_popup (GdkSurface *surface,
gdk_surface_layout_popup_helper (surface,
width,
height,
impl->shadow_left,
impl->shadow_right,
impl->shadow_top,
impl->shadow_bottom,
monitor,
&bounds,
layout,
@@ -596,7 +601,7 @@ gdk_broadway_surface_layout_popup (GdkSurface *surface,
static void
show_popup (GdkSurface *surface)
{
gdk_synthesize_surface_state (surface, GDK_TOPLEVEL_STATE_WITHDRAWN, 0);
gdk_surface_set_is_mapped (surface, TRUE);
gdk_broadway_surface_show (surface, FALSE);
gdk_surface_invalidate_rect (surface, NULL);
}
@@ -1516,7 +1521,7 @@ show_surface (GdkSurface *surface)
was_mapped = GDK_SURFACE_IS_MAPPED (surface);
if (!was_mapped)
gdk_synthesize_surface_state (surface, GDK_TOPLEVEL_STATE_WITHDRAWN, 0);
gdk_surface_set_is_mapped (surface, TRUE);
gdk_broadway_surface_show (surface, FALSE);
@@ -1524,11 +1529,12 @@ show_surface (GdkSurface *surface)
gdk_surface_invalidate_rect (surface, NULL);
}
static gboolean
static void
gdk_broadway_toplevel_present (GdkToplevel *toplevel,
GdkToplevelLayout *layout)
{
GdkSurface *surface = GDK_SURFACE (toplevel);
GdkBroadwaySurface *impl = GDK_BROADWAY_SURFACE (surface);
GdkDisplay *display = gdk_surface_get_display (surface);
GdkMonitor *monitor;
GdkToplevelSize size;
@@ -1536,6 +1542,7 @@ gdk_broadway_toplevel_present (GdkToplevel *toplevel,
int width, height;
GdkGeometry geometry;
GdkSurfaceHints mask;
gboolean maximize;
gdk_broadway_surface_unminimize (surface);
@@ -1577,14 +1584,23 @@ gdk_broadway_toplevel_present (GdkToplevel *toplevel,
gdk_surface_constrain_size (&geometry, mask, width, height, &width, &height);
gdk_broadway_surface_toplevel_resize (surface, width, height);
if (gdk_toplevel_layout_get_maximized (layout))
gdk_broadway_surface_maximize (surface);
else
gdk_broadway_surface_unmaximize (surface);
if (gdk_toplevel_layout_get_maximized (layout, &maximize))
{
if (maximize)
gdk_broadway_surface_maximize (surface);
else
gdk_broadway_surface_unmaximize (surface);
}
if (size.shadow.is_valid)
{
impl->shadow_left = size.shadow.left;
impl->shadow_right = size.shadow.right;
impl->shadow_top = size.shadow.top;
impl->shadow_bottom = size.shadow.bottom;
}
show_surface (surface);
return TRUE;
}
static gboolean

View File

@@ -64,6 +64,11 @@ struct _GdkBroadwaySurface
int root_x;
int root_y;
int shadow_left;
int shadow_right;
int shadow_top;
int shadow_bottom;
};
struct _GdkBroadwaySurfaceClass

View File

@@ -59,17 +59,25 @@ libgdk_broadway = static_library('gdk-broadway',
'-DGTK_COMPILATION',
'-DG_LOG_DOMAIN="Gdk"',
] + common_cflags,
link_args: common_ldflags,
dependencies: [gdk_deps, gdk_broadway_deps])
dependencies: [gdk_deps, gdk_broadway_deps],
)
# gtk4-broadwayd
broadwayd_syslib = os_win32 ? find_library('ws2_32') : shmlib
executable('gtk4-broadwayd',
clienthtml_h, broadwayjs_h, gdkconfig, gdkenum_h,
'broadwayd.c', 'broadway-server.c', 'broadway-output.c',
sources: [
clienthtml_h,
broadwayjs_h,
gdkconfig,
gdkenum_h,
'broadwayd.c',
'broadway-server.c',
'broadway-output.c',
],
include_directories: [confinc, gdkinc, include_directories('.')],
c_args: ['-DGTK_COMPILATION', '-DG_LOG_DOMAIN="Gdk"', ],
dependencies : [broadwayd_syslib, gdk_deps],
install : true)
dependencies: [ broadwayd_syslib, gdk_deps ],
install: true,
)

View File

@@ -15,9 +15,6 @@ gboolean gdk_device_grab_info (GdkDisplay *display,
void gdk_pre_parse (void);
void gdk_surface_freeze_toplevel_updates (GdkSurface *surface);
void gdk_surface_thaw_toplevel_updates (GdkSurface *surface);
gboolean gdk_surface_supports_edge_constraints (GdkSurface *surface);
void gdk_display_set_double_click_time (GdkDisplay *display,

View File

@@ -182,6 +182,7 @@ G_GNUC_UNUSED static inline void
gdk_array(splice) (GdkArray *self,
gsize pos,
gsize removed,
gboolean stolen,
_T_ *additions,
gsize added)
{
@@ -192,8 +193,9 @@ gdk_array(splice) (GdkArray *self,
g_assert (pos + removed <= size);
remaining = size - pos - removed;
gdk_array(free_elements) (gdk_array(index) (self, pos),
gdk_array(index) (self, pos + removed));
if (!stolen)
gdk_array(free_elements) (gdk_array(index) (self, pos),
gdk_array(index) (self, pos + removed));
gdk_array(reserve) (self, size - removed + added);
@@ -225,9 +227,9 @@ gdk_array(set_size) (GdkArray *self,
{
gsize old_size = gdk_array(get_size) (self);
if (new_size > old_size)
gdk_array(splice) (self, old_size, 0, NULL, new_size - old_size);
gdk_array(splice) (self, old_size, 0, FALSE, NULL, new_size - old_size);
else
gdk_array(splice) (self, new_size, old_size - new_size, NULL, 0);
gdk_array(splice) (self, new_size, old_size - new_size, FALSE, NULL, 0);
}
G_GNUC_UNUSED static void
@@ -241,6 +243,7 @@ gdk_array(append) (GdkArray *self,
gdk_array(splice) (self,
gdk_array(get_size) (self),
0,
FALSE,
#ifdef GDK_ARRAY_BY_VALUE
value,
#else

View File

@@ -49,6 +49,12 @@ struct _GdkContentProvider
GObject parent;
};
/**
* GdkContentProviderClass:
* @content_changed: Signal class closure for #GdkContentProvider::content-changed
*
* Class structure for #GdkContentProvider.
*/
struct _GdkContentProviderClass
{
GObjectClass parent_class;
@@ -56,6 +62,7 @@ struct _GdkContentProviderClass
/* signals */
void (* content_changed) (GdkContentProvider *provider);
/*< private >*/
/* vfuncs */
void (* attach_clipboard) (GdkContentProvider *provider,
GdkClipboard *clipboard);

View File

@@ -54,12 +54,11 @@ typedef enum
GDK_PROPERTY_CHANGE_MASK = 1 << 16,
GDK_PROXIMITY_IN_MASK = 1 << 18,
GDK_PROXIMITY_OUT_MASK = 1 << 19,
GDK_SUBSTRUCTURE_MASK = 1 << 20,
GDK_SCROLL_MASK = 1 << 21,
GDK_TOUCH_MASK = 1 << 22,
GDK_SMOOTH_SCROLL_MASK = 1 << 23,
GDK_TOUCHPAD_GESTURE_MASK = 1 << 24,
GDK_TABLET_PAD_MASK = 1 << 25,
GDK_SCROLL_MASK = 1 << 20,
GDK_TOUCH_MASK = 1 << 21,
GDK_SMOOTH_SCROLL_MASK = 1 << 22,
GDK_TOUCHPAD_GESTURE_MASK = 1 << 23,
GDK_TABLET_PAD_MASK = 1 << 24,
GDK_ALL_EVENTS_MASK = 0x3FFFFFE
} GdkEventMask;

View File

@@ -32,6 +32,11 @@ G_BEGIN_DECLS
#define GDK_DEVICE_TOOL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_DEVICE_TOOL, GdkDeviceTool))
#define GDK_IS_DEVICE_TOOL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_DEVICE_TOOL))
/**
* GdkDeviceTool:
*
* A physical tool associated to a #GdkDevice.
*/
typedef struct _GdkDeviceTool GdkDeviceTool;
/**

View File

@@ -30,6 +30,12 @@
* during a DND operation.
*/
/**
* GdkDragSurfaceInterface:
*
* The #GdkDragSurfaceInterface implementation is private to GDK.
*/
G_DEFINE_INTERFACE (GdkDragSurface, gdk_drag_surface, GDK_TYPE_SURFACE)
static gboolean

View File

@@ -430,7 +430,6 @@ static void
gdk_event_init_types_once (void)
{
g_type_ensure (GDK_TYPE_BUTTON_EVENT);
g_type_ensure (GDK_TYPE_CONFIGURE_EVENT);
g_type_ensure (GDK_TYPE_CROSSING_EVENT);
g_type_ensure (GDK_TYPE_DELETE_EVENT);
g_type_ensure (GDK_TYPE_DND_EVENT);
@@ -1139,6 +1138,22 @@ gdk_event_get_axes (GdkEvent *event,
return GDK_EVENT_GET_CLASS (event)->get_axes (event, axes, n_axes);
}
double *
gdk_event_dup_axes (GdkEvent *event)
{
double *axes;
guint n_axes;
if (gdk_event_get_axes (event, &axes, &n_axes))
{
double *axes_copy = g_memdup (axes, n_axes * sizeof (double));
return axes_copy;
}
return NULL;
}
/**
* gdk_event_get_event_type:
* @event: a #GdkEvent
@@ -1315,6 +1330,12 @@ gdk_event_get_position (GdkEvent *event,
/* {{{ GdkButtonEvent */
/**
* GdkButtonEvent:
*
* An event related to a button on a pointer device/
*/
static void
gdk_button_event_finalize (GdkEvent *event)
{
@@ -1439,6 +1460,12 @@ gdk_button_event_get_button (GdkEvent *event)
/* {{{ GdkKeyEvent */
/**
* GdkKeyEvent:
*
* An event related to a key-based device.
*/
static GdkModifierType
gdk_key_event_get_state (GdkEvent *event)
{
@@ -1818,77 +1845,13 @@ gdk_key_event_get_match (GdkEvent *event,
/* }}} */
/* {{{ GdkConfigureEvent */
static gboolean
gdk_configure_event_get_position (GdkEvent *event,
double *x,
double *y)
{
GdkConfigureEvent *self = (GdkConfigureEvent *) event;
*x = self->x;
*y = self->y;
return TRUE;
}
static const GdkEventTypeInfo gdk_configure_event_info = {
sizeof (GdkConfigureEvent),
NULL,
NULL,
NULL,
gdk_configure_event_get_position,
NULL,
NULL,
NULL,
};
GDK_DEFINE_EVENT_TYPE (GdkConfigureEvent, gdk_configure_event,
&gdk_configure_event_info,
GDK_EVENT_TYPE_SLOT (GDK_CONFIGURE))
GdkEvent *
gdk_configure_event_new (GdkSurface *surface,
int width,
int height)
{
GdkConfigureEvent *self;
g_return_val_if_fail (width >= 0 && height >= 0, NULL);
self = gdk_event_alloc (GDK_CONFIGURE, surface, NULL, GDK_CURRENT_TIME);
self->width = width;
self->height = height;
return (GdkEvent *) self;
}
/* {{{ GdkTouchEvent */
/**
* gdk_configure_event_get_size:
* @event: (type GdkConfigureEvent): a configure event
* @width: (out): return location for surface width
* @height: (out): return location for surface height
* GdkTouchEvent:
*
* Extracts the surface size from a configure event.
* An event related to a touch-based device.
*/
void
gdk_configure_event_get_size (GdkEvent *event,
int *width,
int *height)
{
GdkConfigureEvent *self = (GdkConfigureEvent *) event;
g_return_if_fail (GDK_IS_EVENT (event));
g_return_if_fail (GDK_IS_EVENT_TYPE (event, GDK_CONFIGURE));
*width = self->width;
*height = self->height;
}
/* }}} */
/* {{{ GdkTouchEvent */
static void
gdk_touch_event_finalize (GdkEvent *event)
@@ -2021,6 +1984,12 @@ gdk_touch_event_get_emulating_pointer (GdkEvent *event)
/* {{{ GdkCrossingEvent */
/**
* GdkCrossingEvent:
*
* An event caused by a pointing device moving between surfaces.
*/
static void
gdk_crossing_event_finalize (GdkEvent *event)
{
@@ -2159,6 +2128,12 @@ gdk_crossing_event_get_detail (GdkEvent *event)
/* {{{ GdkDeleteEvent */
/**
* GdkDeleteEvent:
*
* An event related to closing a top-level surface.
*/
static const GdkEventTypeInfo gdk_delete_event_info = {
sizeof (GdkDeleteEvent),
NULL,
@@ -2184,6 +2159,12 @@ gdk_delete_event_new (GdkSurface *surface)
/* {{{ GdkFocusEvent */
/**
* GdkFocusEvent:
*
* An event related to a focus change.
*/
static const GdkEventTypeInfo gdk_focus_event_info = {
sizeof (GdkFocusEvent),
NULL,
@@ -2235,6 +2216,12 @@ gdk_focus_event_get_in (GdkEvent *event)
/* {{{ GdkScrollEvent */
/**
* GdkScrollEvent:
*
* An event related to a scrolling motion.
*/
static void
gdk_scroll_event_finalize (GdkEvent *event)
{
@@ -2392,6 +2379,12 @@ gdk_scroll_event_is_stop (GdkEvent *event)
/* {{{ GdkTouchpadEvent */
/**
* GdkTouchpadEvent:
*
* An event related to a touchpad device.
*/
static GdkModifierType
gdk_touchpad_event_get_state (GdkEvent *event)
{
@@ -2588,6 +2581,12 @@ gdk_touchpad_event_get_pinch_scale (GdkEvent *event)
/* {{{ GdkPadEvent */
/**
* GdkPadEvent:
*
* An event related to a pad-based device.
*/
static const GdkEventTypeInfo gdk_pad_event_info = {
sizeof (GdkPadEvent),
NULL,
@@ -2756,6 +2755,12 @@ gdk_pad_event_get_group_mode (GdkEvent *event,
/* {{{ GdkMotionEvent */
/**
* GdkMotionEvent:
*
* An event related to a pointer or touch device motion.
*/
static void
gdk_motion_event_finalize (GdkEvent *event)
{
@@ -2910,6 +2915,12 @@ gdk_event_get_history (GdkEvent *event,
/* {{{ GdkProximityEvent */
/**
* GdkProximityEvent:
*
* An event related to the proximity of a tool to a device.
*/
static void
gdk_proximity_event_finalize (GdkEvent *event)
{
@@ -2967,6 +2978,12 @@ gdk_proximity_event_new (GdkEventType type,
/* {{{ GdkDNDEvent */
/**
* GdkDNDEvent:
*
* An event related to drag and drop operations.
*/
static void
gdk_dnd_event_finalize (GdkEvent *event)
{
@@ -3067,6 +3084,12 @@ gdk_dnd_event_get_drop (GdkEvent *event)
/* {{{ GdkGrabBrokenEvent */
/**
* GdkGrabBrokenEvent:
*
* An event related to a broken windowing system grab.
*/
static const GdkEventTypeInfo gdk_grab_broken_event_info = {
sizeof (GdkGrabBrokenEvent),
NULL,

View File

@@ -106,7 +106,6 @@ typedef struct _GdkEventSequence GdkEventSequence;
typedef struct _GdkEvent GdkEvent;
#define GDK_TYPE_BUTTON_EVENT (gdk_button_event_get_type())
#define GDK_TYPE_CONFIGURE_EVENT (gdk_configure_event_get_type())
#define GDK_TYPE_CROSSING_EVENT (gdk_crossing_event_get_type())
#define GDK_TYPE_DELETE_EVENT (gdk_delete_event_get_type())
#define GDK_TYPE_DND_EVENT (gdk_dnd_event_get_type())
@@ -121,7 +120,6 @@ typedef struct _GdkEvent GdkEvent;
#define GDK_TYPE_TOUCHPAD_EVENT (gdk_touchpad_event_get_type())
typedef struct _GdkButtonEvent GdkButtonEvent;
typedef struct _GdkConfigureEvent GdkConfigureEvent;
typedef struct _GdkCrossingEvent GdkCrossingEvent;
typedef struct _GdkDeleteEvent GdkDeleteEvent;
typedef struct _GdkDNDEvent GdkDNDEvent;
@@ -148,7 +146,6 @@ typedef struct _GdkTouchpadEvent GdkTouchpadEvent;
* @GDK_ENTER_NOTIFY: the pointer has entered the surface.
* @GDK_LEAVE_NOTIFY: the pointer has left the surface.
* @GDK_FOCUS_CHANGE: the keyboard focus has entered or left the surface.
* @GDK_CONFIGURE: the size of the surface has changed.
* @GDK_PROXIMITY_IN: an input device has moved into contact with a sensing
* surface (e.g. a touchscreen or graphics tablet).
* @GDK_PROXIMITY_OUT: an input device has moved out of contact with a sensing
@@ -188,7 +185,6 @@ typedef enum
GDK_ENTER_NOTIFY,
GDK_LEAVE_NOTIFY,
GDK_FOCUS_CHANGE,
GDK_CONFIGURE,
GDK_PROXIMITY_IN,
GDK_PROXIMITY_OUT,
GDK_DRAG_ENTER,
@@ -429,12 +425,6 @@ GdkNotifyType gdk_crossing_event_get_detail (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
gboolean gdk_crossing_event_get_focus (GdkEvent *event);
GDK_AVAILABLE_IN_ALL
GType gdk_configure_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
void gdk_configure_event_get_size (GdkEvent *event,
int *width,
int *height);
GDK_AVAILABLE_IN_ALL
GType gdk_touchpad_event_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
GdkTouchpadGesturePhase

View File

@@ -322,25 +322,6 @@ struct _GdkFocusEvent
gboolean focus_in;
};
/*
* GdkConfigureEvent:
* @x: the new x coordinate of the surface, relative to its parent.
* @y: the new y coordinate of the surface, relative to its parent.
* @width: the new width of the surface.
* @height: the new height of the surface.
*
* Generated when a surface size or position has changed.
*/
struct _GdkConfigureEvent
{
GdkEvent parent_instance;
int x;
int y;
int width;
int height;
};
/*
* GdkProximityEvent:
* @tool: the #GdkDeviceTool associated to the event
@@ -495,10 +476,6 @@ GdkEvent * gdk_focus_event_new (GdkSurface *surface,
GdkDevice *device,
gboolean focus_in);
GdkEvent * gdk_configure_event_new (GdkSurface *surface,
int width,
int height);
GdkEvent * gdk_delete_event_new (GdkSurface *surface);
GdkEvent * gdk_scroll_event_new (GdkSurface *surface,
@@ -626,6 +603,8 @@ void _gdk_event_queue_handle_motion_compression (GdkDisplay *display);
void gdk_event_queue_handle_scroll_compression (GdkDisplay *display);
void _gdk_event_queue_flush (GdkDisplay *display);
double * gdk_event_dup_axes (GdkEvent *event);
G_END_DECLS

View File

@@ -50,7 +50,7 @@ typedef struct _GdkFrameClockClass GdkFrameClockClass;
* @GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS: corresponds to GdkFrameClock::flush-events. Should not be handled by applications.
* @GDK_FRAME_CLOCK_PHASE_BEFORE_PAINT: corresponds to GdkFrameClock::before-paint. Should not be handled by applications.
* @GDK_FRAME_CLOCK_PHASE_UPDATE: corresponds to GdkFrameClock::update.
* @GDK_FRAME_CLOCK_PHASE_LAYOUT: corresponds to GdkFrameClock::layout.
* @GDK_FRAME_CLOCK_PHASE_LAYOUT: corresponds to GdkFrameClock::layout. Should not be handled by applicatiosn.
* @GDK_FRAME_CLOCK_PHASE_PAINT: corresponds to GdkFrameClock::paint.
* @GDK_FRAME_CLOCK_PHASE_RESUME_EVENTS: corresponds to GdkFrameClock::resume-events. Should not be handled by applications.
* @GDK_FRAME_CLOCK_PHASE_AFTER_PAINT: corresponds to GdkFrameClock::after-paint. Should not be handled by applications.

View File

@@ -33,6 +33,11 @@ G_BEGIN_DECLS
#define GDK_GL_TEXTURE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_GL_TEXTURE, GdkGLTexture))
#define GDK_IS_GL_TEXTURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_GL_TEXTURE))
/**
* GdkGLTexture:
*
* A #GdkTexture representing a GL texture object.
*/
typedef struct _GdkGLTexture GdkGLTexture;
typedef struct _GdkGLTextureClass GdkGLTextureClass;

View File

@@ -94,6 +94,11 @@ typedef enum {
#define GDK_MEMORY_TEXTURE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GDK_TYPE_MEMORY_TEXTURE, GdkMemoryTexture))
#define GDK_IS_MEMORY_TEXTURE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GDK_TYPE_MEMORY_TEXTURE))
/**
* GdkMemoryTexture:
*
* A #GdkTexture representing image data in memory.
*/
typedef struct _GdkMemoryTexture GdkMemoryTexture;
typedef struct _GdkMemoryTextureClass GdkMemoryTextureClass;

View File

@@ -31,6 +31,11 @@ G_BEGIN_DECLS
#define GDK_TYPE_PAINTABLE (gdk_paintable_get_type ())
/**
* GdkPaintable:
*
* Interface for paintable objects.
*/
GDK_AVAILABLE_IN_ALL
G_DECLARE_INTERFACE (GdkPaintable, gdk_paintable, GDK, PAINTABLE, GObject)
@@ -74,11 +79,13 @@ typedef enum {
* this function should return the aspect ratio computed from those.
*
* The list of functions that can be implemented for the #GdkPaintable interface.
* Note that apart from the first function, no function is mandatory to implement,
* though it is a good idea to implement #GdkPaintableInterface.get_current_image()
* for non-static paintables and #GdkPaintableInterface.get_flags() if the image
* is not dynamic as the default implementation returns no flags and that will
* make the implementation likely quite slow.
*
* Note that apart from the #GdkPaintableInterface.snapshot() function, no virtual
* function of this interface is mandatory to implement, though it is a good idea
* to implement #GdkPaintableInterface.get_current_image() for non-static paintables
* and #GdkPaintableInterface.get_flags() if the image is not dynamic as the default
* implementation returns no flags and that will make the implementation likely
* quite slow.
*/
struct _GdkPaintableInterface
{

View File

@@ -202,6 +202,7 @@ gdk_pixbuf_get_from_surface (cairo_surface_t *surface,
if (cairo_surface_status (surface) || dest == NULL)
{
cairo_surface_destroy (surface);
g_clear_object (&dest);
return NULL;
}

View File

@@ -38,15 +38,6 @@
G_DEFINE_INTERFACE (GdkPopup, gdk_popup, GDK_TYPE_SURFACE)
enum
{
POPUP_LAYOUT_CHANGED,
N_SIGNALS
};
static guint signals[N_SIGNALS] = { 0 };
static gboolean
gdk_popup_default_present (GdkPopup *popup,
int width,
@@ -101,25 +92,6 @@ gdk_popup_default_init (GdkPopupInterface *iface)
P_("Whether to hide on outside clicks"),
FALSE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
/**
* GdkPopup::popup-layout-changed
* @popup: the #GdkSurface that was laid out
*
* Emitted when the layout of a popup surface has changed, e.g. if the popup
* layout was reactive and after the parent moved causing the popover to end
* up partially off-screen.
*/
signals[POPUP_LAYOUT_CHANGED] =
g_signal_new (g_intern_static_string ("popup-layout-changed"),
GDK_TYPE_POPUP,
G_SIGNAL_RUN_FIRST,
0,
NULL,
NULL,
NULL,
G_TYPE_NONE,
0);
}
/**
@@ -133,13 +105,16 @@ gdk_popup_default_init (GdkPopupInterface *iface)
* If the popup was previously now showing, it will be showed,
* otherwise it will change position according to @layout.
*
* After calling this function, the result of the layout can be queried
* using gdk_popup_get_position_x(), gdk_popup_get_position_y(),
* gdk_surface_get_width(), gdk_surface_get_height(),
* gdk_popup_get_rect_anchor() and gdk_popup_get_surface_anchor().
* After calling this function, the result should be handled in response
* to the #GdkSurface::layout signal being emitted. The resulting popup
* position can be queried using gdk_popup_get_position_x(),
* gdk_popup_get_position_y(), and the resulting size will be sent as
* parameters in the layout signal. Use gdk_popup_get_rect_anchor() and
* gdk_popup_get_surface_anchor() to get the resulting anchors.
*
* Presenting may have fail, for example if it was immediately
* hidden if the @popup was set to autohide.
* Presenting may fail, for example if the @popup is set to autohide
* and is immediately hidden upon being presented. If presenting failed,
* the #GdkSurface::layout signal will not me emitted.
*
* Returns: %FALSE if it failed to be presented, otherwise %TRUE.
*/
@@ -164,7 +139,7 @@ gdk_popup_present (GdkPopup *popup,
* Gets the current popup surface anchor.
*
* The value returned may change after calling gdk_popup_present(),
* or after the "popup-layout-changed" is emitted.
* or after the #GdkSurface::layout signal is emitted.
*
* Returns: the current surface anchor value of @popup
*/
@@ -183,7 +158,7 @@ gdk_popup_get_surface_anchor (GdkPopup *popup)
* Gets the current popup rectangle anchor.
*
* The value returned may change after calling gdk_popup_present(),
* or after the "popup-layout-changed" is emitted.
* or after the #GdkSurface::layout signal is emitted.
*
* Returns: the current rectangle anchor value of @popup
*/

View File

@@ -31,6 +31,11 @@ G_BEGIN_DECLS
#define GDK_TYPE_POPUP (gdk_popup_get_type ())
/**
* GdkPopup:
*
* Interface for popup surfaces.
*/
GDK_AVAILABLE_IN_ALL
G_DECLARE_INTERFACE (GdkPopup, gdk_popup, GDK, POPUP, GObject)

View File

@@ -29,7 +29,13 @@
G_BEGIN_DECLS
typedef struct _GdkSnapshotClass GdkSnapshotClass;
/**
* GdkSnapshot:
*
* Base type for snapshot operations.
*/
typedef struct _GdkSnapshotClass GdkSnapshotClass;
#define GDK_TYPE_SNAPSHOT (gdk_snapshot_get_type ())

View File

@@ -76,8 +76,7 @@
*/
enum {
POPUP_LAYOUT_CHANGED,
SIZE_CHANGED,
LAYOUT,
RENDER,
EVENT,
ENTER_MONITOR,
@@ -115,6 +114,9 @@ static void update_cursor (GdkDisplay *display,
static void gdk_surface_set_frame_clock (GdkSurface *surface,
GdkFrameClock *clock);
static void gdk_surface_queue_set_is_mapped (GdkSurface *surface,
gboolean is_mapped);
static guint signals[LAST_SIGNAL] = { 0 };
static GParamSpec *properties[LAST_PROP] = { NULL, };
@@ -285,6 +287,10 @@ void
gdk_surface_layout_popup_helper (GdkSurface *surface,
int width,
int height,
int shadow_left,
int shadow_right,
int shadow_top,
int shadow_bottom,
GdkMonitor *monitor,
GdkRectangle *bounds,
GdkPopupLayout *layout,
@@ -315,8 +321,8 @@ gdk_surface_layout_popup_helper (GdkSurface *surface,
gdk_popup_layout_get_offset (layout, &rect_anchor_dx, &rect_anchor_dy);
anchor_hints = gdk_popup_layout_get_anchor_hints (layout);
final_rect.width = width - surface->shadow_left - surface->shadow_right;
final_rect.height = height - surface->shadow_top - surface->shadow_bottom;
final_rect.width = width - shadow_left - shadow_right;
final_rect.height = height - shadow_top - shadow_bottom;
final_rect.x = maybe_flip_position (bounds->x,
bounds->width,
root_rect.x,
@@ -380,10 +386,10 @@ gdk_surface_layout_popup_helper (GdkSurface *surface,
final_rect.height = bounds->y + bounds->height - final_rect.y;
}
final_rect.x -= surface->shadow_left;
final_rect.y -= surface->shadow_top;
final_rect.width += surface->shadow_left + surface->shadow_right;
final_rect.height += surface->shadow_top + surface->shadow_bottom;
final_rect.x -= shadow_left;
final_rect.y -= shadow_top;
final_rect.width += shadow_left + shadow_right;
final_rect.height += shadow_top + shadow_bottom;
gdk_surface_get_origin (surface->parent, &x, &y);
final_rect.x -= x;
@@ -469,7 +475,7 @@ gdk_surface_init (GdkSurface *surface)
{
/* 0-initialization is good for all other fields. */
surface->state = GDK_TOPLEVEL_STATE_WITHDRAWN;
surface->state = 0;
surface->fullscreen_mode = GDK_FULLSCREEN_ON_CURRENT_MONITOR;
surface->width = 1;
surface->height = 1;
@@ -548,18 +554,19 @@ gdk_surface_class_init (GdkSurfaceClass *klass)
g_object_class_install_properties (object_class, LAST_PROP, properties);
/**
* GdkSurface::size-changed:
* GdkSurface::layout:
* @surface: the #GdkSurface
* @width: the new width
* @height: the new height
* @width: the current width
* @height: the current height
*
* Emitted when the size of @surface is changed.
* Emitted when the size of @surface is changed, or when relayout should
* be performed.
*
* Surface size is reported in ”application pixels”, not
* ”device pixels” (see gdk_surface_get_scale_factor()).
*/
signals[SIZE_CHANGED] =
g_signal_new (g_intern_static_string ("size-changed"),
signals[LAYOUT] =
g_signal_new (g_intern_static_string ("layout"),
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_FIRST,
0,
@@ -674,6 +681,8 @@ gdk_surface_finalize (GObject *object)
{
GdkSurface *surface = GDK_SURFACE (object);
g_clear_handle_id (&surface->request_motion_id, g_source_remove);
g_signal_handlers_disconnect_by_func (surface->display,
seat_removed_cb, surface);
@@ -919,7 +928,10 @@ _gdk_surface_destroy_hierarchy (GdkSurface *surface,
_gdk_surface_clear_update_area (surface);
surface->state |= GDK_TOPLEVEL_STATE_WITHDRAWN;
g_clear_handle_id (&surface->set_is_mapped_source_id, g_source_remove);
surface->is_mapped = FALSE;
surface->pending_is_mapped = FALSE;
surface->destroyed = TRUE;
surface_remove_from_pointer_info (surface, surface->display);
@@ -1264,7 +1276,7 @@ gdk_surface_schedule_update (GdkSurface *surface)
if (surface->update_freeze_count ||
gdk_surface_is_toplevel_frozen (surface))
{
surface->pending_schedule_update = TRUE;
surface->pending_phases |= GDK_FRAME_CLOCK_PHASE_PAINT;
return;
}
@@ -1317,6 +1329,57 @@ gdk_surface_process_updates_internal (GdkSurface *surface)
g_object_unref (surface);
}
static void
gdk_surface_layout_on_clock (GdkFrameClock *clock,
void *data)
{
GdkSurface *surface = GDK_SURFACE (data);
GdkSurfaceClass *class;
g_return_if_fail (GDK_IS_SURFACE (surface));
if (GDK_SURFACE_DESTROYED (surface))
return;
if (!GDK_SURFACE_IS_MAPPED (surface))
return;
surface->pending_phases &= ~GDK_FRAME_CLOCK_PHASE_LAYOUT;
class = GDK_SURFACE_GET_CLASS (surface);
if (class->compute_size)
{
if (class->compute_size (surface))
return;
}
g_signal_emit (surface, signals[LAYOUT], 0, surface->width, surface->height);
}
/**
* gdk_surface_request_layout:
* @surface: a #GdkSurface
*
* Request a %GDK_FRAME_CLOCK_PHASE_LAYOUT from the surface's
* frame clock. See gdk_frame_clock_request_phase().
*/
void
gdk_surface_request_layout (GdkSurface *surface)
{
GdkSurfaceClass *class;
GdkFrameClock *frame_clock;
class = GDK_SURFACE_GET_CLASS (surface);
if (class->request_layout)
class->request_layout (surface);
frame_clock = gdk_surface_get_frame_clock (surface);
g_return_if_fail (frame_clock);
gdk_frame_clock_request_phase (frame_clock,
GDK_FRAME_CLOCK_PHASE_LAYOUT);
}
static void
gdk_surface_paint_on_clock (GdkFrameClock *clock,
void *data)
@@ -1338,6 +1401,7 @@ gdk_surface_paint_on_clock (GdkFrameClock *clock,
* do the update later when idle instead. */
!surface->in_update)
{
surface->pending_phases &= ~GDK_FRAME_CLOCK_PHASE_PAINT;
gdk_surface_process_updates_internal (surface);
gdk_surface_remove_update_surface (surface);
}
@@ -1498,6 +1562,20 @@ gdk_surface_freeze_updates (GdkSurface *surface)
_gdk_frame_clock_uninhibit_freeze (surface->frame_clock);
}
static gboolean
request_motion_cb (void *data)
{
GdkSurface *surface = GDK_SURFACE (data);
GdkFrameClock *clock = gdk_surface_get_frame_clock (surface);
if (clock)
gdk_frame_clock_request_phase (clock, GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS);
surface->request_motion_id = 0;
return G_SOURCE_REMOVE;
}
/*
* gdk_surface_thaw_updates:
* @surface: a #GdkSurface
@@ -1515,37 +1593,22 @@ gdk_surface_thaw_updates (GdkSurface *surface)
if (--surface->update_freeze_count == 0)
{
_gdk_frame_clock_inhibit_freeze (surface->frame_clock);
GdkFrameClock *frame_clock = surface->frame_clock;
if (surface->pending_schedule_update)
_gdk_frame_clock_inhibit_freeze (frame_clock);
if (surface->pending_phases)
gdk_frame_clock_request_phase (frame_clock, surface->pending_phases);
if (surface->request_motion && surface->request_motion_id == 0)
{
surface->pending_schedule_update = FALSE;
gdk_surface_schedule_update (surface);
surface->request_motion_id =
g_idle_add_full (GDK_PRIORITY_REDRAW + 20,
request_motion_cb, surface, NULL);
}
}
}
void
gdk_surface_freeze_toplevel_updates (GdkSurface *surface)
{
g_return_if_fail (GDK_IS_SURFACE (surface));
surface->update_and_descendants_freeze_count++;
gdk_surface_freeze_updates (surface);
}
void
gdk_surface_thaw_toplevel_updates (GdkSurface *surface)
{
g_return_if_fail (GDK_IS_SURFACE (surface));
g_return_if_fail (surface->update_and_descendants_freeze_count > 0);
surface->update_and_descendants_freeze_count--;
gdk_surface_schedule_update (surface);
gdk_surface_thaw_updates (surface);
}
/*
* gdk_surface_constrain_size:
* @geometry: a #GdkGeometry structure
@@ -1669,8 +1732,7 @@ gdk_surface_hide (GdkSurface *surface)
was_mapped = GDK_SURFACE_IS_MAPPED (surface);
if (GDK_SURFACE_IS_MAPPED (surface))
gdk_synthesize_surface_state (surface, 0, GDK_TOPLEVEL_STATE_WITHDRAWN);
gdk_surface_queue_set_is_mapped (surface, FALSE);
if (was_mapped)
{
@@ -2411,6 +2473,10 @@ gdk_surface_set_frame_clock (GdkSurface *surface,
"resume-events",
G_CALLBACK (gdk_surface_resume_events),
surface);
g_signal_connect (G_OBJECT (clock),
"layout",
G_CALLBACK (gdk_surface_layout_on_clock),
surface);
g_signal_connect (G_OBJECT (clock),
"paint",
G_CALLBACK (gdk_surface_paint_on_clock),
@@ -2431,6 +2497,9 @@ gdk_surface_set_frame_clock (GdkSurface *surface,
g_signal_handlers_disconnect_by_func (G_OBJECT (surface->frame_clock),
G_CALLBACK (gdk_surface_resume_events),
surface);
g_signal_handlers_disconnect_by_func (G_OBJECT (surface->frame_clock),
G_CALLBACK (gdk_surface_layout_on_clock),
surface);
g_signal_handlers_disconnect_by_func (G_OBJECT (surface->frame_clock),
G_CALLBACK (gdk_surface_paint_on_clock),
surface);
@@ -2570,58 +2639,10 @@ gdk_surface_set_opaque_region (GdkSurface *surface,
class->set_opaque_region (surface, region);
}
/**
* gdk_surface_set_shadow_width:
* @surface: a #GdkSurface
* @left: The left extent
* @right: The right extent
* @top: The top extent
* @bottom: The bottom extent
*
* Newer GTK windows using client-side decorations use extra geometry
* around their frames for effects like shadows and invisible borders.
* Window managers that want to maximize windows or snap to edges need
* to know where the extents of the actual frame lie, so that users
* dont feel like windows are snapping against random invisible edges.
*
* Note that this property is automatically updated by GTK, so this
* function should only be used by applications which do not use GTK
* to create toplevel surfaces.
*/
void
gdk_surface_set_shadow_width (GdkSurface *surface,
int left,
int right,
int top,
int bottom)
{
GdkSurfaceClass *class;
g_return_if_fail (GDK_IS_SURFACE (surface));
g_return_if_fail (!GDK_SURFACE_DESTROYED (surface));
g_return_if_fail (left >= 0 && right >= 0 && top >= 0 && bottom >= 0);
if (surface->shadow_left == left &&
surface->shadow_right == right &&
surface->shadow_top == top &&
surface->shadow_bottom == bottom)
return;
surface->shadow_top = top;
surface->shadow_left = left;
surface->shadow_right = right;
surface->shadow_bottom = bottom;
class = GDK_SURFACE_GET_CLASS (surface);
if (class->set_shadow_width)
class->set_shadow_width (surface, left, right, top, bottom);
}
void
gdk_surface_set_state (GdkSurface *surface,
GdkToplevelState new_state)
{
gboolean was_mapped, mapped;
gboolean was_sticky, sticky;
g_return_if_fail (GDK_IS_SURFACE (surface));
@@ -2633,20 +2654,15 @@ gdk_surface_set_state (GdkSurface *surface,
* inconsistent state to the user.
*/
was_mapped = GDK_SURFACE_IS_MAPPED (surface);
was_sticky = GDK_SURFACE_IS_STICKY (surface);
surface->state = new_state;
mapped = GDK_SURFACE_IS_MAPPED (surface);
sticky = GDK_SURFACE_IS_STICKY (surface);
if (GDK_IS_TOPLEVEL (surface))
g_object_notify (G_OBJECT (surface), "state");
if (was_mapped != mapped)
g_object_notify_by_pspec (G_OBJECT (surface), properties[PROP_MAPPED]);
if (was_sticky != sticky)
g_object_notify (G_OBJECT (surface), "sticky");
}
@@ -2659,6 +2675,94 @@ gdk_synthesize_surface_state (GdkSurface *surface,
gdk_surface_set_state (surface, (surface->state | set_flags) & ~unset_flags);
}
void
gdk_surface_queue_state_change (GdkSurface *surface,
GdkToplevelState unset_flags,
GdkToplevelState set_flags)
{
surface->pending_unset_flags |= unset_flags;
surface->pending_set_flags &= ~unset_flags;
surface->pending_set_flags |= set_flags;
surface->pending_unset_flags &= ~set_flags;
}
void
gdk_surface_apply_state_change (GdkSurface *surface)
{
if (!surface->pending_unset_flags && !surface->pending_set_flags)
return;
gdk_synthesize_surface_state (surface,
surface->pending_unset_flags,
surface->pending_set_flags);
surface->pending_unset_flags = 0;
surface->pending_set_flags = 0;
}
static gboolean
set_is_mapped_idle (gpointer user_data)
{
GdkSurface *surface = GDK_SURFACE (user_data);
surface->set_is_mapped_source_id = 0;
g_return_val_if_fail (surface->pending_is_mapped != surface->is_mapped,
G_SOURCE_REMOVE);
surface->is_mapped = surface->pending_is_mapped;
if (surface->is_mapped)
gdk_surface_invalidate_rect (surface, NULL);
g_object_notify (G_OBJECT (surface), "mapped");
return G_SOURCE_REMOVE;
}
void
gdk_surface_set_is_mapped (GdkSurface *surface,
gboolean is_mapped)
{
gboolean was_mapped;
if (surface->pending_is_mapped != surface->is_mapped)
g_clear_handle_id (&surface->set_is_mapped_source_id, g_source_remove);
surface->pending_is_mapped = is_mapped;
was_mapped = surface->is_mapped;
surface->is_mapped = is_mapped;
if (surface->is_mapped)
gdk_surface_invalidate_rect (surface, NULL);
if (was_mapped != is_mapped)
g_object_notify (G_OBJECT (surface), "mapped");
}
static void
gdk_surface_queue_set_is_mapped (GdkSurface *surface,
gboolean is_mapped)
{
if (surface->pending_is_mapped == is_mapped)
return;
surface->pending_is_mapped = is_mapped;
if (surface->is_mapped == surface->pending_is_mapped)
{
g_clear_handle_id (&surface->set_is_mapped_source_id, g_source_remove);
}
else
{
g_return_if_fail (!surface->set_is_mapped_source_id);
surface->set_is_mapped_source_id =
g_idle_add_full (G_PRIORITY_HIGH - 10,
set_is_mapped_idle,
surface, NULL);
}
}
static gboolean
check_autohide (GdkEvent *event)
{
@@ -2770,14 +2874,6 @@ add_event_mark (GdkEvent *event,
break;
}
case GDK_CONFIGURE:
{
int width, height;
gdk_configure_event_get_size (event, &width, &height);
message = g_strdup_printf ("%s {width=%d, height=%d}", kind, width, height);
break;
}
case GDK_ENTER_NOTIFY:
case GDK_LEAVE_NOTIFY:
case GDK_TOUCHPAD_SWIPE:
@@ -2815,30 +2911,18 @@ add_event_mark (GdkEvent *event,
gboolean
gdk_surface_handle_event (GdkEvent *event)
{
GdkSurface *surface = gdk_event_get_surface (event);
gint64 begin_time = GDK_PROFILER_CURRENT_TIME;
gboolean handled = FALSE;
if (check_autohide (event))
return TRUE;
if (gdk_event_get_event_type (event) == GDK_CONFIGURE)
{
int width, height;
gdk_configure_event_get_size (event, &width, &height);
g_signal_emit (gdk_event_get_surface (event), signals[SIZE_CHANGED], 0,
width, height);
handled = TRUE;
}
else
{
GdkSurface *surface = gdk_event_get_surface (event);
if (gdk_event_get_event_type (event) == GDK_MOTION_NOTIFY)
surface->request_motion = FALSE;
if (gdk_event_get_event_type (event) == GDK_MOTION_NOTIFY)
surface->request_motion = FALSE;
g_signal_emit (surface, signals[EVENT], 0, event, &handled);
}
g_signal_emit (surface, signals[EVENT], 0, event, &handled);
if (GDK_PROFILER_IS_RUNNING)
add_event_mark (event, begin_time, GDK_PROFILER_CURRENT_TIME);
@@ -2858,13 +2942,7 @@ gdk_surface_handle_event (GdkEvent *event)
void
gdk_surface_request_motion (GdkSurface *surface)
{
GdkFrameClock *frame_clock;
surface->request_motion = TRUE;
frame_clock = gdk_surface_get_frame_clock (surface);
if (frame_clock)
gdk_frame_clock_request_phase (frame_clock, GDK_FRAME_CLOCK_PHASE_FLUSH_EVENTS);
}
/**

View File

@@ -118,6 +118,9 @@ void gdk_surface_beep (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
void gdk_surface_queue_render (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
void gdk_surface_request_layout (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
GdkFrameClock* gdk_surface_get_frame_clock (GdkSurface *surface);
@@ -125,13 +128,6 @@ GDK_AVAILABLE_IN_ALL
void gdk_surface_set_opaque_region (GdkSurface *surface,
cairo_region_t *region);
GDK_AVAILABLE_IN_ALL
void gdk_surface_set_shadow_width (GdkSurface *surface,
int left,
int right,
int top,
int bottom);
GDK_AVAILABLE_IN_ALL
GdkCairoContext *gdk_surface_create_cairo_context(GdkSurface *surface);
GDK_AVAILABLE_IN_ALL

View File

@@ -44,6 +44,10 @@ struct _GdkSurface
GdkSurface *parent; /* for popups */
GList *children; /* popups */
guint set_is_mapped_source_id;
gboolean pending_is_mapped;
gboolean is_mapped;
gpointer widget;
int x;
@@ -53,13 +57,14 @@ struct _GdkSurface
cairo_region_t *update_area;
guint update_freeze_count;
gboolean pending_schedule_update;
GdkFrameClockPhase pending_phases;
/* This is the update_area that was in effect when the current expose
started. It may be smaller than the expose area if we'e painting
more than we have to, but it represents the "true" damage. */
cairo_region_t *active_update_area;
GdkToplevelState old_state;
GdkToplevelState pending_set_flags;
GdkToplevelState pending_unset_flags;
GdkToplevelState state;
guint8 resize_count;
@@ -75,6 +80,8 @@ struct _GdkSurface
guint shortcuts_inhibited : 1;
guint request_motion : 1;
guint request_motion_id;
struct {
GdkGravity surface_anchor;
GdkGravity rect_anchor;
@@ -83,10 +90,6 @@ struct _GdkSurface
guint update_and_descendants_freeze_count;
int width, height;
int shadow_top;
int shadow_left;
int shadow_right;
int shadow_bottom;
GdkCursor *cursor;
GHashTable *device_cursor;
@@ -160,25 +163,24 @@ struct _GdkSurfaceClass
void (* set_opaque_region) (GdkSurface *surface,
cairo_region_t *region);
void (* set_shadow_width) (GdkSurface *surface,
int left,
int right,
int top,
int bottom);
GdkGLContext *(*create_gl_context) (GdkSurface *surface,
gboolean attached,
GdkGLContext *share,
GError **error);
void (* request_layout) (GdkSurface *surface);
gboolean (* compute_size) (GdkSurface *surface);
};
#define GDK_SURFACE_DESTROYED(d) (((GdkSurface *)(d))->destroyed)
#define GDK_SURFACE_IS_MAPPED(surface) (((surface)->state & GDK_TOPLEVEL_STATE_WITHDRAWN) == 0)
#define GDK_SURFACE_IS_MAPPED(surface) ((surface)->pending_is_mapped)
void gdk_surface_set_state (GdkSurface *surface,
GdkToplevelState new_state);
void gdk_surface_set_is_mapped (GdkSurface *surface,
gboolean is_mapped);
GdkMonitor * gdk_surface_get_layout_monitor (GdkSurface *surface,
GdkPopupLayout *layout,
void (*get_bounds) (GdkMonitor *monitor,
@@ -187,6 +189,10 @@ GdkMonitor * gdk_surface_get_layout_monitor (GdkSurface *surface,
void gdk_surface_layout_popup_helper (GdkSurface *surface,
int width,
int height,
int shadow_left,
int shadow_right,
int shadow_top,
int shadow_bottom,
GdkMonitor *monitor,
GdkRectangle *bounds,
GdkPopupLayout *layout,
@@ -326,9 +332,22 @@ void gdk_surface_constrain_size (GdkGeometry *geometry,
int *new_width,
int *new_height);
void gdk_surface_queue_state_change (GdkSurface *surface,
GdkToplevelState unset_flags,
GdkToplevelState set_flags);
void gdk_surface_apply_state_change (GdkSurface *surface);
void gdk_surface_emit_size_changed (GdkSurface *surface,
int width,
int height);
void gdk_surface_request_compute_size (GdkSurface *surface);
GDK_AVAILABLE_IN_ALL
void gdk_surface_request_motion (GdkSurface *surface);
G_END_DECLS
#endif /* __GDK_SURFACE_PRIVATE_H__ */

View File

@@ -51,11 +51,10 @@ enum
static guint signals[N_SIGNALS] = { 0 };
static gboolean
static void
gdk_toplevel_default_present (GdkToplevel *toplevel,
GdkToplevelLayout *layout)
{
return FALSE;
}
static gboolean
@@ -124,7 +123,7 @@ gdk_toplevel_default_init (GdkToplevelInterface *iface)
g_param_spec_flags ("state",
P_("State"),
P_("State"),
GDK_TYPE_TOPLEVEL_STATE, GDK_TOPLEVEL_STATE_WITHDRAWN,
GDK_TYPE_TOPLEVEL_STATE, 0,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
g_object_interface_install_property (iface,
g_param_spec_string ("title",
@@ -239,18 +238,17 @@ gdk_toplevel_install_properties (GObjectClass *object_class,
* compute the preferred size of the toplevel surface. See
* #GdkToplevel::compute-size for details.
*
* Presenting may fail.
*
* Returns: %FALSE if @toplevel failed to be presented, otherwise %TRUE.
* Presenting is asynchronous and the specified layout parameters are not
* guaranteed to be respected.
*/
gboolean
void
gdk_toplevel_present (GdkToplevel *toplevel,
GdkToplevelLayout *layout)
{
g_return_val_if_fail (GDK_IS_TOPLEVEL (toplevel), FALSE);
g_return_val_if_fail (layout != NULL, FALSE);
g_return_if_fail (GDK_IS_TOPLEVEL (toplevel));
g_return_if_fail (layout != NULL);
return GDK_TOPLEVEL_GET_IFACE (toplevel)->present (toplevel, layout);
GDK_TOPLEVEL_GET_IFACE (toplevel)->present (toplevel, layout);
}
/**

View File

@@ -71,7 +71,6 @@ typedef enum
/**
* GdkToplevelState:
* @GDK_TOPLEVEL_STATE_WITHDRAWN: the surface is not shown
* @GDK_TOPLEVEL_STATE_MINIMIZED: the surface is minimized
* @GDK_TOPLEVEL_STATE_MAXIMIZED: the surface is maximized
* @GDK_TOPLEVEL_STATE_STICKY: the surface is sticky
@@ -98,33 +97,37 @@ typedef enum
*/
typedef enum
{
GDK_TOPLEVEL_STATE_WITHDRAWN = 1 << 0,
GDK_TOPLEVEL_STATE_MINIMIZED = 1 << 1,
GDK_TOPLEVEL_STATE_MAXIMIZED = 1 << 2,
GDK_TOPLEVEL_STATE_STICKY = 1 << 3,
GDK_TOPLEVEL_STATE_FULLSCREEN = 1 << 4,
GDK_TOPLEVEL_STATE_ABOVE = 1 << 5,
GDK_TOPLEVEL_STATE_BELOW = 1 << 6,
GDK_TOPLEVEL_STATE_FOCUSED = 1 << 7,
GDK_TOPLEVEL_STATE_TILED = 1 << 8,
GDK_TOPLEVEL_STATE_TOP_TILED = 1 << 9,
GDK_TOPLEVEL_STATE_TOP_RESIZABLE = 1 << 10,
GDK_TOPLEVEL_STATE_RIGHT_TILED = 1 << 11,
GDK_TOPLEVEL_STATE_RIGHT_RESIZABLE = 1 << 12,
GDK_TOPLEVEL_STATE_BOTTOM_TILED = 1 << 13,
GDK_TOPLEVEL_STATE_BOTTOM_RESIZABLE = 1 << 14,
GDK_TOPLEVEL_STATE_LEFT_TILED = 1 << 15,
GDK_TOPLEVEL_STATE_LEFT_RESIZABLE = 1 << 16
GDK_TOPLEVEL_STATE_MINIMIZED = 1 << 0,
GDK_TOPLEVEL_STATE_MAXIMIZED = 1 << 1,
GDK_TOPLEVEL_STATE_STICKY = 1 << 2,
GDK_TOPLEVEL_STATE_FULLSCREEN = 1 << 3,
GDK_TOPLEVEL_STATE_ABOVE = 1 << 4,
GDK_TOPLEVEL_STATE_BELOW = 1 << 5,
GDK_TOPLEVEL_STATE_FOCUSED = 1 << 6,
GDK_TOPLEVEL_STATE_TILED = 1 << 7,
GDK_TOPLEVEL_STATE_TOP_TILED = 1 << 8,
GDK_TOPLEVEL_STATE_TOP_RESIZABLE = 1 << 9,
GDK_TOPLEVEL_STATE_RIGHT_TILED = 1 << 10,
GDK_TOPLEVEL_STATE_RIGHT_RESIZABLE = 1 << 11,
GDK_TOPLEVEL_STATE_BOTTOM_TILED = 1 << 12,
GDK_TOPLEVEL_STATE_BOTTOM_RESIZABLE = 1 << 13,
GDK_TOPLEVEL_STATE_LEFT_TILED = 1 << 14,
GDK_TOPLEVEL_STATE_LEFT_RESIZABLE = 1 << 15
} GdkToplevelState;
#define GDK_TYPE_TOPLEVEL (gdk_toplevel_get_type ())
/**
* GdkToplevel:
*
* An interface for top level surfaces.
*/
GDK_AVAILABLE_IN_ALL
G_DECLARE_INTERFACE (GdkToplevel, gdk_toplevel, GDK, TOPLEVEL, GObject)
GDK_AVAILABLE_IN_ALL
gboolean gdk_toplevel_present (GdkToplevel *toplevel,
void gdk_toplevel_present (GdkToplevel *toplevel,
GdkToplevelLayout *layout);
GDK_AVAILABLE_IN_ALL
@@ -198,7 +201,6 @@ void gdk_toplevel_begin_move (GdkToplevel *toplevel,
double y,
guint32 timestamp);
G_END_DECLS
#endif /* __GDK_TOPLEVEL_H__ */

View File

@@ -40,7 +40,10 @@ struct _GdkToplevelLayout
grefcount ref_count;
guint resizable : 1;
guint maximized_valid : 1;
guint maximized : 1;
guint fullscreen_valid : 1;
guint fullscreen : 1;
GdkMonitor *fullscreen_monitor;
};
@@ -70,7 +73,9 @@ gdk_toplevel_layout_new (void)
layout = g_new0 (GdkToplevelLayout, 1);
g_ref_count_init (&layout->ref_count);
layout->resizable = TRUE;
layout->maximized_valid = FALSE;
layout->maximized = FALSE;
layout->fullscreen_valid = FALSE;
layout->fullscreen = FALSE;
layout->fullscreen_monitor = NULL;
@@ -125,7 +130,9 @@ gdk_toplevel_layout_copy (GdkToplevelLayout *layout)
g_ref_count_init (&new_layout->ref_count);
new_layout->resizable = layout->resizable;
new_layout->maximized_valid = layout->maximized_valid;
new_layout->maximized = layout->maximized;
new_layout->fullscreen_valid = layout->fullscreen_valid;
new_layout->fullscreen = layout->fullscreen;
if (layout->fullscreen_monitor)
new_layout->fullscreen_monitor = g_object_ref (layout->fullscreen_monitor);
@@ -151,7 +158,9 @@ gdk_toplevel_layout_equal (GdkToplevelLayout *layout,
g_return_val_if_fail (other, FALSE);
return layout->resizable == other->resizable &&
layout->maximized_valid == other->maximized_valid &&
layout->maximized == other->maximized &&
layout->fullscreen_valid == other->fullscreen_valid &&
layout->fullscreen == other->fullscreen &&
layout->fullscreen_monitor == other->fullscreen_monitor;
}
@@ -198,22 +207,32 @@ void
gdk_toplevel_layout_set_maximized (GdkToplevelLayout *layout,
gboolean maximized)
{
layout->maximized_valid = TRUE;
layout->maximized = maximized;
}
/**
* gdk_toplevel_layout_get_maximized:
* @layout: a #GdkToplevelLayout
* @maximized: (out): set to %TRUE if the toplevel should be maximized
*
* Returns whether the layout should present the
* surface as maximized.
* If the layout specifies whether to the toplevel should go maximized,
* the value pointed to by @maximized is set to %TRUE if it should go
* fullscreen, or %FALSE, if it should go unmaximized.
*
* Returns: %TRUE if the layout is maximized
* Returns: whether the @layout specifies the maximized state for the toplevel
*/
gboolean
gdk_toplevel_layout_get_maximized (GdkToplevelLayout *layout)
gdk_toplevel_layout_get_maximized (GdkToplevelLayout *layout,
gboolean *maximized)
{
return layout->maximized;
if (layout->maximized_valid)
{
*maximized = layout->maximized;
return TRUE;
}
return FALSE;
}
/**
@@ -230,6 +249,7 @@ gdk_toplevel_layout_set_fullscreen (GdkToplevelLayout *layout,
gboolean fullscreen,
GdkMonitor *monitor)
{
layout->fullscreen_valid = TRUE;
layout->fullscreen = fullscreen;
if (monitor)
layout->fullscreen_monitor = g_object_ref (monitor);
@@ -238,16 +258,25 @@ gdk_toplevel_layout_set_fullscreen (GdkToplevelLayout *layout,
/**
* gdk_toplevel_layout_get_fullscreen:
* @layout: a #GdkToplevelLayout
* @fullscreen: (out): location to store whether the toplevel should be fullscreen
*
* Returns whether the layout should cause the surface
* to be fullscreen when presented.
* If the layout specifies whether to the toplevel should go fullscreen,
* the value pointed to by @fullscreen is set to %TRUE if it should go
* fullscreen, or %FALSE, if it should go unfullscreen.
*
* Returns: %TRUE if @layout is fullscreen
* Returns: whether the @layout specifies the fullscreen state for the toplevel
*/
gboolean
gdk_toplevel_layout_get_fullscreen (GdkToplevelLayout *layout)
gdk_toplevel_layout_get_fullscreen (GdkToplevelLayout *layout,
gboolean *fullscreen)
{
return layout->fullscreen;
if (layout->fullscreen_valid)
{
*fullscreen = layout->fullscreen;
return TRUE;
}
return FALSE;
}
/**

View File

@@ -30,7 +30,7 @@
G_BEGIN_DECLS
/**
* GdkTopLevelLayout:
* GdkToplevelLayout:
*
* Struct containing information for gdk_toplevel_present()
*/
@@ -66,10 +66,12 @@ void gdk_toplevel_layout_set_fullscreen (GdkToplevelLayout *l
GdkMonitor *monitor);
GDK_AVAILABLE_IN_ALL
gboolean gdk_toplevel_layout_get_maximized (GdkToplevelLayout *layout);
gboolean gdk_toplevel_layout_get_maximized (GdkToplevelLayout *layout,
gboolean *maximized);
GDK_AVAILABLE_IN_ALL
gboolean gdk_toplevel_layout_get_fullscreen (GdkToplevelLayout *layout);
gboolean gdk_toplevel_layout_get_fullscreen (GdkToplevelLayout *layout,
gboolean *fullscreen);
GDK_AVAILABLE_IN_ALL
GdkMonitor * gdk_toplevel_layout_get_fullscreen_monitor (GdkToplevelLayout *layout);

View File

@@ -13,7 +13,7 @@ struct _GdkToplevelInterface
{
GTypeInterface g_iface;
gboolean (* present) (GdkToplevel *toplevel,
void (* present) (GdkToplevel *toplevel,
GdkToplevelLayout *layout);
gboolean (* minimize) (GdkToplevel *toplevel);
gboolean (* lower) (GdkToplevel *toplevel);

View File

@@ -118,18 +118,53 @@ gdk_toplevel_size_set_min_size (GdkToplevelSize *size,
size->min_height = min_height;
}
/**
* gdk_toplevel_size_set_shadow_width:
* @size: a #GdkToplevelSize
* @left: width of the left part of the shadow
* @right: width of the right part of the shadow
* @top: height of the top part of the shadow
* @bottom: height of the bottom part of the shadow
*
* The shadow width corresponds to the part of the computed surface size
* that would consist of the shadow margin surrounding the window, would
* there be any.
*/
void
gdk_toplevel_size_set_shadow_width (GdkToplevelSize *size,
int left,
int right,
int top,
int bottom)
{
size->shadow.is_valid = TRUE;
size->shadow.left = left;
size->shadow.right = right;
size->shadow.top = top;
size->shadow.bottom = bottom;
}
void
gdk_toplevel_size_validate (GdkToplevelSize *size)
{
int geometry_width, geometry_height;
if (size->min_width > size->bounds_width ||
size->min_height > size->bounds_height)
g_warning ("GdkToplevelSize: min_size (%d, %d) exceeds bounds (%d, %d)",
size->min_width, size->min_height,
size->bounds_width, size->bounds_height);
if (size->width > size->bounds_width ||
size->height > size->bounds_height)
g_warning ("GdkToplevelSize: size (%d, %d) exceeds bounds (%d, %d)",
geometry_width = size->width;
geometry_height = size->height;
if (size->shadow.is_valid)
{
geometry_width -= size->shadow.left + size->shadow.right;
geometry_height -= size->shadow.top + size->shadow.bottom;
}
if (geometry_width > size->bounds_width ||
geometry_height > size->bounds_height)
g_warning ("GdkToplevelSize: geometry size (%d, %d) exceeds bounds (%d, %d)",
size->width, size->height,
size->bounds_width, size->bounds_height);

View File

@@ -54,6 +54,13 @@ void gdk_toplevel_size_set_min_size (GdkToplevelSize *
int min_width,
int min_height);
GDK_AVAILABLE_IN_ALL
void gdk_toplevel_size_set_shadow_width (GdkToplevelSize *size,
int left,
int right,
int top,
int bottom);
G_END_DECLS
#endif /* __GDK_TOPLEVEL_SIZE_H__ */

View File

@@ -30,6 +30,14 @@ struct _GdkToplevelSize
int height;
int min_width;
int min_height;
struct {
gboolean is_valid;
int left;
int right;
int top;
int bottom;
} shadow;
};
void gdk_toplevel_size_init (GdkToplevelSize *size,

View File

@@ -24,8 +24,25 @@
#include <glib.h>
/**
* GDK_MAJOR_VERSION:
*
* The major version component of the library's version, e.g. "1" for "1.2.3".
*/
#define GDK_MAJOR_VERSION (@GTK_MAJOR_VERSION@)
/**
* GDK_MINOR_VERSION:
*
* The minor version component of the library's version, e.g. "2" for "1.2.3".
*/
#define GDK_MINOR_VERSION (@GTK_MINOR_VERSION@)
/**
* GDK_MICRO_VERSION:
*
* The micro version component of the library's version, e.g. "3" for "1.2.3".
*/
#define GDK_MICRO_VERSION (@GTK_MICRO_VERSION@)
#ifndef _GDK_EXTERN
@@ -35,9 +52,10 @@
/**
* GDK_DISABLE_DEPRECATION_WARNINGS:
*
* A macro that should be defined before including the gdk.h header.
* If it is defined, no compiler warnings will be produced for uses
* of deprecated GDK and GTK APIs.
* A macro that should be defined before including the `gdk.h` header.
*
* If this symbol is defined, no compiler warnings will be produced for
* uses of deprecated GDK and GTK APIs.
*/
#ifdef GDK_DISABLE_DEPRECATION_WARNINGS
@@ -52,9 +70,6 @@
/* XXX: Every new stable minor release bump should add a macro here */
#define GDK_VERSION_3_92 (G_ENCODE_VERSION (3, 92))
#define GDK_VERSION_3_94 (G_ENCODE_VERSION (3, 94))
/**
* GDK_VERSION_4_0:
*
@@ -65,26 +80,34 @@
/* evaluates to the current stable version; for development cycles,
* this means the next stable target
* this means the next stable target, with a hard backstop to the
* beginning of the stable series
*/
#if (GDK_MINOR_VERSION % 2)
#define GDK_VERSION_CUR_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION + 1))
#if GDK_MAJOR_VERSION >= 4 && (GDK_MINOR_VERSION % 2)
# define GDK_VERSION_CUR_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION + 1))
#elif G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION) > GDK_VERSION_4_0
# define GDK_VERSION_CUR_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION))
#else
#define GDK_VERSION_CUR_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION))
# define GDK_VERSION_CUR_STABLE GDK_VERSION_4_0
#endif
/* evaluates to the previous stable version */
#if (GDK_MINOR_VERSION % 2)
#define GDK_VERSION_PREV_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION - 1))
/* evaluates to the previous stable version, with a hard backstop
* to the beginning of the stable series
*/
#if GDK_MAJOR_VERSION >= 4 && (GDK_MINOR_VERSION % 2)
# define GDK_VERSION_PREV_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION - 1))
#elif GDK_MAJOR_VERSION >= 4 && GDK_MINOR_VERSION > 2
# define GDK_VERSION_PREV_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION - 2))
#else
#define GDK_VERSION_PREV_STABLE (G_ENCODE_VERSION (GDK_MAJOR_VERSION, GDK_MINOR_VERSION - 2))
# define GDK_VERSION_PREV_STABLE GDK_VERSION_4_0
#endif
/**
* GDK_VERSION_MIN_REQUIRED:
*
* A macro that should be defined by the user prior to including
* the gdk.h header.
* the `gdk.h` header.
*
* The definition should be one of the predefined GDK version
* macros: %GDK_VERSION_4_0, %GDK_VERSION_4_2,...
*
@@ -102,7 +125,8 @@
* GDK_VERSION_MAX_ALLOWED:
*
* A macro that should be defined by the user prior to including
* the gdk.h header.
* the `gdk.h` header.
*
* The definition should be one of the predefined GDK version
* macros: %GDK_VERSION_4_0, %GDK_VERSION_4_2,...
*
@@ -122,29 +146,33 @@
/* sanity checks */
#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_MIN_REQUIRED
#error "GDK_VERSION_MAX_ALLOWED must be >= GDK_VERSION_MIN_REQUIRED"
# error "GDK_VERSION_MAX_ALLOWED must be >= GDK_VERSION_MIN_REQUIRED"
#endif
#if GDK_VERSION_MIN_REQUIRED < GDK_VERSION_3_92
#error "GDK_VERSION_MIN_REQUIRED must be >= GDK_VERSION_3_92"
#if GDK_VERSION_MIN_REQUIRED < GDK_VERSION_4_0
# error "GDK_VERSION_MIN_REQUIRED must be >= GDK_VERSION_4_0"
#endif
#define GDK_AVAILABLE_IN_ALL _GDK_EXTERN
/* XXX: Every new stable minor release should add a set of macros here */
/* This is not really necessary for 4.0, since there can't be an
* earlier version, and there are no deprecated symbols. We just
* include it for completeness, and because it's easier to copy
* this stanza every time a new development cycle starts.
*/
#if GDK_VERSION_MAX_ALLOWED < GDK_VERSION_4_0
# define GDK_AVAILABLE_IN_4_0 GDK_UNAVAILABLE(4, 0)
# define GDK_AVAILABLE_IN_4_0 GDK_UNAVAILABLE(4, 0)
#else
# define GDK_AVAILABLE_IN_4_0 _GDK_EXTERN
# define GDK_AVAILABLE_IN_4_0 _GDK_EXTERN
#endif
#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_3_92
# define GDK_DEPRECATED_IN_4_0 GDK_DEPRECATED
# define GDK_DEPRECATED_IN_4_0_FOR(f) GDK_DEPRECATED_FOR(f)
#if GDK_VERSION_MIN_REQUIRED >= GDK_VERSION_4_0
# define GDK_DEPRECATED_IN_4_0 GDK_DEPRECATED
# define GDK_DEPRECATED_IN_4_0_FOR(f) GDK_DEPRECATED_FOR(f)
#else
# define GDK_DEPRECATED_IN_4_0 _GDK_EXTERN
# define GDK_DEPRECATED_IN_4_0_FOR(f) _GDK_EXTERN
# define GDK_DEPRECATED_IN_4_0 _GDK_EXTERN
# define GDK_DEPRECATED_IN_4_0_FOR(f) _GDK_EXTERN
#endif
#endif /* __GDK_VERSION_MACROS_H__ */

View File

@@ -210,8 +210,10 @@ gdk_vulkan_strerror (VkResult result)
return "An unknown error has occurred; either the application has provided invalid input, or an implementation failure has occurred.";
#endif
#if VK_HEADER_VERSION >= 135
#if VK_HEADER_VERSION < 162
case VK_ERROR_INCOMPATIBLE_VERSION_KHR:
return "Acceleration structure serialized with version as the version information is not compatible with device.";
return "This error was removed by the Vulkan gods.";
#endif
case VK_THREAD_IDLE_KHR:
return "A deferred operation is not complete but there is currently no work for this thread to do at the time of this call.";
case VK_THREAD_DONE_KHR:
@@ -223,7 +225,7 @@ gdk_vulkan_strerror (VkResult result)
case VK_ERROR_PIPELINE_COMPILE_REQUIRED_EXT:
return "A requested pipeline creation would have required compilation, but the application requested compilation to not be performed.";
#endif
#if VK_HEADER_VERSION < 140
#if VK_HEADER_VERSION < 142
case VK_RESULT_RANGE_SIZE:
#endif
case VK_RESULT_MAX_ENUM:

View File

@@ -82,7 +82,9 @@ G_GNUC_BEGIN_IGNORE_DEPRECATIONS
-(BOOL)isOpaque
{
return NO;
if ([self window])
return [[self window] isOpaque];
return YES;
}
-(BOOL)isFlipped

View File

@@ -230,9 +230,7 @@
NSRect content_rect;
GdkSurface *surface;
GdkDisplay *display;
GdkEvent *event;
gboolean maximized;
GList *node;
surface = GDK_SURFACE (gdk_surface);
display = gdk_surface_get_display (surface);
@@ -256,13 +254,7 @@
_gdk_surface_update_size (surface);
/* Synthesize a configure event */
event = gdk_configure_event_new (surface,
content_rect.size.width,
content_rect.size.height);
node = _gdk_event_queue_append (display, event);
_gdk_windowing_got_event (display, node, event,
_gdk_display_get_next_serial (display));
gdk_surface_request_layout (surface);
_gdk_macos_surface_reposition_children (gdk_surface);
@@ -320,11 +312,20 @@
-(void)hide
{
BOOL wasKey = [self isKeyWindow];
BOOL wasMain = [self isMainWindow];
inShowOrHide = YES;
[self orderOut:nil];
inShowOrHide = NO;
initialPositionKnown = NO;
if (wasMain)
[self windowDidResignMain:nil];
if (wasKey)
[self windowDidResignKey:nil];
}
-(BOOL)trackManualMove

View File

@@ -122,7 +122,7 @@ gdk_macos_device_ungrab (GdkDevice *device,
grab = _gdk_display_get_last_device_grab (display, device);
if (grab != NULL)
grab->serial_end = 0;
grab->serial_end = grab->serial_start;
_gdk_display_device_grab_update (display, device, 0);
}

View File

@@ -610,7 +610,7 @@ fill_scroll_event (GdkMacosDisplay *self,
sx = [nsevent scrollingDeltaX];
sy = [nsevent scrollingDeltaY];
if (sx != 0.0 || dx != 0.0)
if (sx != 0.0 || sy != 0.0)
ret = gdk_scroll_event_new (GDK_SURFACE (surface),
pointer,
NULL,

View File

@@ -477,7 +477,8 @@ _gdk_macos_display_surface_removed (GdkMacosDisplay *self,
if (self->keyboard_surface == surface)
_gdk_macos_display_surface_resigned_key (self, surface);
g_queue_unlink (&self->sorted_surfaces, &surface->sorted);
if (queue_contains (&self->sorted_surfaces, &surface->sorted))
g_queue_unlink (&self->sorted_surfaces, &surface->sorted);
if (queue_contains (&self->main_surfaces, &surface->main))
_gdk_macos_display_surface_resigned_main (self, surface);
@@ -519,23 +520,30 @@ void
_gdk_macos_display_surface_resigned_key (GdkMacosDisplay *self,
GdkMacosSurface *surface)
{
gboolean was_keyboard_surface;
g_return_if_fail (GDK_IS_MACOS_DISPLAY (self));
g_return_if_fail (GDK_IS_MACOS_SURFACE (surface));
if (self->keyboard_surface == surface)
was_keyboard_surface = self->keyboard_surface == surface;
self->keyboard_surface = NULL;
if (was_keyboard_surface)
{
GdkDevice *keyboard;
GdkEvent *event;
GdkSeat *seat;
GList *node;
seat = gdk_display_get_default_seat (GDK_DISPLAY (self));
keyboard = gdk_seat_get_keyboard (seat);
event = gdk_focus_event_new (GDK_SURFACE (surface), keyboard, FALSE);
_gdk_event_queue_append (GDK_DISPLAY (self), event);
node = _gdk_event_queue_append (GDK_DISPLAY (self), event);
_gdk_windowing_got_event (GDK_DISPLAY (self), node, event,
_gdk_display_get_next_serial (GDK_DISPLAY (self)));
}
self->keyboard_surface = NULL;
_gdk_macos_display_clear_sorting (self);
}
@@ -1049,9 +1057,8 @@ _gdk_macos_display_clear_sorting (GdkMacosDisplay *self)
{
g_return_if_fail (GDK_IS_MACOS_DISPLAY (self));
self->sorted_surfaces.head = NULL;
self->sorted_surfaces.tail = NULL;
self->sorted_surfaces.length = 0;
while (self->sorted_surfaces.head != NULL)
g_queue_unlink (&self->sorted_surfaces, self->sorted_surfaces.head);
}
const GList *

View File

@@ -101,7 +101,7 @@ create_pixel_format (int major,
NSOpenGLPFAAccelerated,
NSOpenGLPFADoubleBuffer,
NSOpenGLPFABackingStore,
NSOpenGLPFAColorSize, 32,
NSOpenGLPFAColorSize, 24,
NSOpenGLPFAAlphaSize, 8,
(NSOpenGLPixelFormatAttribute)nil
@@ -173,11 +173,13 @@ gdk_macos_gl_context_real_realize (GdkGLContext *context,
NSOpenGLContext *shared_gl_context = nil;
NSOpenGLContext *gl_context;
NSOpenGLPixelFormat *pixelFormat;
CGLContextObj cgl_context;
GdkGLContext *shared;
GdkGLContext *shared_data;
NSOpenGLContext *existing;
GLint sync_to_framerate = 1;
GLint validate = 0;
GLint swapRect[4];
int major, minor;
g_assert (GDK_IS_MACOS_GL_CONTEXT (self));
@@ -226,8 +228,19 @@ gdk_macos_gl_context_real_realize (GdkGLContext *context,
return FALSE;
}
[gl_context setValues:&sync_to_framerate forParameter:NSOpenGLCPSwapInterval];
[gl_context setValues:&validate forParameter:NSOpenGLContextParameterStateValidation];
cgl_context = [gl_context CGLContextObj];
swapRect[0] = 0;
swapRect[1] = 0;
swapRect[2] = surface->width;
swapRect[3] = surface->height;
CGLSetParameter (cgl_context, kCGLCPSwapRectangle, swapRect);
CGLSetParameter (cgl_context, kCGLCPSwapInterval, &sync_to_framerate);
CGLEnable (cgl_context, kCGLCESwapRectangle);
if (validate)
CGLEnable (cgl_context, kCGLCEStateValidation);
self->dummy_window = [[NSWindow alloc] initWithContentRect:NSZeroRect
styleMask:0
@@ -259,9 +272,12 @@ gdk_macos_gl_context_begin_frame (GdkDrawContext *context,
cairo_region_t *painted)
{
GdkMacosGLContext *self = (GdkMacosGLContext *)context;
GdkSurface *surface;
g_assert (GDK_IS_MACOS_GL_CONTEXT (self));
surface = gdk_draw_context_get_surface (context);
/* If begin frame is called, that means we are trying to draw to
* the NSWindow using our view. That might be a GdkMacosCairoView
* but we need it to be a GL view. Also, only in this case do we
@@ -271,17 +287,31 @@ gdk_macos_gl_context_begin_frame (GdkDrawContext *context,
if (!self->is_attached &&
gdk_gl_context_get_shared_context (GDK_GL_CONTEXT (context)))
{
CGLContextObj glctx = [self->gl_context CGLContextObj];
GLint swapRect[4];
ensure_gl_view (self);
g_clear_pointer (&self->damage, cairo_region_destroy);
self->damage = cairo_region_copy (painted);
cairo_region_get_extents (painted, &self->flush_rect);
/* Coordinates are in display coordinates, where as flush_rect is
* in GDK coordinates. Must flip Y to match display coordinates where
* 0,0 is the bottom-left corner.
*/
swapRect[0] = self->flush_rect.x; /* left */
swapRect[1] = surface->height - self->flush_rect.y; /* bottom */
swapRect[2] = self->flush_rect.width; /* width */
swapRect[3] = self->flush_rect.height; /* height */
CGLSetParameter (glctx, kCGLCPSwapRectangle, swapRect);
}
if (self->needs_resize)
{
GdkSurface *surface = gdk_draw_context_get_surface (context);
CGLContextObj cgl_context = [self->gl_context CGLContextObj];
GLint opaque;
self->needs_resize = FALSE;
@@ -302,7 +332,8 @@ gdk_macos_gl_context_begin_frame (GdkDrawContext *context,
opaque = GDK_MACOS_TOPLEVEL_SURFACE (surface)->decorated;
else
opaque = FALSE;
[self->gl_context setValues:&opaque forParameter:NSOpenGLCPSurfaceOpacity];
CGLSetParameter (cgl_context, kCGLCPSurfaceOpacity, &opaque);
[self->gl_context update];
}
@@ -311,8 +342,7 @@ gdk_macos_gl_context_begin_frame (GdkDrawContext *context,
if (!self->is_attached)
{
GdkMacosSurface *surface = GDK_MACOS_SURFACE (gdk_draw_context_get_surface (context));
NSView *nsview = _gdk_macos_surface_get_view (surface);
NSView *nsview = _gdk_macos_surface_get_view (GDK_MACOS_SURFACE (surface));
g_assert (self->gl_context != NULL);
g_assert (GDK_IS_MACOS_GL_VIEW (nsview));
@@ -332,14 +362,6 @@ gdk_macos_gl_context_end_frame (GdkDrawContext *context,
GDK_DRAW_CONTEXT_CLASS (gdk_macos_gl_context_parent_class)->end_frame (context, painted);
/* We want to limit how much gets moved to the front buffer so here
* we adjust the clip rectangle before flushBuffer is called.
*/
G_STATIC_ASSERT (sizeof (GLint) == sizeof (int));
[self->gl_context
setValues:(GLint *)&self->flush_rect
forParameter:NSOpenGLCPSwapRectangle];
[self->gl_context flushBuffer];
}
@@ -447,15 +469,28 @@ _gdk_macos_gl_context_new (GdkMacosSurface *surface,
gboolean
_gdk_macos_gl_context_make_current (GdkMacosGLContext *self)
{
NSOpenGLContext *current;
g_return_val_if_fail (GDK_IS_MACOS_GL_CONTEXT (self), FALSE);
if (self->gl_context != nil)
if (self->gl_context == NULL)
return FALSE;
current = [NSOpenGLContext currentContext];
if (self->gl_context != current)
{
/* The OpenGL mac programming guide suggests that glFlush() is called
* before switching current contexts to ensure that the drawing commands
* are submitted.
*/
if (current != NULL)
glFlush ();
[self->gl_context makeCurrentContext];
return TRUE;
}
return FALSE;
return TRUE;
}
G_GNUC_END_IGNORE_DEPRECATIONS

View File

@@ -69,6 +69,10 @@ gdk_macos_popup_surface_layout (GdkMacosPopupSurface *self,
gdk_surface_layout_popup_helper (GDK_SURFACE (self),
width,
height,
self->parent_instance.shadow_left,
self->parent_instance.shadow_right,
self->parent_instance.shadow_top,
self->parent_instance.shadow_bottom,
monitor,
&bounds,
self->layout,

View File

@@ -85,6 +85,11 @@ void _gdk_macos_surface_get_shadow (GdkMacosSurface
int *right,
int *bottom,
int *left);
void _gdk_macos_surface_set_shadow (GdkMacosSurface *self,
int top,
int right,
int bottom,
int left);
NSView *_gdk_macos_surface_get_view (GdkMacosSurface *self);
gboolean _gdk_macos_surface_get_modal_hint (GdkMacosSurface *self);
void _gdk_macos_surface_set_modal_hint (GdkMacosSurface *self,

View File

@@ -85,7 +85,7 @@ _gdk_macos_surface_reposition_children (GdkMacosSurface *self)
}
if (GDK_IS_POPUP (self) && self->did_initial_present)
g_signal_emit_by_name (self, "popup-layout-changed");
gdk_surface_request_layout (GDK_SURFACE (self));
}
static void
@@ -112,15 +112,21 @@ gdk_macos_surface_hide (GdkSurface *surface)
{
GdkMacosSurface *self = (GdkMacosSurface *)surface;
GdkSeat *seat;
gboolean was_mapped;
g_assert (GDK_IS_MACOS_SURFACE (self));
was_mapped = GDK_SURFACE_IS_MAPPED (GDK_SURFACE (self));
seat = gdk_display_get_default_seat (surface->display);
gdk_seat_ungrab (seat);
[self->window hide];
_gdk_surface_clear_update_area (surface);
if (was_mapped)
gdk_surface_freeze_updates (GDK_SURFACE (self));
}
static int
@@ -133,12 +139,12 @@ gdk_macos_surface_get_scale_factor (GdkSurface *surface)
return [self->window backingScaleFactor];
}
static void
gdk_macos_surface_set_shadow_width (GdkSurface *surface,
int left,
int right,
int top,
int bottom)
void
_gdk_macos_surface_set_shadow (GdkMacosSurface *surface,
int top,
int right,
int bottom,
int left)
{
GdkMacosSurface *self = (GdkMacosSurface *)surface;
@@ -361,6 +367,17 @@ gdk_macos_surface_destroy (GdkSurface *surface,
GdkMacosSurface *self = (GdkMacosSurface *)surface;
GdkMacosWindow *window = g_steal_pointer (&self->window);
GdkFrameClock *frame_clock;
if ((frame_clock = gdk_surface_get_frame_clock (GDK_SURFACE (self))))
{
g_signal_handlers_disconnect_by_func (frame_clock,
G_CALLBACK (gdk_macos_surface_before_paint),
self);
g_signal_handlers_disconnect_by_func (frame_clock,
G_CALLBACK (gdk_macos_surface_before_paint),
self);
}
g_clear_pointer (&self->title, g_free);
@@ -474,7 +491,6 @@ gdk_macos_surface_class_init (GdkMacosSurfaceClass *klass)
surface_class->hide = gdk_macos_surface_hide;
surface_class->set_input_region = gdk_macos_surface_set_input_region;
surface_class->set_opaque_region = gdk_macos_surface_set_opaque_region;
surface_class->set_shadow_width = gdk_macos_surface_set_shadow_width;
properties [PROP_NATIVE] =
g_param_spec_pointer ("native",
@@ -533,7 +549,10 @@ _gdk_macos_surface_new (GdkMacosDisplay *display,
}
if (ret != NULL)
_gdk_macos_surface_monitor_changed (ret);
{
gdk_surface_freeze_updates (GDK_SURFACE (ret));
_gdk_macos_surface_monitor_changed (ret);
}
g_object_unref (frame_clock);
@@ -743,7 +762,7 @@ _gdk_macos_surface_show (GdkMacosSurface *self)
was_mapped = GDK_SURFACE_IS_MAPPED (GDK_SURFACE (self));
if (!was_mapped)
gdk_synthesize_surface_state (GDK_SURFACE (self), GDK_TOPLEVEL_STATE_WITHDRAWN, 0);
gdk_surface_set_is_mapped (GDK_SURFACE (self), TRUE);
_gdk_macos_display_clear_sorting (GDK_MACOS_DISPLAY (GDK_SURFACE (self)->display));
@@ -755,6 +774,7 @@ _gdk_macos_surface_show (GdkMacosSurface *self)
{
_gdk_macos_surface_update_position (self);
gdk_surface_invalidate_rect (GDK_SURFACE (self), NULL);
gdk_surface_thaw_updates (GDK_SURFACE (self));
}
}

View File

@@ -96,10 +96,14 @@ _gdk_macos_toplevel_surface_present (GdkToplevel *toplevel,
GdkGeometry geometry;
GdkSurfaceHints mask;
NSWindowStyleMask style_mask;
gboolean maximize;
gboolean fullscreen;
g_assert (GDK_IS_MACOS_TOPLEVEL_SURFACE (self));
g_assert (GDK_IS_MACOS_WINDOW (nswindow));
_gdk_macos_toplevel_surface_attach_to_parent (self);
style_mask = [nswindow styleMask];
monitor = gdk_display_get_monitor_at_surface (display, surface);
@@ -153,27 +157,44 @@ _gdk_macos_toplevel_surface_present (GdkToplevel *toplevel,
if (style_mask != [nswindow styleMask])
[nswindow setStyleMask:style_mask];
if (size.shadow.is_valid)
{
_gdk_macos_surface_set_shadow (GDK_MACOS_SURFACE (surface),
size.shadow.top,
size.shadow.right,
size.shadow.bottom,
size.shadow.left);
}
_gdk_macos_surface_set_geometry_hints (GDK_MACOS_SURFACE (self), &geometry, mask);
gdk_surface_constrain_size (&geometry, mask, width, height, &width, &height);
_gdk_macos_surface_resize (GDK_MACOS_SURFACE (self), width, height);
/* Maximized state */
if (gdk_toplevel_layout_get_maximized (layout))
_gdk_macos_toplevel_surface_maximize (self);
else
_gdk_macos_toplevel_surface_unmaximize (self);
if (gdk_toplevel_layout_get_maximized (layout, &maximize))
{
if (maximize)
_gdk_macos_toplevel_surface_maximize (self);
else
_gdk_macos_toplevel_surface_unmaximize (self);
}
/* Fullscreen state */
if (gdk_toplevel_layout_get_fullscreen (layout))
_gdk_macos_toplevel_surface_fullscreen (self);
else
_gdk_macos_toplevel_surface_unfullscreen (self);
if (gdk_toplevel_layout_get_fullscreen (layout, &fullscreen))
{
if (fullscreen)
_gdk_macos_toplevel_surface_fullscreen (self);
else
_gdk_macos_toplevel_surface_unfullscreen (self);
}
if (GDK_SURFACE (self)->transient_for != NULL)
{
}
else
{
[nswindow setAnimationBehavior:NSWindowAnimationBehaviorDocumentWindow];
if (!self->decorated &&
!GDK_MACOS_SURFACE (self)->did_initial_present &&
GDK_SURFACE (self)->x == 0 &&

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