Compare commits

...

715 Commits

Author SHA1 Message Date
Benjamin Otte
d01ad09dc5 demo: Use a FixedItemSeletion instead of a NoSelection
Simple demo of how to use FixedItemSelection.
2021-11-09 18:38:24 +01:00
Benjamin Otte
28613549c4 gtk: Add GtkFixedItemSelection 2021-11-09 18:38:24 +01:00
Matthias Clasen
bf40b89b53 Merge branch 'wip/jimmac/unfocused-selections' into 'master'
styling: Have unfocused selections

Closes #4393

See merge request GNOME/gtk!4113
2021-11-09 11:34:37 +00:00
Matthias Clasen
9f2dbf4fc5 Merge branch 'master' into 'master'
Fix typos

See merge request GNOME/gtk!4132
2021-11-09 11:28:35 +00:00
Quentin PAGÈS
235b0482dd Update Occitan translation 2021-11-09 09:45:47 +00:00
Milo Casagrande
cbd332bc57 Update Italian translation
(cherry picked from commit 3eb1ca3ecb)
2021-11-09 08:52:30 +00:00
Milo Casagrande
fc8aa80e62 Update Italian translation
(cherry picked from commit 4fa318fa19)
2021-11-09 08:34:59 +00:00
Jonas Ådahl
56404b7006 Merge branch 'gdksurface-wayland' into 'master'
Move some members of `GtkWaylandSurface` to `GtkWaylandToplevel`

See merge request GNOME/gtk!3918
2021-11-09 06:56:27 +00:00
Benjamin Otte
08d48201e9 Merge branch 'wip/otte/for-master' into 'master'
lots of sizing fixes

See merge request GNOME/gtk!4131
2021-11-09 03:15:00 +00:00
Benjamin Otte
76c4673944 boxlayout: Fix broken min-size-for-opposite-size
Assume a vbox with 2 wrapping labels saying
  Hello World
  Hi Ho
being measured for their minimum width for 3 rows of text.
This should be layouted like
  Hello
  World
  Hi Ho
and measured accordingly.

However, previously this was layouted as
  Hello World
  Hi Ho
with 1.5 lines being assigned to both labels.
That will obviously not compute the above wrapping which clearly
results in a smaller min width.

A reftest testing exactly this was included.
2021-11-09 03:41:43 +01:00
Benjamin Otte
0a31201c88 boxlayout: Split loop into if statmement
Turns it into 2 loops, one for the homogeneous part and one for the
complicated part.
2021-11-09 03:41:43 +01:00
Benjamin Otte
afe94e303a boxlayout: Don't listen to comments
... when they are wrong.

Instead, remove them.

Or in other words: GTK4 does not have a fill child property anymore, so
we don't need to run the measuring loop above to determine the size.
2021-11-09 03:41:43 +01:00
Benjamin Otte
b004706009 Revert "sizerequest: Only check reported baselines if requested"
This reverts commit cf7fa931d3.

We store the baseline in the cache and we do not know if baselines might
be queried in the future. So always store them.

No reftest because I don't know how to write one.

premature optimization == √😈
2021-11-09 03:41:43 +01:00
Benjamin Otte
129042425d demos: Update for climate change and Covid 2021-11-09 03:41:43 +01:00
Benjamin Otte
81169d18c3 label: max-width-chars should be ignored sometimes
When a widget is neither wrappable nor ellipsizable, we cannot modify
the label to fit into any size. So we cannot respect max-width-chars.
2021-11-09 03:41:43 +01:00
Benjamin Otte
cce6a603a6 label: max-width-chars has no effect on smaller text
Having a short text and a large max-width-chars should request the
natural width of the text, not the limit from max-width-chars.

This caused huge message dialogs.

Reftests added.
2021-11-09 03:41:43 +01:00
Ian Douglas Scott
1c6608f426 gdk/wayland/surface: Remove unused argument 2021-11-08 14:46:38 -08:00
Ian Douglas Scott
fcdc5538cf gdk/wayland/surface: Move *idle_inhibitor* to GdkWaylandToplevel 2021-11-08 14:46:34 -08:00
Ian Douglas Scott
dd327bc8a6 gdk/wayland/surface: Move *exported to GdkWaylandToplevel 2021-11-08 14:43:19 -08:00
Ian Douglas Scott
b878353f0b gdk/wayland/surface: Move server_decoration to GdkWaylandToplevel 2021-11-08 14:00:00 -08:00
Jordi Mas i Hernandez
27d286eb7a Update Catalan translation 2021-11-08 20:35:15 +00:00
Jordi Mas i Hernandez
01cf559d9d Update Catalan translation 2021-11-08 19:58:52 +00:00
Matthias Clasen
20fd760a52 Merge branch 'small-caps' into 'master'
Handle new pango api

See merge request GNOME/gtk!4137
2021-11-08 19:39:55 +00:00
Matthias Clasen
cca8ae04b6 Bump the pango requirement to 1.49.3
Required for new PangoVariant enumeration values.
2021-11-08 14:17:42 -05:00
Matthias Clasen
60c45dac56 css: Change the way case variants are handled
Instead of translating font-variant-caps directly
to OpenType features, translate them to a PangoVariant,
now that that enumeration reflects all the css values.

This allows pango to emulate Small Caps for fonts that
don't support the OpenType feature.
2021-11-08 14:17:42 -05:00
Matthias Clasen
7bee4fa44b Handle new pango api
The PangoVariant enumeration has gained new values
to match css. Handle those in switches.
2021-11-08 14:17:42 -05:00
Matthias Clasen
4c029af6cd textview: Don't leave embedded children behind
When scrolling embedded widgets out of view,
they sometimes get left behind because we don't
reallocated them. To avoid that, move _all_ children
out of view in size_allocate, and let the current
child allocation plumbing move the visible ones
back in place.
2021-11-08 14:17:42 -05:00
Matthias Clasen
1c6efea370 Remove a confusing comment
It talks about propagating to unanchored children,
but then iterates over anchored_children. That does
not add up.
2021-11-08 14:17:42 -05:00
Matthias Clasen
895dc94cc9 gtk-demo: Avoid a missing icon
The hypertext demo was using an icon that we no longer
include in our embedded icon theme. Use a different one.
2021-11-08 14:17:42 -05:00
Luca Bacci
9f9479a50f Merge branch 'forward-port-mr-3931-to-gtk4' into 'master'
Remove the GdkWin32 global screen offset

Closes #4348 and #1477

See merge request GNOME/gtk!4104
2021-11-08 18:55:07 +00:00
Hugo Carvalho
13d559119f Update Portuguese translation 2021-11-08 11:27:19 +00:00
Daniel Mustieles
cf69d917c1 Updated Spanish translation 2021-11-08 10:32:50 +01:00
Emmanuele Bassi
dc9b145e27 Merge branch 'ebassi/for-master' into 'master'
docs: Fix typo in link

See merge request GNOME/gtk!4135
2021-11-07 23:40:14 +00:00
Emmanuele Bassi
0e27a49d1a docs: Fix typo in link 2021-11-07 23:23:36 +00:00
Hugo Carvalho
4afd416840 Update Portuguese translation 2021-11-07 21:30:40 +00:00
Hugo Carvalho
25142abebf Update Portuguese translation 2021-11-07 21:27:49 +00:00
Emmanuele Bassi
60d50bcb13 Merge branch 'ebassi/docs-link-fixes' into 'master'
docs: Fix wrong fragments in type links

See merge request GNOME/gtk!4134
2021-11-07 19:08:16 +00:00
Emmanuele Bassi
59f45aa30c docs: Fix wrong fragments in type links
Due to a bug in gi-docgen we're not getting a warning if a fragment to a
type does not match the actual type, and we're generating a broken link.

See: https://gitlab.gnome.org/GNOME/gi-docgen/-/merge_requests/120
2021-11-07 18:40:24 +00:00
Emmanuele Bassi
14c32a7cf0 Merge branch 'these-are-flags' into 'master'
docs: Tag Gdk.ModifierType as flags

See merge request GNOME/gtk!4133
2021-11-07 18:21:28 +00:00
Luca Bacci
4c8e703803 GdkWin32: Remove the global screen offset
Removes the _gdk_offset_x / _gdk_offset_y variables,
as today are not needed anymore.
2021-11-07 19:08:30 +01:00
Luca Bacci
8338e55549 GdkWin32: Use a signed integral type for the DPI scale 2021-11-07 19:01:32 +01:00
Marco Melorio
da72cfea40 docs: Tag Gdk.ModifierType as flags 2021-11-07 18:14:15 +01:00
Hodong Kim
0632e94e68 Fix typos 2021-11-07 16:48:39 +09:00
Yuri Chornoivan
4a356ae331 Update Ukrainian translation 2021-11-06 04:16:55 +00:00
Benjamin Otte
4f4f2d169a Merge branch 'wip/otte/for-master' into 'master'
boxlayout: Be more careful with what to consider natural size

See merge request GNOME/gtk!4129
2021-11-06 03:54:08 +00:00
Benjamin Otte
577d520006 reftests: Add reftest for last 2 issues
Use a label that is long enough to require wrapping and force it into a
hardcoded width. Use a sentence where all the words have the same size
to not get unwanted wrapping behavior.

Also append a 2nd row to check that the first row gets the proper height
allocated.

Found by Marco Melorio.
2021-11-06 04:30:50 +01:00
Benjamin Otte
222d6f1db1 label: Don't deduce label width from logical rect
The width of a logical rect after line breaking is sometimes not
wide enough to cause line breaking to break at the exact same points.
(Is that by design or a bug in Pango? I don't know.)

So don't use the width, and only relyon values we actually set to
pango_layout_set_width().
2021-11-06 03:15:04 +01:00
Benjamin Otte
4ffa60be50 boxlayout: Be more careful with what to consider natural size
Don't just use the natural size as the max size, the natural size
is the ideal size, not necessarily the maximum size.

Also check the nat size for opposite min size.
2021-11-06 00:56:55 +01:00
Matthias Clasen
7da72d1295 Merge branch 'remove_some_unused_declarations' into 'master'
remove some unused declarations

See merge request GNOME/gtk!4125
2021-11-05 23:08:56 +00:00
Matthias Clasen
c9735e8ea9 Merge branch 'wip/baedert/for-master' into 'master'
paned: Don't pass values < -1 to gtk_widget_measure()

Closes #4404

See merge request GNOME/gtk!4126
2021-11-05 23:08:28 +00:00
Benjamin Otte
8a7868d006 Merge branch 'wip/otte/for-master' into 'master'
Revert "label: Never measure more than max-width-chars"

Closes #4399

See merge request GNOME/gtk!4120
2021-11-05 22:11:00 +00:00
Benjamin Otte
c4e5242be0 picture: Setting can-shrink requires a resize
So queue one.
2021-11-05 20:51:00 +01:00
Matthias Clasen
935f7f19f3 Merge branch 'yurchor-master-patch-77064' into 'master'
Fix minor typo: Unsupportd -> Unsupported

See merge request GNOME/gtk!4127
2021-11-05 19:41:05 +00:00
Benjamin Otte
5c9ae28937 boxlayout: Compute opposite size properly
For size -1 in the opposite orientation, GtkBoxLayout used to measure
the children based on their min size in the box's orientation instead of
-1. That wasn't really intended, but was a side effect of how the sizing
code did (not) distribute extra size above the minimum size.

This is clearly not what we want.
What we want is measuring the orientation as is for size -1. Then we
want to just take the maximum of all children and use that.

A reftest is incldued that ensures a vbox wraps a label just like an
hbox does.
2021-11-05 20:30:49 +01:00
Benjamin Otte
8e27fc7f9b label: Redo measure() code
The old code couldn't properly do height-for-width because it only
computed the widest and smallest layout instead of looking at the actual
passed in for-size.

The label-sizing reftest has been adapted as the label code is now smart
enough to always display the whole text and no longer requests a too
small width-for-single-row when wrapping.
2021-11-05 20:29:42 +01:00
Yuri Chornoivan
e0c97e6fcc Update Ukrainian translation 2021-11-05 18:46:16 +00:00
Yuri Chornoivan
e80d938ee5 Fix minor typo: Unsupportd -> Unsupported 2021-11-05 18:42:20 +00:00
Matthias Clasen
a6f1737861 Merge branch 'wip/carlosg/no-ping-serials-for-input' into 'master'
gdk/wayland: Do not use xdg_wm_base.ping serials as "user input" serials

See merge request GNOME/gtk!4122
2021-11-05 18:34:02 +00:00
Yuri Chornoivan
c78ed25e30 Update Ukrainian translation 2021-11-05 18:31:16 +00:00
Timm Bäder
c87d1c2fb9 paned: Don't pass values < -1 to gtk_widget_measure()
Fixes #4404
2021-11-05 17:41:42 +01:00
Caolán McNamara
c66d24b41a remove some unused declarations 2021-11-05 14:03:47 +00:00
Carlos Garnacho
c5ac80be2b gdk/wayland: Do not use xdg_wm_base.ping serials as "user input" serials
Ping/pong serials are not meant to be interpreted as user input serials
(e.g. those given back later to the compositor on grabs). As a matter
of fact, Mutter uses a different count (i.e. timestamps) in these, so
using these serials may confuse the compositor into denying certain
operations like DnD.
2021-11-05 14:42:53 +01:00
Benjamin Otte
53acff167b Revert "label: Never measure more than max-width-chars"
This reverts commit ba44e7a228.

The change was meant to revert to old GTK3 behavior but it actually
broke new GTK4 behavior that is in use where max-width-chars is used to
determine an ideal size, but where we don't want to limit the width to
that size.

So what happens is the reintroduction of GTK3-style lots of whitepsace
bugs, and we really don't want those.

We also don't want to break backwards compat if we can avoid it.

So let's revert this.

The reftest that was made for this purpose has been adapted.

Fixes #4399
2021-11-05 06:12:33 +01:00
Matthias Clasen
9c1a41052b Merge branch 'ebassi/cross-bundle' into 'master'
build: Don't use ld when cross-compiling

See merge request GNOME/gtk!4121
2021-11-04 18:11:40 +00:00
Emmanuele Bassi
a1861112ee build: Don't use ld when cross-compiling
We can't guarantee anything on the target toolchain, in that case.
2021-11-04 13:41:35 +00:00
Matthias Clasen
b2a1fb7149 Merge branch 'taozuhong-master-patch-22982' into 'master'
Make dialog content_area box as vertical, keep compatibility with GTK3

See merge request GNOME/gtk!4119
2021-11-04 11:06:44 +00:00
TAO ZUHONG
db2a03ed33 Update gtk/ui/gtkdialog.ui 2021-11-04 08:25:03 +00:00
TAO ZUHONG
9e8bf10653 Make dialog content_area box as vertical, keep compatibility with GTK3 2021-11-04 08:23:04 +00:00
Matthias Clasen
c20a631ab7 Merge branch 'listview-sink-adjustment' into 'master'
listbase: Sink adjustments

Closes #4403

See merge request GNOME/gtk!4117
2021-11-04 01:58:56 +00:00
Matthias Clasen
8c63244855 Merge branch 'activate-signal-dropdown-combobox' into 'master'
Add activate signal to DropDown and ComboBox

See merge request GNOME/gtk!3935
2021-11-04 01:19:43 +00:00
Matthias Clasen
9a31922709 Merge branch 'reftest-no-blink' into 'master'
testsuite: Set GDK_DEBUG unconditionally

See merge request GNOME/gtk!4116
2021-11-04 01:15:31 +00:00
Matthias Clasen
3c2818b30a listbase: Sink adjustments
gtk_adjustment_new returns floating objects.
Sink them.

Fixes: #4403
2021-11-03 21:09:37 -04:00
Matthias Clasen
e017e4252b reftest: No blinking, please
Blinking cursors aren't helpful when we want to
compare renderings pixel-by-pixel. Turn them off.
2021-11-03 20:43:01 -04:00
Matthias Clasen
97365a8ffe reftest: Stop setting GDK_RENDERING
That environment variable isn't used anymore.
2021-11-03 20:40:22 -04:00
Matthias Clasen
df12a41cbb testsuite: Set GDK_DEBUG unconditionally
The default-settings key works in non-debug builds
too, nowadays.
2021-11-03 20:39:33 -04:00
Maximiliano Sandoval R
0aa3a7e71c combo_box: Use mnemonic_activate on override
This is changing the existing behavior where the mnemonic activation
would just grab the focus of the button, this was the behavior in GTK 3.
2021-11-04 00:48:05 +01:00
Maximiliano Sandoval R
3918cdd989 dropdown: Make DropDown activatable
The activation is simply forwarded to the button
within.
2021-11-04 00:47:02 +01:00
Maximiliano Sandoval R
c4df987eef combobox: Make combo box activatable
The activation is simply forwarded to the button
within.
2021-11-04 00:46:47 +01:00
Benjamin Otte
c125ffb384 Merge branch 'wip/otte/for-master' into 'master'
egl: Set the draw buffer to GL_BACK_LEFT

Closes #4402

See merge request GNOME/gtk!4114
2021-11-03 22:22:30 +00:00
Benjamin Otte
6536e3dc54 macos: Fix return value 2021-11-03 22:53:59 +01:00
Benjamin Otte
164d0a5201 gdk: #if => #ifdef
Makes compilers happy
2021-11-03 22:53:59 +01:00
Benjamin Otte
95574f98c4 gl: Use GL_BACK_LEFT
The spec doesn't allow GL_BACK, but many drivers do. Use the
spec-accepted equivalent instead.

Fixed #4402
2021-11-03 22:53:59 +01:00
Benjamin Otte
bca77b5505 egl: Set the draw buffer to GL_BACK_LEFT
Instead of using GL_BACK, use GL_BACK_LEFT, because the spec demands
this (many drivers don't).

Also move the call from the GDK backends into the GLContext code, as
this is a generic EGL issue (nvidia being the main driver in need of
this call, see 9c4c4eaaa1 for a longer
discussion).

Fixes #4402
2021-11-03 22:53:59 +01:00
Jakub Steiner
96f63a6bf3 styling: Have unfocused selections
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/4393
2021-11-03 13:08:01 +01:00
Matthias Clasen
37cbd0662e Merge branch 'small-check' into 'master'
icon: revert object-symbolic check to be smaller

See merge request GNOME/gtk!4110
2021-11-01 19:38:55 +00:00
Tobias Bernard
9b23602806 icon: revert object-symbolic check to be smaller
The larger check works well in the headerbar, but not inline in various UI elements. This reverts the larger check since the latter is more common. For selection mode, a separate larger icon (selection-mode-symbolic) has been added to adwaita-icon-theme.
2021-11-01 18:54:22 +01:00
Matthias Clasen
68f2e1bc06 Merge branch 'ci-require-macos' into 'master'
Revert "ci: Allow macos to fail"

See merge request GNOME/gtk!4109
2021-11-01 15:22:53 +00:00
Matthias Clasen
bc80eb616d Revert "ci: Allow macos to fail"
This reverts commit b7cab5c5eb.

We welcome the macos runner back.
2021-11-01 10:33:09 -04:00
Emmanuele Bassi
d005049084 Merge branch 'build-fix' into 'master'
build: Collect gi-docgen's common arguments

See merge request GNOME/gtk!4108
2021-11-01 13:27:13 +00:00
Emmanuele Bassi
142571d0b8 build: Collect gi-docgen's common arguments
And only enable `--fatal-warnings` if `-Dwerror` has been set, just like
we do for the introspection data generation.
2021-11-01 13:00:51 +00:00
Emmanuele Bassi
5cc6b3e342 docs: Add missing annotation 2021-11-01 12:54:35 +00:00
Emmanuele Bassi
49032b4b63 docs: Fix link to g_signal_emit() 2021-11-01 12:54:07 +00:00
Timm Bäder
1903c6d009 Merge branch 'fix_typo' into 'master'
fix typo in GtkDragSource doc

See merge request GNOME/gtk!4107
2021-11-01 06:42:54 +00:00
Alexandros Theodotou
266fceddf0 fix typo in GtkDragSource doc
GtkDrag => GdkDrag
2021-11-01 03:48:52 +00:00
Rūdolfs Mazurs
973aa8583a Update Latvian translation
(cherry picked from commit d67982d5e0)
2021-10-31 14:59:55 +00:00
Timm Bäder
ca06aeeb2d Merge branch 'bilelmoussaoui/gi-docgen' into 'master'
gtk: fix broken gi-docgen annotation in IconView

See merge request GNOME/gtk!4106
2021-10-30 10:06:35 +00:00
Bilal Elmoussaoui
d1e246c68d gtk: fix broken gi-docgen annotation in IconView 2021-10-30 09:37:12 +00:00
Matthias Clasen
bdea3ed979 4.5.0 2021-10-29 16:03:20 -04:00
Matthias Clasen
dd7cbb6bb5 Merge branch 'bilelmoussaoui/docs-typo' into 'master'
gtk: remove unneeded backtick from gi-docgen item

See merge request GNOME/gtk!4105
2021-10-29 19:53:34 +00:00
Bilal Elmoussaoui
13defc7ceb gtk: remove unneeded backtick from gi-docgen item 2021-10-29 18:32:06 +00:00
Matthias Clasen
61d9874ebc NEWS: Updates 2021-10-29 13:32:31 -04:00
Jordi Mas i Hernandez
207437a6ee Update Catalan translation
(cherry picked from commit ca02700a63)
2021-10-29 11:46:26 +00:00
Matthias Clasen
f7c39ae089 Merge branch 'ebassi/editor-config' into 'master'
Add editorconfig file

See merge request GNOME/gtk!4102
2021-10-28 18:28:47 +00:00
Emmanuele Bassi
f1fbd363f8 Add editorconfig file
Editors that support configuration through the editorconfig spec:

  https://editorconfig.org

should be able to have a subset of the GTK coding style and options
immediately available to them.

Plus, it's better than using relics from the Dark Ages, like modelines.
2021-10-28 18:17:02 +01:00
Carlos Garnacho
206d7635f7 Merge branch 'x11-xi2.4-gestures' into 'master'
Touchpad gestures for X11 (XInput 2.4, X Server 21.1)

See merge request GNOME/gtk!3610
2021-10-28 16:44:52 +00:00
Benjamin Otte
1fa350267f Merge branch 'wip/otte/for-master' into 'master'
cssparser: Remove unused argument

Closes #4381

See merge request GNOME/gtk!4101
2021-10-28 13:16:25 +00:00
Benjamin Otte
9962ef9ac4 broadway: fix texture upload
This was carelessly broken by me in 5b473911.

While fixing it anyway, at some support for better error handling.

Fixes #4381
2021-10-28 14:48:20 +02:00
Benjamin Otte
c97a758aa7 cssparser: Remove unused argument
The base_directory argument is never used. So don't have it.
2021-10-28 03:19:08 +02:00
Matthias Clasen
68eb601194 Merge branch 'gtkeventcontroller.c-fix' into 'master'
master: premature controller unreferencing in gtk_event_controller_handle_event

See merge request GNOME/gtk!4099
2021-10-27 23:50:13 +00:00
Matthias Clasen
cadeca27de Merge branch 'rgba-for-master' into 'master'
docs: standard names are CSS names, not X11 names

See merge request GNOME/gtk!4100
2021-10-27 23:27:42 +00:00
Maxim Zakharov
af2d0f188c gtk: Hold reference on controller until events are fully handled
Fixes premature controller unreferencing in
gtk_event_controller_handle_event() if the controller itself is being
removed while handling the event.
2021-10-28 10:23:32 +11:00
Benjamin Otte
c11a43418e docs: standard names are CSS names, not X11 names
We updated Pango a while ago to use these more common names, but apparently forgot the docs.
2021-10-27 22:12:58 +00:00
Matthias Clasen
d7d4cef66d Merge branch 'wip/chergert/use-fabs-in-macos' into 'master'
macos: fix scale on macOS 12 beta

See merge request GNOME/gtk!4065
2021-10-27 19:37:01 +00:00
Benjamin Otte
9b71bbac3a Merge branch 'wip/otte/for-master' into 'master'
gdktypes: Remove GDK_EXTERN_VAR

Closes #4373

See merge request GNOME/gtk!4097
2021-10-26 23:43:46 +00:00
Benjamin Otte
ac8c4245b2 css: Don't throw warnings on broken URL in image css
If a URL can't be loaded, we might end up with a NULL file. Handle that
case properly by creating an invalid image instead and don't crash or
complain to stderr when files are NULL.

This was broken since 0886ade182

A new reftest has been included. We need a reftest instead of a
CSS parser test, because the error only becomes visible when
compute()ing the actual image.

Fixes #4373
2021-10-26 23:52:38 +02:00
Benjamin Otte
d726ecdb5d gdk: Split enums from types
Add gdkenums.h for enums and keep gdktypes.h for types.

Makes both files easier to read.
2021-10-26 20:59:37 +02:00
Benjamin Otte
41919158cc gdktypes: Remove GDK_EXTERN_VAR
It is unused.
2021-10-26 20:42:22 +02:00
Matthias Clasen
4ea84d3144 Merge branch 'bilelmoussaoui/missing-since-annotations' into 'master'
since annotations cleanup

See merge request GNOME/gtk!4086
2021-10-26 17:53:06 +00:00
Benjamin Otte
3744cb24e2 Merge branch 'alatiera/gdk_create_context_nullable' into 'master'
gdkdisplay: Remove (nullable)

See merge request GNOME/gtk!4096
2021-10-25 17:42:00 +00:00
Rūdolfs Mazurs
a6cbeba5f6 Update Latvian translation
(cherry picked from commit 4f5264d1b7)
2021-10-25 17:00:11 +00:00
Jordan Petridis
4cda2aec57 gdkdisplay: Remove (nullable)
gdk_display_create_gl_context only returns NULL when there is
an error set or asserts/aborts. So nullalbe annotation isn't needed.

Similar to 53312cf696
2021-10-25 18:40:40 +03:00
Emmanuele Bassi
33470fd872 Merge branch 'enterprisey-master-patch-53741' into 'master'
readme: Fix "Building GTK" docs link

See merge request GNOME/gtk!4095
2021-10-25 08:22:44 +00:00
enterprisey
75bba2b055 readme: Fix "Building GTK" docs link 2021-10-25 07:59:03 +00:00
Matthias Clasen
c953e3cc0f Merge branch 'wip/exalm/polish' into 'master'
A few inspector papercut fixes

See merge request GNOME/gtk!4092
2021-10-24 19:04:48 +00:00
Alexander Mikhaylenko
83319a3ea6 inspector: Expand the controllers column view 2021-10-24 22:27:50 +05:00
Alexander Mikhaylenko
516dc79605 inspector: Use .list for property list as well 2021-10-24 22:27:50 +05:00
Alexander Mikhaylenko
2aa2b7f61e inspector: Clean up the .list style
Make it work with the property list as well, handle spinbuttons, adjust
paddings so that buttons don't touch each other, don't override horizontal
padding unnecessarily.
2021-10-24 22:27:24 +05:00
Alexander Mikhaylenko
0053160f28 inspector: Stop using .sidebar for the recorder page
Those aren't sidebars. Add separators manually instead of misusing the
style class.
2021-10-24 04:01:35 +05:00
Alexander Mikhaylenko
2ac8132499 inspector: Use consistent GtkTextView margins 2021-10-24 03:58:21 +05:00
Alexander Mikhaylenko
7aa34cb3d2 inspector: Add a separator under toolbar in css editor
Same as object properties.
2021-10-24 03:55:26 +05:00
Alexander Mikhaylenko
3aee23c172 inspector: Use tabular figures for list position label
Avoid buttons jumping around while moving through list models.
2021-10-24 03:37:01 +05:00
Alexander Mikhaylenko
bec9141233 inspector: Use .toolbar for toolbars
Remove all of the manual margins, spacing and has-frame=0, be more
consistent.
2021-10-24 03:37:01 +05:00
Alexander Mikhaylenko
131683fdcf inspector: Use a GtkSeparator for the object details toolbar
Remove a hardcoded light grey border from the sidebar that was used for
this.
2021-10-24 02:53:22 +05:00
Alexander Mikhaylenko
8176b0c2fc inspector: Remove list header style
The one from the theme works just fine.
2021-10-24 02:51:07 +05:00
Piotr Drąg
513fe87391 Update POTFILES.skip 2021-10-23 13:08:47 +02:00
Benjamin Otte
a07e1bf336 Merge branch 'wip/otte/for-master' into 'master'
Fix a bunch of issues found by static analyzer

See merge request GNOME/gtk!4090
2021-10-23 00:00:32 +00:00
Benjamin Otte
ae117d0cfa png: allocate data before sigsetjmp()
Makes the static analyzer not trip up when trying to analyze memory
leaks.
2021-10-23 00:03:51 +02:00
Benjamin Otte
a4e83ec584 demos: Remove unused code 2021-10-23 00:03:51 +02:00
Benjamin Otte
373ca2389a glx: Remove unused assignment 2021-10-22 23:50:45 +02:00
Benjamin Otte
b2f9a907ce tiff: Fix variable assignment 2021-10-22 23:50:45 +02:00
Benjamin Otte
2b2fd23815 Merge branch 'wip/otte/center-center-center' into 'master'
Add a bunch of reftests and fix their failures

Closes #4285

See merge request GNOME/gtk!4085
2021-10-22 16:35:41 +00:00
Benjamin Otte
2113a18a18 testsuite: Add lots of reftests for picture sizing
Have square images in the following sizes:
  * 20
  * 100
  * 150
  * 200
  * 300
and place them in a can-shrink Picture allocated at the sizes:
  * 200x100
  * 100x200
and set align to center/center.

That's 10 combinations and they should all do the right thing.
2021-10-22 17:51:41 +02:00
Benjamin Otte
1606a41116 widget: adjust allocation even better
This fixes fallout from 3742fabae0 where
we would no longer allocate widgets to their natural size when
align flags where used.

GtkPicture wants to be allocated at 100% in that case, so a picture with
a 100x100 image inside a 200x200 window should be allocated 100x100.

The new adjustment code now does the following (for width-for-height
instead of height-for-width, swap width and height in the following):

1. query the minimum width for the allocated height
2. query the natural width
3. compute the maximum of (1) and (2)
4. set the widget width to the minimum of (3) and the allocated
   width.
5. compute the natural height for (4)
6. set the widget height to the minimum of (5) and the allocated height.
2021-10-22 17:51:40 +02:00
Benjamin Otte
438bf8596e reftests: Don't crash if no node
If we have no node, don't crash when trying to save the node file.

Instead, write an empty file.
2021-10-22 17:51:40 +02:00
Benjamin Otte
b912e84df7 gl: Call make_current() before doing any GL work
But don't call it too early, we only want to call it once we have
prepared the target.

This way, we guarantee that a GL context is always available and that it
is bound to the correct target.
2021-10-22 17:51:40 +02:00
Benjamin Otte
3c9c7a0e72 build: Make sure ifuncs exist when using fp16
Fixes msys compiles on Windows (and everywhere else hopefully).

Fixes #4285
2021-10-22 17:50:42 +02:00
Emmanuele Bassi
82c0654f76 Merge branch 'fix-mac-kana-eisu' into 'master'
Correct translation of Mac JIS Eisu & Kana keys

Closes #4117

See merge request GNOME/gtk!3782
2021-10-22 15:05:29 +00:00
Bilal Elmoussaoui
cb3eae1042 g-i: add missing since 4.6 annotations 2021-10-21 15:34:39 +01:00
Bilal Elmoussaoui
3dcda782ce gdk: fix MemoryFormat since annotations 2021-10-21 15:34:39 +01:00
muzena
1d387b5d45 Update Croatian language 2021-10-21 13:05:28 +02:00
Matthias Clasen
74329abf29 Merge branch 'wip/otte/for-master' into 'master'
Better errors ftw!

See merge request GNOME/gtk!4084
2021-10-21 00:00:29 +00:00
Matthias Clasen
0afae65c8a Merge branch 'subpop/docs-getting-started-hello-world' into 'master'
Match hello world code to description

Closes #4358

See merge request GNOME/gtk!4081
2021-10-20 22:55:42 +00:00
Benjamin Otte
350a5edb87 css: Emit a special error for a common error
This CSS:
  calc(5px+3px)
is wrong because it gets broken to:
  calc(  5px  +3px  )
which is 2 numbers inside the calc, and what you want is:
  calc(  5px  +  3px  )
but you need to add a space to get this, like so:
  calc(5px + 3px)
which is the recommended way to write calc() statements.

So whenever we encounter an error, check if the next token is a signed
number and if so, include it in the error message.
2021-10-21 00:16:20 +02:00
Benjamin Otte
c11bd57422 css: Split dimension token
Add a signed and an unsigned version.

This will become useful real soon.
2021-10-21 00:16:20 +02:00
Benjamin Otte
883b2223c1 Merge branch 'wip/otte/display-gl' into 'master'
Add gdk_display_create_gl_context()

See merge request GNOME/gtk!4083
2021-10-20 22:14:58 +00:00
Benjamin Otte
0898023e6b testsuite: Create GL renderers without surfaces 2021-10-20 21:49:32 +02:00
Benjamin Otte
869d2f281a node-editor: Create renderers surfaceless 2021-10-20 21:49:32 +02:00
Benjamin Otte
cb03fe8f31 gsk: Allow gsk_renderer_realize (renderer, NULL, NULL)
That way, we can use renderers without surfaces.
2021-10-20 21:49:32 +02:00
Benjamin Otte
ea14e94eaf drawcontext: Guard begin/end_frame() against non-surface contexts
This can happen now with gdk_display_create_gl_context().
2021-10-20 20:31:33 +02:00
Benjamin Otte
2601c39cb2 API: Add gdk_display_create_gl_context()
This is an alternative to gdk_surface_create_gl_context() when the
context is meant to only draw to textures.

This is useful in the testsuite or in GStreamer or with GLArea,
basically whenever we want to do GL stuff but don't need to actually
draw anything on screen.

A bunch of code will need to be updated to deal with context->surface
being NULL.
2021-10-20 20:31:33 +02:00
Benjamin Otte
53312cf696 surface: Remove (nullable)
The function only returns NULL on error, and such a function is not
considered nullable.
2021-10-20 20:02:26 +02:00
Link Dupont
9e0494cf4d docs: match hello world code to description
Add the creation of a GtkBox to the hello-world sample code.

Fixes: #4358
2021-10-19 22:40:20 -04:00
Matthias Clasen
3d536f1293 Merge branch 'appdata-build-date' into 'master'
Drop date attribute from our appdata files

See merge request GNOME/gtk!4079
2021-10-19 13:00:20 +00:00
Bernhard M. Wiedemann
d6f4a0d2cf Drop date attribute from our appdata files
in order to make builds reproducible.
See https://reproducible-builds.org/ for why this is good

This was suggested by Matthias Clasen as an alternative to MR !3929
2021-10-19 07:37:59 -04:00
Matthias Clasen
14e6d9555d Merge branch 'setlocale-gapplication-help' into 'master'
GtkApplication: Call setlocale early

Closes #4234

See merge request GNOME/gtk!3928
2021-10-19 02:48:41 +00:00
Matthias Clasen
8b02e87529 Merge branch 'gdkdisplay-c-stdlib-h' into 'master'
gdkdisplay.c: Include stdlib.h

See merge request GNOME/gtk!4041
2021-10-19 02:46:48 +00:00
Matthias Clasen
f04e10238b Merge branch 'wip/hadess/quiet-broadway' into 'master'
broadway: Quiet initialisation failures

See merge request GNOME/gtk!4053
2021-10-19 02:45:42 +00:00
Matthias Clasen
e946ee4040 Merge branch 'file-list-get' into 'master'
Add getter to GdkFileList

See merge request GNOME/gtk!4047
2021-10-19 02:44:19 +00:00
Matthias Clasen
46ba4b9d8c Merge branch 'fix-win11-sdk' into 'master'
Fix building against the Windows 11 SDK (GTK master/4.x)

See merge request GNOME/gtk!4063
2021-10-19 02:42:15 +00:00
Matthias Clasen
464f76ce5d Merge branch 'line-height-percentage' into 'master'
css: Fix handling of percentage for line-height

Closes #3254 and #4354

See merge request GNOME/gtk!4075
2021-10-19 02:41:09 +00:00
Matthias Clasen
9965f26d97 Merge branch 'wip/exalm/levelbar' into 'master'
levelbar: Fill the whole space for discrete level bars

See merge request GNOME/gtk!4042
2021-10-19 02:40:26 +00:00
Benjamin Otte
bf5350e13c Merge branch 'label-sizing' into 'master'
Make label-sizing reftest pass

See merge request GNOME/gtk!4076
2021-10-19 00:19:52 +00:00
Benjamin Otte
3742fabae0 widget: Don't overadjust allocations
When adjusting allocations, don't query height for the current width,
but query it for the adjusted width.

And adjust width not to the width-for-any-height, but to
width-for-allocated-height.
2021-10-19 01:55:59 +02:00
Benjamin Otte
192e554f3e testsuite: don't XFAIL label-sizing anymore
It's fixed now.
2021-10-19 01:10:59 +02:00
Benjamin Otte
00214cbb4a testsuite: Add test specifically for recent fix
label-sizing.ui tests this, too - but that test tests lots of other
things, and if this ever happens again, we want to debug it in a small
test.
2021-10-19 01:10:59 +02:00
Benjamin Otte
ba44e7a228 label: Never measure more than max-width-chars
Even when we have tons of width available, still do the wrapping at
max-width-chars.

This is what happened in GTK3, too, but it happened automatically
because GTK3 did for_size = MIN (for_size, nat_size) and GTK4 does not.

So we do this manually in the label now.

Fixes the label-sizing.ui reftest.
2021-10-19 01:04:25 +02:00
Benjamin Otte
cad979b734 reftest: On failure, save the node files, too
Doesn't hurt to have them available, so it's easy to figure out if a
failure is due to the renderer or if we're generating wrong node files.
2021-10-19 01:01:36 +02:00
Alexander Mikhaylenko
1c5a4de176 levelbar: Fill the whole space for discrete level bars
Ideally this would be using box layout, but it overrides measure() so it's
not possible - so reimplement it instead. Fix an accidentally int division
along the way.
2021-10-19 02:13:49 +05:00
Emmanuele Bassi
ad46e65dff Merge branch 'wip/cdavis/flowbox-add-functions' into 'master'
gtkflowbox: Add prepend() and append()

Closes #4277

See merge request GNOME/gtk!4013
2021-10-18 21:09:10 +00:00
Matthias Clasen
5dec1b0cc0 Merge branch 'wip/baedert/for-master' into 'master'
Some fixes, hmm yes

See merge request GNOME/gtk!4068
2021-10-18 20:58:46 +00:00
Matthias Clasen
c80e877c28 css: Fix handling of percentage for line-height
We weren't doing the right thing here.
This is simpler, and works.

Fixes: #4354
2021-10-18 16:53:46 -04:00
Matthias Clasen
5ff9f4a435 Merge branch 'matthiasc/for-master' into 'master'
Small fixes

Closes #4248

See merge request GNOME/gtk!4072
2021-10-18 18:00:33 +00:00
Matthias Clasen
bd1649e5f4 Merge branch 'feature/calendar-first-day' into 'master'
calendar: Fix abbreviated day names

Closes #4338

See merge request GNOME/gtk!4061
2021-10-18 15:08:35 +00:00
Matthias Clasen
b7cab5c5eb ci: Allow macos to fail
The macos runner is out of commission atm
2021-10-18 11:00:27 -04:00
Jonas Ådahl
6067a556d7 Merge branch 'work/reset_opaque' into 'master'
wayland: Mark opaque_region as dirty on hide

See merge request GNOME/gtk!4020
2021-10-18 13:45:32 +00:00
Jonas Ådahl
6a07a853b0 Merge branch 'work/tidy' into 'master'
wayland: miscellaneous minor tidy ups

See merge request GNOME/gtk!4066
2021-10-18 13:44:52 +00:00
Benjamin Otte
886f435fc8 Merge branch 'wip/otte/for-master' into 'master'
glcontext: reinstate another missing "!"

See merge request GNOME/gtk!4070
2021-10-18 13:32:02 +00:00
Matthias Clasen
96e837ae9f Improve a msgid
Instead of gl-context, say "GL Context".

Fixes: #4248
2021-10-18 08:35:54 -04:00
Matthias Clasen
bddf9f9ca3 docs: Cosmetics
Do a round of "the the" removal.
2021-10-18 08:35:54 -04:00
Matthias Clasen
5f3062aff0 docs: Cosmetics 2021-10-18 08:35:54 -04:00
Benjamin Otte
a859471960 testsuite: Add workarounds for non-gl backends
read: Fix tests for broadway
2021-10-18 14:17:11 +02:00
Benjamin Otte
5b47391162 broadway: Use gdk_texture_save_to_png_bytes()
Instead of using Cairo, save the texture directly.
2021-10-18 12:08:57 +02:00
Benjamin Otte
dcba783389 gdk: Rework gdk_pixbuf_get_from_texture()
Make it use gdk_memory_texture_from_texture().

Also make gdk_memory_format_alpha() privately available so that we can
detect if an image contains an alpha channel.
2021-10-18 12:08:57 +02:00
Benjamin Otte
7eceed8d4d jpeg: Use gdk_memory_texture_from_texture() 2021-10-18 12:08:57 +02:00
Benjamin Otte
800246402f tiff: Refactor
Now we support all the formats.
2021-10-18 12:08:57 +02:00
Benjamin Otte
c7e36bcf22 gltexture: Fix conditions for glGetTexImage() call
The conditions were inverted, plus we failed to limit this call to
non-GLES.
2021-10-17 22:28:44 +02:00
Benjamin Otte
79d2a14061 glcontext: reinstate another missing "!"
A leftover from aa0c22b648.
2021-10-17 22:28:44 +02:00
Timm Bäder
085f0171c1 Ensure blur nodes have a positive blur radius 2021-10-17 12:15:34 +02:00
Timm Bäder
e7ac8275ea main: Flip set_widget_active_state() logic
The function used to take a boolean, just to set the active state of the
widget to the exact opposite of that boolean. Fix that.
2021-10-17 11:21:00 +02:00
Timm Bäder
03d4ac1863 theme: enable tabular numbers in GtkCalendar
It aligns numbers a lot so this makes sense.
2021-10-17 11:12:14 +02:00
Timm Bäder
a61999170e fontrendering: Protect against NULL hints 2021-10-17 11:12:14 +02:00
Timm Bäder
beda50f631 cssparser: Make a signed expression unsigned 2021-10-17 11:12:14 +02:00
Benjamin Otte
cf7ee82755 Merge branch 'fix-dnd-coordinates-on-windows' into 'master'
Fix DND coordinates on Windows

See merge request GNOME/gtk!3930
2021-10-16 17:04:26 +00:00
Benjamin Otte
f6e5a33952 Merge branch 'wip/otte/for-master' into 'master'
glcontext: Reinstate missing "!"

Closes #4349

See merge request GNOME/gtk!4067
2021-10-16 14:11:00 +00:00
Benjamin Otte
7a50ebaa3f gdk: Move GdkMemoryFormat enum to gdktypes.h
It's used in too many places now.
2021-10-16 15:49:37 +02:00
Benjamin Otte
aa0c22b648 glcontext: Reinstate missing "!"
Replacing the return_if_fail()s in commit f584d4f500 lost the
inversions.

Fixes #4349
2021-10-16 15:49:02 +02:00
David Edmundson
aa258fa17f wayland: port code to g_clear_pointer 2021-10-15 12:03:57 +01:00
David Edmundson
66de8f33fb wayland: drop unused member variables 2021-10-15 11:53:18 +01:00
Christian Hergert
e3ef21f770 macos: fix scale on macOS 12 beta
This is a port of the fix in the quartz backend to the new macOS backend.

From the original commit:

In macOS-12.sdk CGContextConverSizeToDeviceSpace returns a negative
height and passing that to CGContextScaleCTM in turn causes the cairo
surface to draw outside the window where it can't be seen. Passing the
absolute values of the scale factors fixes the display on macOS 12 without
affecting earlier macOS versions.
2021-10-14 14:46:30 -07:00
Benjamin Otte
a7ef4c75ea Merge branch 'wip/otte/memoryformat' into 'master'
Refactor various texture machinery

See merge request GNOME/gtk!4057
2021-10-13 12:51:37 +00:00
Benjamin Otte
9a2e9c5be4 gl: Use gdk_memory_texture_new_from_texture()
Way less code to prepare the texture in a proper format.
2021-10-13 14:33:44 +02:00
Benjamin Otte
ddc4a40c33 gl: Refactor texture uploading
Don't pass texture + rect, but instead have
  gdk_memory_texture_new_subtexture()
and use it to generate subtextures and pass them.

This has the advantage of downloading the a too large texture only once
instead of N times.
2021-10-13 14:33:44 +02:00
Benjamin Otte
52e88ed4c8 gltexture: Determine format in current thread
Close widget-factory and observe:

Thread 1:
 * acquire main loop
 * handle close button
 * close window
 * dispose video and media stream
 * stop GstPlayer
WAIT on pipeline stopping

Thread 2:
 * prepare next image in pipeline
 * hand image to GtkGstSink
 * create GdkTexture from image
 * gdk_gl_texture_new() determines format
WAIT on acquiring main loop

Sounds like a deadlock?

Indeed, so don't do that.
2021-10-13 14:33:44 +02:00
Benjamin Otte
5199bebdb5 gl: Move texture uploading to the renderer
It does not belong in GdkGLContext, it's a renderer thing.
It's also the only user of that API.

Introduce gdk_gl_context_check_version() private API to make version
checks simpler.
2021-10-13 14:33:44 +02:00
Benjamin Otte
31e9072906 gl: Fix downloading textures *again*
It turns out glReadPixels() cannot convert pixels and you are only
allowed to pass a single value into the function arguments. You need to
know which ones or things will explode.

GL is great.
2021-10-13 14:33:44 +02:00
Benjamin Otte
c2368cc605 png: Refactor png saving
Do all the memory format shenanigans in GTK now and support all the PNG
formats.
2021-10-13 14:33:44 +02:00
Benjamin Otte
1e7fb52b21 Add memory formats used by libpng
Add unpremultiplied high-depth formats. They are used in the real world,
so let's support them.
2021-10-13 14:33:44 +02:00
Chun-wei Fan
53705a537c tools/generate-uac-manifest.py: Fix UAC manifest .rc
The resource compiler in the Windows 11 SDK does not allow one to include
winuser.h directly in resource scripts (.rc) with a rather cryptic error
message, so fix generating the .rc file to embed the UAC manifest by including
windows.h with WIN32_LEAN_AND_MEAN instead.
2021-10-13 12:21:10 +08:00
Chun-wei Fan
3481ebdafb gtk: Fix version resource on for Windows 11 SDK
The rc.exe that comes with the Windows 11 SDK does not allow one to include
winuser.h directly in the .rc scripts, so make sure that it is not included
by gtk-win32.rc.body.in, but instead include windows.h with WIN32_LEAN_AND_MEAN
defined.
2021-10-13 12:21:10 +08:00
Sveinn í Felli
71eece2f35 Update Icelandic translation
(cherry picked from commit 83b3c7d826)
2021-10-12 22:48:16 +00:00
Christopher Davis
454ca897bb gtkflowbox: Add prepend() and append()
These functions are common across container implementations,
but GtkFlowBox was missing them.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/4277
2021-10-12 11:07:17 -07:00
Niels De Graef
41ca09d645 calendar: Add an explanatory comment
On the magic numbers used to get the abbreviated day names.
2021-10-12 19:37:13 +02:00
Rafael Fontenelle
24b7eec687 Update Brazilian Portuguese translation
(cherry picked from commit 4b9260608a)
2021-10-12 17:34:01 +00:00
Niels De Graef
dcbfd61558 calendar: Fix abbreviated day names
... if the current locale has a different starting day than Sunday.

This needed 2 fixes:
* We need to take into account `calendar->week_start` when
  creating/adding the appropriate `day_name_labels` field
* we were only calculating `calendar->week_start` _after_ attaching the
  `day_name_labels`, so it was still set to 0 (the default value).

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/4338
2021-10-12 19:29:26 +02:00
Emmanuele Bassi
e98b83dade Merge branch 'bilelmoussaoui/gtk-snapshot' into 'master'
gtk: fix Snapshot.push_shadow annotation

See merge request GNOME/gtk!4060
2021-10-12 11:09:13 +00:00
Bilal Elmoussaoui
257adb4464 gtk: fix Snapshot.push_shadow annotation 2021-10-12 09:00:03 +00:00
Benjamin Otte
7b41738979 png: Do loader conversions in GDK
Not inside libpng.

We really want to do them in GL, but we don't have a premultiply step
yet.
2021-10-12 02:06:44 +02:00
Benjamin Otte
b65b64628d texture: Refactor downloading
Pass a format do GdkTextureClass::download(). That way we can download
data in any format.

Also replace gdk_texture_download_texture() with
gdk_memory_texture_from_texture() which again takes a format.

The old functionality is still there for code that wants it: Just pass
gdk_texture_get_format (texture) as the format argument.
2021-10-12 02:06:43 +02:00
Emmanuele Bassi
086a3044e3 Add getter to GdkFileList
Language bindings don't really have any mean of accessing the list of
files for GdkFileList.
2021-10-11 21:40:29 +01:00
Bastien Nocera
fc32c19ca7 broadway: Quiet initialisation failures
Broadway is the only GTK+ backend that throws an error on stderr for a
"display server" connection failure.

This causes problems when gtk_init_check() is used and unexpected error
output is generated such as with hotdoc, which fails when generating a
GTK plugin's documentation instead of overlooking the issue.

"Unable to init server: Could not connect: Connection refused"
2021-10-11 20:36:53 +02:00
Benjamin Otte
d89e82d4a0 Merge branch 'wip/otte/for-master' into 'master'
x11: Don't try to move destroyed windows

See merge request GNOME/gtk!4054
2021-10-11 18:36:20 +00:00
Benjamin Otte
f40ce51a13 x11: Don't try to move destroyed windows
Fixes BadWindow crashes when the resize happen right when tooltips or
other such transient popups were in the process of being destroyed.
2021-10-11 19:28:59 +02:00
Bastien Nocera
e6ae3b8a2b broadway: Quiet initialisation failures
Broadway is the only GTK+ backend that throws an error on stderr when
failing to initialise, which causes problems when gtk_init_check() is
used and unexpected error output is generated.

This causes hotdoc to fail when generating a GTK plugin's documentation
instead of failing quietly.

"Unable to init server: Could not connect: Connection refused"
2021-10-11 14:01:20 +02:00
David Edmundson
dc503897b1 wayland: Mark opaque_region as dirty on hide
Otherwise if we hide and show a window we recreate a new surface,
breaking the compositor's association, but potentially not resend this
data for the new surface.
This matches what we do for input_region.
2021-10-11 12:34:53 +01:00
Matthias Clasen
49a64da7ec Merge branch 'ngl-is-the-new-gl' into 'master'
Rename ngl to gl

Closes #4318

See merge request GNOME/gtk!4037
2021-10-11 06:43:41 +00:00
Matthias Clasen
922e6add38 Merge branch 'docs-window-position' into 'master'
docs: Mention gtk_window_set_position() being gone

See merge request GNOME/gtk!4048
2021-10-11 06:36:23 +00:00
Emmanuele Bassi
232003b046 Merge branch 'docs-urlmap' into 'master'
docs: Add GdkPixbuf to the URL map

See merge request GNOME/gtk!4051
2021-10-10 23:01:39 +00:00
John Ralls
cfadca696b [gtkimcontextquartz] Accommodate moving GdkSurface widget to private.
Fixes macOS build.
2021-10-10 13:16:49 -07:00
Benjamin Otte
5311616ca1 Merge branch 'wip/otte/gles' into 'master'
Improve GLES

See merge request GNOME/gtk!4050
2021-10-09 11:59:42 +00:00
Emmanuele Bassi
c7bb4a9678 docs: Add GdkPixbuf to the URL map
Allow cross-linking to the GdkPixbuf reference.
2021-10-09 10:55:24 +01:00
Benjamin Otte
e581c148d9 testsuite: Add run for GLES
This is supposed to test the most fallback GL stuff, so we might want to
set even more env vars here.

Also enable the run for the Fedora builder in CI.
2021-10-09 06:27:21 +02:00
Benjamin Otte
d4959a95c2 gl: Make sure to set a proper alignment
No matter which branch we take, the alignment setting is always the
same.
2021-10-09 05:25:41 +02:00
Benjamin Otte
780ae5232d gl: Check the stride is a multiple of the bpp 2021-10-09 05:25:41 +02:00
Benjamin Otte
caddea4624 gl: Set stride properly in fallback 2021-10-09 04:44:30 +02:00
Benjamin Otte
27b5dc1452 gl: Fix broken internal format 2021-10-09 04:44:30 +02:00
Benjamin Otte
b4ab9f7b8c testsuite: Add a test targeting GL upload code
Previously, all the tests used the icon upload path using
glTexSubImage2D().

This test uses the custom texture path using glTexImage2D().
2021-10-09 04:44:30 +02:00
Benjamin Otte
e371bd09c1 ngl: Use the right value
It's GL_RGBA, not GL_BGRA, or GLES will complain.
2021-10-09 04:44:30 +02:00
Asier Sarasua Garmendia
db167e09c5 Update Basque translation
(cherry picked from commit 2492729238)
2021-10-08 17:44:35 +00:00
Benjamin Otte
27573d9576 Merge branch 'wip/otte/glcontext' into 'master'
glcontext: Make GLES vs GL configuration clearer

Closes #4221

See merge request GNOME/gtk!4044
2021-10-08 15:57:08 +00:00
Emmanuele Bassi
0054f8bd74 docs: Mention gtk_window_set_position() being gone
People search for it in the migration guide much more than other
GdkSurface and GtkWindow methods.
2021-10-08 12:27:24 +01:00
Benjamin Otte
5c1e402429 Merge branch 'wip/otte/for-master' into 'master'
Fix GLES fallout from recent NGL updates

See merge request GNOME/gtk!4046
2021-10-08 09:11:03 +00:00
Benjamin Otte
e974a0412f glcontext: Add gdk_gl_context_get_api()
This is mostly for inspector.

Not sure if we also want to deprecate gdk_gl_context_get_use_es() in
favor of this function.
2021-10-08 03:31:07 +02:00
Benjamin Otte
76420d7146 ngl: Fix glTexImage2D() usage on GLES
GLES is very adamant about the format and type matching the internal
format, even if the data is NULL.
2021-10-08 03:31:07 +02:00
Benjamin Otte
f584d4f500 gl: Check allowed APIs in realize()
Add gdk_gl_context_is_api_allowed() for backends and make them use it.

Finally, have them return the final API as the return value (or 0 on
error).

And then use that api instead of a use_es boolean flag.

Fixes #4221
2021-10-08 03:31:07 +02:00
Benjamin Otte
8c1f7f7531 glcontext: Deprecate gdk_gl_context_set_use_es()
Make it call gdk_gl_context_set_allowed_apis().

Also port callers to use this function.
2021-10-08 03:31:07 +02:00
Benjamin Otte
c6dd3c11fa glcontext: Add GdkGLContext::allowed-apis
This allows specifying the GL APIs in a more comprehensive way than
gdk_gl_context_set_use_es().
2021-10-08 03:31:07 +02:00
Benjamin Otte
3b9967db48 ngl: Compute correct renderformat
We want to round up, not down.
2021-10-08 03:31:06 +02:00
Benjamin Otte
4f53645e5d ngl: fbo 0 has no color attachment
Query the backbuffer instead.
2021-10-08 03:31:06 +02:00
Matthias Clasen
b7eb1d3310 gsk: provide an ngl renderer
Provide a minimal renderer implementation that fails
in realize. This avoids reusing the same type, which
might give bindings trouble.
2021-10-07 16:46:29 -04:00
Benjamin Otte
222d927e93 Merge branch 'wip/otte/for-master' into 'master'
css: Render the background-clip area, not the background-origin

Closes #4324

See merge request GNOME/gtk!4043
2021-10-07 19:11:28 +00:00
Benjamin Otte
30164d5b46 css: Render the background-clip area, not the background-origin
Testcase included

Fixes #4324
2021-10-07 19:59:44 +02:00
Matthias Clasen
f868c67429 Skip gsk_ngl type funcs
The only type we have with this prefix is the
deprecated duplicate of gsk_gl_renderer_get_type(),
and including it causes some tests to break.
So skip it.
2021-10-07 13:05:53 -04:00
Matthias Clasen
7a1644bc97 Maintain abi
Keep gsk_ngl_renderer_new and gsk_ngl_renderer_get_type,
since they were part of the abi in 4.2, and in an
installed header.

Fixes: #4318
2021-10-07 13:05:53 -04:00
Matthias Clasen
144f727d5a Rename ngl to gl
We have only one gl renderer now, and it is
a bit odd for it not be called gl.
2021-10-07 13:05:53 -04:00
Matthias Clasen
9f1e9b6044 Merge branch 'wip/cdavis/menu-item-markup' into 'master'
Add support for pango markup in menu items

Closes #4306

See merge request GNOME/gtk!4039
2021-10-07 12:32:46 +00:00
Chun-wei Fan
70a622ce54 gdkdisplay.c: Include stdlib.h
It is needed for qsort().
2021-10-07 18:00:51 +08:00
Christopher Davis
0775e21131 Add support for pango markup in menu items
Before c4a2234a28
menu models could use markup for items and the markup would
be parsed, but this was not intended behavior.

This commit adds official support for using markup
for menu items via the `use-markup` property.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/4306
2021-10-07 02:49:11 -07:00
Matthias Clasen
db37452787 Merge branch 'fix-filechooser-portal-crash' into 'master'
filechooserportal: Take a ref on transient-for

Closes #4314

See merge request GNOME/gtk!4038
2021-10-07 05:05:49 +00:00
Matthias Clasen
c7d6bf733a filechooserportal: Take a ref on transient-for
This may fix a crash that has been reported in
file_chooser_portal_data_free.

Fixes: #4314
2021-10-06 22:37:45 -04:00
Matthias Clasen
8d9c3920bb Merge branch 'wip/matthiasc/gsk-hdr' into 'master'
texture: Add hdr api

See merge request GNOME/gtk!4036
2021-10-07 02:03:48 +00:00
Matthias Clasen
6f1742970d ngl: Make render_texture high depth aware
Make a deep texture, if the render nodes have
high depth content.

For now, we use 32F here for the deep format,
since using 16F causes small rounding errors
that break the memorytexture roundtrip tests.
2021-10-06 21:45:54 -04:00
Matthias Clasen
8a24deff97 ngl: Update framebuffer format for each frame
Look at whether the render nodes are high depth and
if so, request a high depth framebuffer.
Whether we actually get one is up to the backend.
2021-10-06 21:35:25 -04:00
Matthias Clasen
985d2d221c ngl: Determine intermediate formats
Look at the framebuffer and the rendernode to
determine what format to use for intermediate
textures.

Our preference here is to use fp16, if we have it
and it makes sense for the framebuffer we're given.
2021-10-06 21:35:25 -04:00
Matthias Clasen
9174814686 ngl: Allow specifying texture formats
Allow passing a format when creating textures or render targets.

Update all callers to pass GL_RGBA8, which is the format we
have always used so far.
2021-10-06 21:35:25 -04:00
Matthias Clasen
2a08641f59 gsk: Add high depth rendernode api
Add private api to find out if the content
of a render node should be considered 'deep'.

The information is collected at creation time,
so there is no tree-walking involved when we
are using this information in the renderer.

Currently, this comes down to whether there are
any texture nodes with high depth textures in the subtree.
In the future, we may want to allow marking gradient
nodes in this way as well.
2021-10-06 21:35:25 -04:00
Benjamin Otte
8950c0dc96 texture: Make format a property of GdkTexture
For MemoryTexture, this is a simple change.

For GLTexture, we need to query the format at texture creation. This
sounds like a bad idea and extra work until one realizes that we'd
need to do that anyway when using the texure the first time - either
when downloading, or when trying to use it in a rendernode, where we
will soon need that information to determine if the texture prefers high
depth.
2021-10-07 02:41:30 +02:00
Benjamin Otte
2e555db9a4 testsuite: Fail more accurately
Don't run the full test and then return "something failed" - instead
just explode when you find the failure.
2021-10-06 22:50:07 +02:00
Benjamin Otte
3f4fb93379 cairo: Use GdkTexture for converting from pixbuf 2021-10-06 22:50:07 +02:00
Benjamin Otte
dc6e831524 gdk: hdr => high depth
The term "hdr" is so overloaded, we shouldn't use them anywhere, except
from maybe describing all of this work in blog posts and other marketing
materials.

So do renames:
* hdr => high_depth
* request_hdr => prefers_high_depth

This more accurately describes what is going on.
2021-10-06 22:50:07 +02:00
Benjamin Otte
afa004fb8b memoryformat: Add gdk_memory_format_prefers_high_depth()
This is unused so far, but is part of preparations for high depth
support in renderers.
2021-10-06 22:50:07 +02:00
Benjamin Otte
149395c306 gl: Move memory <=> GL format mapping
Put it into gdkmemoryformat.c, where all the mapping goes.
2021-10-06 22:50:07 +02:00
Benjamin Otte
48781cf7f7 memorytexture: Split out GdkMemoryFormat handling
Also, now make gdk_memory_convert() the only conversion functions
and allow conversions between any 2 formats by going via a float[4].

This could be optimized via fast-paths, but so far it isn't.
2021-10-06 22:50:07 +02:00
Matthias Clasen
db86b3ea2e Merge branch 'wip/chergert/dropdown-show-arrow' into 'master'
dropdown: add GtkDropDown:show-arrow property

See merge request GNOME/gtk!4033
2021-10-06 19:19:10 +00:00
Christian Hergert
cd2debdfc6 dropdown: fix extraneous * in documentation 2021-10-06 09:56:11 -07:00
Christian Hergert
cd45e6edee dropdown: add GtkDropDown:show-arrow property
This allows hiding the arrow on the dropdown which cannot otherwise be
controlled via CSS.
2021-10-06 09:55:40 -07:00
Matthias Clasen
4360bc326a Merge branch 'matthiasc/for-master' into 'master'
gdk: Fix an oversight

See merge request GNOME/gtk!4035
2021-10-06 03:50:04 +00:00
Matthias Clasen
f819e88e9c gdk: Fix an oversight
The intention here was obviously to return
the hdr config.
2021-10-05 23:47:51 -04:00
Matthias Clasen
0969d9db83 Merge branch 'wip/otte/gl-hdr' into 'master'
Rework GL for HDR support

See merge request GNOME/gtk!4032
2021-10-06 02:59:05 +00:00
Benjamin Otte
cdc85232b2 egl: Implement HDR support
If EGL supports:
* no-config contexts
* >8bits pixel formats
* (optionally) floating point pixel formats

Then select such a profile as the HDR format and use it when HDR is
requested.
2021-10-06 03:44:59 +02:00
Benjamin Otte
5eb42dd9f3 gdk: Add GDK_DEBUG=hdr
Forces request_hdr = TRUE for all requests.

Backends should also use this when choosing whether to honor HDR
requests for low quality compositors - as long as the compositor
pretends to support HDR, shovel HDR at it.
2021-10-06 03:44:59 +02:00
Benjamin Otte
7ede468849 gdk: Add a request_hdr argument to begin_frame()
It's not used by anyone, it's just there.

gdk_draw_context_begin_frame_full() has been added so renderers can
make use of it.
2021-10-06 03:44:58 +02:00
Benjamin Otte
bc7c0d05f8 egl: Support EGL_KHR_no_config_context
If the extension is supported, we create configless contexts.

This will come in handy real soon now, we use different configs for HDR
and SDR.
2021-10-06 03:44:37 +02:00
Benjamin Otte
3ca84c4357 glcontext: Handle failure of eglBindAPI()
We don't want to be sure if we have GL or GLES.
2021-10-06 03:44:36 +02:00
Benjamin Otte
2ff1ea555f egl: Unify contexts
Unify the X11 and Wayland EGL contexts.

This is a bit ugly to implement, because I don't want to create an
interface and I can't make them inherit from the same object, because
one needs to inherit from X11GLContext and the other from
WaylandGLContext.

So we have to put the code in GdkGLContext and make sure non-EGL
contexts can't accidentally run it. This is rather easy because we can
just check for priv->egl_context != NULL.
2021-10-06 03:44:36 +02:00
Benjamin Otte
03cc603093 glcontext: Remove unused functionality
The recent changes made and unused function removals make these features
unused.
2021-10-06 03:44:36 +02:00
Benjamin Otte
64f10eff20 gdk: Remove unused gdk_gl_texture_quads() function
That function carried a lot of baggage.
2021-10-06 03:44:36 +02:00
Benjamin Otte
111c2769a5 cairo-gl: Don't leak framebuffers
The framebufffer was cached, but never deleted. And because this
function is deprecated and nobody should ever use it: Don't bother with
caching now.
2021-10-06 03:44:36 +02:00
Benjamin Otte
482845b027 wayland: Remove initial GL API bind
This is leftover from before the addition of GLES support.

GTK works fine without OpenGL and just OpenGLES.
2021-10-06 03:44:36 +02:00
Benjamin Otte
f8b9b309b0 egl: Move extension checks to GdkDisplay
We check the same extensions anyway, so no need to duplicate the code.
2021-10-06 03:44:36 +02:00
Benjamin Otte
d128ffcc14 egl: Move EGLSurface handling to GdkSurface
Calling gdk_surface_set_egl_native_window() enables this.
2021-10-06 03:44:35 +02:00
Benjamin Otte
aba37c40d3 display: Get carried away by extension checker
I wanted to make it easy to check for multiple extensions and then got
carried away by trying to generate beautiful error messages.
2021-10-06 03:43:47 +02:00
Benjamin Otte
c8204a902c surface: Add a private struct
Adding a random member to it resulted in a lot of header surgery as a
side effect.
2021-10-06 03:43:47 +02:00
Benjamin Otte
032eb15079 glcontext: The content cannot be the current context
The current context owns a reference to the context, so it cannot be
disposed.
2021-10-06 03:43:47 +02:00
Benjamin Otte
70607f56d9 x11: Port to shared EGL code 2021-10-06 03:43:47 +02:00
Benjamin Otte
bfb158d773 egl: Move initialization code and port Wayland
Moves the EGL initialization code to gdk/ so it can be shared between
backends.

Also port the Wayland backend to this code, so I know that it works.
2021-10-06 03:43:47 +02:00
Benjamin Otte
ae8de7168a build: Add a HAVE_EGL define to config.h 2021-10-06 03:43:47 +02:00
Matthias Clasen
9e88275de6 Merge branch 'matthiasc/for-master' into 'master'
inspector: Export gtk_inspector_init

See merge request GNOME/gtk!4034
2021-10-06 00:46:21 +00:00
Matthias Clasen
3f5107cea5 inspector: Export gtk_inspector_init
Quietly export this function mainly for the benefit
of libadwaita, which can can use this to install its
implementation of the gtk-inspector-page extension
point.
2021-10-05 20:10:34 -04:00
Benjamin Otte
04da2ff7c8 surface: Use g_clear_thing() 2021-10-05 04:48:15 +02:00
Benjamin Otte
9012a032c1 widget-factory: Name the images pages 2021-10-05 04:48:15 +02:00
Benjamin Otte
38461ee204 gdk: Make GDK_DEBUG GL backend selection global
We have a global GdkGLBackendType now, just set it.

This way, using the variable forces the backend type, and we don't need
special code handling the env vars in the backends.

It also means setting the env var will now "work" on GDK backends that
don't even support that GL backend and simualte another GDK backend
having registered that GL backend already. So you can run
  GDK_DEBUG=gl-wgl gtk4-demo
on test what Wayland will do when WGL is in use.
2021-10-05 04:48:15 +02:00
Benjamin Otte
75370a2fee pathbar: Use correct marshaler
Recent changes to types didn't update the marshaler. Oops.
2021-10-05 04:48:15 +02:00
Benjamin Otte
6ec6bcafbf win32: Remove unused variables 2021-10-05 04:48:15 +02:00
Dušan Kazik
e2fb67fdea Update Slovak translation
(cherry picked from commit 14f31183b8)
2021-10-04 13:20:33 +00:00
Matthias Clasen
bb5eb3ba55 Merge branch 'docs-label' into 'master'
Various documentation fixes

See merge request GNOME/gtk!4029
2021-10-04 12:25:41 +00:00
Emmanuele Bassi
c9ad181ca4 Merge branch 'filesearch' into 'master'
searchenginemodel: finalize search results

Closes #3546

See merge request GNOME/gtk!4028
2021-10-04 10:01:08 +00:00
Emmanuele Bassi
289394de30 docs: Replace gtk-doc internal link in GtkRequisition 2021-10-04 10:46:45 +01:00
Emmanuele Bassi
12d4a51679 docs: Remove gtk-doc link from GtkTreeView::row-activated 2021-10-04 10:45:34 +01:00
Emmanuele Bassi
9bd0674672 docs: Fix GtkCellLayout description
- Drop gtk-doc internal links
- Escape XML elements
2021-10-04 10:42:59 +01:00
Emmanuele Bassi
a9c1e1e468 docs: Remove gtk-doc links from GtkDrawingArea 2021-10-04 10:37:29 +01:00
Emmanuele Bassi
42ba6f0a34 docs: Fix up GtkTreeViewColumn
Remove the use of gtk-doc links.
2021-10-04 10:36:52 +01:00
Emmanuele Bassi
49603c24ad docs: Clean up GtkCellArea description
- Drop gtk-doc links
- Use gi-docgen links
- Use Markdown code blocks
- Fix code markers around types
2021-10-04 10:30:02 +01:00
Emmanuele Bassi
08aa77c243 docs: Fix GtkListStore description
- Escape XML elements
- Remove old gtk-doc links
- Add a few internal links
- Use Markdown code blocks
2021-10-04 10:16:26 +01:00
Emmanuele Bassi
4e6a76e11e docs: Fix internal links in for GtkLabel's text layout section 2021-10-04 10:15:51 +01:00
Pierre Ossman
34037c0550 searchenginemodel: finalize search results
It is necessary to signal the search engine that we are finished and
that we found something for it to reliably show the results. It would
sometimes work anyway since it is sufficient if any backend signals
completion. However if GtkSearchEngineModel was the only backend
returning results then things would break.
2021-10-04 09:23:39 +02:00
Matthias Clasen
bc086c5a2d Merge branch 'matthiasc/for-master' into 'master'
Add depfiles back to resource generation

See merge request GNOME/gtk!4027
2021-10-04 03:08:42 +00:00
Benjamin Otte
d939f379f4 win32: Comment out unused function 2021-10-04 04:26:49 +02:00
Matthias Clasen
8079f8ea3c Add depfiles back to resource generation
The recent change to faster resource generation
lost the depfiles to ensure that we regenerate
resources when any of the contents change.
Bring it back.
2021-10-03 22:23:56 -04:00
Matthias Clasen
f2dbf57104 Merge branch 'matthiasc/for-master' into 'master'
contentdeserializer: Plug a small memleak

See merge request GNOME/gtk!4026
2021-10-03 19:04:00 +00:00
Matthias Clasen
b8622adac5 contentdeserializer: Plug a small memleak
Found by asan in ci. We intern the mimetypes
when they are registered, so there is no need
to leak this string.
2021-10-03 14:52:09 -04:00
Matthias Clasen
b4bc7983a6 Merge branch 'matthiasc/for-master' into 'master'
ngl: Small docs updates

See merge request GNOME/gtk!4025
2021-10-03 18:33:12 +00:00
Matthias Clasen
f7df384ee1 ngl: Don't cache large glyphs forever
We never put large icons into the icon cache,
so all its items are always atlased, but we do
put large glyphs in to the glyph cache, and we
were never freeing those items, even when they
go unused. Fix that.
2021-10-03 13:43:15 -04:00
Matthias Clasen
095d531cc6 Merge branch 'matthiasc/for-master' into 'master'
ngl: Drop the texture pool object

See merge request GNOME/gtk!4024
2021-10-03 15:36:19 +00:00
Matthias Clasen
8c227622d7 ngl: Small docs updates
Don't refer to nonexisting functions.
2021-10-03 11:08:46 -04:00
Anders Jonsson
1ddcf7d5c5 Update Swedish translation 2021-10-03 14:16:58 +00:00
Matthias Clasen
c93264868b ngl: Plug a memory leak
When creating a GdkTexture from the texture
stored in the driver, we must free the GskNglTexture
struct.
2021-10-03 02:33:01 -04:00
Matthias Clasen
5bf1196bd4 ngl: Drop the texture pool object
This wasn't serving any clear purpose.
2021-10-03 02:32:40 -04:00
Matthias Clasen
139aa17af4 Merge branch 'matthiasc/for-master' into 'master'
Revert "Add GtkLoader to gtk4-widget-factory"

See merge request GNOME/gtk!4023
2021-10-03 05:59:28 +00:00
Matthias Clasen
bfcc2da2ce ngl: Cosmetics
Move _GskNglTextureState to the one place it is used.
2021-10-03 01:20:06 -04:00
Matthias Clasen
670659bcba Revert "Add GtkLoader to gtk4-widget-factory"
This reverts commit 923c944abb.

This commit broke the image dnd, and the async
loading isn't that important here.
2021-10-02 23:58:26 -04:00
Matthias Clasen
5f825eb68b Merge branch 'wip/baedert/for-master' into 'master'
build: Print toolchain in summary

See merge request GNOME/gtk!4022
2021-10-02 16:03:46 +00:00
Timm Bäder
1efccfcced gdk loaders: Add noreturn attribtues where appropriate 2021-10-02 09:08:14 +02:00
Timm Bäder
b7ad3bcf96 build: Print toolchain in summary
Would be nice to print CFLAGS and LDFLAGS as well, but that's not as
easy.
2021-10-02 09:08:14 +02:00
Matthias Clasen
08fd62e328 x11: Better debug for egl
Print the extensions one per line, and sort them
alphabetically, so it is actually possible to find
something in the list.

Also print a short description of the chosen config.
2021-10-01 22:23:08 -04:00
Matthias Clasen
63b73351ae Merge branch 'matthiasc/for-master' into 'master'
Fix the build

See merge request GNOME/gtk!4021
2021-10-02 02:16:42 +00:00
Matthias Clasen
a9f401a9a0 wayland: better debug for egl
Print the extensions one per line, and sort them
alphabetically, so it is actually possible to find
something in the list.

Also print a short description of the chosen config.
2021-10-01 20:55:05 -04:00
Matthias Clasen
e9828f1fcd Fix the build
I messed this up when I changed how we build resources.
2021-10-01 12:56:05 -04:00
Matthias Clasen
169effefc2 Merge branch 'ebassi/getting-started-links' into 'master'
docs: Fix links in the Getting Started page

See merge request GNOME/gtk!4018
2021-10-01 03:48:46 +00:00
Matthias Clasen
6339875989 Fix an oversight 2021-09-30 23:45:33 -04:00
Matthias Clasen
802ad39209 gtk: Speed up build
Avoid serializing the gresource blob into a C string
and running gcc over it. Instead, use ld to put it
directly into an .o file and add it to the build.

The build system machinations here were copied from
gobject/tests/meson.build, and should ideally be part
of the meson gnome module.
2021-09-30 23:30:48 -04:00
Matthias Clasen
200a2f5c71 gtk-demo: Speed up the build
Avoid serializing the gresource blob into a C string
and running gcc over it. Instead, use ld to put it
directly into an .o file and add it to the build.

The build system machinations here were copied from
gobject/tests/meson.build, and should ideally be part
of the meson gnome module.
2021-09-30 23:10:24 -04:00
Matthias Clasen
d7e117f52b widget-factory: Speed up build
Avoid serializing the gresource blob into a C string
and running gcc over it. Instead, use ld to put it
directly into an .o file and add it to the build.

The build system machinations here were copied from
gobject/tests/meson.build, and should ideally be part
of the meson gnome module.
2021-09-30 23:10:24 -04:00
Benjamin Otte
72bbc51ba9 Merge branch 'otte/for-master2' into 'master'
docs: Add note about stable sorting to SortListModel

See merge request GNOME/gtk!4017
2021-10-01 02:49:11 +00:00
Emmanuele Bassi
a816f81ecd docs: Fix links in the Getting Started page
We still have links to old gtk-doc references, as well as links to
developer.gnome.org locations that don't exist any more. On the other
hand, we are missing a bunch of links to existing types and symbols.
2021-10-01 01:44:01 +01:00
Benjamin Otte
5c3b368925 docs: Add note about stable sorting to SortListModel 2021-10-01 00:31:51 +00:00
Matthias Clasen
2a3a1aaf1e Merge branch 'fix-wgl-cairo-fallback' into 'master'
Apply MR !3964 to master (fix WGL->Cairo fallback-related items)

Closes #4257

See merge request GNOME/gtk!3987
2021-10-01 00:29:40 +00:00
Matthias Clasen
156650e90a Merge branch 'dab_fix_libtiff_install' into 'master'
libtiff: update meson patch to install the lib

See merge request GNOME/gtk!4014
2021-10-01 00:27:41 +00:00
Matthias Clasen
bf93537d54 Merge branch 'matthiasc/for-master' into 'master'
widget-factory: Use the same gtk-logo.webm

See merge request GNOME/gtk!4015
2021-10-01 00:27:16 +00:00
Matthias Clasen
f42c61f9d1 Merge branch 'wip/otte/for-master' into 'master'
testsuite: Actually run all memorytexture tests

See merge request GNOME/gtk!4016
2021-10-01 00:26:59 +00:00
Benjamin Otte
ce40c64f6b widget-factory: Copy alpha-corrected logo webm from gtk-demo
I want beautiful content please.

I'd also like to see when transparency suddenly starts working.
2021-10-01 01:18:45 +02:00
Matthias Clasen
f836d2f9f7 widget-factory: Use the same gtk-logo.webm
Use the same animated GTK logo as in gtk4-demo.
That version has a transparent background, so
it is preferrable.
2021-09-30 14:50:31 -04:00
Stéphane Cerveau
bdcfb760b5 libtiff: update meson patch to install the lib
see https://github.com/mesonbuild/wrapdb/pull/171
2021-09-30 15:59:17 +02:00
Daniel Șerbănescu
749883835a Update Romanian translation
(cherry picked from commit dc77823787)
2021-09-30 12:40:53 +00:00
Matthias Clasen
b4d91d5e31 Merge branch 'master-msvc-fixes' into 'master'
Fix GIT master build on Visual Studio 2015

See merge request GNOME/gtk!4010
2021-09-30 12:30:08 +00:00
Chun-wei Fan
dbd0ce30d9 meson: Improve search for libpng
On Visual Studio-style builds, it is likely that we do not have pkg-config
files for libpng, so improve the search for libpng by using CMake's built-in
mechanisms for looking for libpng.  This, however, means that we need to use
'png' rather than 'libpng' for the package name to search for.
2021-09-30 16:21:45 +08:00
Chun-wei Fan
a45e1a01fc fp16.c: Fix float_to_half() function call
Correct the function being called.
2021-09-30 16:21:38 +08:00
Chun-wei Fan
9bff56db9f GDK-Win32: Fix build
Include the appropriate headers as some function prototypes were moved lately.

Also, re-order the include order of the gdk/*private.h headers alphabetically
in the files that were updated.
2021-09-30 16:21:38 +08:00
Matthias Clasen
502b3ceaa2 Merge branch 'matthiasc/for-master' into 'master'
gtk-builder-tool: Simplify <style>

See merge request GNOME/gtk!4009
2021-09-29 15:37:29 +00:00
Matthias Clasen
01abd1565e a11y: Simplify atspi context a bit
We don't really need a bus-address property
that gets copied for every single object.
We keep the address in object data on the
display anyway. Just use it from there.

This gets rid of a nice amount of strdups
at startup.
2021-09-29 10:58:23 -04:00
Matthias Clasen
160aeb4879 Simplify our ui files
Run gtk4-builder-tool simplify over our ui files,
we simplify some more things now.
2021-09-29 10:58:23 -04:00
Matthias Clasen
fd0a5e3c23 buildertool: Fix a simplify issue
<lookup> elements can contain a type name, we can't just
ignore the pcdata content. This was breaking some of our
ui files when simplifying them.
2021-09-29 10:58:23 -04:00
Matthias Clasen
6f002678be gtk-builder-tool: Simplify more
Simplify enum properties as well.

Update affected tests.
2021-09-29 10:58:21 -04:00
Yuri Chornoivan
da5efea663 Update Ukrainian translation 2021-09-29 12:51:56 +00:00
Sveinn í Felli
22ffae1b13 Update Icelandic translation
(cherry picked from commit 4e08ec0ea1)
2021-09-29 12:05:11 +00:00
Yuri Chornoivan
62ed3b476d Update Ukrainian translation 2021-09-29 11:35:43 +00:00
Kukuh Syafaat
4a684a6371 Update Indonesian translation
(cherry picked from commit cc70eaca93)
2021-09-29 05:57:36 +00:00
Matthias Clasen
18c9727a98 Merge branch 'wip/chergert/fix-4279' into 'master'
macos: handle NULL surface when creating GL context

Closes #4279

See merge request GNOME/gtk!4008
2021-09-29 01:22:35 +00:00
Christian Hergert
e77eaa0ace macos: handle NULL surface when creating GL context
Fixes #4279
2021-09-28 17:36:23 -07:00
Matthias Clasen
12e8a92608 Merge branch 'matthiasc/for-master' into 'master'
builder: Simplify parameter collection

See merge request GNOME/gtk!4006
2021-09-28 22:24:13 +00:00
Matthias Clasen
5bc3923bae builder-tool: Avoid <style> when converting
We can just set the css-classes property instead.

Update affected tests.
2021-09-28 17:48:50 -04:00
Matthias Clasen
e99ac8f6d8 builder: Simplify parameter collection
This avoids setting the GValue only to toss it at the
end of the loop body. Instead, we can just do nothing
if this property isn't interesting to us.
2021-09-28 17:48:50 -04:00
Yaron Shahrabani
f5db501879 Update Hebrew translation
(cherry picked from commit e230579149)
2021-09-28 20:28:18 +00:00
Matthias Clasen
8aafee4e35 Merge branch 'matthiasc/for-master' into 'master'
entry: Clarify docs

See merge request GNOME/gtk!4005
2021-09-28 20:24:16 +00:00
Matthias Clasen
83b434d6a5 docs: Mention popovers in the migration guide
Things have changed around popovers, we should mention
that.
2021-09-28 15:47:06 -04:00
Matthias Clasen
2c9a2e94c8 entry: Clarify docs
Mention that max length is in characters.
2021-09-28 15:40:41 -04:00
Matthias Clasen
8f817e67de Merge branch 'matthiasc/for-master' into 'master'
Fix the build

See merge request GNOME/gtk!4004
2021-09-28 19:39:57 +00:00
Matthias Clasen
66c80e82ba Merge branch 'builder-binding-ordering' into 'master'
builder: Fix handling of `<binding>`

Closes #4147

See merge request GNOME/gtk!4003
2021-09-28 19:38:30 +00:00
Matthias Clasen
32191bc18e Fix the build
gcc was complaining here with -Werror=return-type.
2021-09-28 15:19:17 -04:00
Matthias Clasen
c4069fdcee builder: Fix handling of <binding>
We were only applying <binding> elements when the
object is constructed, which can be triggered by
various things (e.g. a <style> element). Defer
this until we reach </object>, so we can be sure
that we pick up all the bindings.

Testcase included.

Fixes: #4147
2021-09-28 15:09:49 -04:00
Matthias Clasen
b17005ddab Merge branch 'fix-builder-parsing' into 'master'
builder: Fix parsing of mixed declarations

Closes #4208

See merge request GNOME/gtk!3997
2021-09-28 04:32:30 +00:00
Benjamin Otte
30a741e6af Merge branch 'wip/lantw/GDK-Win32-Use-lowercase-windows.h' into 'master'
GDK/Win32: Use lowercase windows.h

See merge request GNOME/gtk!4000
2021-09-27 23:23:36 +00:00
Matthias Clasen
69cf1aa050 Merge branch 'builder-leaks' into 'master'
builder: Don't leak refs

See merge request GNOME/gtk!4001
2021-09-27 23:16:29 +00:00
Emmanuele Bassi
1b82de1797 Merge branch 'btj-master-patch-30099' into 'master'
ConstraintGuide getters: annotate out parameters as such

See merge request GNOME/gtk!4002
2021-09-27 22:32:00 +00:00
Matthias Clasen
ec62402908 builder: Fix parsing of mixed declarations
The GtkBuilder parser constructs the object e.g.
when handling a <binding> element. There may be
more <property> elements after it, which we were
just not applying. Fix that by always applying
property when we see </object>. To do that, we
need to track the applied status per property.

Test included.

Fixes: #4208
2021-09-27 17:47:24 -04:00
Matthias Clasen
c8f29a689d builder: Consistently use builder_construct
It seems odd to use this helper in one place,
but not the other.
2021-09-27 17:46:24 -04:00
Matthias Clasen
e3ecd5d23e Add an assertion and comment
Maybe it helps the person unfortunate enough
to stumble in here.
2021-09-27 17:30:25 -04:00
Bart Jacobs
eac0e06a7a ConstraintGuide getters: annotate out parameters as such 2021-09-27 21:23:45 +00:00
Matthias Clasen
834c72bb0f coloreditor: Don't unref unless we own it
Calling gtk_widget_class_bind_template_child does
*not* give you a reference that you need to unref.
It manages the reference for you. So calling
g_clear_object on such a member is wrong.
2021-09-27 16:40:29 -04:00
Matthias Clasen
6b86848984 builder: Don't leak refs
We sometimes end up setting an object on a GValue
that we are then not interested in. We need to
unset it, or we'll leak the ref.
2021-09-27 16:38:32 -04:00
Povilas Kanapickas
68bd94fa25 gdk/x11: Implement XI2.4 touchpad gesture support 2021-09-27 23:19:33 +03:00
Povilas Kanapickas
d981694c64 gdk/x11: Report XI2 version on the server 2021-09-27 23:17:04 +03:00
Matthias Clasen
4fff68355a Merge branch 'wip/lantw/broadway-Use-the-correct-way-to-call-find_library' into 'master'
broadway: Use the correct way to call find_library

See merge request GNOME/gtk!3999
2021-09-27 14:48:58 +00:00
Hugo Carvalho
c79d327b5e Update Portuguese translation
(cherry picked from commit 73861c1178)
2021-09-26 19:59:16 +00:00
Piotr Drąg
35abc0725d Update Polish translation 2021-09-26 17:22:49 +02:00
Aurimas Černius
1fab75d789 Updated Lithuanian translation 2021-09-26 17:22:51 +03:00
Ting-Wei Lan
5175b1676b GDK/Win32: Use lowercase windows.h
Fix build on case-sensitive file systems, so it can be cross-compiled
from Linux with MinGW.
2021-09-26 21:52:12 +08:00
Emin Tufan Çetin
fbae56ef45 Update Turkish translation 2021-09-26 12:23:27 +00:00
Ting-Wei Lan
f96c4eb5bb broadway: Use the correct way to call find_library
While broadway currently doesn't build on Windows, it is still better to
avoid using the old and unsupported way to call find_library.
2021-09-26 18:51:13 +08:00
Benjamin Otte
9395b28542 testsuite: Actually run all memorytexture tests
Whoops
2021-09-26 09:41:55 +02:00
Benjamin Otte
ef09cbee2f build: Fix build with sysprof-capture but without sysprof 2021-09-26 09:41:55 +02:00
Мирослав Николић
5d86f08626 Update Serbian translation
(cherry picked from commit 1a70c49acd)
2021-09-26 05:52:00 +00:00
Мирослав Николић
ec6a824ef9 Update Serbian translation
(cherry picked from commit ea63309512)
2021-09-26 05:33:29 +00:00
Rafael Fontenelle
bbcc818b3d Update Brazilian Portuguese translation
(cherry picked from commit df0f886e77)
2021-09-25 13:58:07 +00:00
Danial Behzadi
7ede54e821 Update Persian translation 2021-09-25 10:25:05 +00:00
Matthias Clasen
b2b7118b8e Merge branch 'ebassi/rst-man' into 'master'
Switch man pages to reStructuredFormat

See merge request GNOME/gtk!3995
2021-09-24 22:03:13 +00:00
Benjamin Otte
8fba0d209e Merge branch 'wip/otte/for-master' into 'master'
win32: Fix GTK warnings

See merge request GNOME/gtk!3998
2021-09-24 21:46:20 +00:00
Benjamin Otte
659181f74b win32: Fix GTK warnings 2021-09-24 23:26:45 +02:00
Benjamin Otte
555993717b Merge branch 'wip/otte/gdk-headers' into 'master'
Clean up GDK headers

See merge request GNOME/gtk!3996
2021-09-24 21:16:55 +00:00
Benjamin Otte
a29474567a gdk: Remove gdkinternals.h 2021-09-24 22:50:29 +02:00
Benjamin Otte
279f9aa6d3 wayland: Don't include gdkinternals.h 2021-09-24 22:50:29 +02:00
Benjamin Otte
d4f9d38368 win32: Fix gcc warnings 2021-09-24 22:50:29 +02:00
Benjamin Otte
47e0539968 x11: Don't include gdkinternals.h 2021-09-24 22:50:29 +02:00
Benjamin Otte
4e836493cc macos: Don't include gdkinternals.h 2021-09-24 22:50:29 +02:00
Benjamin Otte
226ecaf9a2 win32: Don't include gdkinternals.h 2021-09-24 22:50:29 +02:00
Benjamin Otte
bcd9a0141a broadway: Don't include gdkinternals.h 2021-09-24 22:11:57 +02:00
Benjamin Otte
811b5d995b gdk: Don't include gdkinternals.h in gdk-private.h 2021-09-24 22:11:57 +02:00
Benjamin Otte
c7992884ae gdk: Remove gdk.h include form gdkframeclockidle.c 2021-09-24 22:11:57 +02:00
Benjamin Otte
39f2bb28de gdk: Remove gdk.h include from header 2021-09-24 22:11:57 +02:00
Benjamin Otte
78d7cb712e gdk: Remove gdk.h include from gdk-private.h 2021-09-24 22:11:57 +02:00
Benjamin Otte
d61c71c378 macos: Actually set the vfuncs 2021-09-24 22:11:57 +02:00
Emmanuele Bassi
c317a1b7c4 ci: Update the Docker image to use 2021-09-24 19:00:09 +01:00
Yuri Chornoivan
7e48ab4ccd Update Ukrainian translation
(cherry picked from commit 3a0d4d3d13)
2021-09-24 17:06:32 +00:00
Emmanuele Bassi
2fd0da8788 ci: Add Python's docutils to the base image
We use rst2man for generating our man pages.
2021-09-24 18:04:09 +01:00
Emmanuele Bassi
113d546486 docs: Remove the last remaining XML files 2021-09-24 18:01:00 +01:00
Emmanuele Bassi
2c810c747d Switch man pages to reStructuredFormat
It's easier to write than DocBook, and rst2man is faster than xsltproc.
2021-09-24 18:01:00 +01:00
Matthias Clasen
a74d90891a Merge branch 'matthiasc/for-master' into 'master'
headerbar: Cosmetics

See merge request GNOME/gtk!3994
2021-09-24 15:37:24 +00:00
Marek Černocký
381717792b Updated Czech translation 2021-09-24 15:24:12 +02:00
Matthias Clasen
610ba1cadf headerbar: Cosmetics
Use the box api we have.
2021-09-24 08:54:04 -04:00
Matthias Clasen
e41bf097d0 Merge branch 'wip/chergert/undo-fixes' into 'master'
texthistory: add barriers after final grouping

Closes #4276

See merge request GNOME/gtk!3989
2021-09-24 12:36:30 +00:00
Benjamin Otte
7a82e9f557 Merge branch 'wip/otte/shittymorph' into 'master'
gdk: Make sure only one GL backend is used

See merge request GNOME/gtk!3992
2021-09-24 08:50:17 +00:00
Benjamin Otte
23acc993cc gdk: Make sure only one GL backend is used
Creative people managed to create an X11 display and a Wayland display
at once, thereby getting EGL and GLX involved in a fight to the death
over the ownership of the glFoo() symbolspace.

A way to force such a fight with available tools here is (on Wayland)
running something like:
GTK_INSPECTOR_DISPLAY=:1 GTK_DEBUG=interactive gtk4-demo

Related: xdg-desktop-portal-gnome#5
2021-09-24 01:59:37 +02:00
Christian Hergert
659393049e textview: improve undo grouping when overwriting
We want to group in more than one undo group when removing a selection
and replacing it with a new character or characters, unless we're
replacing a single character. In that case, the natural thing is to treat
it as an atomic change.
2021-09-23 13:25:41 -07:00
Christian Hergert
b578c78eff texthistory: add barriers after final grouping
We don't want to allow new items to be grouped into a previous action
group after the end_user_action() is called. This ensures that we add a
barrier action in those conditions.

Fixes #4276
2021-09-23 13:25:35 -07:00
Matthias Clasen
d7db3f1546 Merge branch 'master' into 'master'
gtktextview: Fixed arrow key crash.

Closes #4275

See merge request GNOME/gtk!3984
2021-09-22 23:03:18 +00:00
Matthias Clasen
20f6610c61 Merge branch 'widgetfactory-async-load' into 'master'
Revert "Use GtkLoader for image loading"

See merge request GNOME/gtk!3986
2021-09-22 21:49:15 +00:00
Matthias Clasen
923c944abb Add GtkLoader to gtk4-widget-factory
Add an async-loading paintable implementation
to gtk4-widget-factory, and use it to load the
jpegs in the background.
2021-09-22 17:09:53 -04:00
Matthias Clasen
0b9f6985b1 texture: Document constructors as threadsafe
We aren't providing async loading apis here,
but we want to allow applications to create
textures in a thread, to avoid blocking the
main thread.
2021-09-21 23:10:53 -04:00
Matthias Clasen
1430142ad8 Revert "Add delayed loading for textures"
This reverts commit 4a89cfe2c9.
2021-09-21 23:10:53 -04:00
Matthias Clasen
3a5091cb6e Revert "Use GtkLoader for image loading"
This reverts commit da115ad075.
2021-09-21 23:10:53 -04:00
Chun-wei Fan
ece02317b9 gdkdisplay-win32.c: Don't retry WGL initialization
On Windows, GLES is not that widely available unless one installs wrapper
libraries such as libANGLE, so GLES/EGL support on Windows is used more like
a fallback mode if Desktop OpenGL (WGL) support is inadequate on the system.

Hence, unless one forces WGL or EGL, we will first try to initialize WGL, and
then try to initialize GLES if enabled and if WGL initialization failed, and
then just return whatever the last result we can obtain from these
initialization attempts, since unlike X11 EGL contexts, we do not have
separate modes for WGL except for legacy and non-legacy contexts.
2021-09-22 11:09:02 +08:00
Chun-wei Fan
218a3e3d01 gdkglcontext-win32-wgl.c: Fix Cairo fallback check
We were setting the WGL pixel format in GdkWin32Display too early, so the code
does not bail out correctly when we retry establishing the WGL context.

Fix this by pushing back setting the WGL pixel format only after it passes the
shader availability check.

Should fix issue #4257.
2021-09-22 11:08:53 +08:00
Matthias Clasen
d6d7299859 Merge branch 'composetable/accept-long-replacements' into 'master'
gtkcomposetable: Accept long replacement strings

Closes #4273

See merge request GNOME/gtk!3983
2021-09-21 17:37:06 +00:00
Jordan Yelloz
5f913e9558 gtktextview: Fixed arrow key crash.
When pressing the keyboard arrows to move around when the insertion point is
hidden, it causes an assertion error in blink_cb.

Insertion point blinks should only be scheduled when blinking is enabled and the
insertion point is visible.

Closes #4275
2021-09-21 09:14:22 -07:00
Martin Kühl
a9d7282f00 gtkcomposetable: Accept long replacement strings
This change removes the assertions limiting replacement strings in the compose table to be less than 20 characters.
The limit seems arbitrary, is not required, will break some users' setups, and problems with it result in applications not launching.

Fixes #4273
2021-09-21 17:03:20 +02:00
Benjamin Otte
3e20ecd6e1 Merge branch 'wip/otte/titlebar' into 'master'
window: Add a titlebar property

See merge request GNOME/gtk!3982
2021-09-21 03:08:46 +00:00
Benjamin Otte
1ef000b1ab reftests: Add tests that check default-size is computed correctly
Related: #4136
2021-09-21 02:52:30 +00:00
Benjamin Otte
765e78f72b window: Add a titlebar property
It just turns get/set_titlebar into a property.
2021-09-21 02:52:30 +00:00
Benjamin Otte
32871f997e window: Make priv->titlebar the titlebar
It was priv->title_box before - unless priv->titlebar wasn't NULL, then
it was NULL.

Confusing? Yeah, that's why I changed it.
2021-09-21 02:52:30 +00:00
Benjamin Otte
9fb729ccc0 window: Improve set_titlebar() function
Get rid of a goto and check if the titlebar is already set.
2021-09-21 02:52:30 +00:00
Matthias Clasen
4b582851f7 Merge branch 'mention_a11y_concern' into 'master'
Mention that after setting a button child the user is responsible for a11y relations

See merge request GNOME/gtk!3981
2021-09-20 12:15:44 +00:00
Lukáš Tyrychtr
da20c68d48 Mention that after setting a button child the user is responsible for a11y relations 2021-09-20 10:52:16 +02:00
Benjamin Otte
d19f4ad53a Merge branch 'wip/otte/for-master' into 'master'
cssprovider: Be clearer about warnings vs errors

See merge request GNOME/gtk!3980
2021-09-20 05:38:27 +00:00
Benjamin Otte
d17552670c wayland: Add format hex value to debug print
It's how it's listed in the spec, this makes it easier to search.
2021-09-20 07:04:20 +02:00
Matthias Clasen
6a69b4e475 Merge branch 'matthiasc/for-master' into 'master'
builder: Drop unused part of private api

See merge request GNOME/gtk!3979
2021-09-20 04:29:54 +00:00
Matthias Clasen
0b4817a1c6 window: Drop some dead code
The gtk_window_set_buildable_property implementation
was only used to set the unused builder_visible flag.
Remove both the flag and the vfunc.

This means we no longer have any set_buildable_property
implementations and could eventually drop that vfunc and
the support for it in GtkBuilder.
2021-09-20 00:01:24 -04:00
Benjamin Otte
e931afdc9b cssprovider: Be clearer about warnings vs errors
The CSS parser tried to warn about unexpected syntax that the spec
doesn't define as an error.
2021-09-20 05:57:14 +02:00
Matthias Clasen
7dab5322df builder: Cosmetics 2021-09-19 23:54:38 -04:00
Matthias Clasen
138fd6f0f3 builder: Small optimization
Use g_object_setv where we can.

It would be much nicer if we could pass the
pspecs we already have, and avoid having GObject
look them up again.
2021-09-19 23:26:00 -04:00
Matthias Clasen
5c3bb42612 builder: Avoid a pointless call
pspec->name is guaranteed to be interned already.
2021-09-19 22:13:00 -04:00
Matthias Clasen
2c2d03a8d7 builder: Drop unused part of private api
The aliases arguments was used to support 'primary',
but we no longer have that, and all callers pass
NULL for aliases. So, just drop it.
2021-09-19 22:04:32 -04:00
Emin Tufan Çetin
6474c7af35 Update Turkish translation 2021-09-19 17:22:22 +00:00
Emin Tufan Çetin
145a16ff81 Update Turkish translation 2021-09-19 17:18:57 +00:00
Matthias Clasen
f079d75d1f Merge branch 'resource-cleanup' into 'master'
Clean up gesture icons

See merge request GNOME/gtk!3978
2021-09-19 12:53:59 +00:00
Matthias Clasen
e1facc548a resources: Treat svgs as xml
They can have their whitespace removed just the same.
2021-09-19 08:27:08 -04:00
Matthias Clasen
87e4a542eb Clean up gesture icons
These had duplicate drawing in them, and were
saved with all the extra Inkscape data.
2021-09-19 08:27:08 -04:00
Matthias Clasen
56e6a51ac0 Merge branch 'delayed-loading' into 'master'
gtk-demo: Cosmetics

See merge request GNOME/gtk!3975
2021-09-18 23:02:00 +00:00
Matthias Clasen
da115ad075 Use GtkLoader for image loading
This avoids blocking on image loading while
we have better things to do.
2021-09-18 17:35:00 -04:00
Matthias Clasen
4a89cfe2c9 Add delayed loading for textures
Add a private GdkPaintable implementation that
loads a texture in a thread, and does not show
anything until the texture is loaded. This avoid
blocking on image loading in the main thread.
2021-09-18 17:35:00 -04:00
Matthias Clasen
c9135546b6 loaders: Add profiler marks
These are potentially expensive calls, we
should make sure they show up in profiles.
2021-09-18 17:35:00 -04:00
Jordi Mas
a94e438a29 Update Catalan translation 2021-09-18 21:15:31 +02:00
Matthias Clasen
164443a99a builder: Cosmetics 2021-09-18 14:14:55 -04:00
Matthias Clasen
d88c4d122d gtk-demo: Cosmetics
Tweak the color of the outlines in the font rendering
demo.
2021-09-18 11:08:15 -04:00
Matthias Clasen
d66bc501a4 Merge branch 'wip/baedert/for-master' into 'master'
label: Remove redundant store

Closes #4196

See merge request GNOME/gtk!3891
2021-09-18 15:04:09 +00:00
Timm Bäder
1c2c356ed4 widget factory: Scale down jpeg images 2021-09-18 16:48:48 +02:00
Piotr Drąg
1fae91d123 Update POTFILES.in 2021-09-18 13:12:42 +02:00
Timm Bäder
24415a6ffb cssimageurl: Explicitly check for local_error != NULL
This should always be the case since gdk_texture_new_from_file should
always set the error when it returns NULL, but make it explicit anyway.
2021-09-18 13:08:46 +02:00
Timm Bäder
ae08aa3622 constraintsolver: Remove a dead assignment 2021-09-18 12:53:41 +02:00
Timm Bäder
c24b7877a0 gdktiff: Use guint32 instead of int32
The latter seems to be deprecated.
2021-09-18 09:00:16 +02:00
Matthias Clasen
7b22e37371 Merge branch 'transform-work' into 'master'
transform: Add sections

See merge request GNOME/gtk!3974
2021-09-18 06:35:08 +00:00
Timm Bäder
c2ab1f172d window: Fix mnemonics-visible getter+setter annotations 2021-09-18 08:29:18 +02:00
Timm Bäder
136a3f6e5a stackswitcher: Expand child buttons
Fixes #4196
2021-09-18 08:29:18 +02:00
Timm Bäder
2bc82da34d inspector: Cache if we have ever constructed a window
Silly optimization to get rid of

gtk_main_do_event
  gtk_inspector_handle_event
    gtk_inspector_window_get_for_display
      g_object_get_data

showing up in profiles even though it's useless since we've never even
created any inspector window in the first place.
2021-09-18 08:29:18 +02:00
Matthias Clasen
41b810da7f Add gsk_transform_to_2d_components
This function decomposes a general 2D transform
into skew, scale, rotation and translation.

Tests included.
2021-09-18 02:06:51 -04:00
Matthias Clasen
155e0f3dfb Merge branch 'gbsneto/fix-filechooserwidget-choices' into 'master'
File chooser choice fixes

See merge request GNOME/gtk!3973
2021-09-18 03:59:52 +00:00
Georges Basile Stavracas Neto
02bb23486f filechooserwidget: Return an id in get_choice()
gtk_file_chooser_widget_get_choice() is supposed to return the option
id of the choice, but it currently is returning the option label.

Return the option id instead.
2021-09-18 00:22:05 -03:00
Georges Basile Stavracas Neto
bc0d9488ee filechooserwidget: Match choice id from "options"
When choices are added to the file chooser widget, the options of
that choice are stored object data under the "options" key. However,
gtk_file_chooser_widget_set_choice() was checking for "choices".

Retrieve the options from the "options" key stored data object data.
2021-09-18 00:20:42 -03:00
Matthias Clasen
5742483422 Add more transform tests
Test gsk_transform_to_2d.
2021-09-17 22:37:08 -04:00
Matthias Clasen
7f2cb1138a Merge branch 'static-analysis-fixes' into 'master'
label: Remove a dead assignment

See merge request GNOME/gtk!3972
2021-09-18 02:22:21 +00:00
Matthias Clasen
1289e68931 gsk: Add skew transforms
Add gsk_transform_skew() to make our transform
api more complete wrt to what you would expect
for a graphics api.
2021-09-17 22:07:26 -04:00
Matthias Clasen
9e6adaa913 transform: Add sections
This makes the code easier to navigate (for me).
2021-09-17 22:07:26 -04:00
Matthias Clasen
9cfce67d0f textview: Remove a dead store
Pointed out by clang.
2021-09-17 22:06:21 -04:00
Matthias Clasen
295d406207 listitemmanager: Add a few assertions
This might help poor static analyzers.
2021-09-17 22:06:21 -04:00
Matthias Clasen
ece5fd7db5 Merge branch 'more-glyph-drawing-fixes' into 'master'
ngl: Use exact device scales for glyphs

See merge request GNOME/gtk!3971
2021-09-18 00:26:14 +00:00
Matthias Clasen
c4e558da46 imcontextsimple: Rewrite a function slightly
This hopefully avoids upsetting static analyis.
2021-09-17 20:02:12 -04:00
Matthias Clasen
be1a60d5d0 label: Remove a dead assignment
It may have quieted gcc at some point, but
it upsets clang nowadays. Remove it.
2021-09-17 19:54:16 -04:00
Matthias Clasen
a1adaac69b Merge branch 'glyph-clipping-fixes' into 'master'
gtk-demo: Improve ink extents rendering

See merge request GNOME/gtk!3969
2021-09-17 23:31:41 +00:00
Matthias Clasen
7e4b2b971f Revert "gsk: Stop enlarging text bounding boxes"
This reverts commit 87af45403a.

I've found that this change is needed to ensure that the
bounding boxes of text nodes encompass all the glyphd drawing.
Without it, we overdraw the widget boundaries and cut off
glyphs.
2021-09-17 19:11:06 -04:00
Matthias Clasen
c6cacd2b2d ngl: Use exact device scales for glyphs
We are rendering the glyphs on a larger surface,
and we should avoid introducing unnecessary
rounding errors here. Also, I've found that
we always need to enlarge the surface by one
pixels in each direction to avoid cutting off
the tops of large glyphs.
2021-09-17 19:07:55 -04:00
Matthias Clasen
2c8e55605b gtk-demo: Improve ink extents rendering
Show the pixel-aligned ink rectangle, so we can
see that it includes all the pixels that are inked.
2021-09-17 16:29:30 -04:00
Matthias Clasen
06db477847 gtk-demo: Fix non-circular buttons 2021-09-17 15:24:26 -04:00
Matthias Clasen
e9cf8c6cc7 Merge branch 'glyph-clipping-fixes' into 'master'
gsk: Stop enlarging text bounding boxes

See merge request GNOME/gtk!3968
2021-09-17 18:35:41 +00:00
Matthias Clasen
aad6b2d279 Merge branch 'wip/otte/for-master' into 'master'
icontheme: Fix variable mixup leading to crashes

Closes #4269

See merge request GNOME/gtk!3967
2021-09-17 18:06:30 +00:00
Benjamin Otte
cf3830704b icontheme: Fix variable mixup leading to crashes
Note: Don't have 2 variables named "icon" and "gicon", you will screw
them up.

reftests included.

Fixes #4269
2021-09-17 17:41:13 +00:00
Matthias Clasen
d962360fa0 Fix glyph cache entry sizing
The subpixel-positioned glyph extends on both sides.
2021-09-17 13:38:29 -04:00
Matthias Clasen
76d31ff04b Merge branch 'menu_button_a11y_improvements' into 'master'
Set correct accessible relations for GtkMenuButton

Closes #4254

See merge request GNOME/gtk!3950
2021-09-17 16:51:52 +00:00
Matthias Clasen
87af45403a gsk: Stop enlarging text bounding boxes
This should not be necessary and only serves
to make the actual bugs harder to find.
2021-09-17 12:37:36 -04:00
Emmanuele Bassi
15ffd49efb Apply 4 suggestion(s) to 1 file(s) 2021-09-17 16:26:00 +00:00
Matthias Clasen
37a54eb9fc Merge branch 'matthiasc/for-master' into 'master'
gsk: Add a test for transform_bounds

See merge request GNOME/gtk!3966
2021-09-17 16:22:04 +00:00
Matthias Clasen
63647cace0 testsuite: Run the clipboard test in isolation
We can't have other test pop up windows, and possibly
stealing focus and preventing us from getting data
offers. So, run the clipboard test in isolation.
2021-09-17 11:38:28 -04:00
Matthias Clasen
bef54a382d transform: Improve docs
Add an example for reconstructing transforms.
2021-09-17 10:28:49 -04:00
Matthias Clasen
6a60214e8c gsk: Handle 2D transforms better
For 2D transforms, we can read the scale
factors more directly off the matrix.

This should eventually be moved out into a
function to decompose a 2D transform into
scale + rotation + skew + translation.
2021-09-17 10:28:49 -04:00
Matthias Clasen
27d662f1aa node editor: Preserve aspect ratio
We don't want to distort our rendering.
Tell the paintable to keep the aspect
ratio.
2021-09-17 10:28:49 -04:00
Matthias Clasen
52a8492887 rendernodepaintable: Provide accurate aspect ratio
Since we report width and height as integers, the
default implementation of this introduces rounding
errors. This shows up in the node-editor, as having
uneven scale factors like sx=1.0 and sy=1.0035.
Text nodes don't handle uneven scales like that well
and overdraw.
2021-09-17 10:28:49 -04:00
Lukáš Tyrychtr
ba5d010e39 Delete unneccessary comment and make other more descriptive 2021-09-17 15:11:26 +02:00
Matthias Clasen
8c34dd58c0 gsk: Add a test for transform_bounds 2021-09-17 07:43:07 -04:00
Matthias Clasen
0cce92ab19 Merge branch 'fix-typo' into 'master'
gtkcolorbutton: Fix documentation

See merge request GNOME/gtk!3965
2021-09-17 10:52:59 +00:00
James Westman
f95c21b67c gtkcolorbutton: Fix documentation 2021-09-16 23:53:42 -05:00
Benjamin Otte
1d41dc716e Merge branch 'image-loading' into 'master'
Image loaders

See merge request GNOME/gtk!3939
2021-09-17 03:13:38 +00:00
Benjamin Otte
3914ecbd0f gtk-demo: Use textures in listbox example 2021-09-17 04:31:46 +02:00
Benjamin Otte
0428d8ccd6 examples: Use textures over pixbufs 2021-09-17 04:31:46 +02:00
Benjamin Otte
37a7c6780a icontheme: Implement gtk_icon_theme_lookup_by_gicon() for textures
More feature parity.

Before this, it would have worked just as well - just going via a PNG
bytes step inbetween.
2021-09-17 04:31:46 +02:00
Benjamin Otte
1b85b5597b texture: Implement GIcon and GLoadableIcon
This is mainly for feature parity with GdkPixbuf. And it doesn't hurt
anyone (I hope).
2021-09-17 04:31:46 +02:00
Benjamin Otte
fae32846c7 texture: Refactor gdk_texture_new_from_bytes()
1. Split into a real loader and a fake one

2. Only try the fake one if the real one doesn't support the file.
2021-09-17 04:31:46 +02:00
Benjamin Otte
b271a94f92 texture: Rework error enum
1. Change INSUFFICIENT_MEMORY to TOO_LARGE
   GTK crashes on insufficient memory, we don't emit GErrors.

2. Split UNSUPPORTED into UNSUPPORTED_CONTENT and UNSUPPORTED_FORMAT
   So we know if you need to find an RPM with a loader or curse and
   the weird file.

3. Translate error messages, they are meant for end users.
2021-09-17 03:25:35 +02:00
Benjamin Otte
e58f70d7bb pixbufutils: Don't hardcode formats
Just let the loaders figure out the file format themselves.
2021-09-17 02:34:15 +02:00
Benjamin Otte
4fcf54757f icontheme: Insist that people provide proper values
Seriously...
2021-09-17 02:29:59 +02:00
Benjamin Otte
b5da07f0e1 icontheme: Use textures more
We were going via GLoadablieIcon/GInputStream for everything previously
and we have no API for that with GdkTexture.

With this commit, gdk-pixbuf isn't used anymore when starting
widget-factory for anything but SVG.
2021-09-17 02:12:07 +02:00
Benjamin Otte
a85f4ec6c2 icontheme: Load textures directly when possible
This doesn't fix the codepaths for SVG (both for recoloring and
resizing) and doesn't handle streams yet.
2021-09-17 02:02:51 +02:00
Matthias Clasen
b226478e8b Support 16bit formats in the png loader
When loading, convert all >8-bit data to
GDK_MEMORY_R16G16B16A16_PREMULTIPLIED.

When saving, save all 8-bit formats as 8-bit RGBA,
and save all >8-bt formats as 16-bit RGBA.
2021-09-17 02:02:51 +02:00
Matthias Clasen
14280b5f5b contentdeserializer: Use our on jpeg loader 2021-09-17 02:02:51 +02:00
Matthias Clasen
e720f9d35d Add code to save jpegs 2021-09-17 02:02:51 +02:00
Matthias Clasen
fecb31b706 builder: Stop using pixbufutils
We can just use gdk_pixbuf_new_from_resource here.
2021-09-17 02:02:51 +02:00
Matthias Clasen
729ad8e64a cssimageurl: Just create a texture directly
We don't need to use the pixbufutils api here.
2021-09-17 02:02:51 +02:00
Matthias Clasen
dcd873a6d8 builder: create textures without pixbufs
Load textures using the GdkTexture apis, without
going through a pixbuf first.
2021-09-17 02:02:51 +02:00
Benjamin Otte
679c93e843 texture: Add private can_load() function
... and use it to load textures in gtk_picture_set_from_file().
2021-09-17 00:25:22 +02:00
Benjamin Otte
2d3de8608c texture: Split out type detection
This way, the code using it becomes clearer and we can use it in
multiple places without accidentally doing it wrong (hint: see next
commit).
2021-09-17 00:25:22 +02:00
Benjamin Otte
100b0bf7d9 texture: Remove declaration for nonexisting function 2021-09-17 00:25:22 +02:00
Matthias Clasen
f2ca9ebbd7 texture: Avoid pixbufs when loading resources
We can just use our own loaders here now.
2021-09-17 00:25:22 +02:00
Benjamin Otte
577bf104c0 testsuite: Add png and tiff methods
We encode the texture to a PNG or TIFF and then decode
it again, in various ways.
2021-09-17 00:25:22 +02:00
Benjamin Otte
b1bb7c3258 texture: Add gdk_texture_save_to_tiff_bytes() 2021-09-17 00:25:22 +02:00
Matthias Clasen
c77b5c46a3 rendernodeparser: Avoid gdk_texture_new_for_pixbuf
We can just use gdk_texture_new_from_bytes here now.

Update affected test output.
2021-09-17 00:25:22 +02:00
Matthias Clasen
5b82cf1145 rendernodeparser: Use gdk_texture_save_to_png_bytes
Avoid cairo, and use our own api for saving png data.

Update affected test output.
2021-09-17 00:25:22 +02:00
Matthias Clasen
95a0c93839 Add contentserializer tests for textures 2021-09-17 00:25:22 +02:00
Matthias Clasen
d27bc74481 Use our own loaders for content (de)serialization
Use our own loader to (de)serialiaze textures
to and from png and tiff.

We still fall back to gdk-pixbuf for handling all
the other image formats, and for pixbufs.
2021-09-17 00:25:22 +02:00
Matthias Clasen
e30b4c61cb Add tests for the jpeg loader 2021-09-17 00:25:22 +02:00
Matthias Clasen
daf29e174f Load jpegs without gdk-pixbuf
Use our own loader for jpeg files.
2021-09-17 00:25:22 +02:00
Matthias Clasen
729ba8111a Add code to load jpegs
This lets us avoid gdk-pixbuf for loading
textures from the common image formats.

As a consequence, we are now linking against libjpeg.
2021-09-17 00:25:22 +02:00
Matthias Clasen
d30a029689 Add gdk_texture_save_to_tiff
This is a companion to gdk_texture_save_to_png, using
the tiff format, which will let us avoid lossy conversion
of HDR data, since we can store floating point data.
2021-09-17 00:25:22 +02:00
Matthias Clasen
945c2531ac Add tests for the tiff loader 2021-09-17 00:25:22 +02:00
Matthias Clasen
f925e12e1d Load tiffs without gdk-pixbuf
This will let us load floating point data, in
the future.
2021-09-17 00:25:22 +02:00
Matthias Clasen
a03594df52 Add code to load and save tiff files
Add support for the tiff format, which is flexible
enough to handle all our memory texture formats
without loss.

As a consequence, we are now linking against libtiff.
2021-09-17 00:25:22 +02:00
Matthias Clasen
d7c8f92733 Add gdk_texture_save_to_png_bytes
Just expose what we already have available
internally, so e.g. tests can use it without
static linking.
2021-09-17 00:25:22 +02:00
Matthias Clasen
d6ce65f81c Add tests for the png loader 2021-09-17 00:25:22 +02:00
Matthias Clasen
7949aaabb7 Save pngs without cairo
Use our own loader for pngs, which will allow
us to save e.g. 16-bit data in the future.
2021-09-17 00:25:22 +02:00
Matthias Clasen
a71877bf99 Load pngs without gdk-pixbuf
Use our own loader for pngs, which will allow
us to get e.g. 16-bit data in the future.
2021-09-17 00:25:22 +02:00
Matthias Clasen
f51f7f85eb Add code to load and save pngs
Using libpng instead of the lowest-common-denominator
gdk-pixbuf loader. This will allow us to load >8bit data,
and apply gamma and color correction in the future.
For now, this still just provides RGBA8 data.

As a consequence, we are now linking against libpng.
2021-09-17 00:25:22 +02:00
Matthias Clasen
66031fd00b texture: Add error enum 2021-09-17 00:25:22 +02:00
Benjamin Otte
698b3542a1 Merge branch 'modern-testsuite' into 'master'
testsuite: modernize image handling

Closes #4261

See merge request GNOME/gtk!3955
2021-09-16 22:22:56 +00:00
Benjamin Otte
83ea623775 reftests: Use the default (aka NGL) renderer
All tests pass with the renderer now, so we can remove useof the
fallback.
2021-09-16 23:59:37 +02:00
Benjamin Otte
345faa7250 reftests: XFAIL border-half-pixel test
the GL renderer can't deal with non-integers
2021-09-16 23:59:37 +02:00
Benjamin Otte
08df891070 reftests: Use colors without rounding errors
Color values must be divisible by 15 to be convertible into U8 and U16
values with the same result. 0x80 is not one of these values, so switch
it to 0x99.
2021-09-16 23:59:37 +02:00
Benjamin Otte
56b31c3923 rendernodeparser: Handle is_color attribute for glyphs 2021-09-16 23:59:37 +02:00
Matthias Clasen
93323be22a ngl: Avoid offscreens in more cases
We avoid an offscreen if we know the child node
can 'handle' the transform. Shadow nodes can if their
child node does - either the child node is a text node
in which case the shortcuts we take for shadow nodes
will work fine with the transform (we just render the
text node offset), or the child is not a text node,
in which case we render the shadow to an offscreen
anyway.

This change makes the label-shadows reftest pass with
the GL renderer, not by fixing the issue but by avoiding
it.
2021-09-16 23:59:37 +02:00
Matthias Clasen
9e14de2534 ngl: Improve shortcuts for shadow nodes
For shadow nodes, we try pretty hard to avoid
rendering shadows, and and we have a shortcut
that just renders text offset, but we can try
harder to do nothing - if the text is offset
by zero, we don't need to draw it at all.
2021-09-16 23:59:37 +02:00
Benjamin Otte
62954a0338 ngl Fix bottom-right border render failure
The wrong index was used for offsetting the bottom border rect.

Test included.
2021-09-16 23:59:37 +02:00
Benjamin Otte
7cf5e5546b testsuite: Switch color from khaki to yellow
llvmpipe doesn't loike compositing semitransparent khaki onto solid
khaki without rounding errors.
2021-09-16 23:59:37 +02:00
Benjamin Otte
58f66ebd07 reftests: Make image-compare use textures
All image comparisons are done on textures now.
2021-09-16 23:59:37 +02:00
Benjamin Otte
47330598fb reftests: Use 0.6 instead of 0.5 for alpha
See previous commit about rounding
2021-09-16 23:59:37 +02:00
Benjamin Otte
90ed7b92b2 reftests: Use 0.6 alpha, not 0.5
0.5 leads to some GL renderers computing 0.5 * 0xFF as 0x7F and
others 0x80, while 0.6 * 0xFF (255 is divisible by 5) is always 0x99.
2021-09-16 23:59:37 +02:00
Benjamin Otte
625b5ce91a testsuite: Port compare_render() to use textures 2021-09-16 23:59:37 +02:00
Benjamin Otte
c84d5b1f7f tests: Update rendernode test to use textures 2021-09-16 23:59:37 +02:00
Benjamin Otte
46bb160923 testuite: Add opacity-overdraw test
Tests that overdrawing of content inside an opacity node happens before
the opacity is applied.

This is broken in the GL renderer and causes the opacity.ui reftest to
fail.
2021-09-16 23:59:37 +02:00
Matthias Clasen
390a0b2f2a ngl: Fix opacity handling
We need to use an offscreen whenever there is overlapping
children somewhere in the tree below, just checking the
direct child of the opacity node is not enough.

Fixes: #4261
2021-09-16 23:59:37 +02:00
Benjamin Otte
0dfab46c15 reftests: Use GdkTexture instead of cairo_surface_t
This also switches the rendering code from using gsk_render_node_draw()
to gsk_renderer_render_texture().

Some tests are broken with the GL renderer, so this patch forces the
Cairo renderer until they get fixed.
2021-09-16 23:59:37 +02:00
Benjamin Otte
3a8ec683d3 reftests: Make diff pixels always opaque
We had pixels that did not differ in alpha and we then set 0 alpha
difference hich made the pixel invisible. Oops.
2021-09-16 23:59:37 +02:00
Benjamin Otte
de53b0c7a3 testsuite: remove box-order test
The test used to test that GtkBox ordered it's children left-to-right in
CSS, no matter the text direction or pack-type.

But there is neither a pack-type anymore nor does GTK4 do that.

So that test has been broken for yers, it just didn't render anything
wrong.
2021-09-16 23:59:37 +02:00
Benjamin Otte
75dfb4d63b API: Add gdk_texture_new_from_filename()
There are quite a few places where we can make use of it, in particular
in the testsuite and icontheme.
2021-09-16 23:59:37 +02:00
Benjamin Otte
64acaf99fb testsuite: Fix race in texture-threads test
Threads are evil, yo.
2021-09-16 23:59:37 +02:00
Benjamin Otte
551f76ea69 gltexture: Fallback in download_float()
GLES only allows downloading float if the texture matches specific
criteria and I'm too lazy to determine them, so always fall back.

And the custom stride fallback code isn't necessary, because falling
back does exactly that step already.
2021-09-16 23:59:37 +02:00
Benjamin Otte
a4f3fbbda1 gltexture: Fix download() for GLES
GLES can't do glGetTexImage(), so implement a version that does
glReadPixels() on GLES.
2021-09-16 23:59:37 +02:00
Benjamin Otte
b6d3561f4a testsuite: Be more verbose in texture-threads test
The test randomly fails on CI, so try to be more helpful in debugging
them.
2021-09-16 23:59:37 +02:00
Matthias Clasen
01944d57b7 Merge branch 'master' into 'master'
Do not require wayland-protocols as dependency in the .pc files

See merge request GNOME/gtk!3960
2021-09-16 18:32:23 +00:00
muradm
c9aec9b5a2 Do not require wayland-protocols as dependency in the .pc file
Basically, I was building some packages on Guix. I figured out that
wayland-protocols was listed among propagated-inputs for gtk+ package
(gtk-3-24). propagated-inputs holds a list of runtime dependencies,
that should be available to any other package that depends on gtk+.
While discussing we clarified that wayland-protocols is not runtime
dependency. So I moved it to native-inputs of gtk+ package, which
means that, this dependency will be available only to gtk+ package and
only at build time. Once moved, building of other applications that
depening on gtk+ started to fail.

Investigation showed that, all .pc (pkg-config) files prepared by gtk+
package, was including:

Requires.private: ... wayland-protocols ...

Since it becomes requirement, other applications was failing with
missing dependency wayland-protocols of dependency gtk+, for instance:

-- Checking for module 'gtk+-3.0'
--   Package 'wayland-protocols', required by 'gdk-3.0', not found

While actually wayland-protocols is not even a build time dependency
of application that depends on gtk+. Advertisement of such
requirement, is a bit misleading, because one does not need it at
runtime, especially applications based on gtk.
2021-09-16 20:31:30 +03:00
Matthias Clasen
025759e614 Merge branch 'wip/jimmac/make-toolbar-togglebuttons-visible' into 'master'
theme: make toggled tbuttons in toolbars visible

Closes #4264

See merge request GNOME/gtk!3959
2021-09-16 11:35:35 +00:00
Jakub Steiner
ed679703b8 theme: make toggled tbuttons in toolbars visible
- do what Alex does in libadwaita

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/4264
2021-09-16 12:47:26 +02:00
Matthias Clasen
fe46da1bf4 Merge branch 'misc-texture-things' into 'master'
Add gdk_texture_new_from_bytes

See merge request GNOME/gtk!3958
2021-09-16 03:14:12 +00:00
Benjamin Otte
7fd8899092 pixbufutils: Simplify function 2021-09-15 22:00:41 -04:00
Matthias Clasen
9f8d6ff29c texture: Mention download_float in the docs 2021-09-15 22:00:16 -04:00
Matthias Clasen
1230bce133 Add gdk_texture_new_from_bytes
Add this new api, and make gdk_texture_new_from_file
a wrapper around it.
2021-09-15 22:00:09 -04:00
Matthias Clasen
7c2be93a56 Merge branch 'matthiasc/for-master' into 'master'
Fix memorytexture float conversion

See merge request GNOME/gtk!3957
2021-09-16 01:56:39 +00:00
Matthias Clasen
eb23e23b03 ngl: Avoid cairo_to_png in debug output
Just use a GL texture and gdk_texture_save_to_png,
it was made for this.
2021-09-15 21:18:34 -04:00
Matthias Clasen
75b45aeabf Fix memorytexture float conversion
This was silently dropping the alpha in one case.
2021-09-15 21:14:59 -04:00
Matthias Clasen
23ffd6923d Merge branch 'update-readme' into 'master'
Update the README

See merge request GNOME/gtk!3956
2021-09-15 23:25:57 +00:00
Matthias Clasen
d2eb0288d9 Apply 1 suggestion(s) to 1 file(s) 2021-09-15 21:50:36 +00:00
Matthias Clasen
a4b976f7a2 Update the README
Remove the mention of GNU (since that has not been case
for a long time, effectively), state that GTK is hosted
by the GNOME project, and point to GNOME as a place
for donations.
2021-09-15 15:44:57 -04:00
Boyuan Yang
4930faa984 Update Chinese (China) translation 2021-09-15 18:41:06 +00:00
Dz Chen
84fdda4f56 Update Chinese (China) translation 2021-09-15 15:28:39 +00:00
Matthias Clasen
ec6228b3a4 Merge branch 'function-annotations' into 'master'
Annotate gsk_rounded_rect_is_circular as pure

See merge request GNOME/gtk!3952
2021-09-14 21:39:48 +00:00
Matthias Clasen
8b85e7f35a Annotate gtk_get_default_language as const 2021-09-14 16:38:08 -04:00
Matthias Clasen
d7909dccdc Annotate gtk_editable_get_chars as malloc 2021-09-14 16:38:08 -04:00
Matthias Clasen
7773ae4538 csstypes: Add annotations and inlines
Inline _gtk_css_change_for_sibling and
_gtk_css_change_for_child, and mark a few
other functions as const or malloc.
2021-09-14 16:38:08 -04:00
Matthias Clasen
bec44acdeb Annotate some builder apis as malloc 2021-09-14 16:38:08 -04:00
Matthias Clasen
5bfac597f6 Annotate gtk_accelerator_get_default_mod_mask as const 2021-09-14 16:38:08 -04:00
Matthias Clasen
423a4d4c3e Annotate gsk_cairo_blur_compute_pixels as const 2021-09-14 16:38:08 -04:00
Matthias Clasen
38fce67a9b Annotate gdk_rgba_to_string as malloc 2021-09-14 16:38:08 -04:00
Matthias Clasen
04ef7055cd Annotate gdk_drag_action_is_unique as const 2021-09-14 16:38:08 -04:00
Matthias Clasen
44a031c3c1 Annotate gtk_css_tokenizer_get_location as const 2021-09-14 16:38:08 -04:00
Matthias Clasen
be885c888f cssparser: Mark some functions as pure and malloc 2021-09-14 16:38:08 -04:00
Matthias Clasen
6faef4416f Annotate gsk_ngl_uniform_state_align as pure 2021-09-14 16:38:08 -04:00
Matthias Clasen
5f452a5e6c Annotate gsk_rounded_rect_is_circular as pure
And also mark gsk_rounded_rect_to_string as malloc.
2021-09-14 16:38:08 -04:00
Matthias Clasen
060f2d5f65 Annotate pango_glyph_string_num_glyphs as pure 2021-09-14 16:38:08 -04:00
Matthias Clasen
ebca260f2d Annotate gdk_unichar_direction as const 2021-09-14 16:38:08 -04:00
Matthias Clasen
d4b1f85e14 Merge branch 'gsk-tests-gl' into 'master'
testsuite: Call g_test_init in test binaries

See merge request GNOME/gtk!3953
2021-09-14 20:37:16 +00:00
Matthias Clasen
4439ff0c12 testsuite: Stop running tests for the gl renderer
It does not exist anymore.
2021-09-14 16:12:55 -04:00
Matthias Clasen
ffab67ac70 testsuite: Call g_test_init in test binaries
Without it, we mess out on G_DEBUG=fatal-warnings,
so our ci does not alert us that we run a bunch of
tests which spit out warnings.
2021-09-14 16:12:55 -04:00
Lukáš Tyrychtr
0120ff3518 Merge branch 'master' into menu_button_a11y_improvements 2021-09-14 15:34:14 +02:00
Matthias Clasen
2e63b53b1e Merge branch 'fix_accessible_described_by' into 'master'
Fix generation of accessible description in presence of described by relations

See merge request GNOME/gtk!3948
2021-09-14 13:29:28 +00:00
Matthias Clasen
878c9da736 Merge branch 'test-leak-fixes' into 'master'
testsuite: Fix a few memory leaks

See merge request GNOME/gtk!3947
2021-09-14 13:14:10 +00:00
Lukáš Tyrychtr
955d50a080 Fix generation of accessible description in presence of described by relations
The loop going through the relation list should have stopped on the NULL sentinel value, however it never accesed the next list element.
2021-09-14 14:33:30 +02:00
Matthias Clasen
2b4f798e34 testsuite: Fix a few memory leaks
These are keeping the asan build in ci from passing.
2021-09-14 08:29:45 -04:00
Matthias Clasen
cda5d2dadd Merge branch 'tiff-ci' into 'master'
ci: Add libtiff-devel to the image

See merge request GNOME/gtk!3946
2021-09-14 12:27:39 +00:00
Lukáš Tyrychtr
b664b2d1fd Set correct accessible relations for GtkMenuButton
Up until now, as the focus was moved to the inner button, it was not possible for
assistive technologies to determine the correct labels and descriptions
because developers could set them only for the parent widget.
Now, the proper relations are added so the labels should be picked up properly.

Fixes #4254
2021-09-14 14:26:18 +02:00
Matthias Clasen
c70fdd6331 ci: Use the v4 image 2021-09-14 08:06:09 -04:00
Matthias Clasen
ddec3dedd0 ci: Add libtiff-devel to the image
We want to require libtiff in our build.
2021-09-14 08:06:09 -04:00
Matthias Clasen
b1a5c3ff55 Merge branch 'wip/exalm/papercuts' into 'master'
Fix 2 papercuts

See merge request GNOME/gtk!3945
2021-09-14 11:36:25 +00:00
Alexander Mikhaylenko
8f9a5175f0 media-controls: Make play button flat
Match the volume button.
2021-09-14 12:23:03 +05:00
Alexander Mikhaylenko
099c923679 searchbar: Vertically center the close button 2021-09-14 12:22:45 +05:00
Matthias Clasen
2a12a3e6d9 Merge branch 'fix_#4255' into 'master'
stack: Dispose children before emitting items-changed

Closes #4255

See merge request GNOME/gtk!3943
2021-09-13 16:10:37 +00:00
Julian Sparber
cdc1fa166d stack: Dispose children before emitting items-changed
This makes sure that the `GListModel` returned by
`gtk_stack_get_pages()` actually has the items removed before
`items-changed` is emitted.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4255
2021-09-13 17:19:05 +02:00
Benjamin Otte
f572ca52d2 Merge branch 'wip/otte/texture-threads' into 'master'
gltexture: Make sure downloading textures works in a different thread

See merge request GNOME/gtk!3942
2021-09-13 00:16:30 +00:00
Benjamin Otte
193b383739 ngl: Simplify and unbug texture download
If we can't handle the texture, always just download_texture() it,
that way we are sure it's a memory texture.
2021-09-13 01:56:47 +02:00
Benjamin Otte
6785461c26 gltexture: Make sure downloading textures works in a different thread
This happens in the real world when using the inspector to look at a
node recording of a GStreamer video while the video is still playing.

GStreamer will use the GL context in a different thread while we are
busy trying to download it.

A test is included.
2021-09-13 01:40:03 +02:00
Philipp Kiemle
b9ee9979e7 Update German translation
(cherry picked from commit 17d828fda2)
2021-09-12 21:45:48 +00:00
Benjamin Otte
6bbec87700 Merge branch 'wip/otte/float-textures' into 'master'
Add float texture formats

See merge request GNOME/gtk!3940
2021-09-12 12:55:00 +00:00
Balázs Úr
b35608a351 Update Hungarian translation 2021-09-12 06:03:58 +00:00
Benjamin Otte
416763bf2d testsuite: Add tests for gdk_texture_download_float() 2021-09-12 05:54:37 +02:00
Benjamin Otte
9179ebb28e testsuite: Add memory test support for OpenGL up/downloads
Use a GL renderer to upload textures (and then optionally download them
via release() again). This way, we can test that the GL renderer
properly uploads textures to the right formats (not losing information
for HDR for example) and downloads them again.
2021-09-12 05:54:37 +02:00
Benjamin Otte
bcc17b3033 testsuite: Add tests uploading the memorytextures
Use a GL renderer and render_texture() them.
2021-09-12 05:54:37 +02:00
Benjamin Otte
00439f9e5c testsuite: Rework memorytexture test some more
Instead of predefined colors, generate them randomly.
2021-09-12 05:54:37 +02:00
Benjamin Otte
c9d748fc51 testsuite: Overhaul memorytexture test
Instead of hardcoding pixel values, allow construction of textures by
filling them with GdkRGBA values.
2021-09-12 05:54:37 +02:00
Benjamin Otte
719eafa60c gl: Implement uploading and downloading HDR formats
Also refactor the GL uploading so it does the fallback in a
GLES-compatible way, which means we only need one fallback.
2021-09-12 05:54:37 +02:00
Benjamin Otte
1759d27da9 memorytexture: Add support for HDR formats
Also sanitize the input bytes so the strides match alignment
requirements of the data types.
2021-09-12 05:54:37 +02:00
Benjamin Otte
53275481a5 texture: Add gdk_texture_download_float() 2021-09-12 05:54:37 +02:00
Benjamin Otte
cbe6d0da76 gdk: Deprecate gdk_cairo_draw_from_gl()
It's broken with various pixel formats and OpenGL ES, it's hard to
understand what everything does, and gdk_texture_download() can be used
instead.
2021-09-12 05:54:37 +02:00
Benjamin Otte
c349ed9562 gltexture: Implement download() via glGetTexImage()
1. The download via gdk_cairo_draw_from_gl() was broken sometimes

2. We get easy conversion on fallback by chaining up and using
   download_texture().

3. One more place where Cairo is no longer necessary.
2021-09-12 05:22:21 +02:00
Benjamin Otte
74ce69a8a1 gltexture: Make release() use download_texture()
1. It avoids Cairo, and in particular conversion to Cairo.

2. Keeping a texture allows easy chaining in the vfuncs.

3. Using a texture means releasing will work for HDR formats
   too, once we add them.
2021-09-12 05:22:21 +02:00
Benjamin Otte
4f17f3ac24 texture: Add gdk_texture_download_texture()
A private vfunc that downloads a texture as a GdkMemoryTexture in
whatever format the texture deems best.

There are multiple reasons for this:

 * GLES cannot download the Cairo format. But it can download some
   format and then just delegate to the GdkMemoryTexture implementation.

 * All the other download vfuncs (including the ones still coming) can
   be implemented via download_texture() and delegation, making the
   interface easier.

 * We want to implement image loading and saving support. By using
   download_texture(), we can save in the actual format of the texture.

 * A potential GdkCompressedTexture could be implemented by just
   providing this one vfunc as a compress() step.
2021-09-12 05:22:21 +02:00
Benjamin Otte
9c8e464b04 texture: Add GdkMemoryConversion private enum
Now gdk_memory_convert() converts to one of these conversions instead of
re(ab)using parts of the GdkMemoryFormat enum.
2021-09-12 05:22:21 +02:00
Benjamin Otte
51d0d13a9e gltexture: release() to a texture, not a cairo_surface
This makes forwarding vfuncs a lot easier, because we can just call them
on the texture.
2021-09-12 05:22:21 +02:00
Benjamin Otte
0ee3b1c861 texture: Remove unused argument from vfunc 2021-09-12 05:22:21 +02:00
Balázs Úr
46f88c69a1 Update Hungarian translation 2021-09-11 23:45:21 +00:00
Benjamin Otte
140976a670 Merge branch 'wip/otte/for-master' into 'master'
rendernode: Write the whole node

See merge request GNOME/gtk!3938
2021-09-11 20:56:39 +00:00
Benjamin Otte
9f2b847835 rendernode: Write the whole node
It turns out g_output_stream_write_bytes() does not write the bytes.
It should be renamed to g_output_stream_write_some_of_the_bytes() maybe.
2021-09-11 22:28:40 +02:00
Benjamin Otte
9e11ea699c Merge branch 'hsl' into 'master'
gdk_rgba_parse: Support HSL colors

See merge request GNOME/gtk!3899
2021-09-11 12:57:25 +00:00
Guillaume Bernard
1a4eebe022 Update French translation
(cherry picked from commit 8ffd7e9f87)
2021-09-11 09:41:32 +00:00
Guillaume Bernard
2963468019 Update French translation
(cherry picked from commit f433c543fe)
2021-09-11 09:36:48 +00:00
Matthias Clasen
bfbd95d7d6 Merge branch 'matthiasc/for-master' into 'master'
Stop using config.h.meson

See merge request GNOME/gtk!3936
2021-09-11 02:53:43 +00:00
Matthias Clasen
c1c1d4431d Refactor gdk_gl_context_upload_texture slightly
Introduce a gl_internalformat variable. This will
let us handle more formats in a uniform way in
future commits.
2021-09-10 22:17:31 -04:00
Matthias Clasen
155a4fac5c Add vectorized half-float conversion
We can't make the -4 versions inline, since
we use ifuncs for them, so make vectorized
versions.

Test included.
2021-09-10 22:17:31 -04:00
Matthias Clasen
76f481eb7b Stop using config.h.meson
It isn't necessary and makes us miss defines when
we forget to update it.
2021-09-10 21:08:07 -04:00
James Westman
0782c8a051 gdk_rgba_parse: Support HSL colors 2021-09-10 16:56:42 -05:00
Philipp Kiemle
3d27ff1177 Update German translation
(cherry picked from commit 6228954524)
2021-09-10 19:55:59 +00:00
Matthias Clasen
3ada664a89 Merge branch 'matthiasc/for-master' into 'master'
Fix the testupload test

See merge request GNOME/gtk!3934
2021-09-10 13:54:37 +00:00
Matthias Clasen
643a91bd08 Fix the testupload test
This can only ever have worked by accident.
2021-09-10 08:28:32 -04:00
Luca Bacci
93878da2ca Fix DND coordinates on Windows 2021-09-10 14:01:15 +02:00
Luca Bacci
3f798dbbcd Make the DND indicator not interfere with the drag and drop operation 2021-09-10 14:01:14 +02:00
Emin Tufan Çetin
c86733b4fa Update Turkish translation 2021-09-10 06:40:43 +00:00
Anders Jonsson
55099b7d0e Update Swedish translation 2021-09-08 20:25:27 +00:00
Matthias Clasen
72dc9a21f7 GtkApplication: Call setlocale early
If we don't call setlocale early enough,
--help output may come out misformatted.

Fixes: #4234
2021-09-06 01:38:47 -04:00
Boyuan Yang
db3858a204 Update Chinese (China) translation 2021-09-05 20:33:21 +00:00
Daniel Șerbănescu
07bff74544 Update Romanian translation
(cherry picked from commit bb72acf9cd)
2021-09-05 18:43:44 +00:00
Daniel Șerbănescu
b4262883a8 Update Romanian translation
(cherry picked from commit 63d829bbc1)
2021-09-05 18:34:37 +00:00
Matthias Clasen
563c85e222 Merge branch 'matthiasc/for-master' into 'master'
inspector: Cosmetics

See merge request GNOME/gtk!3925
2021-09-05 17:26:13 +00:00
Matthias Clasen
d75246a543 inspector: Cosmetics
Make some settings entries smaller, and make the
scales match in size. Also, inline adjustments
in the ui file, since we can do that now.
2021-09-05 12:59:11 -04:00
Matthias Clasen
b3856a3ea0 Merge branch 'matthiasc/for-master' into 'master'
Avoid hand-rolled color glyph information

See merge request GNOME/gtk!3924
2021-09-05 16:12:34 +00:00
Matthias Clasen
bd4d24f8ed Bump pango req to 1.49.1
We are using pango api that was introduced in 1.49.1
without ifdefs, so we should require it.
2021-09-05 10:58:50 -04:00
Matthias Clasen
65ce3eb207 Avoid hand-rolled color glyph information
Followup to b244f31337. Pango provides color glyph
information for us now, so we don't need to steal a
bit anymore.
2021-09-05 10:58:50 -04:00
Anders Jonsson
865ac44963 Update Swedish translation
(cherry picked from commit 19af960163)
2021-09-05 14:11:51 +00:00
Yaron Shahrabani
55a935db53 Update Hebrew translation 2021-09-05 13:45:49 +00:00
Matthias Clasen
6fefae3dbb Merge branch 'better-font-rendering-demo' into 'master'
gtk-demo: Improve the font rendering demo

See merge request GNOME/gtk!3923
2021-09-05 04:21:29 +00:00
Matthias Clasen
f7c84ddc7f gtk-demo: Font rendering - Add some bling
Fade the outlines and pixels in and out.
2021-09-04 23:41:44 -04:00
Matthias Clasen
f4a4dd2615 gtk-demo: Font rendering - expand docs 2021-09-04 23:05:55 -04:00
Matthias Clasen
b718d99d1f gtk-demo: Font rendering - Add keynav
Add mnemonics to most controls, and make
Ctrl+/- change the zoom.
2021-09-04 23:00:17 -04:00
Matthias Clasen
c7215d1199 gtk-demo: Font rendering - add outlines
Should outlines as well.
2021-09-04 22:56:07 -04:00
Matthias Clasen
24d69ef125 gtk-demo: Font rendering - better start
Turn antialiasing on initially, and turn the
extents and grid off. Otherwise we show pretty
shocking rendering right from the start.
2021-09-04 22:56:07 -04:00
Matthias Clasen
7c3fbdecf2 gtk-demo: Font rendering - improve the grid
Allow changing the character shown in the grid.
2021-09-04 22:56:07 -04:00
Matthias Clasen
b77938f40f Cosmetics
Remove an unused object from the font rendering
demo ui file.
2021-09-04 22:55:47 -04:00
Matthias Clasen
f703744564 Merge branch 'ebassi/accel-parse-doc' into 'master'
Improve the gtk_accelerator_parse() docs

See merge request GNOME/gtk!3921
2021-09-04 23:39:10 +00:00
Matthias Clasen
a3ccff3773 Merge branch 'text-fixes' into 'master'
textview: fix pango context invalidation

See merge request GNOME/gtk!3922
2021-09-04 21:39:30 +00:00
Asier Sarasua Garmendia
9869082c1c Update Basque translation
(cherry picked from commit 0768addbb3)
2021-09-04 20:54:41 +00:00
Matthias Clasen
754212d0f9 textview: Invalidate Pango contexts
We need to invalidate the Pango contexts when
font settings change. Use the new helper
gtk_widget_update_pango_context to make it less
likely that we forget to update some things.
2021-09-04 15:42:05 -04:00
Matthias Clasen
a9b81577c6 widget: Provide a helper for updating pango contexts 2021-09-04 15:42:05 -04:00
Matthias Clasen
eaa2dada54 Rename an internal function
It occupies a name I want to reuse for something else.
2021-09-04 15:42:05 -04:00
Matthias Clasen
ce2b2128bb Revert "gsk: Add font options to text nodes"
This reverts commit f1347f5841.
2021-09-04 15:42:05 -04:00
Matthias Clasen
41c25b8809 Revert "gsk: Add font options to the glyph cache"
This reverts commit 6599cb001f.
2021-09-04 15:42:05 -04:00
Matthias Clasen
b5ff35ff3e Revert "gsk: Pass font options along"
This reverts commit 299c7c3514.
2021-09-04 15:42:05 -04:00
Matthias Clasen
06423d807f Revert "gtk: Pass font options along"
This reverts commit 062a15310a.
2021-09-04 15:42:05 -04:00
Goran Vidović
0395395d52 Update Croatian translation
(cherry picked from commit 6fe3b21a01)
2021-09-04 18:12:03 +00:00
Emmanuele Bassi
c3ca48b249 Improve the gtk_accelerator_parse() docs
We need to escape the modifiers in angular brackets, or Markdown will
consider them as HTML tags.

We also should document the modifiers we're parsing.
2021-09-04 18:56:08 +01:00
Boyuan Yang
464e0aed04 Update Chinese (China) translation 2021-09-04 17:38:16 +00:00
Goran Vidović
d46e4fcecd Update Croatian translation
(cherry picked from commit 543b7defec)
2021-09-04 17:16:26 +00:00
Changwoo Ryu
363fb96e81 Update Korean translation 2021-09-04 09:02:48 +00:00
Changwoo Ryu
2382bd3bb2 Update Korean translation
(cherry picked from commit 0a5af76932)
2021-09-04 08:59:40 +00:00
Anders Jonsson
3b0a9e84ab Update Swedish translation
(cherry picked from commit 2dbcad428a)
2021-09-03 22:59:37 +00:00
gsittyz
bd7b8e87c1 Correct translation of Mac JIS Eisu & Kana keys
Since UCKeyTranslate() converts these keys to Space key unexpectedly,
applications can't distinguish these keys by keysyms.
To solve it, this fix translates these keys by the same way with
function keys & keypad keys.
This patch is equivalent to the patch proposed in:
https://bugzilla.gnome.org/show_bug.cgi?id=702841

Closes #4117
2021-07-24 20:59:18 +09:00
689 changed files with 79933 additions and 67395 deletions

32
.editorconfig Normal file
View File

@@ -0,0 +1,32 @@
# SPDX-FileCopyrightText: 2021 The GTK Authors
# SPDX-License-Identifier: CC0-1.0
root = true
[*]
charset = utf-8
end_of_line = lf
trim_trailing_whitespace = true
[*.[ch]]
indent_size = 2
indent_style = space
insert_final_newline = true
# For the legacy tabs which still exist in the code:
tab_width = 8
[*.ui]
indent_size = 2
indent_style = space
insert_final_newline = true
[*.xml]
indent_size = 2
indent_style = space
[meson.build]
indent_size = 2
indent_style = space
[*.md]
max_line_length = 80

View File

@@ -25,7 +25,7 @@ variables:
BACKEND_FLAGS: "-Dx11-backend=true -Dwayland-backend=true -Dbroadway-backend=true"
FEATURE_FLAGS: "-Dvulkan=enabled -Dcloudproviders=enabled"
MESON_TEST_TIMEOUT_MULTIPLIER: 3
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v33"
FEDORA_IMAGE: "registry.gitlab.gnome.org/gnome/gtk/fedora:v35"
FLATPAK_IMAGE: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master"
.only-default:
@@ -91,6 +91,7 @@ fedora-x86_64:
- meson compile -C _build_hello
- .gitlab-ci/run-tests.sh _build x11
- .gitlab-ci/run-tests.sh _build wayland
- .gitlab-ci/run-tests.sh _build waylandgles
- .gitlab-ci/run-tests.sh _build broadway
release-build:

View File

@@ -53,6 +53,7 @@ RUN dnf -y install \
libpng-devel \
librsvg2 \
libselinux-devel \
libtiff-devel \
libubsan \
libXcomposite-devel \
libXcursor-devel \
@@ -75,6 +76,7 @@ RUN dnf -y install \
pcre-devel \
pcre-static \
python3 \
python3-docutils \
python3-gobject \
python3-jinja2 \
python3-markdown \

View File

@@ -44,6 +44,24 @@ case "${backend}" in
kill ${compositor}
;;
waylandgles)
export XDG_RUNTIME_DIR="$(mktemp -p $(pwd) -d xdg-runtime-XXXXXX)"
weston --backend=headless-backend.so --socket=wayland-6 --idle-time=0 &
compositor=$!
export WAYLAND_DISPLAY=wayland-6
meson test -C ${builddir} \
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
--print-errorlogs \
--setup=${backend} \
--suite=gtk \
--no-suite=gsk-compare-broadway
exit_code=$?
kill ${compositor}
;;
broadway)
export XDG_RUNTIME_DIR="$(mktemp -p $(pwd) -d xdg-runtime-XXXXXX)"
@@ -62,6 +80,12 @@ case "${backend}" in
exit_code=0
kill ${server}
;;
*)
echo "Failed to add ${backend} to .gitlab-ci/run-tests.sh"
exit 1
;;
esac
cd ${builddir}

View File

@@ -48,7 +48,7 @@ if ! pkg-config --atleast-version=2.66.0 glib-2.0; then
fi
pkg-config --modversion glib-2.0
if ! pkg-config --atleast-version=1.49.0 pango; then
if ! pkg-config --atleast-version=1.49.3 pango; then
git clone https://gitlab.gnome.org/GNOME/pango.git _pango
meson setup _pango_build _pango
meson compile -C _pango_build

112
NEWS
View File

@@ -1,19 +1,127 @@
Overview of Changes
===================
Overview of Changes in 4.5.0
============================
* gsk:
- Drop the GL renderer in favor of NGL
- Rename NGL to GL
- Fix some coordinate overflow issues
- Reimplement texture upload and download for better
support of image formats and color spaces
- New api:
gsk_transform_skew
gsk_transform_to_2d_components
* gdk:
- Support HSL in gdk_rgba_parse
- Use libpng, libjpeg and libtiff directly when loading
textures, and support more image formats (including 16bit
and float formats)
- New apis:
gdk_texture_new_from_bytes
gdk_texture_new_from_filename
gdk_texture_download_float
gdk_texture_save_to_png_bytes
gdk_texture_save_to_tiff
gdk_texture_save_to_tiff_bytes
gdk_display_create_gl_context
- Implement GIcon and GLoadableIcon in GdkTexture
- Move EGL initialization to the frontend
- Use configless EGL contexts, if supported
- Use >8bit pixel formats, if supported and requested
* css:
- Add support for line-height
- Add support for text-transform
* theme:
- Fixes for buttons in toolbars
* input:
- Update compose sequences from libX11 1.7.2
- Accept replacement string longer than 20 characters
* text:
- Implement sloped caret drawing
- Add a gtk-hint-font-metrics setting to switch
font rendering to be more similar to GTK3
* GtkTextView:
- Add support for line height
- Add support for text transforms
- Misc fixes for css->pango attribute translations
- Invalidate pango contexts when font settings change
- Improve undo grouping when overwriting
* GtkListView:
- Make tree indentation more flexible with
GtkTreeExpander:indent-for-icon
* GtkMenuButton:
- Support custom children
* GtkFlowBox:
- Add prepend and append
* GtkCalendar:
- Fix handling of weeks starting on Monday
* GtkWindow:
- Add a titlebar property
* GtkDropDown:
- Add a show-arrow property
* GtkPopoverMenu:
- Support a use-markup attribute in menu models
* Add GtkSymbolicPaintable
* Tools:
- Support DND in gtk4-node-editor and the inspector's recorder
* Demos:
- Improve the font rendering demo
* Build:
- Require Pango 1.49
- Require libpng, libtiff and libjpeg
- Speed up handling of resources during build
* X11:
- Support touchpad gestures with XInput 2.4
* Windows:
- Fix DND coordinates
* Translation updates:
Basque
Brazilian Portuguese
Catalan
Chinese (China)
Croatian
Czech
Dutch
Finnish
French
Galician
German
Hebrew
Hungarian
Icelandic
Indonesian
Kazakh
Korean
Latvian
Lithuanian
Persian
Portuguese
Romanian
Serbian
Slovak
Spanish
Swedish
Turkish
Ukrainian
Overview of Changes in 4.4.0

View File

@@ -10,10 +10,12 @@ GTK is a multi-platform toolkit for creating graphical user interfaces.
Offering a complete set of widgets, GTK is suitable for projects ranging
from small one-off projects to complete application suites.
GTK is free software and part of the GNU Project. However, the
licensing terms for GTK, the GNU LGPL, allow it to be used by all
developers, including those developing proprietary software, without any
license fees or royalties.
GTK is a free and open-source software project. The licensing terms
for GTK, the GNU LGPL, allow it to be used by all developers, including those
developing proprietary software, without any license fees or royalties.
GTK is hosted by the GNOME project (thanks!) and used by a wide variety
of applications and projects.
The official download location
@@ -112,7 +114,7 @@ can be found in the file:
docs/reference/gtk/html/gtk-building.html
```
Or [online](https://developer.gnome.org/gtk4/stable/gtk-building.html)
Or [online](https://docs.gtk.org/gtk4/building.html)
How to report bugs
------------------
@@ -151,6 +153,9 @@ Contributing to GTK
Please, follow the [contribution guide](./CONTRIBUTING.md) to know how to
start contributing to GTK.
If you want to support GTK financially, please consider donating to
the GNOME project, which runs the infrastructure hosting GTK.
Release notes
-------------

View File

@@ -1,286 +0,0 @@
/* always defined to indicate that i18n is enabled */
#define ENABLE_NLS 1
/* Use structured logging */
#define G_LOG_STRUCTURED 1
/* The prefix for our gettext translation domains. */
#mesondefine GETTEXT_PACKAGE
/* Disable deprecation warnings from glib */
#mesondefine GLIB_DISABLE_DEPRECATION_WARNINGS
/* Define the location where the catalogs will be installed */
#mesondefine GTK_LOCALEDIR
/* Define to 1 if you have the `bind_textdomain_codeset' function. */
#mesondefine HAVE_BIND_TEXTDOMAIN_CODESET
/* Have the cloudproviders library */
#mesondefine HAVE_CLOUDPROVIDERS
/* define if we have colord */
#mesondefine HAVE_COLORD
/* Define to 1 if you have the <crt_externs.h> header file. */
#mesondefine HAVE_CRT_EXTERNS_H
/* Define to 1 if you have the `dcgettext' function. */
#mesondefine HAVE_DCGETTEXT
/* Define to 1 if you have the <dlfcn.h> header file. */
#mesondefine HAVE_DLFCN_H
/* Have the ffmpeg library */
#mesondefine HAVE_FFMPEG
/* Define to 1 if you have the <ftw.h> header file. */
#mesondefine HAVE_FTW_H
/* Define to 1 if you have the `getpagesize' function. */
#mesondefine HAVE_GETPAGESIZE
/* Define to 1 if you have the `getresuid' function. */
#mesondefine HAVE_GETRESUID
/* Define if gio-unix is available */
#mesondefine HAVE_GIO_UNIX
/* Define if GStreamer support is available */
#mesondefine HAVE_GSTREAMER
/* Define to 1 if you have the <inttypes.h> header file. */
#mesondefine HAVE_INTTYPES_H
/* Define to 1 if the system has the type `IPrintDialogCallback'. */
#mesondefine HAVE_IPRINTDIALOGCALLBACK
/* Define to 1 if you have the <locale.h> header file. */
#mesondefine HAVE_LOCALE_H
/* Define to 1 if you have the `lstat' function. */
#mesondefine HAVE_LSTAT
/* Define to 1 if you have the `mallinfo' function. */
#mesondefine HAVE_MALLINFO
/* Define to 1 if you have the <memory.h> header file. */
#mesondefine HAVE_MEMORY_H
/* Define to 1 if you have the `mkstemp' function. */
#mesondefine HAVE_MKSTEMP
/* Define to 1 if you have the `mlock` function. */
#mesondefine HAVE_MLOCK
/* Define to 1 if you have a working `mmap' system call. */
#mesondefine HAVE_MMAP
/* Define to 1 if you have a working `madvise' system call. */
#mesondefine HAVE_MADVISE
/* Define to 1 if you have the `posix_fallocate' function. */
#mesondefine HAVE_POSIX_FALLOCATE
/* Have the Xrandr extension library */
#mesondefine HAVE_RANDR
/* Have the Xrandr 1.5 extension library */
#mesondefine HAVE_RANDR15
/* Define to 1 if you have the `sincos' function. */
#mesondefine HAVE_SINCOS
/* Define to 1 if you have the <stdint.h> header file. */
#mesondefine HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#mesondefine HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#mesondefine HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#mesondefine HAVE_STRING_H
/* Define to 1 if you have the <sys/mman.h> header file. */
#mesondefine HAVE_SYS_MMAN_H
/* Define to 1 if you have the <sys/param.h> header file. */
#mesondefine HAVE_SYS_PARAM_H
/* Have the sysprof-capture library */
#mesondefine HAVE_SYSPROF
/* Define to 1 if you have the <sys/stat.h> header file. */
#mesondefine HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/time.h> header file. */
#mesondefine HAVE_SYS_TIME_H
/* Define to 1 if you have the <sys/types.h> header file. */
#mesondefine HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#mesondefine HAVE_UNISTD_H
/* Have the Xcursor library */
#mesondefine HAVE_XCURSOR
/* Have the XDAMAGE X extension */
#mesondefine HAVE_XDAMAGE
/* Have the XFIXES X extension */
#mesondefine HAVE_XFIXES
/* Define to 1 if XFree Xinerama is available */
#mesondefine HAVE_XFREE_XINERAMA
/* Have XGenericEvent */
#mesondefine HAVE_XGENERICEVENTS
/* Define to use XKB extension */
#mesondefine HAVE_XKB
/* Have the SYNC extension library */
#mesondefine HAVE_XSYNC
/* Define to 1 if you have the `_lock_file' function */
#mesondefine HAVE__LOCK_FILE
/* Define to 1 if you have the `flockfile' function */
#mesondefine HAVE_FLOCKFILE
/* Define if _NL_MEASUREMENT_MEASUREMENT is available */
#mesondefine HAVE__NL_MEASUREMENT_MEASUREMENT
/* Define if _NL_PAPER_HEIGHT is available */
#mesondefine HAVE__NL_PAPER_HEIGHT
/* Define if _NL_PAPER_WIDTH is available */
#mesondefine HAVE__NL_PAPER_WIDTH
/* Define if _NL_TIME_FIRST_WEEKDAY is available */
#mesondefine HAVE__NL_TIME_FIRST_WEEKDAY
/* Define to the sub-directory where libtool stores uninstalled libraries. */
#mesondefine LT_OBJDIR
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
#mesondefine NO_MINUS_C_MINUS_O
/* Define to the address where bug reports for this package should be sent. */
#mesondefine PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#mesondefine PACKAGE_NAME
/* Define to the full name and version of this package. */
#mesondefine PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#mesondefine PACKAGE_TARNAME
/* Define to the home page for this package. */
#mesondefine PACKAGE_URL
/* Define to the version of this package. */
#mesondefine PACKAGE_VERSION
/* Use NSBundle functions to determine load paths for libraries, translations,
etc. */
#mesondefine QUARTZ_RELOCATION
/* Define to 1 if you have the ANSI C header files. */
#mesondefine STDC_HEADERS
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# undef __EXTENSIONS__
#endif
/* Define to 1 if XInput 2.2 is available */
#mesondefine XINPUT_2_2
/* Define to 1 if the X Window System is missing or not being used. */
#mesondefine X_DISPLAY_MISSING
/* Enable large inode numbers on Mac OS X 10.5. */
#ifndef _DARWIN_USE_64_BIT_INODE
# define _DARWIN_USE_64_BIT_INODE 1
#endif
/* Number of bits in a file offset, on hosts where this is settable. */
#mesondefine _FILE_OFFSET_BITS
/* defines how to decorate public symbols while building */
#mesondefine _GDK_EXTERN
/* Define for large files, on AIX-style hosts. */
#mesondefine _LARGE_FILES
/* Define to 1 if on MINIX. */
#mesondefine _MINIX
/* Define to 2 if the system does not provide POSIX.1 features except with
this defined. */
#mesondefine _POSIX_1_SOURCE
/* Define to 1 if you need to in order for `stat' and other things to work. */
#mesondefine _POSIX_SOURCE
/* Define to `int' if <sys/types.h> doesn't define. */
#mesondefine gid_t
/* Define to `int' if <sys/types.h> doesn't define. */
#mesondefine uid_t
/* Define to 1 if linux/memfd.h exists */
#mesondefine HAVE_LINUX_MEMFD_H
#mesondefine HAVE_LINUX_INPUT_H
#mesondefine HAVE_DEV_EVDEV_INPUT_H
#mesondefine GTK_SYSCONFDIR
#mesondefine GTK_LOCALEDIR
#mesondefine GTK_DATADIR
#mesondefine GTK_LIBDIR
#mesondefine GTK_PRINT_BACKENDS
#mesondefine HAVE_CAIRO_SCRIPT_INTERPRETER
#mesondefine HAVE_HARFBUZZ
#mesondefine HAVE_PANGOFT
#mesondefine ISO_CODES_PREFIX
/* Define if tracker3 is available */
#mesondefine HAVE_TRACKER3
#mesondefine HAVE_F16C
/* Does the OS support GDesktopAppInfo? */
#mesondefine HAVE_DESKTOPAPPINFO

View File

@@ -1,6 +1,11 @@
/* Pango/Font Rendering
*
* Demonstrates various aspects of font rendering.
* Demonstrates various aspects of font rendering,
* such as hinting, antialiasing and grid alignment.
*
* The demo lets you explore font rendering options
* interactively to get a feeling for they affect the
* shape and positioning of the glyphs.
*/
#include <gtk/gtk.h>
@@ -17,10 +22,14 @@ static GtkWidget *down_button = NULL;
static GtkWidget *text_radio = NULL;
static GtkWidget *show_grid = NULL;
static GtkWidget *show_extents = NULL;
static GtkWidget *show_pixels = NULL;
static GtkWidget *show_outlines = NULL;
static PangoContext *context;
static int scale = 9;
static int scale = 7;
static double pixel_alpha = 1.0;
static double outline_alpha = 0.0;
static void
update_image (void)
@@ -28,7 +37,7 @@ update_image (void)
const char *text;
PangoFontDescription *desc;
PangoLayout *layout;
PangoRectangle ink, pink, logical;
PangoRectangle ink, logical;
int baseline;
cairo_surface_t *surface;
cairo_t *cr;
@@ -39,6 +48,7 @@ update_image (void)
cairo_hint_style_t hintstyle;
cairo_hint_metrics_t hintmetrics;
cairo_antialias_t antialias;
cairo_path_t *path;
if (!context)
context = gtk_widget_create_pango_context (image);
@@ -49,16 +59,18 @@ update_image (void)
fopt = cairo_font_options_copy (pango_cairo_context_get_font_options (context));
hint = gtk_combo_box_get_active_id (GTK_COMBO_BOX (hinting));
if (strcmp (hint, "none") == 0)
hintstyle = CAIRO_HINT_STYLE_NONE;
else if (strcmp (hint, "slight") == 0)
hintstyle = CAIRO_HINT_STYLE_SLIGHT;
else if (strcmp (hint, "medium") == 0)
hintstyle = CAIRO_HINT_STYLE_MEDIUM;
else if (strcmp (hint, "full") == 0)
hintstyle = CAIRO_HINT_STYLE_FULL;
else
hintstyle = CAIRO_HINT_STYLE_DEFAULT;
hintstyle = CAIRO_HINT_STYLE_DEFAULT;
if (hint)
{
if (strcmp (hint, "none") == 0)
hintstyle = CAIRO_HINT_STYLE_NONE;
else if (strcmp (hint, "slight") == 0)
hintstyle = CAIRO_HINT_STYLE_SLIGHT;
else if (strcmp (hint, "medium") == 0)
hintstyle = CAIRO_HINT_STYLE_MEDIUM;
else if (strcmp (hint, "full") == 0)
hintstyle = CAIRO_HINT_STYLE_FULL;
}
cairo_font_options_set_hint_style (fopt, hintstyle);
if (gtk_check_button_get_active (GTK_CHECK_BUTTON (hint_metrics)))
@@ -84,7 +96,6 @@ update_image (void)
pango_layout_set_font_description (layout, desc);
pango_layout_set_text (layout, text, -1);
pango_layout_get_extents (layout, &ink, &logical);
pink = ink;
baseline = pango_layout_get_baseline (layout);
pango_extents_to_pixels (&ink, NULL);
@@ -94,10 +105,14 @@ update_image (void)
cairo_set_source_rgb (cr, 1, 1, 1);
cairo_paint (cr);
cairo_set_source_rgb (cr, 0, 0, 0);
cairo_set_source_rgba (cr, 0, 0, 0, pixel_alpha);
cairo_move_to (cr, 10, 10);
pango_cairo_show_layout (cr, layout);
pango_cairo_layout_path (cr, layout);
path = cairo_copy_path (cr);
cairo_destroy (cr);
g_object_unref (layout);
@@ -136,7 +151,7 @@ update_image (void)
if (gtk_check_button_get_active (GTK_CHECK_BUTTON (show_extents)))
{
cairo_set_source_rgba (cr, 0, 0, 1, 1);
cairo_set_source_rgb (cr, 0, 0, 1);
cairo_rectangle (cr,
scale * (10 + pango_units_to_double (logical.x)) - 0.5,
@@ -149,17 +164,45 @@ update_image (void)
cairo_line_to (cr, scale * (10 + pango_units_to_double (logical.x + logical.width)) + 1,
scale * (10 + pango_units_to_double (baseline)) - 0.5);
cairo_stroke (cr);
cairo_set_source_rgba (cr, 1, 0, 0, 1);
cairo_set_source_rgb (cr, 1, 0, 0);
cairo_rectangle (cr,
scale * (10 + pango_units_to_double (pink.x)) + 0.5,
scale * (10 + pango_units_to_double (pink.y)) + 0.5,
scale * pango_units_to_double (pink.width) - 1,
scale * pango_units_to_double (pink.height) - 1);
scale * (10 + ink.x) - 0.5,
scale * (10 + ink.y) - 0.5,
scale * ink.width + 1,
scale * ink.height + 1);
cairo_stroke (cr);
}
for (int i = 0; i < path->num_data; i += path->data[i].header.length)
{
cairo_path_data_t *data = &path->data[i];
switch (data->header.type)
{
case CAIRO_PATH_CURVE_TO:
data[3].point.x *= scale; data[3].point.y *= scale;
data[2].point.x *= scale; data[2].point.y *= scale;
data[1].point.x *= scale; data[1].point.y *= scale;
break;
case CAIRO_PATH_LINE_TO:
case CAIRO_PATH_MOVE_TO:
data[1].point.x *= scale; data[1].point.y *= scale;
break;
case CAIRO_PATH_CLOSE_PATH:
break;
default:
g_assert_not_reached ();
}
}
cairo_set_source_rgba (cr, 0, 0, 0, outline_alpha);
cairo_move_to (cr, scale * 20 - 0.5, scale * 20 - 0.5);
cairo_append_path (cr, path);
cairo_stroke (cr);
cairo_surface_destroy (surface);
cairo_destroy (cr);
cairo_path_destroy (path);
}
else
{
@@ -167,10 +210,26 @@ update_image (void)
PangoLayoutRun *run;
PangoGlyphInfo *g;
int i, j;
GString *str;
gunichar ch;
if (*text == '\0')
text = " ";
ch = g_utf8_get_char (text);
str = g_string_new ("");
for (i = 0; i < 4; i++)
{
g_string_append_unichar (str, ch);
g_string_append_unichar (str, 0x200c);
}
layout = pango_layout_new (context);
pango_layout_set_font_description (layout, desc);
pango_layout_set_text (layout, "aaaa", -1);
pango_layout_set_text (layout, str->str, -1);
g_string_free (str, TRUE);
pango_layout_get_extents (layout, &ink, &logical);
pango_extents_to_pixels (&logical, NULL);
@@ -185,7 +244,7 @@ update_image (void)
cairo_set_source_rgb (cr, 0, 0, 0);
for (i = 0; i < 4; i++)
{
g = &(run->glyphs->glyphs[i]);
g = &(run->glyphs->glyphs[2*i]);
g->geometry.width = PANGO_UNITS_ROUND (g->geometry.width * 3 / 2);
}
@@ -193,7 +252,7 @@ update_image (void)
{
for (i = 0; i < 4; i++)
{
g = &(run->glyphs->glyphs[i]);
g = &(run->glyphs->glyphs[2*i]);
g->geometry.x_offset = i * (PANGO_SCALE / 4);
g->geometry.y_offset = j * (PANGO_SCALE / 4);
}
@@ -212,7 +271,6 @@ update_image (void)
cairo_surface_destroy (surface);
}
gtk_picture_set_pixbuf (GTK_PICTURE (image), pixbuf2);
g_object_unref (pixbuf2);
@@ -220,6 +278,78 @@ update_image (void)
pango_font_description_free (desc);
}
static gboolean fading = FALSE;
static double start_pixel_alpha;
static double end_pixel_alpha;
static double start_outline_alpha;
static double end_outline_alpha;
static gint64 start_time;
static gint64 end_time;
static double
ease_out_cubic (double t)
{
double p = t - 1;
return p * p * p + 1;
}
static gboolean
change_alpha (GtkWidget *widget,
GdkFrameClock *clock,
gpointer user_data)
{
gint64 now = g_get_monotonic_time ();
double t;
t = ease_out_cubic ((now - start_time) / (double) (end_time - start_time));
pixel_alpha = start_pixel_alpha + (end_pixel_alpha - start_pixel_alpha) * t;
outline_alpha = start_outline_alpha + (end_outline_alpha - start_outline_alpha) * t;
update_image ();
if (now >= end_time)
{
fading = FALSE;
return G_SOURCE_REMOVE;
}
return G_SOURCE_CONTINUE;
}
static void
start_alpha_fade (void)
{
gboolean pixels;
gboolean outlines;
if (fading)
return;
pixels = gtk_check_button_get_active (GTK_CHECK_BUTTON (show_pixels));
outlines = gtk_check_button_get_active (GTK_CHECK_BUTTON (show_outlines));
start_pixel_alpha = pixel_alpha;
if (pixels && outlines)
end_pixel_alpha = 0.5;
else if (pixels)
end_pixel_alpha = 1;
else
end_pixel_alpha = 0;
start_outline_alpha = outline_alpha;
if (outlines)
end_outline_alpha = 1.0;
else
end_outline_alpha = 0.0;
start_time = g_get_monotonic_time ();
end_time = start_time + G_TIME_SPAN_SECOND / 2;
fading = TRUE;
gtk_widget_add_tick_callback (window, change_alpha, NULL, NULL);
}
static void
update_buttons (void)
{
@@ -227,20 +357,26 @@ update_buttons (void)
gtk_widget_set_sensitive (down_button, scale > 1);
}
static void
scale_up (void)
static gboolean
scale_up (GtkWidget *widget,
GVariant *args,
gpointer user_data)
{
scale += 1;
update_buttons ();
update_image ();
return TRUE;
}
static void
scale_down (void)
static gboolean
scale_down (GtkWidget *widget,
GVariant *args,
gpointer user_data)
{
scale -= 1;
update_buttons ();
update_image ();
return TRUE;
}
GtkWidget *
@@ -266,6 +402,8 @@ do_fontrendering (GtkWidget *do_widget)
text_radio = GTK_WIDGET (gtk_builder_get_object (builder, "text_radio"));
show_grid = GTK_WIDGET (gtk_builder_get_object (builder, "show_grid"));
show_extents = GTK_WIDGET (gtk_builder_get_object (builder, "show_extents"));
show_pixels = GTK_WIDGET (gtk_builder_get_object (builder, "show_pixels"));
show_outlines = GTK_WIDGET (gtk_builder_get_object (builder, "show_outlines"));
g_signal_connect (up_button, "clicked", G_CALLBACK (scale_up), NULL);
g_signal_connect (down_button, "clicked", G_CALLBACK (scale_down), NULL);
@@ -277,6 +415,8 @@ do_fontrendering (GtkWidget *do_widget)
g_signal_connect (text_radio, "notify::active", G_CALLBACK (update_image), NULL);
g_signal_connect (show_grid, "notify::active", G_CALLBACK (update_image), NULL);
g_signal_connect (show_extents, "notify::active", G_CALLBACK (update_image), NULL);
g_signal_connect (show_pixels, "notify::active", G_CALLBACK (start_alpha_fade), NULL);
g_signal_connect (show_outlines, "notify::active", G_CALLBACK (start_alpha_fade), NULL);
update_image ();

View File

@@ -1,13 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkAdjustment" id="scale_adj">
<property name="upper">24</property>
<property name="step-increment">1</property>
<property name="page-increment">4</property>
</object>
<object class="GtkWindow" id="window">
<property name="default-width">1080</property>
<property name="default-height">430</property>
<property name="default-width">1024</property>
<property name="default-height">768</property>
<child type="titlebar">
<object class="GtkHeaderBar">
<child type="title">
@@ -87,20 +82,20 @@
</object>
</child>
<child>
<object class="GtkLabel">
<property name="label">Hinting</property>
<property name="xalign">1</property>
<style>
<class name="dim-label"/>
</style>
<object class="GtkCheckButton" id="show_pixels">
<property name="label">Show _Pixels</property>
<property name="use-underline">1</property>
<property name="active">1</property>
<layout>
<property name="column">3</property>
<property name="row">0</property>
</layout>
</object>
</child>
<child>
<object class="GtkCheckButton" id="antialias">
<property name="label">Antialias</property>
<object class="GtkCheckButton" id="show_outlines">
<property name="label">Show _Outline</property>
<property name="use-underline">1</property>
<layout>
<property name="column">3</property>
<property name="row">1</property>
@@ -108,45 +103,73 @@
</object>
</child>
<child>
<object class="GtkComboBoxText" id="hinting">
<property name="active">0</property>
<property name="valign">center</property>
<items>
<item translatable="yes" id="none">None</item>
<item translatable="yes" id="slight">Slight</item>
<item translatable="yes" id="medium">Medium</item>
<item translatable="yes" id="full">Full</item>
</items>
<object class="GtkBox">
<property name="spacing">6</property>
<child>
<object class="GtkLabel">
<property name="label">_Hinting</property>
<property name="use-underline">1</property>
<property name="mnemonic-widget">hinting</property>
<style>
<class name="dim-label"/>
</style>
</object>
</child>
<child>
<object class="GtkComboBoxText" id="hinting">
<property name="active">0</property>
<property name="valign">center</property>
<items>
<item translatable="yes" id="none">None</item>
<item translatable="yes" id="slight">Slight</item>
<item translatable="yes" id="medium">Medium</item>
<item translatable="yes" id="full">Full</item>
</items>
</object>
</child>
<layout>
<property name="column">4</property>
<property name="column-span">2</property>
</layout>
</object>
</child>
<child>
<object class="GtkCheckButton" id="antialias">
<property name="label">_Antialias</property>
<property name="use-underline">1</property>
<property name="active">1</property>
<layout>
<property name="column">4</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkCheckButton" id="hint_metrics">
<property name="label">Hint Metrics</property>
<property name="label">Hint _Metrics</property>
<property name="use-underline">1</property>
<layout>
<property name="column">4</property>
<property name="column">5</property>
<property name="row">1</property>
</layout>
</object>
</child>
<child>
<object class="GtkCheckButton" id="show_extents">
<property name="label">Show Extents</property>
<property name="active">1</property>
<property name="label">Show _Extents</property>
<property name="use-underline">1</property>
<layout>
<property name="column">5</property>
<property name="column">6</property>
<property name="row">0</property>
</layout>
</object>
</child>
<child>
<object class="GtkCheckButton" id="show_grid">
<property name="active">1</property>
<property name="label">Show Grid</property>
<property name="label">Show _Grid</property>
<property name="use-underline">1</property>
<layout>
<property name="column">5</property>
<property name="column">6</property>
<property name="row">1</property>
</layout>
</object>
@@ -154,11 +177,24 @@
<child>
<object class="GtkButton" id="up_button">
<property name="icon-name">list-add-symbolic</property>
<property name="halign">center</property>
<property name="valign">center</property>
<style>
<class name="circular"/>
</style>
<child>
<object class="GtkShortcutController">
<property name="scope">managed</property>
<child>
<object class="GtkShortcut">
<property name="trigger">&lt;Control&gt;plus</property>
<property name="action">activate</property>
</object>
</child>
</object>
</child>
<layout>
<property name="column">6</property>
<property name="column">7</property>
<property name="row">0</property>
</layout>
</object>
@@ -166,11 +202,24 @@
<child>
<object class="GtkButton" id="down_button">
<property name="icon-name">list-remove-symbolic</property>
<property name="halign">center</property>
<property name="valign">center</property>
<style>
<class name="circular"/>
</style>
<child>
<object class="GtkShortcutController">
<property name="scope">managed</property>
<child>
<object class="GtkShortcut">
<property name="trigger">&lt;Control&gt;minus</property>
<property name="action">activate</property>
</object>
</child>
</object>
</child>
<layout>
<property name="column">6</property>
<property name="column">7</property>
<property name="row">1</property>
</layout>
</object>
@@ -179,7 +228,7 @@
<object class="GtkLabel">
<property name="hexpand">1</property>
<layout>
<property name="column">7</property>
<property name="column">8</property>
</layout>
</object>
</child>

View File

@@ -874,8 +874,8 @@ gtk_gears_tick (GtkWidget *widget,
{
GtkGears *gears = GTK_GEARS (widget);
GtkGearsPrivate *priv = gtk_gears_get_instance_private (gears);
GdkFrameTimings *timings, *previous_timings;
gint64 previous_frame_time = 0;
GdkFrameTimings *previous_timings;
gint64 previous_frame_time;
gint64 frame_time;
gint64 history_start, history_len;
gint64 frame;
@@ -915,12 +915,6 @@ gtk_gears_tick (GtkWidget *widget,
}
}
timings = gdk_frame_clock_get_current_timings (frame_clock);
previous_timings = gdk_frame_clock_get_timings (frame_clock,
gdk_frame_timings_get_frame_counter (timings) - 1);
if (previous_timings != NULL)
previous_frame_time = gdk_frame_timings_get_frame_time (previous_timings);
return G_SOURCE_CONTINUE;
}

View File

@@ -94,13 +94,12 @@ show_page (GtkTextView *text_view,
gtk_text_buffer_insert (buffer, &iter, " can easily be realized with ", -1);
insert_link (buffer, &iter, "tags", 2);
gtk_text_buffer_insert (buffer, &iter, ".\n", -1);
gtk_text_buffer_insert (buffer, &iter,
"Of course you can also embed Emoji 😋, "
"icons ", -1);
gtk_text_buffer_insert (buffer, &iter, "Of course you can also embed Emoji 😋, ", -1);
gtk_text_buffer_insert (buffer, &iter, "icons ", -1);
theme = gtk_icon_theme_get_for_display (gtk_widget_get_display (GTK_WIDGET (text_view)));
icon = gtk_icon_theme_lookup_icon (theme,
"microphone-sensitivity-high-symbolic",
"eye-not-looking-symbolic",
NULL,
16,
1,

View File

@@ -8,7 +8,7 @@
#include <stdlib.h>
#include <string.h>
static GdkPixbuf *avatar_pixbuf_other;
static GdkTexture *avatar_texture_other;
static GtkWidget *window = NULL;
#define GTK_TYPE_MESSAGE (gtk_message_get_type ())
@@ -196,12 +196,9 @@ gtk_message_row_update (GtkMessageRow *row)
gtk_button_set_label (GTK_BUTTON (priv->resent_by_button), priv->message->resent_by);
if (strcmp (priv->message->sender_nick, "@GTKtoolkit") == 0)
{
gtk_image_set_from_icon_name (priv->avatar_image, "org.gtk.Demo4");
gtk_image_set_icon_size (priv->avatar_image, GTK_ICON_SIZE_LARGE);
}
gtk_image_set_from_icon_name (priv->avatar_image, "org.gtk.Demo4");
else
gtk_image_set_from_pixbuf (priv->avatar_image, avatar_pixbuf_other);
gtk_image_set_from_paintable (priv->avatar_image, GDK_PAINTABLE (avatar_texture_other));
}
@@ -344,7 +341,7 @@ do_listbox (GtkWidget *do_widget)
if (!window)
{
avatar_pixbuf_other = gdk_pixbuf_new_from_resource_at_scale ("/listbox/apple-red.png", 32, 32, FALSE, NULL);
avatar_texture_other = gdk_texture_new_from_resource ("/listbox/apple-red.png");
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),

View File

@@ -25,6 +25,7 @@
<property name="margin-start">8</property>
<property name="margin-end">8</property>
<property name="icon-name">image-missing</property>
<property name="icon-size">large</property>
<layout>
<property name="column">0</property>
<property name="row">0</property>

View File

@@ -177,6 +177,15 @@ file_open_cb (GtkWidget *button,
gtk_native_dialog_show (GTK_NATIVE_DIALOG (dialog));
}
static void
listview_activate_cb (GtkListView *listview,
guint pos,
gpointer unused)
{
gtk_fixed_item_selection_set_selected_position (GTK_FIXED_ITEM_SELECTION (gtk_list_view_get_model (listview)),
pos);
}
GtkWidget *
do_listview_words (GtkWidget *do_widget)
{
@@ -185,6 +194,7 @@ do_listview_words (GtkWidget *do_widget)
GtkWidget *header, *listview, *sw, *vbox, *search_entry, *open_button, *overlay;
GtkFilterListModel *filter_model;
GtkStringList *stringlist;
GtkFixedItemSelection *selection;
GtkFilter *filter;
GFile *file;
@@ -241,11 +251,15 @@ do_listview_words (GtkWidget *do_widget)
gtk_widget_set_vexpand (sw, TRUE);
gtk_overlay_set_child (GTK_OVERLAY (overlay), sw);
selection = gtk_fixed_item_selection_new (G_LIST_MODEL (filter_model));
listview = gtk_list_view_new (
GTK_SELECTION_MODEL (gtk_no_selection_new (G_LIST_MODEL (filter_model))),
GTK_SELECTION_MODEL (selection),
gtk_builder_list_item_factory_new_from_bytes (NULL,
g_bytes_new_static (factory_text, strlen (factory_text))));
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), listview);
gtk_list_view_set_single_click_activate (GTK_LIST_VIEW (listview), TRUE);
g_signal_connect (listview, "activate", G_CALLBACK (listview_activate_cb), NULL);
g_signal_connect (filter_model, "items-changed", G_CALLBACK (update_title_cb), progress);
g_signal_connect (filter_model, "notify::pending", G_CALLBACK (update_title_cb), progress);

View File

@@ -156,10 +156,74 @@ demos_h = custom_target('gtk4 demo header',
command: [ find_program('geninclude.py'), '@OUTPUT@', '@INPUT@' ],
)
gtkdemo_resources = gnome.compile_resources('gtkdemo_resources',
'demo.gresource.xml',
source_dir: '.',
)
objcopy_supports_add_symbol = false
objcopy = find_program('objcopy', required : false)
if objcopy.found()
objcopy_supports_add_symbol = run_command(objcopy, '--help').stdout().contains('--add-symbol')
endif
ld = find_program('ld', required : false)
if build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_add_symbol and ld.found()
glib_compile_resources = find_program('glib-compile-resources')
# Create the resource blob
gtkdemo_gresource = custom_target('gtkdemo.gresource',
input : 'demo.gresource.xml',
output : 'gtkdemo.gresource',
depfile : 'gtkdemo.gresource.d',
command : [glib_compile_resources,
'--generate',
'--target=@OUTPUT@',
'--dependency-file=@DEPFILE@',
'--sourcedir=' + meson.current_source_dir(),
'--sourcedir=' + meson.current_build_dir(),
'@INPUT@'])
# Create resource data file
gtkdemo_resources_c = custom_target('gtkdemo_resources.c',
input : 'demo.gresource.xml',
output : 'gtkdemo_resources.c',
depfile : 'gtkdemo_resources.c.d',
command : [glib_compile_resources,
'--generate-source',
'--target=@OUTPUT@',
'--dependency-file=@DEPFILE@',
'--sourcedir=' + meson.current_source_dir(),
'--sourcedir=' + meson.current_build_dir(),
'--external-data',
'--c-name', '_g_binary_gtkdemo',
'@INPUT@'])
# Create object file containing resource data
gtkdemo_resources_binary = custom_target('gtkdemo_resources.o',
input : gtkdemo_gresource,
output : 'gtkdemo_resources.o',
command : [ld,
'-r',
'-b','binary',
'@INPUT@',
'-o','@OUTPUT@'])
# Rename symbol to match the one in the C file
gtkdemo_resources_o = custom_target('gtkdemo_resources2.o',
input : gtkdemo_resources_binary,
output : 'gtkdemo_resources2.o',
command : [objcopy,
'--add-symbol','_g_binary_gtkdemo_resource_data=.data:0',
'@INPUT@',
'@OUTPUT@'])
gtkdemo_resources = [
gtkdemo_resources_c,
gtkdemo_resources_o,
]
else
gtkdemo_resources = gnome.compile_resources('gtkdemo_resources',
'demo.gresource.xml',
source_dir: '.',
)
endif
# Use a subset of compiler flags
demo_cflags = []

View File

@@ -33,7 +33,7 @@
<developer_name>Matthias Clasen and others</developer_name>
<content_rating type="oars-1.1"/>
<releases>
<release version="@BUILD_VERSION@" date="@BUILD_DATE@">
<release version="@BUILD_VERSION@">
<description>
<p>A new build of GTK.</p>
</description>

View File

@@ -32,7 +32,7 @@
<developer_name>Matthias Clasen and others</developer_name>
<content_rating type="oars-1.1"/>
<releases>
<release version="@BUILD_VERSION@" date="@BUILD_DATE@">
<release version="@BUILD_VERSION@">
<description>
<p>A new build of GTK.</p>
</description>

View File

@@ -12,19 +12,9 @@ demo_conf_h = declare_dependency(
)
# appdata
today = 'unknown'
date = find_program('date',
required: false)
if date.found()
r = run_command(date, '-I')
if r.returncode() == 0
today = r.stdout().strip()
endif
endif
appdata_config = configuration_data()
appdata_config.set('BUILD_VERSION', meson.project_version())
appdata_config.set('BUILD_DATE', today)
subdir('constraint-editor')
subdir('gtk-demo')

View File

@@ -24,7 +24,7 @@
#include "gtkrendererpaintableprivate.h"
#include "gsk/gskrendernodeparserprivate.h"
#include "gsk/ngl/gsknglrenderer.h"
#include "gsk/gl/gskglrenderer.h"
#ifdef GDK_WINDOWING_BROADWAY
#include "gsk/broadway/gskbroadwayrenderer.h"
#endif
@@ -646,7 +646,6 @@ create_cairo_texture (NodeEditorWindow *self)
GskRenderer *renderer;
GskRenderNode *node;
GdkTexture *texture;
GdkSurface *surface;
paintable = gtk_picture_get_paintable (GTK_PICTURE (self->picture));
if (paintable == NULL ||
@@ -659,9 +658,8 @@ create_cairo_texture (NodeEditorWindow *self)
if (node == NULL)
return NULL;
surface = gtk_native_get_surface (gtk_widget_get_native (GTK_WIDGET (self)));
renderer = gsk_cairo_renderer_new ();
gsk_renderer_realize (renderer, surface, NULL);
gsk_renderer_realize (renderer, NULL, NULL);
texture = gsk_renderer_render_texture (renderer, node, NULL);
gsk_render_node_unref (node);
@@ -839,16 +837,18 @@ node_editor_window_add_renderer (NodeEditorWindow *self,
GskRenderer *renderer,
const char *description)
{
GdkSurface *surface;
GdkPaintable *paintable;
surface = gtk_native_get_surface (GTK_NATIVE (self));
g_assert (surface != NULL);
if (renderer != NULL && !gsk_renderer_realize (renderer, surface, NULL))
if (!gsk_renderer_realize (renderer, NULL, NULL))
{
g_object_unref (renderer);
return;
GdkSurface *surface = gtk_native_get_surface (GTK_NATIVE (self));
g_assert (surface != NULL);
if (!gsk_renderer_realize (renderer, surface, NULL))
{
g_object_unref (renderer);
return;
}
}
paintable = gtk_renderer_paintable_new (renderer, gtk_picture_get_paintable (GTK_PICTURE (self->picture)));
@@ -872,7 +872,7 @@ node_editor_window_realize (GtkWidget *widget)
"Default");
#endif
node_editor_window_add_renderer (self,
gsk_ngl_renderer_new (),
gsk_gl_renderer_new (),
"OpenGL");
#ifdef GDK_RENDERING_VULKAN
node_editor_window_add_renderer (self,

View File

@@ -198,6 +198,7 @@
<child>
<object class="GtkPicture" id="picture">
<property name="can-shrink">0</property>
<property name="keep-aspect-ratio">1</property>
<property name="halign">center</property>
<property name="valign">center</property>
<child>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 MiB

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

View File

@@ -1,9 +1,73 @@
# demos/widget-factory
widgetfactory_resources = gnome.compile_resources('widgetfactory_resources',
'widget-factory.gresource.xml',
source_dir: '.',
)
objcopy_supports_add_symbol = false
objcopy = find_program('objcopy', required : false)
if objcopy.found()
objcopy_supports_add_symbol = run_command(objcopy, '--help').stdout().contains('--add-symbol')
endif
ld = find_program('ld', required : false)
if build_machine.system() == 'linux' and objcopy.found() and objcopy_supports_add_symbol and ld.found()
glib_compile_resources = find_program('glib-compile-resources')
# Create the resource blob
widgetfactory_gresource = custom_target('widgetfactory.gresource',
input : 'widget-factory.gresource.xml',
output : 'widgetfactory.gresource',
depfile: 'widgetfactory.gresource.d',
command : [glib_compile_resources,
'--generate',
'--target=@OUTPUT@',
'--dependency-file=@DEPFILE@',
'--sourcedir=' + meson.current_source_dir(),
'--sourcedir=' + meson.current_build_dir(),
'@INPUT@'])
# Create resource data file
widgetfactory_resources_c = custom_target('widgetfactory_resources.c',
input : 'widget-factory.gresource.xml',
output : 'widgetfactory_resources.c',
depfile: 'widgetfactory_resources.c.d',
command : [glib_compile_resources,
'--generate-source',
'--target=@OUTPUT@',
'--dependency-file=@DEPFILE@',
'--sourcedir=' + meson.current_source_dir(),
'--sourcedir=' + meson.current_build_dir(),
'--external-data',
'--c-name', '_g_binary_widgetfactory',
'@INPUT@'])
# Create object file containing resource data
widgetfactory_resources_binary = custom_target('widgetfactory_resources.o',
input : widgetfactory_gresource,
output : 'widgetfactory_resources.o',
command : [ld,
'-r',
'-b','binary',
'@INPUT@',
'-o','@OUTPUT@'])
# Rename symbol to match the one in the C file
widgetfactory_resources_o = custom_target('widgetfactory_resources2.o',
input : widgetfactory_resources_binary,
output : 'widgetfactory_resources2.o',
command : [objcopy,
'--add-symbol','_g_binary_widgetfactory_resource_data=.data:0',
'@INPUT@',
'@OUTPUT@'])
widgetfactory_resources = [
widgetfactory_resources_c,
widgetfactory_resources_o,
]
else
widgetfactory_resources = gnome.compile_resources('widgetfactory_resources',
'widget-factory.gresource.xml',
source_dir: '.',
)
endif
executable('gtk4-widget-factory',
sources: ['widget-factory.c', widgetfactory_resources],

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 MiB

After

Width:  |  Height:  |  Size: 38 KiB

View File

@@ -34,7 +34,7 @@
<developer_name>Matthias Clasen and others</developer_name>
<content_rating type="oars-1.1"/>
<releases>
<release version="@BUILD_VERSION@" date="@BUILD_DATE@">
<release version="@BUILD_VERSION@">
<description>
<p>A new build of GTK.</p>
</description>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 MiB

After

Width:  |  Height:  |  Size: 59 KiB

File diff suppressed because it is too large Load Diff

View File

@@ -33,7 +33,7 @@ calls to different backends, and error out on unsupported windowing systems:
else
#endif
#ifdef GDK_WINDOWING_WAYLAND
if (GTK_IS_WAYLAND_DISPLAY (display))
if (GDK_IS_WAYLAND_DISPLAY (display))
{
// make Wayland-specific calls here
}

View File

@@ -16,12 +16,10 @@ if get_option('gtk_doc')
command: [
gidocgen,
'generate',
'--quiet',
'--fatal-warnings',
gidocgen_common_args,
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gtk'),
'--config=@INPUT0@',
'--output-dir=@OUTPUT@',
'--no-namespace-dir',
'--content-dir=@0@'.format(meson.current_source_dir()),
'@INPUT1@',
],
@@ -46,12 +44,10 @@ if get_option('gtk_doc')
command: [
gidocgen,
'generate',
'--quiet',
'--fatal-warnings',
gidocgen_common_args,
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gtk'),
'--config=@INPUT0@',
'--output-dir=@OUTPUT@',
'--no-namespace-dir',
'--content-dir=@0@'.format(meson.current_source_dir()),
'@INPUT1@',
],
@@ -78,12 +74,10 @@ if get_option('gtk_doc')
command: [
gidocgen,
'generate',
'--quiet',
'--fatal-warnings',
gidocgen_common_args,
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gtk'),
'--config=@INPUT0@',
'--output-dir=@OUTPUT@',
'--no-namespace-dir',
'--content-dir=@0@'.format(meson.current_source_dir()),
'@INPUT1@',
],

View File

@@ -13,4 +13,5 @@ baseURLs = [
[ 'Gtk', 'https://docs.gtk.org/gtk4/' ],
[ 'Pango', 'https://docs.gtk.org/Pango/' ],
[ 'PangoCairo', 'https://docs.gtk.org/PangoCairo/' ],
[ 'GdkPixbuf', 'https://docs.gtk.org/gdk-pixbuf/' ],
]

View File

@@ -23,7 +23,7 @@ calls to different backends, and error out on unsupported windowing systems:
#endif
#ifdef GDK_WINDOWING_WAYLAND
if (GTK_IS_WAYLAND_DISPLAY (display))
if (GDK_IS_WAYLAND_DISPLAY (display))
{
// make Wayland-specific calls here
}

View File

@@ -29,7 +29,7 @@ calls to different backends, and error out on unsupported windowing systems:
else
#endif
#ifdef GDK_WINDOWING_WAYLAND
if (GTK_IS_WAYLAND_DISPLAY (display))
if (GDK_IS_WAYLAND_DISPLAY (display))
{
// make Wayland-specific calls here
}

View File

@@ -13,12 +13,10 @@ if get_option('gtk_doc')
command: [
gidocgen,
'generate',
'--quiet',
'--fatal-warnings',
gidocgen_common_args,
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gtk'),
'--config=@INPUT0@',
'--output-dir=@OUTPUT@',
'--no-namespace-dir',
'--content-dir=@0@'.format(meson.current_source_dir()),
'@INPUT1@',
],

View File

@@ -13,4 +13,5 @@ baseURLs = [
[ 'Gtk', 'https://docs.gtk.org/gtk4/' ],
[ 'Pango', 'https://docs.gtk.org/Pango/' ],
[ 'PangoCairo', 'https://docs.gtk.org/PangoCairo/' ],
[ 'GdkPixbuf', 'https://docs.gtk.org/gdk-pixbuf/' ],
]

View File

@@ -3,13 +3,13 @@ Slug: gtk-getting-started
GTK is a [widget toolkit](http://en.wikipedia.org/wiki/Widget_toolkit).
Each user interface created by GTK consists of widgets. This is implemented
in C using [GObject](#gobject), an object-oriented framework for C. Widgets
in C using [class@GObject.Object], an object-oriented framework for C. Widgets
are organized in a hierarchy. The window widget is the main container.
The user interface is then built by adding buttons, drop-down menus, input
fields, and other widgets to the window. If you are creating complex user
interfaces it is recommended to use GtkBuilder and its GTK-specific markup
description language, instead of assembling the interface manually. You can
also use a visual user interface editor, like [glade](https://glade.gnome.org/).
also use a visual user interface editor, like [Glade](https://glade.gnome.org/).
GTK is event-driven. The toolkit listens for events such as a click
on a button, and passes the event to your application.
@@ -17,7 +17,7 @@ on a button, and passes the event to your application.
This chapter contains some tutorial information to get you started with
GTK programming. It assumes that you have GTK, its dependencies and a C
compiler installed and ready to use. If you need to build GTK itself first,
refer to the [Compiling the GTK libraries](#gtk-compiling) section in this
refer to the [Compiling the GTK libraries](building.html) section in this
reference.
## Basics
@@ -68,7 +68,7 @@ gcc $( pkg-config --cflags gtk4 ) -o example-0 example-0.c $( pkg-config --libs
```
For more information on how to compile a GTK application, please
refer to the [Compiling GTK Applications](#gtk-compiling)
refer to the [Compiling GTK Applications](compiling.html)
section in this reference.
All GTK applications will, of course, include `gtk/gtk.h`, which declares
@@ -106,16 +106,16 @@ The call to [ctor@Gtk.ApplicationWindow.new] will create a new
window will have a frame, a title bar, and window controls depending on the
platform.
A window title is set using [method@Gtk.Window.set_title]. This function
A window title is set using [`method@Gtk.Window.set_title`]. This function
takes a `GtkWindow` pointer and a string as input. As our `window` pointer
is a `GtkWidget` pointer, we need to cast it to `GtkWindow`; instead of
casting `window` via a typical C cast like `(GtkWindow*)`, `window` can be
cast using the macro `GTK_WINDOW()`. `GTK_WINDOW()` will check if the
pointer is an instance of the `GtkWindow` class, before casting, and emit a
warning if the check fails. More information about this convention can be
found [here](https://developer.gnome.org/gobject/stable/gtype-conventions.html).
found [in the GObject documentation](https://docs.gtk.org/gobject/concepts.html#conventions).
Finally the window size is set using [method@Gtk.Window.set_default_size]
Finally the window size is set using [`method@Gtk.Window.set_default_size`]
and the window is then shown by GTK via [method@Gtk.Widget.show].
When you close the window, by (for example) pressing the X button, the
@@ -161,19 +161,24 @@ activate (GtkApplication *app,
{
GtkWidget *window;
GtkWidget *button;
GtkWidget *box;
window = gtk_application_window_new (app);
gtk_window_set_title (GTK_WINDOW (window), "Window");
gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_set_halign (box, GTK_ALIGN_CENTER);
gtk_widget_set_valign (box, GTK_ALIGN_CENTER);
gtk_window_set_child (GTK_WINDOW (window), box);
button = gtk_button_new_with_label ("Hello World");
gtk_widget_set_halign (button, GTK_ALIGN_CENTER);
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
g_signal_connect (button, "clicked", G_CALLBACK (print_hello), NULL);
g_signal_connect_swapped (button, "clicked", G_CALLBACK (gtk_window_destroy), window);
gtk_window_set_child (GTK_WINDOW (window), button);
gtk_box_append (GTK_BOX (box), button);
gtk_widget_show (window);
}
@@ -212,10 +217,10 @@ The `GtkBox` widget is created with [ctor@Gtk.Box.new], which takes a
this box will contain can either be laid out horizontally or vertically.
This does not matter in this particular case, as we are dealing with only
one button. After initializing box with the newly created `GtkBox`, the code
adds the box widget to the window widget using [method@Gtk.Window.set_child].
adds the box widget to the window widget using [`method@Gtk.Window.set_child`].
Next the `button` variable is initialized in similar manner.
[ctor@Gtk.Button.new_with_label] is called which returns a
[`ctor@Gtk.Button.new_with_label`] is called which returns a
[class@Gtk.Button] to be stored in `button`. Afterwards `button` is added to
our `box`.
@@ -241,8 +246,8 @@ More information about creating buttons can be found
[here](https://wiki.gnome.org/HowDoI/Buttons).
The rest of the code in `example-1.c` is identical to `example-0.c`. The next
section will elaborate further on how to add several GtkWidgets to your GTK
application.
section will elaborate further on how to add several [class@Gtk.Widget]s to your
GTK application.
## Packing
@@ -251,10 +256,18 @@ a window. When you do so, it becomes important to control how each widget is
positioned and sized. This is where packing comes in.
GTK comes with a large variety of _layout containers_ whose purpose it
is to control the layout of the child widgets that are added to them.
See [Layout containers](#LayoutContainers) for an overview.
is to control the layout of the child widgets that are added to them, like:
The following example shows how the GtkGrid container lets you
- [class@Gtk.Box]
- [class@Gtk.Grid]
- [class@Gtk.Revealer]
- [class@Gtk.Stack]
- [class@Gtk.Overlay]
- [class@Gtk.Paned]
- [class@Gtk.Expander]
- [class@Gtk.Fixed]
The following example shows how the [class@Gtk.Grid] container lets you
arrange several buttons:
![Grid packing](grid-packing.png)
@@ -353,11 +366,11 @@ draw function.
The contents of a widget often need to be partially or fully redrawn, e.g.
when another window is moved and uncovers part of the widget, or when the
window containing it is resized. It is also possible to explicitly cause a
widget to be redrawn, by calling [method@Gtk.Widget.queue_draw]. GTK takes
widget to be redrawn, by calling [`method@Gtk.Widget.queue_draw`]. GTK takes
care of most of the details by providing a ready-to-use cairo context to the
draw function.
The following example shows how to use a draw function with GtkDrawingArea.
The following example shows how to use a draw function with [class@Gtk.DrawingArea].
It is a bit more complicated than the previous examples, since it also
demonstrates input event handling with event controllers.
@@ -402,9 +415,9 @@ resize_cb (GtkWidget *widget,
if (gtk_native_get_surface (gtk_widget_get_native (widget)))
{
surface = gdk_surface_create_similar_surface (gtk_native_get_surface (gtk_widget_get_native (widget)),
CAIRO_CONTENT_COLOR,
gtk_widget_get_width (widget),
gtk_widget_get_height (widget));
CAIRO_CONTENT_COLOR,
gtk_widget_get_width (widget),
gtk_widget_get_height (widget));
/* Initialize the surface to white */
clear_surface ();
@@ -690,16 +703,16 @@ gcc $( pkg-config --cflags gtk4 ) -o example-3 example-3.c $( pkg-config --libs
Note that `GtkBuilder` can also be used to construct objects that are
not widgets, such as tree models, adjustments, etc. That is the reason
the method we use here is called [method@Gtk.Builder.get_object] and returns
a `GObject` instead of a `GtkWidget`.
the method we use here is called [`method@Gtk.Builder.get_object`] and
returns a `GObject` instead of a `GtkWidget`.
Normally, you would pass a full path to [method@Gtk.Builder.add_from_file] to
Normally, you would pass a full path to [`method@Gtk.Builder.add_from_file`] to
make the execution of your program independent of the current directory.
A common location to install UI descriptions and similar data is
`/usr/share/appname`.
It is also possible to embed the UI description in the source code as a
string and use [method@Gtk.Builder.add_from_string] to load it. But keeping the
string and use [`method@Gtk.Builder.add_from_string`] to load it. But keeping the
UI description in a separate file has several advantages: It is then possible
to make minor adjustments to the UI without recompiling your program, and,
more importantly, graphical UI editors such as [Glade](http://glade.gnome.org)
@@ -762,17 +775,17 @@ main (int argc, char *argv[])
```
All the application logic is in the application class, which is a subclass of
GtkApplication. Our example does not yet have any interesting functionality.
`GtkApplication`. Our example does not yet have any interesting functionality.
All it does is open a window when it is activated without arguments, and open
the files it is given, if it is started with arguments.
To handle these two cases, we override the activate() vfunc, which gets
To handle these two cases, we override the `activate()` vfunc, which gets
called when the application is launched without commandline arguments, and
the `open()` virtual function, which gets called when the application is
launched with commandline arguments.
To learn more about `GApplication` entry points, consult the GIO
[documentation](https://developer.gnome.org/gio/stable/GApplication.html#GApplication.description).
[documentation](https://docs.gtk.org/gio/class.Application.html).
```c
#include <gtk/gtk.h>
@@ -841,8 +854,8 @@ example_app_new (void)
```
Another important class that is part of the application support in GTK is
`GtkApplicationWindow`. It is typically subclassed as well. Our subclass does
not do anything yet, so we will just get an empty window.
[class@Gtk.ApplicationWindow]. It is typically subclassed as well. Our
subclass does not do anything yet, so we will just get an empty window.
```c
#include <gtk/gtk.h>
@@ -907,10 +920,10 @@ and it accepts files as commandline arguments.
### Populating the window
In this step, we use a GtkBuilder template to associate a
GtkBuilder ui file with our application window class.
In this step, we use a `GtkBuilder` template to associate a
`GtkBuilder` ui file with our application window class.
Our simple ui file gives the window a title, and puts a GtkStack
Our simple ui file gives the window a title, and puts a `GtkStack`
widget as the main content.
```xml
@@ -934,9 +947,9 @@ widget as the main content.
To make use of this file in our application, we revisit our
`GtkApplicationWindow` subclass, and call
`gtk_widget_class_set_template_from_resource()` from the class init
[`method@Gtk.WidgetClass.set_template_from_resource`] from the class init
function to set the ui file as template for this class. We also
add a call to `gtk_widget_init_template()` in the instance init
add a call to [`method@Gtk.Widget.init_template`] in the instance init
function to instantiate the template for each instance of our
class.
@@ -963,7 +976,7 @@ example_app_window_class_init (ExampleAppWindowClass *class)
You may have noticed that we used the `_from_resource()` variant of the function
that sets a template. Now we need to use
[GLib's resource functionality](https://developer.gnome.org/gio/stable/GResource.html)
[GLib's resource functionality](https://docs.gtk.org/gio/struct.Resource.html)
to include the ui file in the binary. This is commonly done by listing all resources
in a `.gresource.xml` file, such as this:
@@ -985,7 +998,7 @@ glib-compile-resources exampleapp.gresource.xml --target=resources.c --generate-
```
The gnome module of the [Meson build system](https://mesonbuild.com)
provides the [gnome.compile_resources()](https://mesonbuild.com/Gnome-module.html#gnomecompile_resources)
provides the [`gnome.compile_resources()`](https://mesonbuild.com/Gnome-module.html#gnomecompile_resources)
method for this task.
Our application now looks like this:
@@ -1001,7 +1014,7 @@ To this end, we add a member to the struct of our application window subclass
and keep a reference to the `GtkStack` there. The first member of the struct
should be the parent type from which the class is derived. Here,
`ExampleAppWindow` is derived from `GtkApplicationWindow`. The
`gtk_widget_class_bind_template_child()` function arranges things so that after
[`func@Gtk.widget_class_bind_template_child`] function arranges things so that after
instantiating the template, the `stack` member of the struct will point to the
widget of the same name from the template.
@@ -1081,7 +1094,7 @@ tell it to display information about our stack.
The stack switcher gets all its information it needs to display tabs from
the stack that it belongs to. Here, we are passing the label to show for
each file as the last argument to the [method@Gtk.Stack.add_titled]
each file as the last argument to the [`method@Gtk.Stack.add_titled`]
function.
Our application is beginning to take shape:
@@ -1121,7 +1134,7 @@ resulting menu model with the menu button that we've added to the headerbar.
Since menus work by activating GActions, we also have to add a suitable set
of actions to our application.
Adding the actions is best done in the startup() vfunc, which is guaranteed
Adding the actions is best done in the `startup()` vfunc, which is guaranteed
to be called once for each primary application instance:
```c
@@ -1179,7 +1192,7 @@ example_app_class_init (ExampleAppClass *class)
Our preferences menu item does not do anything yet, but the Quit menu item
is fully functional. Note that it can also be activated by the usual Ctrl-Q
shortcut. The shortcut was added with `gtk_application_set_accels_for_action()`.
shortcut. The shortcut was added with [`method@Gtk.Application.set_accels_for_action`].
The application menu looks like this:
@@ -1191,7 +1204,7 @@ A typical application will have a some preferences that should be remembered
from one run to the next. Even for our simple example application, we may
want to change the font that is used for the content.
We are going to use `GSettings` to store our preferences. `GSettings` requires
We are going to use [class@Gio.Settings] to store our preferences. `GSettings` requires
a schema that describes our settings:
```xml
@@ -1218,10 +1231,9 @@ a schema that describes our settings:
```
Before we can make use of this schema in our application, we need to compile
it into the binary form that GSettings expects. GIO provides
[macros](https://developer.gnome.org/gio/2.36/ch31s06.html) to do this in
autotools-based projects, and the gnome module of the Meson build system
provides the [gnome.compile_schemas()](https://mesonbuild.com/Gnome-module.html#gnomecompile_schemas)
it into the binary form that GSettings expects. GIO provides macros to do
this in Autotools-based projects, and the gnome module of the Meson build
system provides the [`gnome.compile_schemas()`](https://mesonbuild.com/Gnome-module.html#gnomecompile_schemas)
method for this task.
Next, we need to connect our settings to the widgets that they are supposed
@@ -1681,7 +1693,8 @@ What our application looks like now:
Widgets and other objects have many useful properties.
Here we show some ways to use them in new and flexible ways, by wrapping
them in actions with `GPropertyAction` or by binding them with `GBinding`.
them in actions with [class@Gio.PropertyAction] or by binding them with
[class@GObject.Binding].
To set this up, we add two labels to the header bar in our window template,
named `lines_label` and `lines`, and bind them to struct members in the

View File

@@ -0,0 +1,57 @@
.. _gtk4-broadwayd(1):
==============
gtk4-broadwayd
==============
---------------------------
The Broadway display server
---------------------------
SYNOPSIS
--------
| **gtk4-broadwayd** [OPTIONS...] <DISPLAY>
| **gtk4-broadwayd** --port=PORT --address=ADDRESS <DISPLAY>
| **gtk4-broadwayd** --unixaddress=ADDRESS <DISPLAY>
DESCRIPTION
-----------
``gtk4-broadwayd`` is a display server for the Broadway GDK backend. It allows
multiple GTK applications to display their windows in the same web browser, by
connecting to gtk4-broadwayd.
When using gtk4-broadwayd, specify the display number to use, prefixed with a
colon, similar to X. The default display number is 0.
::
gtk4-broadwayd :5
Then point your web browser at ``http://127.0.0.1:8085``.
Start your applications like this:
::
GDK_BACKEND=broadway BROADWAY_DISPLAY=:5 gtk4-demo
OPTIONS
-------
``--port PORT``
Use the given ``PORT`` for the HTTP connection, instead of the default ``8080 + (DISPLAY - 1)``.
``--address ADDRESS``
Use the given ``address`` for the HTTP connection, instead of the default ``http://127.0.0.1``.
``--unixsocket ADDRESS``
Use the given ``address`` as the unix domain socket address. This option
overrides ``--address`` and ``--port``, and it is available only on Unix-like
systems.

View File

@@ -1,84 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
]>
<refentry id="gtk4-broadwayd">
<refentryinfo>
<title>gtk4-broadwayd</title>
<productname>GTK</productname>
<authorgroup>
<author>
<contrib>Developer</contrib>
<firstname>Alexander</firstname>
<surname>Larsson</surname>
</author>
</authorgroup>
</refentryinfo>
<refmeta>
<refentrytitle>gtk4-broadwayd</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class="manual">User Commands</refmiscinfo>
</refmeta>
<refnamediv>
<refname>gtk4-broadwayd</refname>
<refpurpose>Broadway display server</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>gtk4-broadwayd</command>
<arg choice="opt">--port <replaceable>PORT</replaceable></arg>
<arg choice="opt">--address <replaceable>ADDRESS</replaceable></arg>
<arg choice="opt">--unixsocket <replaceable>ADDRESS</replaceable></arg>
<arg choice="opt"><replaceable>:DISPLAY</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>
<para>
<command>gtk4-broadwayd</command> is a display server for the Broadway
GDK backend. It allows multiple GTK applications to display their
windows in the same web browser, by connecting to gtk4-broadwayd.
</para>
<para>
When using gtk4-broadwayd, specify the display number to use, prefixed
with a colon, similar to X. The default display number is 0.
<programlisting>
gtk4-broadwayd :5
</programlisting>
Then point your web browser at <literal>http://127.0.0.1:8085</literal>.
Start your applications like this:
<programlisting>
GDK_BACKEND=broadway BROADWAY_DISPLAY=:5 gtk4-demo
</programlisting>
</para>
</refsect1>
<refsect1><title>Options</title>
<variablelist>
<varlistentry>
<term>--port</term>
<listitem><para>Use <replaceable>PORT</replaceable> as the HTTP
port, instead of the default 8080 + (<replaceable>DISPLAY</replaceable> - 1).
</para></listitem>
</varlistentry>
<varlistentry>
<term>--address</term>
<listitem><para>Use <replaceable>ADDRESS</replaceable> as the HTTP
address, instead of the default <literal>http://127.0.0.1:<replaceable>PORT</replaceable></literal>.
</para></listitem>
</varlistentry>
<varlistentry>
<term>--unixsocket</term>
<listitem><para>Use <replaceable>ADDRESS</replaceable> as the unix domain socket
address. This option overrides <literal>--address</literal> and <literal>--port</literal>.
It is available only on Unix-like systems.
</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
</refentry>

View File

@@ -0,0 +1,85 @@
.. _gtk4-builder-tool(1):
=================
gtk4-builder-tool
=================
-----------------------
GtkBuilder File Utility
-----------------------
SYNOPSIS
--------
| **gtk4-builder-tool** <COMMAND> [OPTIONS...] <FILE>
|
| **gtk4-builder-tool** validate <FILE>
| **gtk4-builder-tool** enumerate <FILE>
| **gtk4-builder-tool** simplify [OPTIONS...] <FILE>
| **gtk4-builder-tool** preview [OPTIONS...] <FILE>
DESCRIPTION
-----------
``gtk4-builder-tool`` can perform various operations on GtkBuilder UI definition
files.
COMMANDS
--------
Validation
^^^^^^^^^^
The ``validate`` command validates the given UI definition file and reports
errors to ``stderr``.
Enumeration
^^^^^^^^^^^
The ``enumerate`` command lists all the named objects that are present in the UI
definition file.
Preview
^^^^^^^
The ``preview`` command displays the UI dfinition file.
This command accepts options to specify the ID of the toplevel object and a CSS
file to use.
``--id=ID``
The ID of the object to preview. If not specified, gtk4-builder-tool will
choose a suitable object on its own.
``--css=FILE``
Load style information from the given CSS file.
Simplification
^^^^^^^^^^^^^^
The ``simplify`` command simplifies the UI definition file by removing
properties that are set to their default values and writes the resulting XML to
the standard output, or back to the input file.
When the ``--3to4`` option is specified, the ``simplify`` command interprets the
input as a GTK 3 UI definuition file and attempts to convert it to GTK 4
equivalents. It performs various conversions, such as renaming properties,
translating child properties to layout properties, rewriting the setup for
GtkNotebook, GtkStack, GtkAssistant or changing toolbars into boxes.
You should always test the modified UI definition files produced by
gtk4-builder-tool before using them in production.
Note in particular that the conversion done with ``--3to4`` is meant as a
starting point for a port from GTK 3 to GTK 4. It is expected that you will have
to do manual fixups after the initial conversion.
``--replace``
Write the content back to the UI definition file instead of using the standard
output.
``--3to4``
Transform a GTK 3 UI definition file to the equivalent GTK 4 definitions.

View File

@@ -1,110 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
]>
<refentry id="gtk4-builder-tool">
<refentryinfo>
<title>gtk4-builder-tool</title>
<productname>GTK</productname>
<authorgroup>
<author>
<contrib>Developer</contrib>
<firstname>Matthias</firstname>
<surname>Clasen</surname>
</author>
</authorgroup>
</refentryinfo>
<refmeta>
<refentrytitle>gtk4-builder-tool</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class="manual">User Commands</refmiscinfo>
</refmeta>
<refnamediv>
<refname>gtk4-builder-tool</refname>
<refpurpose>GtkBuilder file utility</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>gtk4-builder-tool</command>
<arg choice="opt"><replaceable>COMMAND</replaceable></arg>
<arg choice="opt" rep="repeat"><replaceable>OPTION</replaceable></arg>
<arg choice="plain"><replaceable>FILE</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>
<para>
<command>gtk4-builder-tool</command> can perform various operations
on GtkBuilder .ui files.
</para>
<para>
The <option>validate</option> command validates the .ui file and reports
errors to stderr.
</para>
<para>
The <option>enumerate</option> command lists all the named objects that
are created in the .ui file.
</para>
<para>
The <option>preview</option> command displays the .ui file. This command
accepts options to specify the ID of the toplevel object and a .css file
to use.
</para>
<para>
The <option>simplify</option> command simplifies the .ui file by removing
properties that are set to their default values and writes the resulting XML
to stdout, or back to the input file.
</para>
<para>
When the <option>--3to4</option> is specified, <option>simplify</option>
interprets the input as a GTK 3 ui file and attempts to convert it to GTK 4
equivalents. It performs various conversions, such as renaming properties,
translating child properties to layout properties, rewriting the setup for
GtkNotebook, GtkStack, GtkAssistant or changing toolbars into boxes.
</para>
<para>
You should always test the modified .ui files produced by gtk4-builder-tool
before using them in production.
</para>
<para>
Note in particular that the conversion
done with <option>--3to4</option> is meant as a starting point for a port
from GTK 3 to GTK 4. It is expected that you will have to do manual fixups
after the initial conversion.
</para>
</refsect1>
<refsect1><title>Simplify Options</title>
<para>The <option>simplify</option> command accepts the following options:</para>
<variablelist>
<varlistentry>
<term><option>--replace</option></term>
<listitem><para>Write the content back to the .ui file instead of stdout.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--3to4</option></term>
<listitem><para>Transform a GTK 3 ui file to GTK 4</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1><title>Preview Options</title>
<para>The <option>preview</option> command accepts the following options:</para>
<variablelist>
<varlistentry>
<term><option>--id=<arg choice="plain">ID</arg></option></term>
<listitem><para>The ID of the object to preview. If not specified,
gtk4-builder-tool will choose a suitable object on its own.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--css=<arg choice="plain">FILE</arg></option></term>
<listitem><para>Load style information from the given .css file.</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
</refentry>

View File

@@ -0,0 +1,22 @@
.. _gtk4-demo-application(1):
=====================
gtk4-demo-application
=====================
--------------------------
Demonstrate GtkApplication
--------------------------
SYNOPSIS
--------
| **gtk4-demo-application**
DESCRIPTION
-----------
``gtk4-demo-application`` is an example application used by ``gtk4-demo``.
There is no need to call it manually.

View File

@@ -1,44 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
]>
<refentry id="gtk4-demo-application">
<refentryinfo>
<title>gtk4-demo-application</title>
<productname>GTK</productname>
<authorgroup>
<author>
<contrib>Developer</contrib>
<firstname>Matthias</firstname>
<surname>Clasen</surname>
</author>
</authorgroup>
</refentryinfo>
<refmeta>
<refentrytitle>gtk4-demo-application</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class="manual">User Commands</refmiscinfo>
</refmeta>
<refnamediv>
<refname>gtk4-demo-application</refname>
<refpurpose>Demonstrate GtkApplication</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>gtk4-demo-application</command>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>
<para>
<command>gtk4-demo-application</command> is an example application
used by <command>gtk4-demo</command>. There is no need to call it
manually.
</para>
</refsect1>
</refentry>

View File

@@ -0,0 +1,48 @@
.. _gtk4-demo(1):
=========
gtk4-demo
=========
-----------------------
Demonstrate GTK widgets
-----------------------
SYNOPSIS
--------
| **gtk4-demo** [OPTIONS...]
DESCRIPTION
-----------
``gtk4-demo`` is a collection of examples.
Its purpose is to demonstrate many GTK widgets in a form that is useful to
application developers.
The application shows the source code for each example, as well as other used
resources, such as UI description files and image assets.
OPTIONS
-------
``-h, --help``
Show help options.
``--version``
Show program version.
``--list``
List available examples.
``--run EXAMPLE``
Run the named example. Use ``--list`` to see the available examples.
``--autoquit``
Quit after a short timeout. This is intended for use with ``--run``, e.g. when profiling.

View File

@@ -1,81 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
]>
<refentry id="gtk4-demo">
<refentryinfo>
<title>gtk4-demo</title>
<productname>GTK</productname>
<authorgroup>
<author>
<contrib>Developer</contrib>
<firstname>Matthias</firstname>
<surname>Clasen</surname>
</author>
</authorgroup>
</refentryinfo>
<refmeta>
<refentrytitle>gtk4-demo</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class="manual">User Commands</refmiscinfo>
</refmeta>
<refnamediv>
<refname>gtk4-demo</refname>
<refpurpose>Demonstrate GTK widgets</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>gtk4-demo</command>
<arg choice="opt">--help</arg>
<arg choice="opt">--version</arg>
<arg choice="opt">--list</arg>
<arg choice="opt">--run <replaceable>EXAMPLE</replaceable></arg>
<arg choice="opt">--autoquit</arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>
<para>
<command>gtk4-demo</command> is a collection of examples.
Its purpose is to demonstrate many GTK widgets in a form
that is useful to application developers.
</para>
<para>
The application shows the source code for each example, as well as
other used resources, such as ui files and icons.
</para>
</refsect1>
<refsect1><title>Options</title>
<para>The following options are understood:</para>
<variablelist>
<varlistentry>
<term><option>-h</option>, <option>--help</option></term>
<listitem><para>Show help options</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--version</option></term>
<listitem><para>Show program version</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--list</option></term>
<listitem><para>List available examples.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>-run <replaceable>EXAMPLE</replaceable></option></term>
<listitem><para>Run the named example. Use <option>--list</option> to
see the available examples.</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--autoquit</option></term>
<listitem><para>Quit after a short timeout. This is intended for use
with <option>--run</option>, e.g. when profiling.</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
</refentry>

View File

@@ -0,0 +1,40 @@
.. _gtk4-encode-symbolic-svg(1):
========================
gtk4-encode-symbolic-svg
========================
--------------------------------
Symbolic icon conversion utility
--------------------------------
SYNOPSIS
--------
| **gtk4-encode-symbolic-svg** [OPTIONS...] <PATH> <WIDTH>x<HEIGHT>
DESCRIPTION
-----------
``gtk4-encode-symbolic-svg`` converts symbolic SVG icons into specially prepared
PNG files. GTK can load and recolor these PNGs, just like original SVGs, but
loading them is much faster.
``PATH`` is the name of a symbolic SVG file, ``WIDTH`` x ``HEIGHT`` are the
desired dimensions for the generated PNG file.
To distinguish them from ordinary PNGs, the generated files have the extension
``.symbolic.png``.
OPTIONS
-------
``-o, --output DIRECTORY``
Write png files to ``DIRECTORY`` instead of the current working directory.
``--debug``
Generate PNG files of the various channels during the conversion. If these
files are not monochrome green, they are often helpful in pinpointing the
problematic parts of the source SVG.

View File

@@ -1,74 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
]>
<refentry id="gtk4-encode-symbolic-svg">
<refentryinfo>
<title>gtk4-encode-symbolic-svg</title>
<productname>GTK</productname>
<authorgroup>
<author>
<contrib>Developer</contrib>
<firstname>Alexander</firstname>
<surname>Larsson</surname>
</author>
</authorgroup>
</refentryinfo>
<refmeta>
<refentrytitle>gtk4-encode-symbolic-svg</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class="manual">User Commands</refmiscinfo>
</refmeta>
<refnamediv>
<refname>gtk4-encode-symbolic-svg</refname>
<refpurpose>Symbolic icon conversion utility</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>gtk4-encode-symbolic-svg</command>
<arg choice="opt">OPTION...</arg>
<arg choice="plain"><replaceable>PATH</replaceable></arg>
<arg choice="plain"><replaceable>WIDTH</replaceable>x<replaceable>HEIGHT</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>
<para>
<command>gtk4-encode-symbolic-svg</command> converts symbolic svg icons into
specially prepared png files. GTK can load and recolor these pngs, just like
original svgs, but loading them is much faster.
</para>
<para>
<replaceable>PATH</replaceable> is the name of a symbolic svg file,
<replaceable>WIDTH</replaceable>x<replaceable>HEIGHT</replaceable> are the
desired dimensions for the generated png file.
</para>
<para>
To distinguish them from ordinary pngs, the generated files have the extension
<filename>.symbolic.png</filename>.
</para>
</refsect1>
<refsect1><title>Options</title>
<variablelist>
<varlistentry>
<term>-o <replaceable>DIRECTORY</replaceable></term>
<term>--output <replaceable>DIRECTORY</replaceable></term>
<listitem><para>Write png files to <replaceable>DIRECTORY</replaceable>
instead of the current working directory.</para></listitem>
</varlistentry>
<varlistentry>
<term>--debug</term>
<listitem><para>Generate png files of the various channels during
the conversion. If these files are not monochrome green, they
are often helpful in pinpointing the problematic parts of
the source svg.</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
</refentry>

View File

@@ -0,0 +1,28 @@
.. _gtk4-icon-browser(1):
=================
gtk4-icon-browser
=================
-----------------
List themed icons
-----------------
SYNOPSIS
--------
| **gtk4-icon-browser** [OPTIONS...]
DESCRIPTION
-----------
``gtk4-icon-browser`` is a utility to explore the icons in the current icon
theme. It shows icons in various sizes, their symbolic variants where available,
as well as a description of the icon and its context.
OPTIONS
-------
``-h, --help``
Show the application help.

View File

@@ -1,55 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
]>
<refentry id="gtk4-icon-browser">
<refentryinfo>
<title>gtk4-icon-browser</title>
<productname>GTK</productname>
<authorgroup>
<author>
<contrib>Developer</contrib>
<firstname>Matthias</firstname>
<surname>Clasen</surname>
</author>
</authorgroup>
</refentryinfo>
<refmeta>
<refentrytitle>gtk4-icon-browser</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class="manual">User Commands</refmiscinfo>
</refmeta>
<refnamediv>
<refname>gtk4-icon-browser</refname>
<refpurpose>List themed icons</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>gtk4-icon-browser</command>
<arg choice="opt">--help</arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>
<para>
<command>gtk4-icon-browser</command> is a utility to explore the icons
in the current icon theme. It shows icons in various sizes, their symbolic
variants where available, as well as a description of the icon and its context.
</para>
</refsect1>
<refsect1><title>Options</title>
<para>The following options are understood:</para>
<variablelist>
<varlistentry>
<term><option>-h</option>, <option>--help</option></term>
<listitem><para>Show help options</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
</refentry>

View File

@@ -0,0 +1,50 @@
.. _gtk4-launch(1):
===========
gtk4-launch
===========
---------------------
Launch an application
---------------------
SYNOPSIS
--------
| **gtk4-launch** [OPTIONS...] <APPLICATION> [URI...]
DESCRIPTION
-----------
``gtk4-launch`` launches an application using the given name. The application is
started with proper startup notification on a default display, unless specified
otherwise.
``gtk4-launch`` takes at least one argument, the name of the application to
launch. The name should match application desktop file name, as residing in the
applications subdirectories of the XDG data directories, with or without the
``.desktop`` suffix.
If called with more than one argument, the rest of them besides the application
name are considered URI locations and are passed as arguments to the launched
application.
OPTIONS
-------
``-?, -h, --help``
Print the command's help and exit.
``--version``
Print the command's version and exit.
ENVIRONMENT
-----------
Some environment variables affect the behavior of ``gtk4-launch``:
``XDG_DATA_HOME, XDG_DATA_DIRS``
The environment variables specifying the XDG data directories.

View File

@@ -1,85 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
]>
<refentry id="gtk4-launch">
<refentryinfo>
<title>gtk4-launch</title>
<productname>GTK</productname>
<authorgroup>
<author>
<contrib>Developer</contrib>
<firstname>Tomáš</firstname>
<surname>Bžatek</surname>
<email>tbzatek@redhat.com</email>
</author>
</authorgroup>
</refentryinfo>
<refmeta>
<refentrytitle>gtk4-launch</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class="manual">User Commands</refmiscinfo>
</refmeta>
<refnamediv>
<refname>gtk4-launch</refname>
<refpurpose>Launch an application</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>gtk4-launch</command>
<arg choice="opt" rep="repeat">OPTION</arg>
<arg choice="plain">APPLICATION</arg>
<arg choice="opt" rep="repeat">URI</arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>
<para>
<command>gtk4-launch</command> launches an application using the given name.
The application is started with proper startup notification on a default
display, unless specified otherwise.
</para>
<para>
<command>gtk4-launch</command> takes at least one argument, the name of
the application to launch. The name should match application desktop file name,
as residing in the applications subdirectories of the XDG data directories, with
or without the '.desktop' suffix.
</para>
<para>
If called with more than one argument, the rest of them besides the application
name are considered URI locations and are passed as arguments to the launched
application.
</para>
</refsect1>
<refsect1><title>Options</title>
<para>The following options are understood:</para>
<variablelist>
<varlistentry>
<term><option>-?</option>, <option>--help</option></term>
<listitem><para>Prints a short help text and exits.</para></listitem>
</varlistentry>
</variablelist>
<variablelist>
<varlistentry>
<term><option>--version</option></term>
<listitem><para>Prints the program version and exits.</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1><title>Environment</title>
<para>Some environment variables affect the behavior of <command>gtk4-launch</command>.</para>
<variablelist>
<varlistentry>
<term><option>XDG_DATA_HOME</option>, <option>XDG_DATA_DIRS</option></term>
<listitem><para>The environment variables specifying the XDG dta directories.</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
</refentry>

View File

@@ -0,0 +1,21 @@
.. _gtk4-query-settings(1):
===================
gtk4-query-settings
===================
------------------------------------
Print name and value of GTK settings
------------------------------------
SYNOPSIS
--------
| **gtk4-query-settings** [PATTERN]
DESCRIPTION
-----------
``gtk4-query-settings`` prints both name and value of all properties available
in the ``GtkSettings`` class. Optionally, you can filter which properties to
list by specifying a ``PATTERN``.

View File

@@ -1,45 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
]>
<refentry id="gtk4-query-settings">
<refentryinfo>
<title>gtk4-query-settings</title>
<productname>GTK</productname>
<authorgroup>
<author>
<contrib>Developer</contrib>
<firstname>Timm</firstname>
<surname>Bäder</surname>
</author>
</authorgroup>
</refentryinfo>
<refmeta>
<refentrytitle>gtk4-query-settings</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class="manual">User Commands</refmiscinfo>
</refmeta>
<refnamediv>
<refname>gtk4-query-settings</refname>
<refpurpose>Utility to print name and value of all GtkSettings properties</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>gtk4-query-settings</command>
<arg choice="opt"><replaceable>PATTERN</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>
<para>
<command>gtk4-query-settings</command> prints both name and value of all properties
available in the GtkSettings class. Optionally, you can filter which properties
to list by specifying a PATTERN.
</para>
</refsect1>
</refentry>

View File

@@ -0,0 +1,65 @@
.. _gtk4-update-icon-cache(1):
======================
gtk4-update-icon-cache
======================
--------------------------
Icon theme caching utility
--------------------------
SYNOPSIS
--------
| **gtk4-update-icon-cache** [OPTIONS...] <PATH>
DESCRIPTION
-----------
``gtk4-update-icon-cache`` creates ``mmap(2)``-able cache files for icon themes.
It expects to be given the ``PATH`` to an icon theme directory containing an
``index.theme``, e.g. ``/usr/share/icons/hicolor``, and writes a
``icon-theme.cache`` containing cached information about the icons in the
directory tree below the given directory.
GTK can use the cache files created by ``gtk4-update-icon-cache`` to avoid a lot
of system call and disk seek overhead when the application starts. Since the
format of the cache files allows them to be shared across multiple processes,
for instance using the POSIX ``mmap(2)`` system call, the overall memory
consumption is reduced as well.
OPTIONS
-------
``-f, --force``
Overwrite an existing cache file even if it appears to be up-to-date.
``-t, --ignore-theme-index``
Don't check for the existence of ``index.theme`` in the icon theme directory.
Without this option, ``gtk4-update-icon-cache`` refuses to create an icon
cache in a directory which does not appear to be the toplevel directory of an
icon theme.
``-i, --index-only``
Don't include image data in the cache.
``--include-image-data``
Include image data in the cache.
``-c, --source <NAME>``
Output a C header file declaring a constant ``NAME`` with the contents of the
icon cache.
``-q, --quiet``
Turn off verbose output.
``-v, --validate``
Validate existing icon cache.

View File

@@ -1,123 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
]>
<refentry id="gtk4-update-icon-cache">
<refentryinfo>
<title>gtk4-update-icon-cache</title>
<productname>GTK</productname>
<authorgroup>
<author>
<contrib>Developer</contrib>
<firstname>Matthias</firstname>
<surname>Clasen</surname>
</author>
</authorgroup>
</refentryinfo>
<refmeta>
<refentrytitle>gtk4-update-icon-cache</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class="manual">User Commands</refmiscinfo>
</refmeta>
<refnamediv>
<refname>gtk4-update-icon-cache</refname>
<refpurpose>Icon theme caching utility</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>gtk4-update-icon-cache</command>
<arg choice="opt">--force</arg>
<arg choice="opt">--ignore-theme-index</arg>
<group>
<arg choice="plain">--index-only</arg>
<arg choice="plain">--include-image-data</arg>
</group>
<arg choice="opt">--source <arg choice="plain"><replaceable>NAME</replaceable></arg></arg>
<arg choice="opt">--quiet</arg>
<arg choice="opt">--validate</arg>
<arg choice="plain"><replaceable>PATH</replaceable></arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>
<para>
<command>gtk4-update-icon-cache</command> creates mmapable cache
files for icon themes.
</para>
<para>
It expects to be given the <replaceable>PATH</replaceable> to an icon theme
directory containing an <filename>index.theme</filename>, e.g.
<filename>/usr/share/icons/hicolor</filename>, and writes a
<filename>icon-theme.cache</filename> containing cached information about
the icons in the directory tree below the given directory.
</para>
<para>
GTK can use the cache files created by <command>gtk4-update-icon-cache</command>
to avoid a lot of system call and disk seek overhead when the application
starts. Since the format of the cache files allows them to be shared across
multiple processes, for instance using the POSIX <command>mmap()</command> system
call, the overall memory consumption is reduced as well.
</para>
</refsect1>
<refsect1><title>Options</title>
<variablelist>
<varlistentry>
<term>--force</term>
<term>-f</term>
<listitem><para>Overwrite an existing cache file even if it appears to be
up-to-date.</para></listitem>
</varlistentry>
<varlistentry>
<term>--ignore-theme-index</term>
<term>-t</term>
<listitem><para>Don't check for the existence of <filename>index.theme</filename>
in the icon theme directory. Without this option, <command>gtk4-update-icon-cache</command>
refuses to create an icon cache in a directory which does not appear to
be the toplevel directory of an icon theme.
</para></listitem>
</varlistentry>
<varlistentry>
<term>--index-only</term>
<term>-i</term>
<listitem><para>Don't include image data in the cache.
</para></listitem>
</varlistentry>
<varlistentry>
<term>--include-image-data</term>
<listitem><para>Include image data in the cache.
</para></listitem>
</varlistentry>
<varlistentry>
<term>--source</term>
<term>-c</term>
<listitem><para>Output a C header file declaring a constant
<replaceable>NAME</replaceable> with the contents of the icon
cache.</para></listitem>
</varlistentry>
<varlistentry>
<term>--quiet</term>
<term>-q</term>
<listitem><para>Turn off verbose output.
</para></listitem>
</varlistentry>
<varlistentry>
<term>--validate</term>
<term>-v</term>
<listitem><para>Validate existing icon cache.
</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
</refentry>

View File

@@ -0,0 +1,34 @@
.. _gtk4-widget-factory(1):
===================
gtk4-widget-factory
===================
-------------------------------
Showcase GTK widgets and styles
-------------------------------
SYNOPSIS
--------
| **gtk4-widget-factory** [OPTIONS...]
DESCRIPTION
-----------
``gtk4-widget-factory`` is a collection of examples.
Its purpose is to demonstrate many GTK widgets in a form that is useful to GTK theme developers.
The application shows widgets in different, typical combinations and states.
OPTIONS
-------
``-h, --help``
Show the application help.
``--version``
Show the application version.

View File

@@ -1,63 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
]>
<refentry id="gtk4-widget-factory">
<refentryinfo>
<title>gtk4-widget-factory</title>
<productname>GTK</productname>
<authorgroup>
<author>
<contrib>Developer</contrib>
<firstname>Matthias</firstname>
<surname>Clasen</surname>
</author>
</authorgroup>
</refentryinfo>
<refmeta>
<refentrytitle>gtk4-widget-factory</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class="manual">User Commands</refmiscinfo>
</refmeta>
<refnamediv>
<refname>gtk4-widget-factory</refname>
<refpurpose>Demonstrate GTK widgets</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>gtk4-widget-factory</command>
<arg choice="opt">--help</arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1><title>Description</title>
<para>
<command>gtk4-widget-factory</command> is a collection of examples.
Its purpose is to demonstrate many GTK widgets in a form
that is useful to GTK theme developers.
</para>
<para>
The application shows widgets in different, typical combinations
and states.
</para>
</refsect1>
<refsect1><title>Options</title>
<para>The following options are understood:</para>
<variablelist>
<varlistentry>
<term><option>-h</option>, <option>--help</option></term>
<listitem><para>Show help options</para></listitem>
</varlistentry>
<varlistentry>
<term><option>--version</option></term>
<listitem><para>Show program version</para></listitem>
</varlistentry>
</variablelist>
</refsect1>
</refentry>

View File

@@ -42,12 +42,10 @@ if get_option('gtk_doc')
command: [
gidocgen,
'generate',
'--quiet',
'--fatal-warnings',
gidocgen_common_args,
'--add-include-path=@0@'.format(meson.current_build_dir() / '../../../gtk'),
'--config=@INPUT0@',
'--output-dir=@OUTPUT@',
'--no-namespace-dir',
'--content-dir=@0@'.format(meson.current_source_dir()),
'@INPUT1@',
],
@@ -59,24 +57,15 @@ if get_option('gtk_doc')
)
endif
xsltproc = find_program('xsltproc', required: false)
if get_option('man-pages') and not xsltproc.found()
error('No xsltproc found, but man pages were explicitly enabled')
rst2man = find_program('rst2man', required: false)
if get_option('man-pages') and not rst2man.found()
error('No rst2man found, but man pages were explicitly enabled')
endif
if get_option('man-pages') and xsltproc.found()
xlstproc_flags = [
'--nonet',
'--stringparam', 'man.output.quietly', '1',
'--stringparam', 'funcsynopsis.style', 'ansi',
'--stringparam', 'man.th.extra1.suppress', '1',
'--stringparam', 'man.authors.section.enabled', '0',
'--stringparam', 'man.copyright.section.enabled', '0',
]
man_files = [
[ 'gtk4-broadwayd', '1', ],
[ 'gtk4-builder-tool', '1', ],
if get_option('man-pages') and rst2man.found()
rst_files = [
[ 'gtk4-broadwayd', '1' ],
[ 'gtk4-builder-tool', '1' ],
[ 'gtk4-encode-symbolic-svg', '1', ],
[ 'gtk4-launch', '1', ],
[ 'gtk4-query-settings', '1', ],
@@ -84,7 +73,7 @@ if get_option('man-pages') and xsltproc.found()
]
if get_option('demos')
man_files += [
rst_files += [
[ 'gtk4-demo', '1', ],
[ 'gtk4-demo-application', '1', ],
[ 'gtk4-widget-factory', '1', ],
@@ -92,21 +81,25 @@ if get_option('man-pages') and xsltproc.found()
]
endif
foreach man: man_files
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),
rst2man_flags = [
'--syntax-highlight=none',
]
foreach rst: rst_files
man_name = rst[0]
man_section = rst.get(1, '1')
custom_target('man-@0@'.format(man_name),
input: '@0@.rst'.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',
rst2man,
rst2man_flags,
'@INPUT@',
],
capture: true,
install: true,
install_dir: join_paths(get_option('mandir'), 'man@0@'.format(man_section)),
install_dir: get_option('mandir') / 'man@0@'.format(man_section),
)
endforeach
endif

View File

@@ -315,7 +315,7 @@ have been added to `GdkDisplay`.
The root window is an X11-centric concept that is no longer exposed in the
backend-neutral GDK API. If you need to interact with the X11 root window,
you can use [method@GdkX11.Display.get_xrootwindow] to get its XID.
you can use [`method@GdkX11.Display.get_xrootwindow`] to get its XID.
### Stop using `GdkVisual`
@@ -333,9 +333,9 @@ had replacements in GTK 3 and were deprecated in favor of `GdkSeat`.
In GTK 4, the two roles of a standalone toplevel window and of a popup that
is placed relative to a parent window have been separated out into two
interfaces, [class@Gdk.Toplevel] and [class@Gdk.Popup]. Surfaces
implementing these interfaces are created with [ctor@Gdk.Surface.new_toplevel]
and [ctor@Gdk.Surface.new_popup], respectively, and they are presented on
interfaces, [iface@Gdk.Toplevel] and [iface@Gdk.Popup]. Surfaces
implementing these interfaces are created with [`ctor@Gdk.Surface.new_toplevel`]
and [`ctor@Gdk.Surface.new_popup`], respectively, and they are presented on
screen using [method@Gdk.Toplevel.present] and [method@Gdk.Popup.present].
The `present()` functions take parameters in the form of an auxiliary layout
struct, [struct@Gdk.PopupLayout] or [struct@Gdk.ToplevelLayout].
@@ -362,9 +362,9 @@ windows, you you will have to use Xlib apis.
A number of minor API cleanups have happened in `GdkSurface`
as well. For example, `gdk_surface_input_shape_combine_region()`
has been renamed to [method@Gdk.Surface.set_input_region], and
has been renamed to [`method@Gdk.Surface.set_input_region`], and
`gdk_surface_begin_resize_drag()` has been renamed to
[method@Gdk.Toplevel.begin_resize].
[`method@Gdk.Toplevel.begin_resize`].
### The "iconified" window state has been renamed to "minimized"
@@ -388,7 +388,7 @@ have accessors that you will have to use.
Event compression is always enabled in GTK 4, for both motion and
scroll events. If you need to see the uncoalesced motion or scroll
history, use [method@Gdk.Event.get_history] on the latest event.
history, use [`method@Gdk.Event.get_history`] on the latest event.
### Stop using grabs
@@ -668,18 +668,21 @@ box children as necessary.
### Adapt to `GtkWindow` API changes
Following the `GdkSurface` changes, a number of `GtkWindow` APIs that were
X11-specific have been removed. This includes `gtk_window_set_geometry_hints()`,
`gtk_window_set_gravity()`, `gtk_window_move()`, `gtk_window_parse_geometry()`,
X11-specific have been removed. This includes `gtk_window_set_position()`,
`gtk_window_set_geometry_hints()`, `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,
[method@Gdk.Toplevel.begin_resize]).
[`method@Gdk.Toplevel.begin_resize`]); alternatively, you will need to get
the native windowing system surface from the `GtkWindow` and call platform
specific API.
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
[method@Gtk.Window.set_default_size] and [method@Gtk.Window.get_default_size].
[`method@Gtk.Window.set_default_size`] and [`method@Gtk.Window.get_default_size`].
### Adapt to `GtkHeaderBar` and `GtkActionBar` API changes
@@ -1051,7 +1054,7 @@ Observing widget contents and widget size is now done by using the
### Monitor handling has changed
Instead of a monitor number, [class@Gdk.Monitor] is now used throughout.
Instead of a monitor number, [class@Gdk.Monitor] is now used throughout.
[method@Gdk.Display.get_monitors] returns the list of monitors that can be queried
or observed for monitors to pass to APIs like [method@Gtk.Window.fullscreen_on_monitor].
@@ -1332,6 +1335,18 @@ pointer coordinates as inout arguments any more, but as normal in ones.
See: [method@Gtk.TreeView.get_tooltip_context], [method@Gtk.IconView.get_tooltip_context]
### Adapt to GtkPopover changes
In GTK 3, a `GtkPopover` could be attached to any widget, using the `relative-to`
property. This is no longer possible in GTK 4. The parent widget has to be aware
of its popover children, and manage their size allocation. Therefore, only widgets
with dedicated popover support can have them, such as [class@Gtk.MenuButton] or
[class@Gtk.PopoverMenuBar].
If you want to make a custom widget that has an attached popover, you need to call
[method@Gtk.Popover.present] in your [vfunc@Gtk.Widget.size_allocate] vfunc, in order
to update the positioning of the popover.
### Stop using GtkFileChooserButton
The `GtkFileChooserButton` widget was removed, due to its shortcomings in

View File

@@ -1,101 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE partintro PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [
]>
<partintro>
<para>
GTK is a library for creating graphical user interfaces. It
works on many UNIX-like platforms, Windows, and OS X.
GTK is released under the GNU Library General Public License
(GNU LGPL), which allows for flexible licensing of client
applications. GTK has a C-based object-oriented architecture that
allows for maximum flexibility. Bindings for many other languages have
been written, including C++, Objective-C, Guile/Scheme, Perl, Python,
TOM, Ada95, Free Pascal, and Eiffel. The GTK library itself contains
<firstterm>widgets</firstterm>, that is, GUI components such as GtkButton
or GtkTextView.
</para>
<para>
GTK depends on the following libraries:
<variablelist>
<varlistentry>
<term>GLib</term>
<listitem><para>
A general-purpose utility library, not specific to graphical user interfaces.
GLib provides many useful data types, macros, type conversions,
string utilities, file utilities, a main loop abstraction, and so on.
</para></listitem>
</varlistentry>
<varlistentry>
<term>GObject</term>
<listitem><para>A library that provides a type system, a collection of
fundamental types including an object type, a signal system.
</para></listitem>
</varlistentry>
<varlistentry>
<term>GIO</term>
<listitem><para>A modern, easy-to-use VFS API including abstractions for
files, drives, volumes, stream IO, as well as network programming and
DBus communication.
</para></listitem>
</varlistentry>
<varlistentry>
<term>cairo</term>
<listitem><para>Cairo is a 2D graphics library with support for multiple
output devices.
</para></listitem>
</varlistentry>
<varlistentry>
<term>Pango</term>
<listitem><para>
Pango is a library for internationalized text handling. It centers
around the PangoLayout object, representing a paragraph of text.
Pango provides the engine for GtkTextView, GtkLabel, GtkEntry, and
other widgets that display text.
</para></listitem>
</varlistentry>
<varlistentry>
<term>GdkPixbuf</term>
<listitem><para>
This is a small library which allows you to create GdkPixbuf
("pixel buffer") objects from image data or image files.
Use a GdkPixbuf in combination with GtkImage to display images.
</para></listitem>
</varlistentry>
<varlistentry>
<term>graphene</term>
<listitem><para>
This is a small library which provides vector and matrix datatypes
and operations. graphene provides optimized implementations using
various SIMD instruction sets such as SSE.
</para></listitem>
</varlistentry>
<varlistentry>
<term>GDK</term>
<listitem><para>
GDK is the abstraction layer that allows GTK to support multiple
windowing systems. GDK provides window system facilities on Wayland,
X11, Windows, and OS X.
</para></listitem>
</varlistentry>
<varlistentry>
<term>GSK</term>
<listitem><para>
GSK is a library for creating a scene graph from render nodes,
and rendering it using different rendering APIs. GSK provides renderers
for OpenGL, Vulkan and cairo.
</para></listitem>
</varlistentry>
</variablelist>
</para>
</partintro>

View File

@@ -14,7 +14,7 @@ the question you have, this list is a good place to start.
(most of it about GTK 2.x and 3.x, but still somewhat applicable). This
reference manual also contains a introductory
[Getting Started](#gtk-getting-started) part.
More documentation ranging from whitepapers to online books can be found at
the [GNOME developer's site](https://developer.gnome.org). After studying these
materials you should be well prepared to come back to this reference manual for details.
@@ -93,11 +93,11 @@ the question you have, this list is a good place to start.
`gi18n.h` provides the following shorthand macros for convenience.
Conventionally, people define macros as follows for convenience:
#define _(x) gettext (x)
#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
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
@@ -205,14 +205,14 @@ the question you have, this list is a good place to start.
Here is an example showing the three approaches using the copyright
sign © which has Unicode and ISO-8859-1 codepoint 169 and is represented
in UTF-8 by the two bytes 194, 169, or `"\302\251"` as a string literal:
g_print ("direct UTF-8: ©");
g_print ("escaped UTF-8: \302\251");
text = g_convert ("runtime conversion: ©", -1,
"ISO-8859-1", "UTF-8", NULL, NULL, NULL);
g_print (text);
g_free (text);
If you are using gettext() to localize your application, you need
to call bind_textdomain_codeset() to ensure that translated strings
are returned in UTF-8 encoding.
@@ -432,10 +432,10 @@ the question you have, this list is a good place to start.
26. How do I associate some data with a row in the tree?
Remember that the [class@Gtk.TreeModel] columns don't necessarily have to be
Remember that the [iface@Gtk.TreeModel] columns don't necessarily have to be
displayed. So you can put non-user-visible data in your model just
like any other data, and retrieve it with [method@Gtk.TreeModel.get].
See the [tree widget overview](#TreeWidget).
See the [tree widget overview](#TreeWidget).
27. How do I put an image and some text in the same column?
@@ -447,7 +447,7 @@ the question you have, this list is a good place to start.
28. I can set data easily on my [class@Gtk.TreeStore] or [class@Gtk.ListStore] models using
[method@Gtk.ListStore.set] and [method@Gtk.TreeStore.set], but can't read it back?
Both the [class@Gtk.TreeStore] and the [class@Gtk.ListStore] implement the [class@Gtk.TreeModel]
Both the [class@Gtk.TreeStore] and the [class@Gtk.ListStore] implement the [iface@Gtk.TreeModel]
interface. As a consequence, you can use any function this interface
implements. The easiest way to read a set of data back is to use
[method@Gtk.TreeModel.get].

View File

@@ -13,4 +13,5 @@ baseURLs = [
[ 'Gtk', 'https://docs.gtk.org/gtk4/' ],
[ 'Pango', 'https://docs.gtk.org/Pango/' ],
[ 'PangoCairo', 'https://docs.gtk.org/PangoCairo/' ],
[ 'GdkPixbuf', 'https://docs.gtk.org/gdk-pixbuf/' ],
]

View File

@@ -3,6 +3,15 @@ toml_conf.set('version', meson.project_version())
gidocgen = find_program('gi-docgen', required: get_option('gtk_doc'))
gidocgen_common_args = [
'--quiet',
'--no-namespace-dir',
]
if get_option('werror')
gidocgen_common_args += ['--fatal-warnings']
endif
docs_dir = gtk_datadir / 'doc'
if get_option('gtk_doc') and not build_gir

View File

@@ -603,8 +603,8 @@ bloat_pad_startup (GApplication *application)
g_object_unref (icon);
g_bytes_unref (bytes);
icon = G_ICON (gdk_pixbuf_new_from_resource ("/org/gtk/libgtk/icons/16x16/actions/folder-new.png", NULL));
item = g_menu_item_new ("Pixbuf", NULL);
icon = G_ICON (gdk_texture_new_from_resource ("/org/gtk/libgtk/icons/16x16/actions/folder-new.png"));
item = g_menu_item_new ("Texture", NULL);
g_menu_item_set_icon (item, icon);
g_menu_append_item (menu, item);
g_object_unref (item);

View File

@@ -7,7 +7,7 @@
#include <glib.h>
#include <glib/gprintf.h>
#include "gdktypes.h"
#include "gdkinternals.h"
#include "gdkdeviceprivate.h"
#include <stdlib.h>
#include <string.h>
#include <errno.h>

View File

@@ -609,56 +609,46 @@ open_shared_memory (void)
return ret;
}
typedef struct {
int fd;
gsize size;
} PngData;
static cairo_status_t
write_png_cb (void *closure,
const guchar *data,
unsigned int length)
{
PngData *png_data = closure;
int fd = png_data->fd;
while (length)
{
gssize ret = write (fd, data, length);
if (ret <= 0)
return CAIRO_STATUS_WRITE_ERROR;
png_data->size += ret;
length -= ret;
data += ret;
}
return CAIRO_STATUS_SUCCESS;
}
guint32
gdk_broadway_server_upload_texture (GdkBroadwayServer *server,
GdkTexture *texture)
{
guint32 id;
cairo_surface_t *surface = gdk_texture_download_surface (texture);
BroadwayRequestUploadTexture msg;
PngData data;
GBytes *bytes;
const guchar *data;
gsize size;
int fd;
bytes = gdk_texture_save_to_png_bytes (texture);
fd = open_shared_memory ();
data = g_bytes_get_data (bytes, &size);
id = server->next_texture_id++;
data.fd = open_shared_memory ();
data.size = 0;
cairo_surface_write_to_png_stream (surface, write_png_cb, &data);
msg.id = id;
msg.offset = 0;
msg.size = data.size;
msg.size = 0;
while (msg.size < size)
{
gssize ret = write (fd, data + msg.size, size - msg.size);
if (ret <= 0)
{
if (errno == EINTR)
continue;
break;
}
msg.size += ret;
}
g_bytes_unref (bytes);
/* This passes ownership of fd */
gdk_broadway_server_send_fd_message (server, msg,
BROADWAY_REQUEST_UPLOAD_TEXTURE, data.fd);
BROADWAY_REQUEST_UPLOAD_TEXTURE, fd);
return id;
}

View File

@@ -2,8 +2,10 @@
#define __GDK_BROADWAY_SERVER__
#include <gdk/gdktypes.h>
#include "gdkdeviceprivate.h"
#include "broadway-protocol.h"
#include "gdkinternals.h"
typedef struct _GdkBroadwayServer GdkBroadwayServer;
typedef struct _GdkBroadwayServerClass GdkBroadwayServerClass;

View File

@@ -34,6 +34,7 @@ gdk_broadway_cairo_context_dispose (GObject *object)
static void
gdk_broadway_cairo_context_begin_frame (GdkDrawContext *draw_context,
gboolean prefers_high_depth,
cairo_region_t *region)
{
GdkBroadwayCairoContext *self = GDK_BROADWAY_CAIRO_CONTEXT (draw_context);

View File

@@ -30,7 +30,6 @@
#include "gdkmonitor-broadway.h"
#include "gdkseatdefaultprivate.h"
#include "gdkdevice-broadway.h"
#include "gdkinternals.h"
#include "gdkdeviceprivate.h"
#include <gdk/gdktextureprivate.h>
#include "gdk-private.h"
@@ -214,7 +213,7 @@ _gdk_broadway_display_open (const char *display_name)
broadway_display->server = _gdk_broadway_server_new (display, display_name, &error);
if (broadway_display->server == NULL)
{
g_printerr ("Unable to init Broadway server: %s\n", error->message);
GDK_NOTE (MISC, g_message ("Unable to init Broadway server: %s\n", error->message));
g_error_free (error);
return NULL;
}

View File

@@ -27,7 +27,6 @@
#include "gdkdisplayprivate.h"
#include "gdkkeys.h"
#include "gdksurface.h"
#include "gdkinternals.h"
#include "gdkbroadway-server.h"
#include "gdkmonitorprivate.h"

View File

@@ -28,7 +28,6 @@
#include "gdksurfaceprivate.h"
#include "gdkprivate-broadway.h"
#include "gdkinternals.h"
#include "gdkdisplay-broadway.h"
#include <string.h>

View File

@@ -34,6 +34,7 @@ gdk_broadway_draw_context_dispose (GObject *object)
static void
gdk_broadway_draw_context_begin_frame (GdkDrawContext *draw_context,
gboolean prefers_high_depth,
cairo_region_t *region)
{
GdkBroadwayDrawContext *self = GDK_BROADWAY_DRAW_CONTEXT (draw_context);

View File

@@ -19,8 +19,9 @@
#include "gdkeventsource.h"
#include "gdksurfaceprivate.h"
#include "gdkeventsprivate.h"
#include "gdkframeclockprivate.h"
#include "gdksurfaceprivate.h"
#include <stdlib.h>

View File

@@ -25,7 +25,6 @@
#include "config.h"
#include "gdkprivate-broadway.h"
#include "gdkinternals.h"
#include "gdkdisplay-broadway.h"
#include "gdkkeysprivate.h"
#include "gdkkeysyms.h"

View File

@@ -30,7 +30,6 @@
#define __GDK_PRIVATE_BROADWAY_H__
#include <gdk/gdkcursor.h>
#include <gdk/gdkinternals.h>
#include "gdksurface-broadway.h"
#include "gdkdisplay-broadway.h"
#include "gdkdrawcontext-broadway.h"

View File

@@ -35,13 +35,12 @@
#include "gdkdragsurfaceprivate.h"
#include "gdkeventsource.h"
#include "gdkframeclockidleprivate.h"
#include "gdkinternals.h"
#include "gdkpopupprivate.h"
#include "gdkprivate-broadway.h"
#include "gdkseatprivate.h"
#include "gdksurfaceprivate.h"
#include "gdktextureprivate.h"
#include "gdktoplevelprivate.h"
#include "gdk-private.h"
#include <graphene.h>
#include <stdlib.h>

View File

@@ -27,7 +27,6 @@
#include <gdk/gdksurfaceprivate.h>
#include "gdkbroadwaysurface.h"
#include "gdkinternals.h"
G_BEGIN_DECLS

View File

@@ -64,7 +64,7 @@ libgdk_broadway = static_library('gdk-broadway',
# gtk4-broadwayd
broadwayd_syslib = os_win32 ? find_library('ws2_32') : shmlib
broadwayd_syslib = os_win32 ? cc.find_library('ws2_32') : shmlib
executable('gtk4-broadwayd',
sources: [

View File

@@ -1,8 +1,7 @@
#ifndef __GDK__PRIVATE_H__
#define __GDK__PRIVATE_H__
#include <gdk/gdk.h>
#include "gdk/gdkinternals.h"
#include "gdk/gdktypes.h"
/* Private API for use in GTK+ */
@@ -29,14 +28,10 @@ gboolean gdk_should_use_portal (void);
const char * gdk_get_startup_notification_id (void);
PangoDirection gdk_unichar_direction (gunichar ch);
PangoDirection gdk_unichar_direction (gunichar ch) G_GNUC_CONST;
PangoDirection gdk_find_base_dir (const char *text,
int len);
void gdk_surface_set_widget (GdkSurface *surface,
gpointer widget);
gpointer gdk_surface_get_widget (GdkSurface *surface);
typedef struct
{
const char *key;

View File

@@ -26,18 +26,14 @@
#include "gdkversionmacros.h"
#include "gdkinternals.h"
#include "gdkintl.h"
#include "gdkresources.h"
#include "gdk-private.h"
#include "gdkconstructor.h"
#ifndef HAVE_XCONVERTCASE
#include "gdkkeysyms.h"
#endif
#include "gdkdebug.h"
#include "gdkdisplay.h"
#include "gdkglcontextprivate.h"
#include "gdkintl.h"
#include "gdk-private.h"
#include <string.h>
#include <stdlib.h>
@@ -125,7 +121,7 @@ static const GdkDebugKey gdk_debug_keys[] = {
{ "gl-software", GDK_DEBUG_GL_SOFTWARE, "Force OpenGL software rendering" },
{ "gl-texture-rect", GDK_DEBUG_GL_TEXTURE_RECT, "Use OpenGL texture rectangle extension" },
{ "gl-legacy", GDK_DEBUG_GL_LEGACY, "Use a legacy OpenGL context" },
{ "gl-gles", GDK_DEBUG_GL_GLES, "Use a GLES OpenGL context" },
{ "gl-gles", GDK_DEBUG_GL_GLES, "Only allow OpenGL GLES API" },
{ "gl-debug", GDK_DEBUG_GL_DEBUG, "Insert debugging information in OpenGL" },
{ "gl-egl", GDK_DEBUG_GL_EGL, "Use EGL on X11 or Windows" },
{ "gl-glx", GDK_DEBUG_GL_GLX, "Use GLX on X11" },
@@ -133,6 +129,7 @@ static const GdkDebugKey gdk_debug_keys[] = {
{ "vulkan-disable", GDK_DEBUG_VULKAN_DISABLE, "Disable Vulkan support" },
{ "vulkan-validate", GDK_DEBUG_VULKAN_VALIDATE, "Load the Vulkan validation layer" },
{ "default-settings",GDK_DEBUG_DEFAULT_SETTINGS, "Force default values for xsettings", TRUE },
{ "high-depth", GDK_DEBUG_HIGH_DEPTH, "Use high bit depth rendering if possible", TRUE },
};
@@ -299,6 +296,14 @@ gdk_pre_parse (void)
gdk_debug_keys,
G_N_ELEMENTS (gdk_debug_keys));
/* These are global */
if (GDK_DEBUG_CHECK (GL_EGL))
gdk_gl_backend_use (GDK_GL_EGL);
else if (GDK_DEBUG_CHECK (GL_GLX))
gdk_gl_backend_use (GDK_GL_GLX);
else if (GDK_DEBUG_CHECK (GL_WGL))
gdk_gl_backend_use (GDK_GL_WGL);
#ifndef G_HAS_CONSTRUCTORS
stash_desktop_startup_notification_id ();
#endif

View File

@@ -47,6 +47,7 @@
#include <gdk/gdkdragsurface.h>
#include <gdk/gdkdrawcontext.h>
#include <gdk/gdkdrop.h>
#include <gdk/gdkenums.h>
#include <gdk/gdkenumtypes.h>
#include <gdk/gdkevents.h>
#include <gdk/gdkframeclock.h>

View File

@@ -32,7 +32,7 @@ G_BEGIN_DECLS
#define GDK_TYPE_APP_LAUNCH_CONTEXT (gdk_app_launch_context_get_type ())
#define GDK_APP_LAUNCH_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GDK_TYPE_APP_LAUNCH_CONTEXT, GdkAppLaunchContext))
#define GDK_IS_APP_LAUNCH_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_APP_LAUNCH_CONTEXT))
#define GDK_IS_APP_LAUNCH_CONTEXT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GDK_TYPE_APP_LAUNCH_CONTEXT))
GDK_AVAILABLE_IN_ALL

View File

@@ -17,9 +17,7 @@
#include "config.h"
#include "gdkcairo.h"
#include "gdkinternals.h"
#include "gdkcairoprivate.h"
#include <math.h>
@@ -93,11 +91,7 @@ void
gdk_cairo_surface_paint_pixbuf (cairo_surface_t *surface,
const GdkPixbuf *pixbuf)
{
int width, height;
guchar *gdk_pixels, *cairo_pixels;
int gdk_rowstride, cairo_stride;
int n_channels;
int j;
GdkTexture *texture;
if (cairo_surface_status (surface) != CAIRO_STATUS_SUCCESS)
return;
@@ -113,71 +107,11 @@ gdk_cairo_surface_paint_pixbuf (cairo_surface_t *surface,
cairo_surface_flush (surface);
width = gdk_pixbuf_get_width (pixbuf);
height = gdk_pixbuf_get_height (pixbuf);
gdk_pixels = gdk_pixbuf_get_pixels (pixbuf);
gdk_rowstride = gdk_pixbuf_get_rowstride (pixbuf);
n_channels = gdk_pixbuf_get_n_channels (pixbuf);
cairo_stride = cairo_image_surface_get_stride (surface);
cairo_pixels = cairo_image_surface_get_data (surface);
for (j = height; j; j--)
{
guchar *p = gdk_pixels;
guchar *q = cairo_pixels;
if (n_channels == 3)
{
guchar *end = p + 3 * width;
while (p < end)
{
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
q[0] = p[2];
q[1] = p[1];
q[2] = p[0];
q[3] = 0xFF;
#else
q[0] = 0xFF;
q[1] = p[0];
q[2] = p[1];
q[3] = p[2];
#endif
p += 3;
q += 4;
}
}
else
{
guchar *end = p + 4 * width;
guint t1,t2,t3;
#define MULT(d,c,a,t) G_STMT_START { t = c * a + 0x80; d = ((t >> 8) + t) >> 8; } G_STMT_END
while (p < end)
{
#if G_BYTE_ORDER == G_LITTLE_ENDIAN
MULT(q[0], p[2], p[3], t1);
MULT(q[1], p[1], p[3], t2);
MULT(q[2], p[0], p[3], t3);
q[3] = p[3];
#else
q[0] = p[3];
MULT(q[1], p[0], p[3], t1);
MULT(q[2], p[1], p[3], t2);
MULT(q[3], p[2], p[3], t3);
#endif
p += 4;
q += 4;
}
#undef MULT
}
gdk_pixels += gdk_rowstride;
cairo_pixels += cairo_stride;
}
texture = gdk_texture_new_for_pixbuf (GDK_PIXBUF (pixbuf));
gdk_texture_download (texture,
cairo_image_surface_get_data (surface),
cairo_image_surface_get_stride (surface));
g_object_unref (texture);
cairo_surface_mark_dirty (surface);
}

View File

@@ -50,7 +50,7 @@ cairo_region_t *
gdk_cairo_region_create_from_surface
(cairo_surface_t *surface);
GDK_AVAILABLE_IN_ALL
GDK_DEPRECATED_IN_4_6_FOR(gdk_gl_texture_new)
void gdk_cairo_draw_from_gl (cairo_t *cr,
GdkSurface *surface,
int source,

View File

@@ -25,7 +25,6 @@
#include "gdkcairocontextprivate.h"
#include "gdkcairo.h"
#include "gdkinternals.h"
/**
* GdkCairoContext:

View File

@@ -18,6 +18,8 @@
#ifndef __GDK_CAIRO_PRIVATE_H__
#define __GDK_CAIRO_PRIVATE_H__
#include "gdkcairo.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <cairo.h>

View File

@@ -1253,14 +1253,14 @@ gdk_clipboard_set_content (GdkClipboard *clipboard,
* @...: value contents conforming to @type
*
* Sets the clipboard to contain the value collected from the given varargs.
*
*
* Values should be passed the same way they are passed to other value
* collecting APIs, such as [`method@GObject.Object.set`] or
* [`id@g_signal_emit`].
* [`func@GObject.signal_emit`].
*
* ```c
* gdk_clipboard_set (clipboard, GTK_TYPE_STRING, "Hello World");
*
*
* gdk_clipboard_set (clipboard, GDK_TYPE_TEXTURE, some_texture);
* ```
*/

View File

@@ -25,6 +25,8 @@
#include "filetransferportalprivate.h"
#include "gdktexture.h"
#include "gdkrgbaprivate.h"
#include "loaders/gdkpngprivate.h"
#include "loaders/gdktiffprivate.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
@@ -655,6 +657,56 @@ pixbuf_deserializer (GdkContentDeserializer *deserializer)
deserializer);
}
static void
texture_deserializer_finish (GObject *source,
GAsyncResult *result,
gpointer deserializer)
{
GOutputStream *stream = G_OUTPUT_STREAM (source);
GBytes *bytes;
GError *error = NULL;
GdkTexture *texture = NULL;
gssize written;
written = g_output_stream_splice_finish (stream, result, &error);
if (written < 0)
{
gdk_content_deserializer_return_error (deserializer, error);
return;
}
bytes = g_memory_output_stream_steal_as_bytes (G_MEMORY_OUTPUT_STREAM (stream));
texture = gdk_texture_new_from_bytes (bytes, &error);
g_bytes_unref (bytes);
if (texture == NULL)
{
gdk_content_deserializer_return_error (deserializer, error);
return;
}
g_value_take_object (gdk_content_deserializer_get_value (deserializer), texture);
gdk_content_deserializer_return_success (deserializer);
}
static void
texture_deserializer (GdkContentDeserializer *deserializer)
{
GOutputStream *output;
output = g_memory_output_stream_new_resizable ();
g_output_stream_splice_async (output,
gdk_content_deserializer_get_input_stream (deserializer),
G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE
| G_OUTPUT_STREAM_SPLICE_CLOSE_TARGET,
gdk_content_deserializer_get_priority (deserializer),
gdk_content_deserializer_get_cancellable (deserializer),
texture_deserializer_finish,
deserializer);
g_object_unref (output);
}
static void
string_deserializer_finish (GObject *source,
GAsyncResult *result,
@@ -863,48 +915,71 @@ init (void)
initialized = TRUE;
gdk_content_register_deserializer ("image/png",
GDK_TYPE_TEXTURE,
texture_deserializer,
NULL,
NULL);
gdk_content_register_deserializer ("image/tiff",
GDK_TYPE_TEXTURE,
texture_deserializer,
NULL,
NULL);
gdk_content_register_deserializer ("image/jpeg",
GDK_TYPE_TEXTURE,
texture_deserializer,
NULL,
NULL);
formats = gdk_pixbuf_get_formats ();
/* Make sure png comes first */
for (f = formats; f; f = f->next)
{
GdkPixbufFormat *fmt = f->data;
char *name;
char *name;
name = gdk_pixbuf_format_get_name (fmt);
if (g_str_equal (name, "png"))
{
formats = g_slist_delete_link (formats, f);
formats = g_slist_prepend (formats, fmt);
{
formats = g_slist_delete_link (formats, f);
formats = g_slist_prepend (formats, fmt);
g_free (name);
break;
}
g_free (name);
break;
}
g_free (name);
}
}
for (f = formats; f; f = f->next)
{
GdkPixbufFormat *fmt = f->data;
char **mimes, **m;
char *name;
name = gdk_pixbuf_format_get_name (fmt);
mimes = gdk_pixbuf_format_get_mime_types (fmt);
for (m = mimes; *m; m++)
{
gdk_content_register_deserializer (*m,
GDK_TYPE_TEXTURE,
pixbuf_deserializer,
NULL,
NULL);
{
/* Turning pngs, jpegs and tiffs into textures is handled above */
if (!g_str_equal (name, "png") &&
!g_str_equal (name, "jpeg") &&
!g_str_equal (name, "tiff"))
gdk_content_register_deserializer (*m,
GDK_TYPE_TEXTURE,
pixbuf_deserializer,
NULL,
NULL);
gdk_content_register_deserializer (*m,
GDK_TYPE_PIXBUF,
pixbuf_deserializer,
NULL,
NULL);
}
}
g_strfreev (mimes);
g_free (name);
}
g_slist_free (formats);
@@ -933,11 +1008,13 @@ init (void)
if (!g_get_charset (&charset))
{
char *mime = g_strdup_printf ("text/plain;charset=%s", charset);
gdk_content_register_deserializer (mime,
G_TYPE_STRING,
string_deserializer,
(gpointer) charset,
g_free);
g_free (mime);
}
gdk_content_register_deserializer ("text/plain",
G_TYPE_STRING,

View File

@@ -808,8 +808,13 @@ gdk_content_formats_builder_add_mime_type (GdkContentFormatsBuilder *builder,
builder->n_mime_types++;
}
/* G_DEFINE_BOXED wants this */
typedef gpointer GdkFileList;
/* {{{ GdkFileList */
/* We're using GdkFileList* and GSList* interchangeably, counting on the
* fact that we're just passing around gpointers; the only reason why we
* have a GdkFileList opaque type is for language bindings, because they
* can have no idea what a GSList of GFiles is.
*/
static gpointer
gdk_file_list_copy (gpointer list)
@@ -824,3 +829,23 @@ gdk_file_list_free (gpointer list)
}
G_DEFINE_BOXED_TYPE (GdkFileList, gdk_file_list, gdk_file_list_copy, gdk_file_list_free)
/**
* gdk_file_list_get_files:
* @file_list: the file list
*
* Retrieves the list of files inside a `GdkFileList`.
*
* This function is meant for language bindings.
*
* Returns: (transfer container) (element-type GFile): the files inside the list
*
* Since: 4.6
*/
GSList *
gdk_file_list_get_files (GdkFileList *file_list)
{
return g_slist_copy ((GSList *) file_list);
}
/* }}} */

View File

@@ -109,8 +109,19 @@ void gdk_content_formats_builder_add_gtype (GdkContentForma
/* dunno where else to put this */
#define GDK_TYPE_FILE_LIST (gdk_file_list_get_type ())
GDK_AVAILABLE_IN_ALL
GType gdk_file_list_get_type (void) G_GNUC_CONST;
GType gdk_file_list_get_type (void) G_GNUC_CONST;
/**
* GdkFileList:
*
* An opaque type representing a list of files.
*
* Since: 4.6
*/
typedef struct _GdkFileList GdkFileList;
GDK_AVAILABLE_IN_4_6
GSList * gdk_file_list_get_files (GdkFileList *file_list);
G_END_DECLS

View File

@@ -26,6 +26,10 @@
#include "filetransferportalprivate.h"
#include "gdktextureprivate.h"
#include "gdkrgba.h"
#include "loaders/gdkpngprivate.h"
#include "loaders/gdktiffprivate.h"
#include "loaders/gdkjpegprivate.h"
#include "gdkmemorytextureprivate.h"
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <string.h>
@@ -606,6 +610,7 @@ gdk_content_serialize_finish (GAsyncResult *result,
/*** SERIALIZERS ***/
static void
pixbuf_serializer_finish (GObject *source,
GAsyncResult *res,
@@ -636,11 +641,7 @@ pixbuf_serializer (GdkContentSerializer *serializer)
else if (G_VALUE_HOLDS (value, GDK_TYPE_TEXTURE))
{
GdkTexture *texture = g_value_get_object (value);
cairo_surface_t *surface = gdk_texture_download_surface (texture);
pixbuf = gdk_pixbuf_get_from_surface (surface,
0, 0,
gdk_texture_get_width (texture), gdk_texture_get_height (texture));
cairo_surface_destroy (surface);
pixbuf = gdk_pixbuf_get_from_texture (texture);
}
else
{
@@ -658,6 +659,77 @@ pixbuf_serializer (GdkContentSerializer *serializer)
g_object_unref (pixbuf);
}
static void
texture_serializer_finish (GObject *source,
GAsyncResult *res,
gpointer user_data)
{
GdkContentSerializer *serializer = GDK_CONTENT_SERIALIZER (source);
GError *error = NULL;
if (!g_task_propagate_boolean (G_TASK (res), &error))
gdk_content_serializer_return_error (serializer, error);
else
gdk_content_serializer_return_success (serializer);
}
static void
serialize_texture_in_thread (GTask *task,
gpointer source_object,
gpointer task_data,
GCancellable *cancellable)
{
GdkContentSerializer *serializer = source_object;
const GValue *value;
GdkTexture *texture;
GBytes *bytes = NULL;
GError *error = NULL;
gboolean result = FALSE;
GInputStream *input;
gssize spliced;
value = gdk_content_serializer_get_value (serializer);
texture = g_value_get_object (value);
if (strcmp (gdk_content_serializer_get_mime_type (serializer), "image/png") == 0)
bytes = gdk_save_png (texture);
else if (strcmp (gdk_content_serializer_get_mime_type (serializer), "image/tiff") == 0)
bytes = gdk_save_tiff (texture);
else if (strcmp (gdk_content_serializer_get_mime_type (serializer), "image/jpeg") == 0)
bytes = gdk_save_jpeg (texture);
else
g_assert_not_reached ();
input = g_memory_input_stream_new_from_bytes (bytes);
spliced = g_output_stream_splice (gdk_content_serializer_get_output_stream (serializer),
input,
G_OUTPUT_STREAM_SPLICE_CLOSE_SOURCE,
gdk_content_serializer_get_cancellable (serializer),
&error);
g_object_unref (input);
g_bytes_unref (bytes);
result = spliced != -1;
if (result)
g_task_return_boolean (task, result);
else
g_task_return_error (task, error);
}
static void
texture_serializer (GdkContentSerializer *serializer)
{
GTask *task;
task = g_task_new (serializer,
gdk_content_serializer_get_cancellable (serializer),
texture_serializer_finish,
NULL);
g_task_run_in_thread (task, serialize_texture_in_thread);
g_object_unref (task);
}
static void
string_serializer_finish (GObject *source,
GAsyncResult *result,
@@ -877,51 +949,72 @@ init (void)
initialized = TRUE;
gdk_content_register_serializer (GDK_TYPE_TEXTURE,
"image/png",
texture_serializer,
NULL, NULL);
gdk_content_register_serializer (GDK_TYPE_TEXTURE,
"image/tiff",
texture_serializer,
NULL, NULL);
gdk_content_register_serializer (GDK_TYPE_TEXTURE,
"image/jpeg",
texture_serializer,
NULL, NULL);
formats = gdk_pixbuf_get_formats ();
/* Make sure png comes first */
for (f = formats; f; f = f->next)
{
GdkPixbufFormat *fmt = f->data;
char *name;
char *name;
name = gdk_pixbuf_format_get_name (fmt);
if (g_str_equal (name, "png"))
{
formats = g_slist_delete_link (formats, f);
formats = g_slist_prepend (formats, fmt);
{
formats = g_slist_delete_link (formats, f);
formats = g_slist_prepend (formats, fmt);
g_free (name);
break;
}
g_free (name);
break;
}
g_free (name);
}
}
for (f = formats; f; f = f->next)
{
GdkPixbufFormat *fmt = f->data;
char **mimes, **m;
char *name;
if (!gdk_pixbuf_format_is_writable (fmt))
continue;
continue;
name = gdk_pixbuf_format_get_name (fmt);
mimes = gdk_pixbuf_format_get_mime_types (fmt);
for (m = mimes; *m; m++)
{
gdk_content_register_serializer (GDK_TYPE_TEXTURE,
*m,
pixbuf_serializer,
gdk_pixbuf_format_get_name (fmt),
g_free);
{
/* Turning textures into pngs, tiffs or jpegs is handled above */
if (!g_str_equal (name, "png") &&
!g_str_equal (name, "tiff") &&
!g_str_equal (name, "jpeg"))
gdk_content_register_serializer (GDK_TYPE_TEXTURE,
*m,
pixbuf_serializer,
gdk_pixbuf_format_get_name (fmt),
g_free);
gdk_content_register_serializer (GDK_TYPE_PIXBUF,
*m,
pixbuf_serializer,
gdk_pixbuf_format_get_name (fmt),
g_free);
}
}
g_strfreev (mimes);
g_free (name);
}
g_slist_free (formats);

View File

@@ -31,7 +31,6 @@
#include "gdkcursorprivate.h"
#include "gdktexture.h"
#include "gdkintl.h"
#include "gdkinternals.h"
#include <math.h>
#include <errno.h>

View File

@@ -18,8 +18,11 @@
#ifndef __GDK_DEBUG_H__
#define __GDK_DEBUG_H__
G_BEGIN_DECLS
#include <glib.h>
#include "gdktypes.h"
G_BEGIN_DECLS
typedef enum {
GDK_DEBUG_MISC = 1 << 0,
@@ -47,6 +50,7 @@ typedef enum {
GDK_DEBUG_VULKAN_DISABLE = 1 << 21,
GDK_DEBUG_VULKAN_VALIDATE = 1 << 22,
GDK_DEBUG_DEFAULT_SETTINGS= 1 << 23,
GDK_DEBUG_HIGH_DEPTH = 1 << 24,
} GdkDebugFlags;
extern guint _gdk_debug_flags;

View File

@@ -22,7 +22,6 @@
#include "gdkdeviceprivate.h"
#include "gdkdevicetool.h"
#include "gdkdisplayprivate.h"
#include "gdkinternals.h"
#include "gdkintl.h"
#include "gdkkeysprivate.h"
@@ -331,7 +330,7 @@ gdk_device_class_init (GdkDeviceClass *klass)
* GdkDevice::changed:
* @device: the `GdkDevice`
*
* Emitted either when the the number of either axes or keys changes.
* Emitted either when the number of either axes or keys changes.
*
* On X11 this will normally happen when the physical device
* routing events through the logical device changes (for

View File

@@ -25,6 +25,7 @@
#include <gdk/gdkversionmacros.h>
#include <gdk/gdktypes.h>
#include <gdk/gdkdevicetool.h>
#include <gdk/gdkenums.h>
G_BEGIN_DECLS

View File

@@ -20,7 +20,7 @@
#include <math.h>
#include "gdkdevicetoolprivate.h"
#include "gdkinternals.h"
#include "gdkenumtypes.h"
#include "gdkintl.h"
/**

View File

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

View File

@@ -27,16 +27,20 @@
#include "gdkintl.h"
#include "gdk-private.h"
#include "gdkapplaunchcontext.h"
#include "gdkclipboardprivate.h"
#include "gdkdeviceprivate.h"
#include "gdkdisplaymanagerprivate.h"
#include "gdkevents.h"
#include "gdkinternals.h"
#include "gdkmonitorprivate.h"
#include "gdkframeclockidleprivate.h"
#include "gdkeventsprivate.h"
#include "gdkglcontextprivate.h"
#include "gdkmonitorprivate.h"
#ifdef HAVE_EGL
#include <epoxy/egl.h>
#endif
#include <math.h>
#include <glib.h>
#include <stdlib.h>
/**
* GdkDisplay:
@@ -87,6 +91,12 @@ struct _GdkDisplayPrivate {
GdkGLContext *gl_context;
GError *gl_error;
#ifdef HAVE_EGL
EGLDisplay egl_display;
EGLConfig egl_config;
EGLConfig egl_config_high_depth;
#endif
guint rgba : 1;
guint composited : 1;
guint input_shapes : 1;
@@ -146,6 +156,26 @@ gdk_display_default_init_gl (GdkDisplay *display,
return NULL;
}
static guint
gdk_display_default_rate_egl_config (GdkDisplay *display,
gpointer egl_display,
gpointer config)
{
guint distance = 0;
#ifdef HAVE_EGL
int tmp;
if (!eglGetConfigAttrib (egl_display, config, EGL_SAMPLE_BUFFERS, &tmp) || tmp != 0)
distance += 0x20000;
if (!eglGetConfigAttrib (egl_display, config, EGL_DEPTH_SIZE, &tmp) || tmp != 0 ||
!eglGetConfigAttrib (egl_display, config, EGL_STENCIL_SIZE, &tmp) || tmp != 0)
distance += 0x10000;
#endif
return distance;
}
static GdkSeat *
gdk_display_real_get_default_seat (GdkDisplay *display)
{
@@ -173,6 +203,7 @@ gdk_display_class_init (GdkDisplayClass *class)
class->make_default = gdk_display_real_make_default;
class->get_app_launch_context = gdk_display_real_get_app_launch_context;
class->init_gl = gdk_display_default_init_gl;
class->rate_egl_config = gdk_display_default_rate_egl_config;
class->get_default_seat = gdk_display_real_get_default_seat;
class->opened = gdk_display_real_opened;
@@ -352,6 +383,9 @@ gdk_display_dispose (GObject *object)
g_queue_clear (&display->queued_events);
g_clear_object (&priv->gl_context);
#ifdef HAVE_EGL
g_clear_pointer (&priv->egl_display, eglTerminate);
#endif
g_clear_error (&priv->gl_error);
G_OBJECT_CLASS (gdk_display_parent_class)->dispose (object);
@@ -1233,6 +1267,8 @@ gdk_display_init_gl (GdkDisplay *self)
*/
priv->gl_context = context;
gdk_gl_backend_use (GDK_GL_CONTEXT_GET_CLASS (context)->backend_type);
gdk_profiler_end_mark (before, "initialize OpenGL", NULL);
}
@@ -1289,6 +1325,38 @@ gdk_display_prepare_gl (GdkDisplay *self,
}
}
/**
* gdk_display_create_gl_context:
* @self: a `GdkDisplay`
* @error: return location for an error
*
* Creates a new `GdkGLContext` for the `GdkDisplay`.
*
* The context is disconnected from any particular surface or surface
* and cannot be used to draw to any surface. It can only be used to
* draw to non-surface framebuffers like textures.
*
* If the creation of the `GdkGLContext` failed, @error will be set.
* Before using the returned `GdkGLContext`, you will need to
* call [method@Gdk.GLContext.make_current] or [method@Gdk.GLContext.realize].
*
* Returns: (transfer full): the newly created `GdkGLContext`
*
* Since: 4.6
*/
GdkGLContext *
gdk_display_create_gl_context (GdkDisplay *self,
GError **error)
{
g_return_val_if_fail (GDK_IS_DISPLAY (self), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
if (!gdk_display_prepare_gl (self, error))
return NULL;
return gdk_gl_context_new (self, NULL);
}
/*< private >
* gdk_display_get_gl_context:
* @self: the `GdkDisplay`
@@ -1310,6 +1378,417 @@ gdk_display_get_gl_context (GdkDisplay *self)
return priv->gl_context;
}
#ifdef HAVE_EGL
#ifdef G_ENABLE_DEBUG
static int
strvcmp (gconstpointer p1,
gconstpointer p2)
{
const char * const *s1 = p1;
const char * const *s2 = p2;
return strcmp (*s1, *s2);
}
static char *
describe_extensions (EGLDisplay egl_display)
{
const char *extensions;
char **exts;
char *ext;
extensions = eglQueryString (egl_display, EGL_EXTENSIONS);
exts = g_strsplit (extensions, " ", -1);
qsort (exts, g_strv_length (exts), sizeof (char *), strvcmp);
ext = g_strjoinv ("\n\t", exts);
if (ext[0] == '\n')
ext[0] = ' ';
g_strfreev (exts);
return g_strstrip (ext);
}
static char *
describe_egl_config (EGLDisplay egl_display,
EGLConfig egl_config)
{
EGLint red, green, blue, alpha, type;
if (egl_config == NULL)
return g_strdup ("-");
if (!eglGetConfigAttrib (egl_display, egl_config, EGL_RED_SIZE, &red) ||
!eglGetConfigAttrib (egl_display, egl_config, EGL_GREEN_SIZE, &green) ||
!eglGetConfigAttrib (egl_display, egl_config, EGL_BLUE_SIZE, &blue) ||
!eglGetConfigAttrib (egl_display, egl_config, EGL_ALPHA_SIZE, &alpha))
return g_strdup ("Unknown");
if (epoxy_has_egl_extension (egl_display, "EGL_EXT_pixel_format_float"))
{
if (!eglGetConfigAttrib (egl_display, egl_config, EGL_COLOR_COMPONENT_TYPE_EXT, &type))
type = EGL_COLOR_COMPONENT_TYPE_FIXED_EXT;
}
else
type = EGL_COLOR_COMPONENT_TYPE_FIXED_EXT;
return g_strdup_printf ("R%dG%dB%dA%d%s", red, green, blue, alpha, type == EGL_COLOR_COMPONENT_TYPE_FIXED_EXT ? "" : " float");
}
#endif
/*<private>
* gdk_display_get_egl_display:
* @self: a display
*
* Retrieves the EGL display connection object for the given GDK display.
*
* This function returns `NULL` if GL is not supported or GDK is using
* a different OpenGL framework than EGL.
*
* Returns: (nullable): the EGL display object
*/
gpointer
gdk_display_get_egl_display (GdkDisplay *self)
{
GdkDisplayPrivate *priv = gdk_display_get_instance_private (self);
g_return_val_if_fail (GDK_IS_DISPLAY (self), NULL);
if (!priv->egl_display &&
!gdk_display_prepare_gl (self, NULL))
return NULL;
return priv->egl_display;
}
gpointer
gdk_display_get_egl_config (GdkDisplay *self)
{
GdkDisplayPrivate *priv = gdk_display_get_instance_private (self);
return priv->egl_config;
}
gpointer
gdk_display_get_egl_config_high_depth (GdkDisplay *self)
{
GdkDisplayPrivate *priv = gdk_display_get_instance_private (self);
return priv->egl_config_high_depth;
}
static EGLDisplay
gdk_display_create_egl_display (EGLenum platform,
gpointer native_display)
{
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
EGLDisplay egl_display = NULL;
if (epoxy_has_egl_extension (NULL, "EGL_KHR_platform_base"))
{
PFNEGLGETPLATFORMDISPLAYPROC getPlatformDisplay =
(void *) eglGetProcAddress ("eglGetPlatformDisplay");
if (getPlatformDisplay != NULL)
egl_display = getPlatformDisplay (platform, native_display, NULL);
if (egl_display != NULL)
goto out;
}
if (epoxy_has_egl_extension (NULL, "EGL_EXT_platform_base"))
{
PFNEGLGETPLATFORMDISPLAYEXTPROC getPlatformDisplay =
(void *) eglGetProcAddress ("eglGetPlatformDisplayEXT");
if (getPlatformDisplay != NULL)
egl_display = getPlatformDisplay (platform, native_display, NULL);
if (egl_display != NULL)
goto out;
}
egl_display = eglGetDisplay ((EGLNativeDisplayType) native_display);
out:
gdk_profiler_end_mark (start_time, "Create EGL display", NULL);
return egl_display;
}
#define MAX_EGL_ATTRS 30
typedef enum {
GDK_EGL_CONFIG_PERFECT = (1 << 0),
GDK_EGL_CONFIG_HDR = (1 << 1),
} GdkEGLConfigCreateFlags;
static EGLConfig
gdk_display_create_egl_config (GdkDisplay *self,
GdkEGLConfigCreateFlags flags,
GError **error)
{
GdkDisplayPrivate *priv = gdk_display_get_instance_private (self);
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
EGLint attrs[MAX_EGL_ATTRS];
EGLConfig *configs;
EGLint count, alloced;
EGLConfig best_config;
guint best_score;
int i = 0;
attrs[i++] = EGL_SURFACE_TYPE;
attrs[i++] = EGL_WINDOW_BIT;
attrs[i++] = EGL_COLOR_BUFFER_TYPE;
attrs[i++] = EGL_RGB_BUFFER;
attrs[i++] = EGL_RED_SIZE;
attrs[i++] = (flags & GDK_EGL_CONFIG_HDR) ? 9 : 8;
attrs[i++] = EGL_GREEN_SIZE;
attrs[i++] = (flags & GDK_EGL_CONFIG_HDR) ? 9 : 8;
attrs[i++] = EGL_BLUE_SIZE;
attrs[i++] = (flags & GDK_EGL_CONFIG_HDR) ? 9 : 8;
attrs[i++] = EGL_ALPHA_SIZE;
attrs[i++] = 8;
if (flags & GDK_EGL_CONFIG_HDR &&
self->have_egl_pixel_format_float)
{
attrs[i++] = EGL_COLOR_COMPONENT_TYPE_EXT;
attrs[i++] = EGL_DONT_CARE;
}
attrs[i++] = EGL_NONE;
g_assert (i < MAX_EGL_ATTRS);
if (!eglChooseConfig (priv->egl_display, attrs, NULL, -1, &alloced) || alloced == 0)
{
g_set_error_literal (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE,
_("No EGL configuration available"));
return NULL;
}
configs = g_new (EGLConfig, alloced);
if (!eglChooseConfig (priv->egl_display, attrs, configs, alloced, &count))
{
g_set_error_literal (error, GDK_GL_ERROR, GDK_GL_ERROR_NOT_AVAILABLE,
_("Failed to get EGL configurations"));
return NULL;
}
g_warn_if_fail (alloced == count);
best_score = G_MAXUINT;
best_config = NULL;
for (i = 0; i < count; i++)
{
guint score = GDK_DISPLAY_GET_CLASS (self)->rate_egl_config (self, priv->egl_display, configs[i]);
if (score < best_score)
{
best_score = score;
best_config = configs[i];
}
if (score == 0)
break;
}
g_free (configs);
gdk_profiler_end_mark (start_time, "Create EGL config", NULL);
if (best_score == G_MAXUINT)
{
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
_("No EGL configuration with required features found"));
return NULL;
}
else if ((flags & GDK_EGL_CONFIG_PERFECT) && best_score != 0)
{
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
_("No perfect EGL configuration found"));
return NULL;
}
return best_config;
}
#undef MAX_EGL_ATTRS
static gboolean
gdk_display_check_egl_extensions (EGLDisplay egl_display,
const char **extensions,
GError **error)
{
GString *missing = NULL;
gsize i, n_missing;
n_missing = 0;
for (i = 0; extensions[i] != NULL; i++)
{
if (!epoxy_has_egl_extension (egl_display, extensions[i]))
{
if (missing == NULL)
{
missing = g_string_new (extensions[i]);
}
else
{
g_string_append (missing, ", ");
g_string_append (missing, extensions[i]);
}
n_missing++;
}
}
if (n_missing)
{
g_set_error (error, GDK_GL_ERROR, GDK_GL_ERROR_UNSUPPORTED_PROFILE,
/* translators: Arguments are the number of missing extensions
* followed by a comma-separated list of their names */
g_dngettext (GETTEXT_PACKAGE,
"EGL implementation is missing extension %2$s",
"EGL implementation is missing %d extensions: %s",
n_missing),
(int) n_missing, missing->str);
g_string_free (missing, TRUE);
return FALSE;
}
return TRUE;
}
gboolean
gdk_display_init_egl (GdkDisplay *self,
int platform,
gpointer native_display,
gboolean allow_any,
GError **error)
{
GdkDisplayPrivate *priv = gdk_display_get_instance_private (self);
G_GNUC_UNUSED gint64 start_time = GDK_PROFILER_CURRENT_TIME;
G_GNUC_UNUSED gint64 start_time2;
int major, minor;
if (!gdk_gl_backend_can_be_used (GDK_GL_EGL, error))
return FALSE;
if (!epoxy_has_egl ())
{
gboolean sandboxed = gdk_running_in_sandbox ();
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
sandboxed ? _("libEGL not available in this sandbox")
: _("libEGL not available"));
return FALSE;
}
priv->egl_display = gdk_display_create_egl_display (platform, native_display);
if (priv->egl_display == NULL)
{
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
_("Failed to create EGL display"));
return FALSE;
}
start_time2 = GDK_PROFILER_CURRENT_TIME;
if (!eglInitialize (priv->egl_display, &major, &minor))
{
priv->egl_display = NULL;
g_set_error_literal (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
_("Could not initialize EGL display"));
return FALSE;
}
gdk_profiler_end_mark (start_time2, "eglInitialize", NULL);
if (major < GDK_EGL_MIN_VERSION_MAJOR ||
(major == GDK_EGL_MIN_VERSION_MAJOR && minor < GDK_EGL_MIN_VERSION_MINOR))
{
g_clear_pointer (&priv->egl_display, eglTerminate);
g_set_error (error, GDK_GL_ERROR,
GDK_GL_ERROR_NOT_AVAILABLE,
_("EGL version %d.%d is too old. GTK requires %d.%d"),
major, minor, GDK_EGL_MIN_VERSION_MAJOR, GDK_EGL_MIN_VERSION_MINOR);
return FALSE;
}
if (!gdk_display_check_egl_extensions (priv->egl_display,
(const char *[]) {
"EGL_KHR_create_context",
"EGL_KHR_surfaceless_context",
NULL
},
error))
{
g_clear_pointer (&priv->egl_display, eglTerminate);
return FALSE;
}
priv->egl_config = gdk_display_create_egl_config (self,
allow_any ? 0 : GDK_EGL_CONFIG_PERFECT,
error);
if (priv->egl_config == NULL)
{
g_clear_pointer (&priv->egl_display, eglTerminate);
return FALSE;
}
self->have_egl_buffer_age =
epoxy_has_egl_extension (priv->egl_display, "EGL_EXT_buffer_age");
self->have_egl_swap_buffers_with_damage =
epoxy_has_egl_extension (priv->egl_display, "EGL_EXT_swap_buffers_with_damage");
self->have_egl_no_config_context =
epoxy_has_egl_extension (priv->egl_display, "EGL_KHR_no_config_context");
self->have_egl_pixel_format_float =
epoxy_has_egl_extension (priv->egl_display, "EGL_EXT_pixel_format_float");
if (self->have_egl_no_config_context)
priv->egl_config_high_depth = gdk_display_create_egl_config (self,
GDK_EGL_CONFIG_HDR,
error);
if (priv->egl_config_high_depth == NULL)
priv->egl_config_high_depth = priv->egl_config;
GDK_DISPLAY_NOTE (self, OPENGL, {
char *ext = describe_extensions (priv->egl_display);
char *std_cfg = describe_egl_config (priv->egl_display, priv->egl_config);
char *hd_cfg = describe_egl_config (priv->egl_display, priv->egl_config_high_depth);
g_message ("EGL API version %d.%d found\n"
" - Vendor: %s\n"
" - Version: %s\n"
" - Client APIs: %s\n"
" - Extensions:\n"
"\t%s\n"
" - Selected fbconfig: %s\n"
" high depth: %s",
major, minor,
eglQueryString (priv->egl_display, EGL_VENDOR),
eglQueryString (priv->egl_display, EGL_VERSION),
eglQueryString (priv->egl_display, EGL_CLIENT_APIS),
ext, std_cfg,
priv->egl_config_high_depth == priv->egl_config ? "none" : hd_cfg);
g_free (hd_cfg);
g_free (std_cfg);
g_free (ext);
});
gdk_profiler_end_mark (start_time, "init EGL", NULL);
return TRUE;
}
#endif
GdkDebugFlags
gdk_display_get_debug_flags (GdkDisplay *display)
{

View File

@@ -71,6 +71,9 @@ gboolean gdk_display_supports_input_shapes (GdkDisplay *display);
GDK_AVAILABLE_IN_4_4
gboolean gdk_display_prepare_gl (GdkDisplay *self,
GError **error);
GDK_AVAILABLE_IN_4_6
GdkGLContext *gdk_display_create_gl_context(GdkDisplay *self,
GError **error);
GDK_AVAILABLE_IN_ALL
GdkDisplay *gdk_display_get_default (void);

View File

@@ -27,7 +27,6 @@
#include "gdkconfig.h"
#include "gdkdisplaymanagerprivate.h"
#include "gdkdisplayprivate.h"
#include "gdkinternals.h"
#include "gdkkeysprivate.h"
#include "gdkintl.h"

View File

@@ -92,6 +92,8 @@ struct _GdkDisplay
guint double_click_time; /* Maximum time between clicks in msecs */
guint double_click_distance; /* Maximum distance between clicks in pixels */
GList *seats;
#ifdef GDK_RENDERING_VULKAN
VkInstance vk_instance;
VkDebugReportCallbackEXT vk_debug_callback;
@@ -103,7 +105,11 @@ struct _GdkDisplay
guint vulkan_refcount;
#endif /* GDK_RENDERING_VULKAN */
GList *seats;
/* egl info */
guint have_egl_buffer_age : 1;
guint have_egl_swap_buffers_with_damage : 1;
guint have_egl_no_config_context : 1;
guint have_egl_pixel_format_float : 1;
};
struct _GdkDisplayClass
@@ -140,10 +146,15 @@ struct _GdkDisplayClass
GdkKeymap * (*get_keymap) (GdkDisplay *display);
GdkGLContext * (*init_gl) (GdkDisplay *display,
GdkGLContext * (* init_gl) (GdkDisplay *display,
GError **error);
/* Returns the distance from a perfect score EGL config.
* GDK chooses the one with the *LOWEST* score */
guint (* rate_egl_config) (GdkDisplay *display,
gpointer egl_display,
gpointer egl_config);
GdkSeat * (*get_default_seat) (GdkDisplay *display);
GdkSeat * (*get_default_seat) (GdkDisplay *display);
GListModel * (*get_monitors) (GdkDisplay *self);
GdkMonitor * (*get_monitor_at_surface) (GdkDisplay *display,
@@ -208,6 +219,16 @@ GdkSurface * gdk_display_create_surface (GdkDisplay *display
GdkGLContext * gdk_display_get_gl_context (GdkDisplay *display);
gboolean gdk_display_init_egl (GdkDisplay *display,
int /*EGLenum*/ platform,
gpointer native_display,
gboolean allow_any,
GError **error);
gpointer gdk_display_get_egl_display (GdkDisplay *display);
gpointer gdk_display_get_egl_config (GdkDisplay *display);
gpointer gdk_display_get_egl_config_high_depth
(GdkDisplay *display);
void gdk_display_set_rgba (GdkDisplay *display,
gboolean rgba);
void gdk_display_set_composited (GdkDisplay *display,

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