Compare commits

...

1847 Commits

Author SHA1 Message Date
Matthias Clasen
05e8057b5b Fix gtk_column_view_sort_by_column
We must clear the current sort columns before
setting the new one, to prevent double arrows
in the headers.

Fixes: #4696
2022-04-18 20:37:04 -04:00
Matthias Clasen
e89365e9e3 gtk-builder-tool: Error out if screenshooting fails
If we don't produce a texture for whatever reason,
apologize and fail.
2022-04-18 11:16:05 -04:00
Timm Bäder
6484807719 Merge branch 'badcel/fix-typo' into 'main'
docs: Fix typo in description of GtkExpression

See merge request GNOME/gtk!4647
2022-04-18 09:27:05 +00:00
Marcel Tiede
527ff05107 docs: Fix typo in description of GtkExpression 2022-04-18 06:20:19 +00:00
Matthias Clasen
b89cfdb77f Merge branch 'screenshot-command' into 'main'
gtk-builder-tool: Add a screenshot command

See merge request GNOME/gtk!4645
2022-04-17 17:40:46 +00:00
Matthias Clasen
499687a11d gtk-builder-tool: Add a screenshot command
This is an obvious variation of the preview
command. It can save a .ui file as either
.png or .node.
2022-04-17 12:57:46 -04:00
Matthias Clasen
c5e26dd591 gtk-builder-tool: Reshuffle --help
Use GOptionContext better.
2022-04-17 12:57:46 -04:00
Matthias Clasen
bc17d1d5ea Merge branch 'wip/exalm/scrolled-window' into 'main'
scrolledwindow: Pick up gtk-overlay-scrolling changes on the fly

See merge request GNOME/gtk!4642
2022-04-17 16:07:59 +00:00
Matthias Clasen
b88ac0890e gtk-builder-tool: Small reshuffle
Move the display check into the preview command.
2022-04-17 11:23:00 -04:00
Matthias Clasen
d30baf34b3 Merge branch 'filechooser-entry-popup' into 'main'
filechooser: Prevent random completion popups

See merge request GNOME/gtk!4643
2022-04-17 03:51:32 +00:00
Matthias Clasen
b927ad2c87 Merge branch 'filechooser-save-sensitive' into 'main'
filechooser: Small fix for save mode

Closes #4851

See merge request GNOME/gtk!4644
2022-04-17 03:31:39 +00:00
Matthias Clasen
4540dac11a filechooser: Prevent random completion popups
It is very irritating when the entry completion popup
appears not in response to user input in the entry.
In particular, when that happens right as the dialog
is shown.

To prevent that, temporarily disable completion
when setting the entry text programmatically.
2022-04-16 23:29:04 -04:00
Matthias Clasen
aa9cac695d filechooser: Small fix for save mode
When changing folders, we were making the select
button insensitive when there's no files around.
That doesn't make sense in save mode when we don't
want to select a file but create one.

Fixes: #4851
2022-04-16 22:00:22 -04:00
Alexander Mikhaylenko
52412ca944 scrolledwindow: Pick up gtk-overlay-scrolling changes on the fly 2022-04-16 16:56:17 +04:00
Alexander Mikhaylenko
cd82b18cfd scrolledwindow: Fix :kinetic-scrolling setter 2022-04-16 16:30:33 +04:00
Matthias Clasen
da5bb6ff22 Merge branch 'wip/exalm/tooltip' into 'main'
tooltipwindow: Don't restrict minimum tooltip label length

Closes #3741

See merge request GNOME/gtk!4640
2022-04-16 00:07:21 +00:00
Alexander Mikhaylenko
7871f1e13b tooltipwindow: Don't restrict minimum tooltip label length
We only care about wrapping at that length, we still want short tooltips
for short labels.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3741
2022-04-16 03:48:21 +04:00
Alexander Mikhaylenko
dd18c7dedf tooltipwindow: Remove a duplicate gtk_widget_class_set_css_name() call 2022-04-16 03:28:50 +04:00
Matthias Clasen
a34a6e9b84 Merge branch 'ebassi/for-main' into 'main'
docs: Fix the GtkPaned style

See merge request GNOME/gtk!4637
2022-04-15 00:09:42 +00:00
Emmanuele Bassi
0a5f29c9eb Mark nullable arguments in GtkPaned
The set_start_child() and set_end_child() methods take NULL for the
child argument, as a way to remove the child from the paned widget.
2022-04-14 22:44:17 +01:00
Emmanuele Bassi
417be0719b docs: Fix the GtkPaned style
Use proper links to properties and methods, and drop gtk-doc'isms.
2022-04-14 22:43:40 +01:00
Matthias Clasen
3263a26cad Merge branch 'fix_tooltip' into 'main'
label: Maintain value for `has-tooltip` for labels with links

See merge request GNOME/gtk!4635
2022-04-14 18:00:43 +00:00
Matthias Clasen
00916c2b47 Merge branch 'fix_link_tabs' into 'main'
label: Move focus out of widget after last link

Closes #4681

See merge request GNOME/gtk!4636
2022-04-14 11:36:19 +00:00
Julian Sparber
e3320633a6 label: Move focus out of widget after last link
This allows the user to navigate via tab the links in a label and exits
the widget after the last link, when moving forward, and first link,
when moving backward.

This also ensures that ellipsised links arn't focused.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4681
2022-04-14 12:48:20 +02:00
Julian Sparber
764a8cea59 label: Maintain value for has-tooltip for labels with links
The `has-tooltip` property gets set to `false` for label with links if no
link is selected. This makes sure to only change the property to `true`
but never to `false`.
2022-04-13 19:05:53 +02:00
Benjamin Otte
a2599c2bb9 Merge branch 'clarify-scrollable-docs' into 'main'
scrollable: Clarify when to set adjustment props

See merge request GNOME/gtk!4632
2022-04-12 23:48:55 +00:00
Ivan Molodetskikh
e2675306e1 scrollable: Clarify when to set adjustment props
Instead of populating the properties right away (when the widget might
not have been allocated yet, and hence cannot know the right values),
the widget should queue an allocation, where it will populate the
values.
2022-04-12 17:22:51 +03:00
Benjamin Otte
7d1429cb91 Merge branch 'gles-win32' into 'main'
Inspector: Fix running on Windows with GLES (was: fix running GL demos with GLES on Windows)

See merge request GNOME/gtk!4595
2022-04-08 22:00:33 +00:00
Matthias Clasen
f13a018739 Merge branch 'matthiasc/for-main' into 'main'
gsk/gl: Typo fix

See merge request GNOME/gtk!4628
2022-04-08 16:14:43 +00:00
Matthias Clasen
84b3b1fab5 gsk/gl: Typo fix 2022-04-08 11:20:12 -04:00
Luca Bacci
048bb6db6f Merge branch 'gdk-win32-fix-mouse-move-crossing-events' into 'main'
GdkWin32: Mouse events fixes

Closes #4722 and #4813

See merge request GNOME/gtk!4620
2022-04-08 08:31:14 +00:00
Matthias Clasen
8c548d5579 Merge branch 'nonoverlapping-containers' into 'main'
gsk/gl: Avoid offscreening in more cases

See merge request GNOME/gtk!4619
2022-04-07 14:32:53 +00:00
Matthias Clasen
09d5ec1b08 Merge branch 'n-docs-fixes' into 'main'
More doc fixes

See merge request GNOME/gtk!4618
2022-04-07 14:05:40 +00:00
Matthias Clasen
28bba484da Merge branch 'matthiasc/for-main' into 'main'
gl: Don't leak big glyphs

See merge request GNOME/gtk!4626
2022-04-07 11:46:11 +00:00
Matthias Clasen
191558cfa4 gtk-demo: Small fixup to the cursors demo 2022-04-07 07:01:29 -04:00
Luca Bacci
cb0c1b3f08 GdkWin32: Generate crossing event after button release
Fixes #4813
2022-04-06 20:27:46 +02:00
Luca Bacci
91f200167e GdkWin32: Correct generation of crossing events when holding an implicit grab
Fixes #4722
2022-04-06 20:27:32 +02:00
Luca Bacci
2b6fb005a8 GdkWin32: Report serial for events 2022-04-06 19:45:50 +02:00
Matthias Clasen
af6bec7539 Merge branch 'push-history-position-fix' into 'main'
gdk: always populate GDK_AXIS_{X,Y} in merged event history

Closes #4809

See merge request GNOME/gtk!4623
2022-04-06 15:56:26 +00:00
Matthias Clasen
38362c2803 Merge branch 'wip/carlosg/osk-activation' into 'main'
imwayland: Connect OSK activating gesture to parent widget on editables

Closes #4795

See merge request GNOME/gtk!4624
2022-04-06 15:44:43 +00:00
Carlos Garnacho
eb7c78aa48 imwayland: Do not defer commit() after set_surrounding_text()
For reasons that only apply to the old serial handling, asking for
the surrounding after IM changes resulted in lazy handling of
commit() afterwards.

With the recent interpretation of serials, this problem became more
apparent, since it is in fact very likely that the last interaction
step after an IM change is notifying of the changed surrounding
text after the IM change was applied.

Make handling of surrounding text similar to caret position changes,
always commit() after the state change, but skip through non-changes.

This makes the compositor state fully up-to-date after an IM change.
2022-04-06 13:52:05 +02:00
Carlos Garnacho
7ab39b5461 imwayland: Connect OSK activating gesture to parent widget on editables
The gesture as connected currently on the child GtkText is easily overridden
by the parent editables (and gently done so in the attempt to consume all
clicks).

Connect this gesture to the parent editable widget in these cases, so the
gesture can cohabit with the click-consuming one. It's not part of the same
group, but it won't be abruptly cancelled.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4795
2022-04-06 13:52:05 +02:00
Hemidark
0c44851848 gdk: always populate GDK_AXIS_{X,Y} in merged event history
Since GdkTimeCoord stores only axis values, prior to this change,
if a device didn't report GDK_AXIS_X or GDK_AXIS_Y, the history
attached to merged motion events wouldn't contain any positional
information.

Commit 6012276093 already addressed
this issue for devices without tools by storing the event position
in GdkTimeCoord using GDK_AXIS_X and GDK_AXIS_Y and augmenting the
GdkTimeCoord's axis bitmask accordingly.

This change generalizes that workaround to all devices. Note that
if a device DOES report values for GDK_AXIS_X and GDK_AXIS_Y, those
values won't be overwritten.

Closes #4809
2022-04-05 15:35:12 -07:00
Matthias Clasen
d72ed045df gsk/gl: Use pre-collected opacity information
We now collect this information during node
construction, so use it here.

The concrete change here is that we now avoid
offscreens for container nodes with multiple children,
as long as they don't overlap. In particular, this
avoid offscreens for ellipsized dim labels.
2022-04-05 14:57:38 -04:00
Matthias Clasen
38eb182947 gsk: Collect opacity information
Collect information about whether to use offscreens
for opacity during node construction, so we don't
need to walk the tree repeatedly, later.
2022-04-05 14:57:38 -04:00
Matthias Clasen
0eba21b2b5 gsk: Track disjointness of container nodes
This can be used to optimize some things in the
GL renderer.
2022-04-05 14:57:38 -04:00
Matthias Clasen
21cba193ad Merge branch 'blurry-offscreen' into 'main'
gsk/gl: Always align offscreen rendering with the pixel grid

Closes #3833

See merge request GNOME/gtk!4621
2022-04-05 12:25:59 +00:00
Matthias Clasen
ee7c83e15a Merge branch 'matthiasc/for-main' into 'main'
gl: Don't leak big glyphs

See merge request GNOME/gtk!4622
2022-04-05 03:15:53 +00:00
Matthias Clasen
48dbbbc099 gl: Don't leak big glyphs
We were never resetting the accessed bit of
glyphs that are big enough to be stored individually,
so these would just accumulate and never be dropped.
2022-04-04 23:00:45 -04:00
Sebastian Keller
1c733857b3 testsuite: Add unaligned-offscreen test
Tests whether text rendered to an offscreen node unaligned with the
pixel grid introduces blurriness.
2022-04-04 23:48:58 +02:00
Sebastian Keller
85a6517d65 gsk/gl: Always align offscreen rendering with the pixel grid
This fixes two issues with the offscreen rendering code for nodes with
bounds not aligned with the pixel grid:

1.) When drawing to an offscreen buffer the size of the offscreen buffer
was rounded up, but then later when used as texture the vertices
correspond to the original bounds with the unrounded size. This could
then result in the offscreen texture being drawn onscreen at a slightly
smaller size, which then lead to it being visually shifted and blurry.

This is fixed by adjusting the u/v coordinates to ignore the padding
region in the offscreen texture that got added by the size increase from
rounding.

2.) The viewport used when rendering to the offscreen buffer was not
aligned with the pixel grid for nodes at coordinates not aligned with
the pixel grid. Then because the content of the offscreen buffer is not
aligned with the pixel grid and later when used as textures sampling
from it will result in interpolated values for an onscreen pixel. This
could also result in shifting and blurriness, especially for nested
offscreen rendering at different offsets.

This is fixed by adding similar padding at the beginning of the
texture and also adjusting the u/v coordinates to ignore this region.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3833
2022-04-04 21:40:01 +02:00
Christian Hergert
d75147db0a Merge branch 'sumibi-yakitori/fix-minimize-window-macos' into 'main'
macos: Fix problem that window cannot be minimized by user operation

Closes #4811

See merge request GNOME/gtk!4613
2022-04-04 18:53:19 +00:00
sumibi-yakitori
d3cf7088b3 macos: Skip running showAndMakeKey when a window is minimized by user action
When a window is minimized by user action, the `showAndMakeKey` method is not executed when idle. This prevents the window from being un-minimized immediately.
And allow programmatic minimization of a window by un-minimizing them in `_gdk_macos_toplevel_surface_present`

Closes #4811
2022-04-05 01:06:44 +09:00
Maximiliano Sandoval R
ffa7185397 application: Add link and inline code blocks 2022-04-04 14:11:16 +02:00
Maximiliano Sandoval R
d7fe62817c filter: Add link to FilterListmodel 2022-04-04 14:10:56 +02:00
Maximiliano Sandoval R
a034bdb17e texttag: Correct typo
Does not generate a gir docstring without it.
2022-04-04 14:10:18 +02:00
Matthias Clasen
af20f7e9b5 gl: Don't leak big glyphs
We were never resetting the accessed bit of
glyphs that are big enough to be stored individually,
so these would just accumulate and never be dropped.
2022-04-03 20:25:22 -04:00
Christian Hergert
15b7a4572b Merge branch 'sumibi-yakitori/fix-maximize-window-macos' into 'main'
macos: prohibit fullscreen transition if in transtion

This prevents performing additional fullscreen transitions while
a transition is already in progress.

Closes #4808

See merge request GNOME/gtk!4612
2022-04-03 22:14:52 +00:00
sumibi-yakitori
146bb70c2e macos: prohibit fullscreen transition if in transtion
This prevents performing additional fullscreen transitions while
a transition is already in progress.
2022-04-03 22:14:52 +00:00
Matthias Clasen
494de142f6 Merge branch 'matthiasc/for-main' into 'main'
inspector: Avoid a crash

See merge request GNOME/gtk!4617
2022-04-03 20:11:29 +00:00
Matthias Clasen
5d979cde82 inspector: Avoid another crash
We need to handle all event types here.
This was tripping over GDK_TOUCHPAD_HOLD events.
2022-04-03 15:55:21 -04:00
Matthias Clasen
f48b894468 inspector: Avoid a crash
Attribute lists can be NULL, it turns out.
2022-04-03 15:55:21 -04:00
Matthias Clasen
a6e47892be Merge branch 'matthiasc/for-main' into 'main'
gsk: Plug a memory leak

See merge request GNOME/gtk!4616
2022-04-03 14:21:13 +00:00
Matthias Clasen
1e0c25d96a Merge branch 'meson_fixes' into 'main'
meson: Use proper type for bools

See merge request GNOME/gtk!4615
2022-04-03 12:41:14 +00:00
Matthias Clasen
f57eec5288 css: Plug a memory leak
We were leaking the terms of calc values. Oops.
2022-04-03 08:04:35 -04:00
illiliti
e938befcbc meson: Use proper type for bools
Fix invalid usage of bools which violates official meson specification and thus
breaks muon, an implementation of meson written in C.
2022-04-03 14:55:33 +03:00
Matthias Clasen
2af8ac655b gsk: Plug a memory leak
This was introduced in 9defc7fc64.
2022-04-03 07:34:44 -04:00
Matthias Clasen
cc3c0125a8 Merge branch 'matthiasc/for-main' into 'main'
imcontextsimple: Plug a memory leak

See merge request GNOME/gtk!4614
2022-04-02 19:47:03 +00:00
Matthias Clasen
59f9be457f imcontextsimple: Plug a memory leak 2022-04-02 15:30:47 -04:00
Emmanuele Bassi
d1ce514260 Merge branch 'selection-model-docs' into 'main'
docs: Fix links in selection models

See merge request GNOME/gtk!4609
2022-04-01 11:20:11 +00:00
Maximiliano Sandoval R
ad5e72728f docs: Fix links in selection models 2022-04-01 13:04:14 +02:00
Andika Triwidada
1bf24f7b19 Update Indonesian translation 2022-04-01 03:56:36 +00:00
Matthias Clasen
a3cedb0163 Merge branch 'clipboard-seg' into 'main'
x11: Check return of gdk_x11_get_xatom_name_for_display

See merge request GNOME/gtk!4607
2022-04-01 00:56:32 +00:00
Matthias Clasen
97bab27d82 Merge branch 'fix-win32-empty-clipboard' into 'main'
gdkclipboard-win32.c: Fix call to gdk_clipboard_claim_remote() (check GdkContentFormat is not NULL

Closes #4796

See merge request GNOME/gtk!4604
2022-04-01 00:56:02 +00:00
Matthias Clasen
6030da573d Merge branch 'nls' into 'main'
Remove #ifdef ENABLE_NLS

See merge request GNOME/gtk!4606
2022-03-31 17:07:37 +00:00
Matthias Clasen
0128574ca1 Merge branch 'wip/carlosg/immulticontext-display-switch' into 'main'
gtkimmulticontext: Handle switches between displays

Closes #4805

See merge request GNOME/gtk!4605
2022-03-31 16:29:38 +00:00
Christoph Reiter
b27a169200 Merge branch 'msys2-ci-cleanup' into 'main'
CI: clean up MSYS2 build dependencies

See merge request GNOME/gtk!4600
2022-03-31 15:46:54 +00:00
Xavier Claessens
bcd0704511 Remove #ifdef ENABLE_NLS
libintl API is guaranteed to always be available, glib will fallback to
proxy-libintl in case gettext is not found.
2022-03-31 11:41:34 -04:00
Dr. David Alan Gilbert
506566b6a4 x11: Check return of gdk_x11_get_xatom_name_for_display
When given an invalid atom, gdk_x11_get_xatom_name_for_display can
return NULL and trigger a seg in gdk_x11_clipboard_formats_from_atoms.
Check for NULL.

Why I'm seeing a bad atom there is probably a separate question.
https://bugzilla.redhat.com/show_bug.cgi?id=2037786
2022-03-31 15:56:09 +01:00
Carlos Garnacho
b67da38916 gtkimmulticontext: Handle switches between displays
Currently the GtkIMMultiContext may stick to a delegate GtkIMContext
that no longer applies after the multicontext is dissociated from
any widget.

Handle set_client_widget() so that it can handle changes between
widgets from 2 different display, but also so the delegate is made
NULL whenever the context has a NULL widget.

Doing so, any new client widget results in a new delegate IM context
lookup from the right GdkDisplay and GtkSettings, which avoids any
mix up.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4805
2022-03-31 16:35:29 +02:00
Chun-wei Fan
8519ab56f5 gdkclipboard-win32.c: Fix call to gdk_clipboard_claim_remote()
The call to gdk_win32_clipboard_request_contentformats() can return NULL even
without an error condition being hit (such as when the system clipboard is
empty), so check whether the returned GdkContentFormat pointer is not NULL
before calling gdk_clipboard_claim_remote(), which expects it to be not NULL,
otherwise we face a warning from that funtion and the subsequent
g_object_unref().

This at least partially fixes issue #4796.
2022-03-31 10:55:39 +08:00
Chun-wei Fan
89d87e3482 inspector/general.c: Check whether GL context supports WGL
We may well be using an EGL context that does not support Desktop (W)GL on
Windows, such as in the case of using libANGLE.  So, check whether WGL is
supported for this running instance before trying to query WGL extensions.

This will get rid of warning messages from libepoxy.
2022-03-30 16:09:18 +08:00
Carlos Garnacho
04c9c6b428 Merge branch 'wip/exalm/scroll-hold' into 'main'
eventcontrollerscroll: Always propagate hold events

See merge request GNOME/gtk!4599
2022-03-28 14:27:55 +00:00
Alexander Mikhaylenko
9bd8ed0d82 eventcontrollerscroll: Always propagate hold events
Otherwise a stray scroll controller may prevent others from getting hold
events, even if it always propagates scroll events and does absolutely
nothing.
2022-03-28 12:04:15 +00:00
Rūdolfs Mazurs
40386c97eb Update Latvian translation
(cherry picked from commit 3b50f2e8b9)
2022-03-27 20:19:34 +00:00
Rūdolfs Mazurs
6649cc6e5e Update Latvian translation
(cherry picked from commit d4dd7969d6)
2022-03-27 19:54:19 +00:00
Christoph Reiter
e69dc04a7f CI: clean up MSYS2 build dependencies
We only need a C compiler and not the whole toolchain,
and gst-plugins-bad was split into libraries and plugins.
pkg-config -> pkgconf.

This should speed the CI setup up a bit.
2022-03-27 20:10:58 +02:00
Emmanuele Bassi
c1361f7a5a Merge branch 'antoniof-main-patch-34986' into 'main'
overlaylayout: Set position style class on child

Closes nautilus#2099

See merge request GNOME/gtk!4597
2022-03-27 16:25:50 +00:00
António Fernandes
351ffef704 overlaylayout: Set position style class on child
As documented:
> Overlay children whose alignments cause them to be positioned
> at an edge get the style classes “.left”, “.right”, “.top”, 
> and/or “.bottom” according to their position.

Likely accidental regression in b7ee2cbc28

Fixes https://gitlab.gnome.org/GNOME/nautilus/-/issues/2099
2022-03-27 14:59:10 +00:00
Matthias Clasen
a1ddd3fead Merge branch 'inspector-attributes' into 'main'
inspector: Allow viewing PangoAttrList properties

See merge request GNOME/gtk!4596
2022-03-25 13:03:00 +00:00
Matthias Clasen
79f0f4ee8e inspector: Allow viewing PangoAttrList properties
We have pango_attr_list_to/from_string, so this is
easy. The editing UI isn't ideal, but it solves my
immediate need to see attributes.
2022-03-25 08:35:16 -04:00
Matthias Clasen
7b8bfb4c80 Merge branch 'main' into 'main'
Check for 'rst2man' misses installed 'rst2man.py' (#4728)

See merge request GNOME/gtk!4586
2022-03-25 11:48:28 +00:00
Benjamin Otte
7106cf6524 Merge branch 'wip/chergert/fix-gl-rgba' into 'main'
gdk/gl: handle GL_RGBA/GL_UNSIGNED_NORMALIZED

Closes #4783

See merge request GNOME/gtk!4594
2022-03-25 01:34:15 +00:00
Christian Hergert
e706e14fd9 gdk/gl: handle GL_RGBA/GL_UNSIGNED_NORMALIZED
WebKit's GTK 4 port can give us textures with an internal format of
GL_RGBA with GL_UNSIGNED_NORMALIZED and a bit-depth of 8. This fixes
warnings for every GdkGLTexture created/delivered to the GskGLRenderer.

The format is essentially the same as GL_RGBA8 since it is normalized
between 0.0..1.0 for 8-bit components.

Fixes #4783
2022-03-24 18:05:11 -07:00
Matthias Clasen
3f1021048f Merge branch 'want_prepare_without_play_for_size' into 'main'
GtkMediaStream with gstreamer backend isn't 'prepared' until media is played

See merge request GNOME/gtk!4560
2022-03-24 19:19:01 +00:00
Matthias Clasen
ddba7f8601 Apply 1 suggestion(s) to 1 file(s) 2022-03-24 17:16:11 +00:00
Bruce Cowan
1660a0eaf1 Update British English translation
(cherry picked from commit dd198cfc06)
2022-03-24 13:19:45 +00:00
Kukuh Syafaat
ffffb382e2 Update Indonesian translation 2022-03-23 15:39:17 +00:00
Kukuh Syafaat
09453bc60b Update Indonesian translation 2022-03-23 13:46:25 +00:00
Matthias Clasen
f76b749e43 Merge branch 'fix-popover-menu-rtl-position' into 'main'
popover-menu: Fix buttons' position in RTL

See merge request GNOME/gtk!4587
2022-03-23 02:16:41 +00:00
Cheng-Chia Tseng
0aca2a03b4 Update Chinese (Taiwan) translation 2022-03-22 14:47:50 +00:00
Matthias Clasen
fd358990a2 Merge branch 'wip/chergert/reduce-overlay-overhead' into 'main'
Default: avoid use of opacity for overlay scrollbars

See merge request GNOME/gtk!4590
2022-03-22 13:27:54 +00:00
Matthias Clasen
01b91c1ba3 Merge branch 'fix-high-depth-switch' into 'main'
surface: Use correct display when destroying a surface for depth switch

Closes #4773

See merge request GNOME/gtk!4591
2022-03-22 12:58:07 +00:00
Sebastian Keller
cc02076b75 surface: Use correct display when destroying a surface for depth switch
When surface depth switches from non-high-depth to high-depth (or vice
versa) the current surface has to be destroyed before a new one can be
created for this window. eglDestroySurface however was getting passed a
GdkDisplay, rather than the EGLDisplay it expects. As a result the old
surface did not get destroyed and the new surface could not be created
causing rendering to freeze.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4773
2022-03-22 08:18:26 +01:00
Christian Hergert
b726a2d902 Default: avoid use of opacity for overlay scrollbars
If using the opacity CSS property the renderer cannot optimize these
handles without the use of offscreens due to the use of both a border
and rgb render node.

Instead, we can apply the alpha to the color values and get the same
effect in a way that the GL renderer can optimize without the use of
offscreen textures for a sizeable reduction in runtime overhead.
2022-03-21 22:10:23 -07:00
Marek Černocký
654ae5928a Updated Czech translation 2022-03-21 14:57:35 +01:00
Marek Černocký
1c24514798 Updated Czech translation 2022-03-21 12:14:36 +01:00
Yosef Or Boczko
33f3ab9991 popover-menu: Fix buttons' position in RTL
The radio/check/previous buttons shows in
the wrong place in RTL. Fix it.

#4641

Signed-off-by: Yosef Or Boczko <yoseforb@gmail.com>
2022-03-20 00:54:26 +02:00
aneejit1
91511a80ac Check for 'rst2man' misses installed 'rst2man.py' (#4728)
By default, 'docutils' installs 'rst2man' as 'rst2man.py'. Amend the
check for 'rst2man' to look for 'rst2man.py' as well if 'rst2man' is
not found.
2022-03-19 13:58:40 +00:00
Philipp Kiemle
a585457861 Update German translation
(cherry picked from commit d9c39f6795)
2022-03-19 12:32:43 +00:00
Carlos Garnacho
4a0ddac307 Merge branch 'wip/carlosg/fix-accumulated-velocity' into 'main'
kinetic scroll fixes

See merge request GNOME/gtk!4572
2022-03-19 12:02:56 +00:00
Carlos Garnacho
f7d9ede82d gtkkineticscrolling: Do not take distance based shortcuts
The pixel distance could be small enough between tick() calls that
this kind of checks might potentially become a problem. Rely only on
the calculated velocity to trigger the STOPPED phase, and use a lower
threshold to avoid cutting the animation too early.

Related: https://gitlab.gnome.org/GNOME/gtk/-/issues/4725
2022-03-19 12:35:11 +01:00
Carlos Garnacho
65839f67f8 gtkscrolledwindow: Do not trigger kinetic helpers on 0 velocity
Doing this is pointless, so it could be skipped.
2022-03-19 12:35:11 +01:00
Carlos Garnacho
df40db137b gtkscrolledwindow: Change lifetime of kinetic scroll helpers
In order to properly accumulate scroll velocities, we need to keep
the kinetic scroll helpers after we have possibly stopped them
in the process of initiating a further scroll flick.

So, instead of stopping (and destroying) those helpers on scroll-begin,
keep them until the next scroll-end if a scroll was initiated before
kinetic scroll finished. This way we can fetch the last velocity when
calculating the extra kick.

In order to ensure the helpers don't live beyond what it is expected,
we now also remove them after a finished hold event.

Fixes the accumulation of scrolling velocity on consecutive scroll
sequences.
2022-03-19 12:35:11 +01:00
Carlos Garnacho
129bc27d53 gtkscrolledwindow: Refactor kinetic scroll animation
Do not depend on the kinetic scroll helpers existing or not before
exiting the animation, as we may want to keep those a little bit
longer after stopped.
2022-03-19 12:35:11 +01:00
Carlos Garnacho
274e2b221f gtkkineticscroll: Do not reset velocity after stop()
We may want to fetch the last velocity obtained, even though we
preemptively called stop() on a kinetic scroll helper. Keep this
velocity so it can be queried later on.
2022-03-19 12:35:11 +01:00
Emmanuele Bassi
adc4009354 Merge branch 'search-delay-versions' into 'main'
Fix GtkSearchEntry:search-delay docs

See merge request GNOME/gtk!4585
2022-03-19 10:14:04 +00:00
Sebastian Dröge
f058a42bd3 Add version marker to GtkSearchEntry:search-delay property 2022-03-19 11:56:05 +02:00
Sebastian Dröge
3a8cb276e7 Fix typo in gtk_search_entry_set_search_delay() docs causing it to not show up 2022-03-19 11:55:03 +02:00
Matthias Clasen
eeaa73c12a Merge branch 'macos-fix-scroll-unit-build' into 'main'
macos: fix scroll-unit build

See merge request GNOME/gtk!4584
2022-03-19 03:57:48 +00:00
panoplie
3873861b27 macos: fix scroll-unit build 2022-03-19 02:55:02 +01:00
Carlos Garnacho
8e455e333b Merge branch 'scroll-unit' into 'main'
GdkScrollEvent: indicate the delta unit with a new GdkScrollUnit enum

See merge request GNOME/gtk!4508
2022-03-19 00:47:08 +00:00
Matthias Clasen
3d10e6c3d1 Merge branch 'wip/carlosg/rewritten-events-from-other-toplevels' into 'main'
gtk/main: Make coords out of surface when rewriting events for grabs

Closes #4760

See merge request GNOME/gtk!4566
2022-03-19 00:34:17 +00:00
Matthias Clasen
dcc7cf7114 Merge branch 'wip/chergert/gsk-gl-texture-library' into 'main'
gsk/gl: texture libraries, shader creation

See merge request GNOME/gtk!4583
2022-03-18 23:46:17 +00:00
panoplie
f1d0886087 gtkeventcontrollerscroll: Map surface scroll unit in discrete steps 2022-03-19 00:41:26 +01:00
panoplie
951e4ee6b2 recorder: Show scroll events deltas unit 2022-03-19 00:41:26 +01:00
panoplie
f9e2c106bc gtkrange: Add scroll unit handling 2022-03-19 00:41:26 +01:00
panoplie
53956e5389 gtkscrolledwindow: Add scroll unit handling
On the "scroll" signal, the widget uses
gtk_event_controller_scroll_get_unit() to get the
scroll unit.

When the unit is GDK_SCROLL_UNIT_WHEEL, the
behavior is unchanged: the widget scrolls a
certain number of pixels at each wheel detent
click. This number of pixels is determined by the
window dimensions in get_wheel_detent_scroll_step().

When the delta unit is GDK_SCROLL_UNIT_SURFACE, the
widget directly adds the delta to the number of
scrolled pixels no matter the window dimensions.
2022-03-19 00:41:26 +01:00
panoplie
3ab63fd03b gtkeventcontrollerscroll: Add scroll unit getter
The scroll unit is accessible through
gtk_event_controller_scroll_get_unit() after the
"scroll" signal reception.
2022-03-19 00:41:26 +01:00
panoplie
fb4927827b gdk: Add enum to indicate the unit of scroll deltas
Add a new GdkScrollUnit enum that represent the
unit of scroll deltas provided by GdkScrollEvent.
The unit is accessible through
gdk_scroll_event_get_unit().
2022-03-19 00:41:26 +01:00
Christian Hergert
cbbca38d88 gsk/gl: use consistent library naming 2022-03-18 14:59:49 -07:00
Christian Hergert
c64836e1c9 gsk/gl: make texture libraries more autonomous
This moves a lot of the texture atlas control out of the driver and into
the various texture libraries through their base GskGLTextureLibrary class.

Additionally, this gives more control to libraries on allocating which can
be necessary for some tooling such as future Glyphy integration.

As part of this, the 1x1 pixel initialization is moved to the Glyph library
which is the only place where it is actually needed.

The compact vfunc now is responsible for compaction and it allows for us
to iterate the atlas hashtable a single time instead of twice as we were
doing previously.

The init_atlas vfunc is used to do per-library initialization such as
adding a 1x1 pixel in the Glyph cache used for coloring lines.

The allocate vfunc purely allocates but does no upload. This can be useful
for situations where a library wants to reuse the allocator from the
base class but does not want to actually insert a key/value entry. The
glyph library uses this for it's 1x1 pixel.

In the future, we will also likely want to decouple the rectangle packing
implementation from the atlas structure, or at least move it into a union
so that we do not allocate unused memory for alternate allocators.
2022-03-18 14:59:46 -07:00
Christian Hergert
6b23fe3aa7 gsk/gl: pin atlases to single texture library
This removes the sharing of atlases across various texture libraries. Doing
so is necessary so that atlases can have different semantics for how they
allocate within the texture as well as potentially allowing for different
formats of texture data.

For example, in the future we might store non-pixel data in the textures
such as Glyphy or even keep glyphs with color content separate from glyphs
which do not and can use alpha channel only.
2022-03-18 12:48:43 -07:00
Christian Hergert
9defc7fc64 gsk/gl: add more control over shader generation
This allows the gskglprograms.defs a bit more control over how a shader
will get generated and if it needs to combine sources. Currently, none of
the built-in shaders do that, but upcoming shaders which come from external
libraries will need the ability to inject additional sources in-between
layers.
2022-03-18 12:34:32 -07:00
Christian Hergert
9d56f44cdf gsk/gl: rename glyphs to glyphs_library
This naming style is less likely to collide with shader naming and makes
it clear where it is consumed what it is.
2022-03-18 12:34:32 -07:00
Christian Hergert
1b9da2bb17 gsk/gl: allow configuring atlas size 2022-03-18 12:34:27 -07:00
Christian Hergert
2efc1729e2 gsk/gl: check for format as well
This could potentially happen if a uniform had never been set.
2022-03-18 12:33:33 -07:00
Christian Hergert
a66a0dde81 gsk/gl: only clear glyph cache durign reclaimation
We don't need to clear the front cache on every frame as we can clear it
specifically when we do reclaimation to avoid unnecessary memset() calls.
2022-03-18 12:33:33 -07:00
Christian Hergert
7062411bad gsk/gl: ignore max_entry_size when zero
If the max_entry_size is zero, then assume we can add anything to the
atlas. This allows for situations where we might be uploading an arc list
to the atlas instead of pixel data for GPU font rendering.
2022-03-18 12:33:33 -07:00
Christian Hergert
9dbd137ec8 gsk/gl: make max-frame-age configurable
This is nice for some texture libraries that we might want to keep around
for longer than say 60 frames such as a glyph cache.
2022-03-18 12:33:33 -07:00
Matthias Clasen
79fad9f221 gtk-demo: Don't hardcode a title font
We want a large font size, but we don't have to
hardcode Sans.
2022-03-18 12:33:33 -07:00
Matthias Clasen
8f9ee48aaa Merge branch 'filefilter-suffixes' into 'main'
filefilter: Fix <suffixes> in buildable

See merge request GNOME/gtk!4581
2022-03-17 16:57:09 +00:00
James Westman
8eb9844a45 filefilter: Fix <suffixes> in buildable
A bug in GtkFileFilter's GtkBuildable implementation caused the
<suffixes> tag not to be recognized.
2022-03-17 10:52:20 -05:00
Milo Casagrande
b90132c917 Update Italian translation
(cherry picked from commit 3e4bfa2bae)
2022-03-17 08:36:13 +00:00
Milo Casagrande
23806b7788 Update Italian translation
(cherry picked from commit 9bbf09fb0a)
2022-03-17 08:34:32 +00:00
Мирослав Николић
d266c0d105 Update Serbian translation
(cherry picked from commit c874f65d95)
2022-03-17 06:04:41 +00:00
Carlos Garnacho
581461c2b5 Merge branch 'wip/carlosg/im-wayland-serials' into 'main'
gtk/imwayland: Use serial to control outbound messages

Closes #3641

See merge request GNOME/gtk!4398
2022-03-16 18:52:24 +00:00
Carlos Garnacho
f108f053d4 gtk/imwayland: Use serial to control outbound messages
Following the text-input protocol changes at
https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/115,
use the serial number to have the client push changes to the
zwp_text_input_v3 object only after compositor/client states match.

This specifically is more lenient to compositors pushing multiple
.done events ahead of the client replying to them.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3641
2022-03-16 17:38:14 +01:00
Matthias Clasen
df593ee651 Merge branch 'wip/carlosg/im-text-location' into 'main'
gtkimcontextwayland: Add native surface offset to input coordinates

Closes #4668

See merge request GNOME/gtk!4573
2022-03-16 11:54:26 +00:00
Carlos Garnacho
4dcd011486 gtkimcontextwayland: Add native surface offset to input coordinates
We were missing the surface offset (e.g. shadows) at the time of expressing
the text caret location in surface coordinates. Add this offset so the
coordinates are as expected by the compositor.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4668
2022-03-16 09:57:42 +01:00
Matthias Clasen
6fe7e373e2 Merge branch 'gtk/gss-search-delay' into 'main'
searchentry: Make search delay editable

Closes #4133

See merge request GNOME/gtk!4563
2022-03-15 22:40:54 +00:00
Ondřej Míchal
0c3583b4bd searchentry: Make search delay editable
The default search delay of 150ms can be too low at times[0], leading app
developers to add additional delay while handling the search-changed
signal[1].

Based on past work from hugsie[2].

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/4133

[0] https://github.com/getting-things-gnome/gtg/issues/281
[1] https://github.com/getting-things-gnome/gtg/pull/587
[2] https://gitlab.gnome.org/GNOME/gtk/-/issues/678
2022-03-15 23:55:10 +02:00
Kjartan Maraas
5bd0179a88 Update Norwegian Bokmål translation
(cherry picked from commit 72a557087c)
2022-03-15 15:26:58 +00:00
Matthias Clasen
f116efd48e Merge branch 'main' into 'main'
gtkplacessidebar: Prevent calling g_object_unref on null

See merge request GNOME/gtk!4569
2022-03-15 14:37:14 +00:00
Matthias Clasen
8057bee295 Apply 1 suggestion(s) to 1 file(s) 2022-03-15 14:35:09 +00:00
Matthias Clasen
ab330f1efc Merge branch 'wip/jimmac/symbolics-gnome-42-sync' into 'main'
icons: update symbolics

See merge request GNOME/gtk!4571
2022-03-15 14:29:27 +00:00
Carlos Garnacho
e5dc66b10e gtk/main: Fix handling of !owner_events grabs
These are meant to always redirect events to the grabbing surface,
even for other surfaces of the same client. We weren't doing that
(instead letting the event go through unmodified), fix this handling
so GTK sees the events consistenty.
2022-03-15 14:40:49 +01:00
Carlos Garnacho
aa43d97a80 gtk/main: Make coords out of surface when rewriting events for grabs
If a grab is held on a toplevel surface tree, and events happen on a
different surface tree from another toplevel/window group, we rewrite
these events so they look like generated on the window group that
holds the grab, but it missed that coordinates would fail to be
translated, so these would stay unchanged and "pointing" to random
parts of the toplevel that is holding the grab and handling the events.

Since off-surface coordinates are not specially meaningful, and in
fact impossible to obtain in some backends, just fake the coordinates
making it sure that all rewritten events point outside the surface.

The grabbing window will still handle the events, but the coordinates
in these will be harmlessly moot.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4760
2022-03-15 14:29:16 +01:00
Matthias Clasen
eaf4fb68f3 Merge branch 'avoid-objcopy-on-arm' into 'main'
build: Avoid objcopy on arm

Closes #4757, #4748, and #4752

See merge request GNOME/gtk!4567
2022-03-15 13:08:53 +00:00
Jakub Steiner
bfe193e6e2 icons: update symbolics
- match the metaphors/style updates of gnome 42

See https://gitlab.gnome.org/GNOME/gtk/-/issues/4764
2022-03-15 08:31:26 +01:00
Мирослав Николић
aa8dec3d27 Update Serbian translation
(cherry picked from commit b59f9b97f3)
2022-03-15 06:33:46 +00:00
Matthias Clasen
d2e7060150 Merge branch 'builder-tool-nodisplay' into 'main'
gtk-builder-tool: Operate without display

See merge request GNOME/gtk!4568
2022-03-14 22:15:11 +00:00
Fina Wilke
08f3acb534 gtkplacessidebar: Prevent calling g_object_unref on null
g_object_unref would be called on a null end_icon when provider_account_status
is CLOUD_PROVIDERS_ACCOUNT_STATUS_IDLE
2022-03-14 22:33:35 +01:00
Matthias Clasen
525f96f2f8 gtk-builder-tool: Operate without display
The simplify and validate commands can function
without a display connection, only preview absolutely
needs one. Allow this, by using gtk_init_check().
2022-03-14 15:40:12 -04:00
Matthias Clasen
b6b2682bd6 build: Avoid objcopy on arm
The trickery we do with objcopy and ld to speed up
resource inclusion does not seem to work right on
32bit Arm, so just skip it there.

Fixes: #4757, #4748, #4752
2022-03-14 08:44:09 -04:00
Christian Kirbach
1832964188 Update German translation
(cherry picked from commit a1f4735652)
2022-03-13 22:09:17 +00:00
Matthias Clasen
eb599653e6 Merge branch 'wip/lantw/build-Don't-use-ld-and-objcopy-when-cross-compiling' into 'main'
build: Don't use ld and objcopy when cross-compiling

See merge request GNOME/gtk!4565
2022-03-13 14:31:23 +00:00
Ting-Wei Lan
e1e88ce665 build: Don't use ld and objcopy when cross-compiling
These commands don't work when compiling Windows binaries on Linux.
2022-03-13 15:19:46 +08:00
Balázs Úr
66d21689bc Update Hungarian translation 2022-03-13 00:23:04 +00:00
Matthias Clasen
8186cb8bee Merge branch 'wip/chergert/for-main' into 'main'
macos: fit'n'finish fixes for main

See merge request GNOME/gtk!4564
2022-03-12 19:07:41 +00:00
Baurzhan Muftakhidinov
9b8f28903b Update Kazakh translation
(cherry picked from commit 6ac723321f)
2022-03-12 13:23:41 +00:00
Anders Jonsson
1cd42825c2 Update Swedish translation
(cherry picked from commit 343b08f3e6)
2022-03-12 11:39:33 +00:00
Christian Hergert
166444f115 macos: exclude popups from window list
This probably only matters if you do window list integration for the global
menu on macOS.
2022-03-11 22:36:26 -08:00
Christian Hergert
3cd68c5de5 macos: pass events to foreign windows 2022-03-11 18:25:47 -08:00
Christian Hergert
9e2357d5f3 macos: clear sorted surfaces when showing file chooser
When showing the native file chooser, we need to ensure we clear the
sorted surfaces in the display so that we don't risk delivering events
correctly on the next frame.
2022-03-11 18:19:44 -08:00
Christian Hergert
bd0c68f641 macos: dont steal key window from NSPanel
Or we risk making it really difficult to use native file choosers.
2022-03-11 18:07:34 -08:00
Christian Hergert
c3a7d79154 macos: fix window level for popups
This comment isn't really accurate anymore it seems, so we can start
setting the proper stacking order for popups now.
2022-03-11 18:01:05 -08:00
Christian Hergert
25624083dd macos: fix attachment of popups to parents
We had code to do it and it never actually got used correctly. This ensures
that the popup services are attached to the parents so that they get proper
stacking orders when displayed. Additionally, it fixes popups from being
shown as their own windows in Exposé.
2022-03-11 17:53:42 -08:00
Christian Hergert
407b5246a6 macos: fix window activation during shadow click-through
If we are clicking through the shadow of a window, we need to take special
care to not raise the old window on mouseUp. This is normally done by the
display server for us, so we need to use the proper API that is public to
handle this (rather than CGSSetWindowTags()). Doing so requires us to
dispatch the event to the NSView and then cancel the activcation from
the mouseDown: event there.
2022-03-11 14:44:07 -08:00
Christian Hergert
6bedcf22bc macos: select new key window after processing events
If we closed a key window in response to events, we need to denote another
window as the new key window. This is easiest to do from an idle so that
we don't clobber notification pairs of "did resign"/"did become" key
window.

We have a sorted set of surfaces by display server stacking, so we can
take the first one we come across that is already mapped and re-show it
to become key/main.
2022-03-11 14:44:06 -08:00
Christian Hergert
eeb9d6c398 macos: request layout with server-side decoration
If we have server-side decorations we might need to request a layout in
response to the resize notification. We don't need to do this in other
cases because we already handle that in the process of doing the resize
(and that code is that way because of delayed delivery of NSNotification).
2022-03-11 14:44:06 -08:00
Christian Hergert
cf8d2374c5 macos: fix resize when using server-side decorations
If we are using NSWindow titled windows, we don't end up waking up the
frame clock when the window is resized on the display server. This ensures
that we do that after getting a notification of resize.
2022-03-11 14:44:06 -08:00
Christian Hergert
9fa5378d83 macos: set main window in addition to key
If we are showing the window, we might also want to make it the main
window for the application when shown.
2022-03-11 14:44:06 -08:00
Dušan Kazik
90352d760d Update Slovak translation
(cherry picked from commit c8d1f23ff5)
2022-03-11 07:44:15 +00:00
Balázs Úr
c3c1763a9f Update Hungarian translation 2022-03-11 01:09:19 +00:00
Matthias Clasen
9f7c9ce6ad Merge branch 'better-format-conversions' into 'main'
gdk: Clean up the optimised premultiply conversion function

See merge request GNOME/gtk!4550
2022-03-10 19:26:25 +00:00
Matthias Clasen
1f155bf39a Merge branch 'wlprotocols-dependency-correctness' into 'main'
meson: use proper handling of wayland-protocols dependency

See merge request GNOME/gtk!4561
2022-03-10 19:15:39 +00:00
Christian Hergert
84014e3414 macos: make transient-for key window when hiding surface
This only handled the popover case before and not the transient-for case.
2022-03-10 08:04:14 -08:00
Christian Hergert
4ced1c90f1 macos: actually drop unnecessary momentum events
These would get passed along to the NSApplication which we don't really
need to have happen. Denote it as such.
2022-03-10 03:21:12 -08:00
Christian Hergert
54c3b947fc macos: queue all pending events
Rather than process these a single event at a time, queue all of the
outstanding events from the NSEvent queue.
2022-03-10 03:20:07 -08:00
Eli Schwartz
94007caf8d meson: use proper handling of wayland-protocols dependency
Ensure that resolution of the subproject occurs via the dependency
interface, not the "poke at subprojects manually" interface, and make
that actually work via --wrap-mode=forcefallback.

There's no need to mark it as not-required and then manually invoke
subproject(), since fallback should work correctly and it is always
needed.

However, if fallback was performed (or forced) it would error out since
get_variable() was instructed to only use pkg-config while the relevant
variable was exported by the subproject as an internal fallback
dependency.
2022-03-10 00:08:36 -05:00
Matthias Clasen
675c8b45b1 Merge branch 'wip/jimmac/legacy-icons-gtk4' into 'main'
icons: add missing legacy fullcolor

See merge request GNOME/gtk!4558
2022-03-09 23:37:26 +00:00
Christian Hergert
ea59d174a0 macos: drop enter/exit when in manual drag/resize
If we are in a manual resize/drag then we don't want to generate crossing
events as they can just confuse things.
2022-03-09 13:20:53 -08:00
Christian Hergert
32935d9fb0 macos: allow dropping NSEvent without propagation
There are cases we might want to consume a NSEvent without creating a
GdkEvent or passing it along to the NSApplication for processing. This
creates a new value we can use and check against to propagate that without
having to do out parameters at the slightly odd invalid pointer value for
a GdkEvent (similar to how MMAP_FAILED is done).
2022-03-09 13:19:22 -08:00
Christian Hergert
b390e1da4f macos: do not focus new window when resigning main
This can get in the way of how we track changes while events are actively
processing. Instead, we may want to delay this until the next main loop
idle and then check to see if we have a main window as the NSNotification
may have come in right after this.
2022-03-09 12:33:46 -08:00
Jiri Grönroos
cccd1147e7 Update Finnish translation
(cherry picked from commit d188c6dbaf)
2022-03-09 19:03:58 +00:00
Emmanuele Bassi
d8db5f3217 Merge branch 'fix_gtk_accessible_update_relation_example' into 'main'
fix docs for gtk_accessible_update_relation example

See merge request GNOME/gtk!4559
2022-03-09 18:22:54 +00:00
Marek Černocký
f5bb364bb5 Fixed Czech translation 2022-03-09 19:06:22 +01:00
Caolán McNamara
82f57c6a93 GtkMediaStream with gstreamer backend isn't 'prepared' until media is played
This seems to be a problem since:
https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/3565

To demo the problem, the video demo in gtk4-demo is currently set to
autoplay, but it doesn't autoplay on load as expected because the
"prepared" notification doesn't fire until the user explicitly presses
play.

Similarly if the demo is tweaked to disable autoplay then on loading a
video (or an audio-only ogg) the duration is not known or shown until
the user presses play.

In LibreOffice we want to know what the size of the video is to position
it before the user can interact with it to set it to play. We can
workaround this to some degree by listening to "invalidate-size" on the
GtkMediaStream object which updates for videos, but that doesn't wor
for audio-only streams.

So restore listening to media-info-updated but ignore -1 (which I see
for audio-only where I get -1 and then a useful value) and 0 of the
original report.

see also:
https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/3550

GNOME/gtk!4513
2022-03-09 16:29:11 +00:00
Caolán McNamara
20c41dce80 fix docs for gtk_accessible_update_relation example 2022-03-09 16:24:47 +00:00
Jakub Steiner
a9de385ac5 icons: add missing legacy fullcolor
- relied on in testsuite

See https://gitlab.gnome.org/GNOME/gtk/-/issues/4754
2022-03-09 16:19:16 +01:00
Anders Jonsson
ead210c170 Update Swedish translation
(cherry picked from commit 9053fd8335)
2022-03-09 10:50:11 +00:00
Matthias Clasen
2ad471542a Merge branch 'fix-focus-issues' into 'main'
Fix some focus issues

See merge request GNOME/gtk!4556
2022-03-08 19:37:45 +00:00
Danial Behzadi
d73cff5846 Update Persian translation
(cherry picked from commit a9720259f0)
2022-03-08 15:01:00 +00:00
Matthias Clasen
213376ee0a text: Stop blinking when we lose focus
We were looking at GtkWidget:has-focus from
event controller signal handlers here, but
the widget property is only changed after
the event controllers.
2022-03-08 06:06:47 -07:00
Matthias Clasen
1cc100415f focus controller: Update for active window
When the window gains or looses active status,
update the focus controllers status.
2022-03-08 06:06:47 -07:00
Matthias Clasen
d9ad7884e9 window: Update has-focus property
Update the :has-focus property of the focus
widget when the active status of the window
changes.

We change the property after generating the
GDK_CROSSING_ACTIVE crossing events.
2022-03-08 06:05:49 -07:00
Ask Hjorth Larsen
f545d7a910 Updated Danish translation 2022-03-08 01:28:14 +01:00
Ask Hjorth Larsen
206eb647a4 Updated Danish translation of gtk-properties 2022-03-08 01:28:11 +01:00
Aurimas Černius
00e637b480 Updated Lithuanian translation 2022-03-07 18:29:37 +02:00
Emmanuele Bassi
bfc8b7b7b6 Merge branch 'gdk-tests-naming' into 'main'
Use the correct name for installed gdk tests

See merge request GNOME/gtk!4555
2022-03-07 15:34:31 +00:00
Sebastien Bacher
c44288c739 Use the correct name for installed gdk tests 2022-03-07 16:13:38 +01:00
Luna Jernberg
2fb5104731 Update Swedish translation
(cherry picked from commit 89bba41fd7)
2022-03-07 08:09:54 +00:00
Matthias Clasen
0ae4d80766 Merge branch 'wip/chergert/for-main' into 'main'
macos: fixes for main

See merge request GNOME/gtk!4553
2022-03-06 01:36:13 +00:00
Christian Hergert
f5098e4fc5 macos: fix cursor blink time
The value from settings is for the duration of the blink period, not the
timeout. This fixes the blink lasting longer than 10 seconds.
2022-03-05 12:01:53 -08:00
Christian Hergert
28607f082c macos: require input region to become key
Some things cannot become key windows (like tooltips). We can use the
input_region existence to determine if we should allow it as a key window.
2022-03-05 11:58:43 -08:00
Matthias Clasen
f3968f2f1e Merge branch 'fix-doc-typo' into 'main'
Fix a documentation typo

Closes #4747

See merge request GNOME/gtk!4552
2022-03-05 05:50:10 +00:00
Matthias Clasen
88fa226223 Fix a documentation typo
It is XDG_DATA_HOME.

Fixes: #4747
2022-03-04 22:18:06 -07:00
Jordi Mas i Hernandez
c4c496a31c Update Catalan translation
(cherry picked from commit 2be2912e43)
2022-03-04 21:40:53 +00:00
Changwoo Ryu
c1eac4a421 Update Korean translation 2022-03-04 14:22:53 +00:00
Changwoo Ryu
b5d1323f49 Update Korean translation
(cherry picked from commit 2755ad19be)
2022-03-04 14:20:48 +00:00
Matthias Clasen
e297ac319d Merge branch 'fixup-shadernode-constructor' into 'main'
Fix up preconditions of gsk_gl_shader_node_new

Closes #4739

See merge request GNOME/gtk!4551
2022-03-04 06:06:35 +00:00
Matthias Clasen
bf852bea24 Fix up preconditions of gsk_gl_shader_node_new
These were not quite right, and implied that args
may be NULL, when it really can't.

Fixes: #4739
2022-03-03 22:40:10 -07:00
Matthias Clasen
a652507b7b Merge branch 'center-layout-setters' into 'main'
gtk: Have GtkCenterLayout hold a reference to its widgets

See merge request GNOME/gtk!4544
2022-03-03 19:38:28 +00:00
Jason Francis
4a2a76c231 gtk: Have GtkCenterLayout hold a reference to its widgets 2022-03-03 14:00:25 -05:00
Benjamin Otte
8cb7369b7a Merge branch 'wip/chergert/KHR_swap_buffers_with_damage' into 'main'
gdk: use EGL_KHR_swap_buffers_with_damage

See merge request GNOME/gtk!4548
2022-03-03 15:29:47 +00:00
Emmanuel Gil Peyrot
588076d166 gdk: Add a rgb8 → rgba8 conversion macro
This one can be used for both premultiplied and non-premultiplied alpha
formats, since alpha is always 255.  It is useful for opaque PNG upload
on both cairo and GL renderers.
2022-03-03 16:05:52 +01:00
Emmanuel Gil Peyrot
3a98b28ab7 gdk: Make the optimized premultiply function a macro
That way, all permutations are possible.  Previously it was only useful
in the cairo renderer, which required rgba8 → premultiplied bgra8, while
the GL renderer required rgba8 → premultiplied rgba8.  Now both are
available.
2022-03-03 16:04:45 +01:00
Emmanuel Gil Peyrot
cfeedcc321 gdk: Remove pixel format conversion ARM intrinsics
This was only useful when building for AArch32 without -mfpu=neon, on
AArch64 or with -mfpu=neon gcc is smart enough to do the auto-
vectorisation, leading to code almost as good as what I wrote in
1fdf5b7cf8.
2022-03-03 16:04:45 +01:00
Matthias Clasen
d0aedbc9fc Merge branch 'bilelmoussaoui/docs' into 'main'
headerbar: Fix docs

See merge request GNOME/gtk!4545
2022-03-03 14:11:25 +00:00
Changwoo Ryu
5557a528b6 Update Korean translation
(cherry picked from commit 156f99560d)
2022-03-03 12:46:55 +00:00
Christian Hergert
5316eb0c35 gdk: use EGL_KHR_swap_buffers_with_damage
It appears that NVIDIA does not implement EGL_EXT_swap_buffers_with_damage
on their EGL implementation, but does implement the KHR variant of it.
This checks for a suitable implementation and stores a pointer to the
compatible implementation within the GdkGLContextPrivate struct.
2022-03-03 01:22:01 -08:00
Bilal Elmoussaoui
e6afe28de5 headerbar: Fix docs 2022-03-03 08:36:33 +00:00
Matthias Clasen
eaf0353205 Merge branch 'wip/chergert/for-main' into 'main'
macos: various fixes

See merge request GNOME/gtk!4543
2022-03-02 13:37:06 +00:00
Carlos Garnacho
f9f9bd3f5b Merge branch 'xdg-activation-no-surface' into 'main'
wayland: xdg-activation: Don't assume there's a focus surface

See merge request GNOME/gtk!4366
2022-03-02 12:44:52 +00:00
Christian Hergert
ca79688f52 macos: clear window stack before requesting motion
We want to ensure that we recalculate the sort order of windows before
processing the motion. Generally this would be done in response from the
display server in GdkMacosWindow, but I've seen it possible to race there.
2022-03-02 01:04:53 -08:00
Christian Hergert
efa8f903c2 macos: invalidate surface contents when mapping 2022-03-02 00:48:06 -08:00
Christian Hergert
f7d0b91267 macos: move children when monitor changes
We can rely on other code to move monitors, but specifically with children
we want to try harder to move them as a group and keep positioning in tact.
2022-03-02 00:47:27 -08:00
Christian Hergert
ed4f0de2b0 macos: make move_resize possibly idempotent
We need to handle the case where we might be racing against an incoming
configure event due to how notifications are queued from the display
server. Rather than calling configure (and possibly causing other things
to move around) this just queries the display server directly for the
coordinates that we care about.

Additionally, we can display:NO as we are in control of all the display
process now using CALayer.
2022-03-02 00:45:44 -08:00
Christian Hergert
50b96dcdd5 macos: handle transient-for from configure
We failed to handle the toplevel with transient-for case here which could
cause our X/Y calculations to be off in other areas such as best monitor
detection.
2022-03-02 00:43:33 -08:00
Christian Hergert
cf25f2c04b macos: use parent frame clock again
We do actually need the parent frame clock here because it is the way we
ensure that we get layout called for our popup surfaces at the same time
as the parent surface.
2022-03-02 00:42:09 -08:00
Christian Hergert
ddf07ffe22 macos: reduce chances for layout cycles
We need to be more careful about when we request a layout because it can
cause us to get into a layout cycle at maximum frame rate.
2022-03-02 00:40:21 -08:00
Christian Hergert
82f1eaacc9 macos: improve initial placement of toplevels with parent
This doesn't appear to happen much, but if it does it is nice to setup
the window placement initially. Generally, transient-for is set after
the creation of the toplevel rather than here.
2022-03-02 00:38:39 -08:00
Christian Hergert
4cdb07fa02 macos: leave a note about monitor configuration
It can be helpful to see what the range of monitor values is when emulating
the GDK coordinate system.
2022-03-02 00:37:07 -08:00
Christian Hergert
bdd5393084 macos: use GdkMacosBuffer for storing damage region
The GdkMacosBuffer object already has storage for tracking the damage
region as it is used in GdkMacosCairoContext to manually copy regions from
the front buffer to the back buffer. This makes the GdkMacosGLContext also
use that field so that we can easily drop old damage regions when the
buffer is lost. This happens during resizes, monitor changes, etc.
2022-03-02 00:36:17 -08:00
Christian Hergert
27b87ebec5 macos: add clamp helper to keep rectangle in workarea
This helper is useful to ensure we are consistent with how we keep a
window clamped to the workarea of a monitor when placing windows on
screen. (This does not affect snap-to-edges).
2022-03-02 00:34:27 -08:00
Christian Hergert
8c0df66d5f macos: style cleanup 2022-03-02 00:33:13 -08:00
Christian Hergert
e5238bf54f macos: add re-entrancy check when monitors change 2022-03-02 00:32:50 -08:00
Christian Hergert
e9abcde031 macos: check for best_monitor before using
Make sure we have a monitor to enqueue/dequeue from before using it. That
also allows us to use this from destroy and what-not.
2022-03-02 00:32:07 -08:00
Goran Vidović
d45281e6c7 Update Croatian translation
(cherry picked from commit 4eee322654)
2022-03-01 13:05:13 +00:00
Goran Vidović
3fd5ebffcb Update Croatian translation
(cherry picked from commit 67ae05d855)
2022-03-01 12:54:18 +00:00
Carlos Garnacho
88a621fa13 Merge branch 'wip/carlosg/focus-request-over-xdg-activation' into 'main'
wayland: Use xdg-activation for non-startup initiated focus requests

See merge request GNOME/gtk!4535
2022-03-01 11:21:12 +00:00
Marek Černocký
ce4b799f1e Updated Czech translation 2022-03-01 12:08:18 +01:00
Carlos Garnacho
4dcacff312 wayland: Use xdg-activation for non-startup initiated focus requests
Currently, we have all the plumbing in place so that GTK consumes the
startup notification ID when focusing a window through the xdg-activation
protocol.

This however misses the case that a window might be requested to be
focused with no startup ID (i.e. via interaction with the application,
not through GApplication or other application launching logic).

In this case, we let the application create a token that will be
consumed by itself. The serial used is that from the last
interaction, so the compositor will still be able to do focus prevention
logic if it applies.

Since we already do have a last serial at hand, prefer xdg-activation
all the way over the now stale gtk-shell focusing support. The timestamp
argument becomes unused, but that is a weak argument to prefer the
private protocol over the standard one. The gtk-shell protocol support
is so far left for interaction with older Mutter.
2022-03-01 11:38:51 +01:00
Matthias Clasen
fd7667246d Merge branch 'wip/chergert/for-main' into 'main'
macos: various fixes and multi-monitor frame clocks

Closes #4736, #4735, #4732, #4733, and #4734

See merge request GNOME/gtk!4533
2022-02-28 22:13:03 +00:00
Matthias Clasen
b8cb15f28d Merge branch 'wip/carlosg/scrolledwindow-warning' into 'main'
gtkscrolledwindow: Do not try to doubly trigger deceleration

Closes #4730

See merge request GNOME/gtk!4536
2022-02-28 21:50:19 +00:00
Christian Hergert
51607ce93c macos: avoid size/origin changes when possible
If _gdk_macos_surface_move_resize() was called with various -1 parameters
we really want to avoid changing anything even if we think we know what
the value might be. Otherwise, we risk messing up in-flight operations that
we have not yet been notified of yet.

This improves the chances we place windows in an appropriate location as
they don't et screwed up before window-manager placement.
2022-02-28 13:09:57 -08:00
Christian Hergert
66284cd245 macos: start application in foreground
We need to bring the application to the foreground in multiple ways, and
this call to [NSApp activateIgnoringOtherApps:YES] ensures that we become
foreground before the first window is opened. Otherwise we end up starting
applications in the background.

Fixes #4736
2022-02-28 12:20:24 -08:00
Christian Hergert
f9faecd5b7 macos: add GDK_NOTE when surface changes monitor 2022-02-28 12:13:29 -08:00
Christian Hergert
92261b5022 macos: add GDK_NOTE for surface sizing and placement
This can be useful to debug sizing issues with the surface as well as the
"window manager" placement code.
2022-02-28 11:50:21 -08:00
Christian Hergert
91f5bfd211 macos: leave note about monitor discovery 2022-02-28 11:36:27 -08:00
Christian Hergert
63f20b173d macos: external access to display name helpers
These can be handy to print debug information when we don't have a
GdkMacosMonitor to work with.
2022-02-28 11:36:27 -08:00
Christian Hergert
25b3bd64af macos: fix redisplay of GdkPopup
This broke recently during the configure cleanups and also needed to have
the tail directions fixed again.
2022-02-28 11:36:27 -08:00
Christian Hergert
fc4d36e50a macos: fix cairo renderer with double buffering
If we are double buffering surfaces with IOSurface then we need to copy
the area that was damaged in the previous frame to the back buffer. This
can be done with IOSurface but we need to hold the read-only lock so that
we don't cause the underlying IOSurface contents to be invalidated.

Additionally, since this is only used in the context of rendering to a
GdkMacosSurface, we know the life-time of the cairo_surface_t and can
simply lock/unlock the IOSurface buffer from begin_frame/end_frame to have
the buffer flushing semantics we want.

To ensure that we don't over damage, we store the damage in begin_frame
(and copy it) and then subtract it from the next frames damage to determine
the smallest amount we need to copy (taking scale factor into account).

We don't care to modify the damage region to swapBuffers because they
already have the right contents and could potentially fall into another
tile anyway and we'd like to avoid damaging that.

Fixes #4735
2022-02-28 11:36:27 -08:00
Christian Hergert
dbede0b115 macos: add readonly IOSurfaceLock helper
This can be used to lock a surface for reading to avoid causing the
surface contents to be invalidated. This is needed when reading back from
a front-buffer to the back-buffer as is needed when using Cairo surfaces
to implement something similar to BufferAge.
2022-02-28 11:36:27 -08:00
Christian Hergert
1e40033852 macos: short-circuit on NSEventPhaseMayBegin
We only need to send a single event in this case, so just short-circuit
instead of trying to return an additional event.
2022-02-28 11:36:27 -08:00
Christian Hergert
478bf45320 macos: support mix-rate monitors
Previously, a single CVDisplayLink was used to drive updates for all
surfaces across all monitors. It used a 'best guess' rate which would
allow for updates across monitors of mixed rates. This is undesirable for
situations where you might have a 144hz monitor as it does not allow for
reaching up to that frame rate.

Instead, we want to use a per-monitor CVDisplayLink which will fire at the
rate of the monitor down to the level of updates we require. This commit
does just that.

When a surface crosses onto a new monitor, that monitor is used to drive
the GdkFrameClock.

Fixes #4732
2022-02-28 11:36:27 -08:00
Christian Hergert
dac0b7d609 macos: use video mode for refresh rate and interval
Using the mode allows better detection of refresh rate and refresh
interval for the CVDisplayLink bridge to GdkFrameClock. Using it can help
ensure that our 144hz displays can actually reach that rather than falling
back to just 60hz.

This will also need future commits to rework the displaylink source to be
per-monitor.
2022-02-28 11:36:27 -08:00
Christian Hergert
d14987e819 macos: send stop event when fingers touch
When the fingers are placed on the touchpad, we get a scroll event with
the phase NSEventPhaseMayBegin. We can use this to synthesize an is_stop
event. This results in the scrolledwindow stopping scroll with stop
gestures.

This can cause another warning as well, however, which should be addressed
from #4730.

Fixes #4733
2022-02-28 11:36:27 -08:00
Christian Hergert
3a0077f65f macos: remove emulated scroll events
We don't appear to actually need the emulated scroll events and they get
in the way of proper scrolling with the touchpad.

Fixes #4734
2022-02-28 11:36:27 -08:00
Christian Hergert
03882ef8e5 macos: do not inherit parents frame clock
Windows can end up on different monitors despite having a parent or
transient-for ancestor. We want them to be driven by the CVDisplayLink
for the best-monitor, and so this needs to be unshared.
2022-02-28 11:36:27 -08:00
Christian Hergert
505e10f3ea macos: calculate best monitor when changing screens
When we change screens, we can keep track of the best monitor so that we
can use it to register CVDisplayLink callbacks.
2022-02-28 11:36:27 -08:00
Christian Hergert
1e01444de8 macos: remove duplicated opaque_region field
This can be relied upon from GdkSurface and we do not need to keep a copy
of it. Just remove it and use the GdkSurface.opaque_region field.
2022-02-28 11:36:27 -08:00
Christian Hergert
4404c43cd3 macos: use display id when creating CVDisplayLink
Currently we're using a display link that is for all active displays which
is just the display server trying to find some timings that try to overlap
as many as possible.

That was fine for a prototype, but we really need to do better for
situations with mixed frame rate (such as 60hz and 120hz promotion
displays). Additionally, the 144hz external monitor I have will never
reach 144hz using the current design.

This is just the first step in changing this, but the goal is to have
one of these attached to each GdkMacosMonitor which we can then use to
thaw surfaces specific to that monitor.
2022-02-28 11:36:27 -08:00
Christian Hergert
92a7c7cdc3 macos: move feedback mechanisms into separate file
We will eventually be needing additional feedback from the display server
which would be nice to keep away from the rest of GdkMacosDisplay for
cleanliness sake. Particularly for feedback from mission control and other
environment factors that requires private API for proper integration.
2022-02-28 11:36:23 -08:00
Carlos Garnacho
33db142eab gtkscrolledwindow: Do not try to doubly trigger deceleration
This may come from different sources at around the same time, e.g.
a hold gesture while on overshoot. Avoid doing that if an
animation is already set.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4730
2022-02-28 20:27:43 +01:00
Carlos Garnacho
68319afd23 Merge branch 'startup-vs-xdg-activation' into 'main'
Startup tracking with xdg-activation

See merge request GNOME/gtk!3883
2022-02-28 17:29:09 +00:00
Guido Günther
25f4e597ee print-editor: Use gtk_window_present()
This lets xdg-activation work as otherwise gdk_wayland_surface_focus is
never invoked.
2022-02-28 16:55:54 +00:00
Guido Günther
db8339ca66 demo: Use gtk_window_present()
This lets xdg-activation work as otherwise gdk_wayland_surface_focus is
never invoked.
2022-02-28 16:55:54 +00:00
Guido Günther
5ba02e3459 widget-factory: Use gtk_window_present()
This lets xdg-activation work as otherwise gdk_wayland_surface_focus is
never invoked.
2022-02-28 16:55:54 +00:00
Guido Günther
999509be61 wayland: Keep startup_notification_id around long enough
When using xdg_activation we need to keep the id around until we send
the first activate to signal succesful startup.
2022-02-28 16:55:54 +00:00
Guido Günther
5dca6dce91 window: Make sure we call gdk_wayland_surface_focus
When using xdg_activation this is responsible for submitting
the activation token / startup id to the compositor.
2022-02-28 16:55:54 +00:00
Luca Bacci
d3acfa8c2b Merge branch 'gdk-win32-configure-as-needed-fullscreen' into 'main'
GdkWin32: Configure as needed when fullscreening toplevels

Closes #4631

See merge request GNOME/gtk!4506
2022-02-28 15:11:36 +00:00
Luca Bacci
c1cc8c979b Merge branch 'win32-fix-4724-gtk4' into 'main'
gdkkeys-win32: Only perform substitution as last-resort [GTK4]

See merge request GNOME/gtk!4531
2022-02-28 08:44:10 +00:00
Matthias Clasen
eed74f6ea0 Merge branch 'ci-disable-debug' into 'main'
CI: disable debug for MSVC

See merge request GNOME/gtk!4525
2022-02-27 15:45:16 +00:00
Philip Zander
e5a4b91997 gdkkeys-win32: Only perform substitution as last-resort
Instead of performing keyboard layout substitution whenever we find a matching
entry in the registry, first try to load the original layout and only attempt
substitution when that fails.

See #4724
2022-02-27 16:40:58 +01:00
Matthias Clasen
885b34d382 Merge branch 'wip/ricotz/annotations' into 'main'
gdk: Add missing out annotation on gdk_content_deserialize_finish

See merge request GNOME/gtk!4529
2022-02-27 00:50:07 +00:00
Rico Tzschichholz
3faf9d85bb gdk: Add missing out annotation on gdk_content_deserialize_finish 2022-02-26 22:05:20 +01:00
Benjamin Otte
4cd4c25c25 Merge branch 'wip/otte/for-main' into 'main'
glrenderer: Don't return NULL form render_texture()

See merge request GNOME/gtk!4522
2022-02-26 20:15:18 +00:00
Benjamin Otte
bffa5dfddd listview: Fix return_if_fail()s 2022-02-26 20:35:44 +01:00
Benjamin Otte
2fe20878c3 flattenlistmodel: Fix indentation 2022-02-26 20:35:44 +01:00
Benjamin Otte
b28c3ef3d9 renderers: Handle large viewports
When large viewports are passed to gsk_renderer_render_texture(), don't
fail (or even return NULL).

Instead, draw multiple tiles and assemble them into a memory texture.

Tests added to the testsuite for this.
2022-02-26 20:35:44 +01:00
Matthias Clasen
ed5fb4bbfe Merge branch 'try-to-fix-ci-build' into 'main'
Revert "Bump the wayland-protocols dep"

See merge request GNOME/gtk!4528
2022-02-26 18:08:38 +00:00
Matthias Clasen
2dd86aaa00 Revert "Bump the wayland-protocols dep"
This reverts commit 6a7da77980.

This is causing various build problems between wayland-protocols
and wayland-scanner.
2022-02-26 12:03:22 -05:00
Christoph Reiter
eaf952d902 CI: disable debug for MSVC
CI currently fails with "fatal error LNK1318: Unexpected PDB error; OK (0) ''"
Google tells me it might be related to hitting a memory limit. Let's try
disabling debug for now.
2022-02-26 16:32:15 +01:00
Piotr Drąg
88cb6a46f2 Update Polish translation 2022-02-26 13:29:33 +01:00
Matthias Clasen
c76b4bdc77 Merge branch 'wip/chergert/macos-add-window-accessor' into 'main'
macos: add getter for NSWindow with macOS windowing

See merge request GNOME/gtk!4509
2022-02-26 03:17:59 +00:00
Matej Urbančič
62fe4eae16 Update Slovenian translation 2022-02-25 21:13:32 +00:00
Christian Hergert
99a40de8ad macos: add getter for NSWindow with macOS windowing
There may be various reasons that an application could need access to the
underlying NSWindow that is being used to display the GdkMacosSurface
contents. This provides a minimal API to do that without exposing our
implementation details through public API.

As our rendering system is likely to change over time, we very much want
to keep GdkMacosView, GdkMacosLayer, GdkMacosTile, and GdkMacosWindow all
private implementation details which are subject to change.

As this is public API, we are a bit long-winded with the name so it is
clear what is being accessed without polluting symbol names with things
like "ns" as we used to.
2022-02-25 11:36:39 -08:00
Aleksandr Melman
b8376407a4 Update Russian translation 2022-02-25 18:38:49 +00:00
Luca Bacci
a5643b0c83 Merge branch 'gdk-win32-fix-issue-1402-gtk4' into 'main'
Fix last error reporting when calling GetClipboardOwner

Closes #1402

See merge request GNOME/gtk!4521
2022-02-25 16:54:15 +00:00
Luca Bacci
828688d5cd Fix last error reporting when calling GetClipboardOwner
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/1402
2022-02-25 17:14:39 +01:00
Matthias Clasen
fc47b913b1 Merge branch 'wip/chergert/macos-fix-popover-tails' into 'main'
macos: fix positioning of popover tails

See merge request GNOME/gtk!4515
2022-02-25 15:50:15 +00:00
Matthias Clasen
7d8b3357a5 Merge branch 'wip/chergert/better-positioning' into 'main'
macos: fix positioning of popover tails

See merge request GNOME/gtk!4516
2022-02-25 15:49:50 +00:00
Matthias Clasen
e0b98bc7de Merge branch 'wip/chergert/macos-fix-titled-resize' into 'main'
macos: fix origin during live resize of titled window

See merge request GNOME/gtk!4519
2022-02-25 15:49:07 +00:00
Matthias Clasen
493b145496 Merge branch 'wip/chergert/macos-unfullscreen' into 'main'
macos: restore unfullscreen frame with style mask

See merge request GNOME/gtk!4518
2022-02-25 15:48:44 +00:00
Matthias Clasen
1b2c11d7f5 Merge branch 'wip/chergert/fix-macos-overshoot' into 'main'
macos: fix kinetic scrolling with overshoot

See merge request GNOME/gtk!4517
2022-02-25 14:37:45 +00:00
Christian Hergert
a56828237a macos: fix origin during live resize of titled window
When using server-side-decorations, we need to avoid potential cycles with
compute-size as it may not have the new sizing information yet. We can
just short circuit during "live resize" to get that effect.

Fixes poor window resizing from top-left on titled windows.
2022-02-24 23:29:18 -08:00
Christian Hergert
56e2a7e8bb macos: restore unfullscreen frame with style mask
This doesn't give us appropriate results if we use the window delegate.
Instead, we need to adjust the frame at the same time we change the
style mask so that we end up in the same location.
2022-02-24 22:32:43 -08:00
Christian Hergert
f278f3610b macos: fix kinetic scrolling with overshoot
Previously we had issues on macos where the overshoot would keep showing.
To fix this we need to actually use discrete events instead of the
generated deltas from macOS in the scroll wheel case. Additionally, we need
to drop the kinetic momentum events from macOS and rely on the gtk kinetic
events which are already happening anyway. We also need to submit the
is_stop event for the GDK_SCROLL_SMOOTH case when we detect it.

To keep the discrete scroll events correct, we need to alter the hack in
gtkscrolledwindow.c to use the same path as other platforms except for
when a smooth scroll event is in place. In the future, I would imagine that
this falls into the boundary of high-precision scrolling and would share
the same code paths as other platforms.

With all of these in place, kinetic scrolling with overshoot appears the
same on macOS as other platforms.
2022-02-24 18:58:48 -08:00
Christian Hergert
c111e633e9 macos: remove unused code 2022-02-24 18:58:07 -08:00
Christian Hergert
eea7cf30bb macos: create new windows with slight origin offset
When creating new windows, it is better if we create them with a slight
offset to where they were created before so that they are visible to the
user separately from what they might be overshadowing.
2022-02-24 18:58:07 -08:00
Christian Hergert
36bdcfaccb macos: fix positioning of popover tails
This broke with the previous fixes for initial window positioning. We need
the initial positioning so that tails will be displayed correctly when the
popover surface is displayed.
2022-02-24 16:29:53 -08:00
Luming Zh
45bb820656 Update Chinese (China) translation 2022-02-25 00:07:39 +00:00
Fran Dieguez
617deb8bb6 Update Galician translation 2022-02-24 12:53:57 +00:00
Matthias Clasen
8efcd34dbe Merge branch 'ebassi/unexport-x11' into 'main'
Remove unnecessary warning

See merge request GNOME/gtk!4512
2022-02-24 12:32:41 +00:00
Daniel Mustieles
a78b573f8b Updated Spanish translation 2022-02-24 12:54:02 +01:00
Emmanuele Bassi
226f0e0567 Remove unnecessary warning
Unexporting the window handle on X11 is a no-op, so there's no need
to emit a warning.
2022-02-24 02:04:06 +00:00
Rafael Fontenelle
4304a494ae Update Brazilian Portuguese translation 2022-02-23 23:54:08 +00:00
Matthias Clasen
b71ff21530 Merge branch 'bump-wayland-dep' into 'main'
Bump the wayland-protocols dep

See merge request GNOME/gtk!4511
2022-02-23 21:05:01 +00:00
Matthias Clasen
6a7da77980 Bump the wayland-protocols dep
Bump the dep to 1.25, so we can add support
for toplevel bounds.
2022-02-23 14:30:49 -05:00
Matthias Clasen
c5f92340ee Fix up tests for version bump 2022-02-23 14:29:48 -05:00
Hugo Carvalho
572a884e90 Update Portuguese translation 2022-02-23 11:29:15 +00:00
Emin Tufan Çetin
69bc9d0702 Update Turkish translation 2022-02-23 09:42:06 +00:00
Yuri Chornoivan
34ff9e359b Update Ukrainian translation 2022-02-23 07:10:19 +00:00
Benjamin Otte
de705c2a2b Add 4.8 version macros 2022-02-22 22:55:48 -05:00
Benjamin Otte
d1102f586c build: Set version to 4.7 2022-02-22 22:55:42 -05:00
Matthias Clasen
bcb6cf04ed Merge branch 'wip/chergert/macos-window-manager' into 'main'
macos: improve placement of windows

See merge request GNOME/gtk!4510
2022-02-23 03:53:33 +00:00
Matthias Clasen
c9dbb30aff Merge branch 'ebassi/docs-related' into 'main'
docs: Split dependencies from related libraries

See merge request GNOME/gtk!4474
2022-02-23 03:28:47 +00:00
Matthias Clasen
2c88797195 Merge branch 'wip/chergert/macos-iosurface' into 'main'
macos: modernize rendering with CALayer and IOSurface

See merge request GNOME/gtk!4477
2022-02-23 03:10:43 +00:00
Christian Hergert
89a351fd66 macos: improve placement of windows
This does some very basic window management so that we place surfaces in
locations where they can actually be interacted with correctly.
2022-02-22 18:43:46 -08:00
Christian Hergert
e1d3d01e2f macos: update CGL context when surface resizes 2022-02-22 13:15:25 -08:00
Christian Hergert
76a58c40db macos: force pixel format without depth/stencil
We don't need either depth or stencil buffers, so we want a pixel format
without them so that things like glClear() can do less work.
2022-02-22 13:09:30 -08:00
Yosef Or Boczko
3b0ceeb09a Update Hebrew translation 2022-02-22 20:22:59 +00:00
Danial Behzadi
f95e082186 Update Persian translation 2022-02-22 20:08:03 +00:00
Christian Hergert
df8e2bc0a0 macos: only invalidate tiles when size changes
If the size changes, we need to relayout the tiles. Otherwise we can keep
using what we had before. Generally, that shouldn't happen, but the
previous check was failing in a number of ways.
2022-02-22 12:01:29 -08:00
Christian Hergert
42164fa8bb macos: reload IOSurface when monitor configuration changes
We also want to reload buffer contents if the display server changes the
monitor configuration, such as after changing resolution or orientation.
2022-02-22 12:01:29 -08:00
Christian Hergert
6016e17a38 macos: double buffer IOSurface
It looks like, particularly on the M1, we might need to double buffer the
contents of the IOSurface<->OpenGL texture bindings. This doesn't appear
to show up on the Intel macbooks I've tried, but I've seen it in the wild
on an M1.
2022-02-22 12:01:29 -08:00
Christian Hergert
b2de83efcb macos: restore key window after hiding popup
This fixes the focus returning to the parent window after the popup has
been hidden in the form of being a "Key Window" in macOS.
2022-02-22 12:01:29 -08:00
Christian Hergert
493f90499b macos: fix window drag across mixed-scale monitors
If we have a 2x scale laptop with a 1x scale external display, we would
need to create a new IOSurface for the external display once it crosses
a boundary, otherwise we won't have something capable of displaying
correctly on the second monitor.
2022-02-22 12:01:29 -08:00
Christian Hergert
8b71cff71d macos: use CALayer and IOSurface for rendering
This provides a major shift in how we draw both when accelerated OpenGL
as well as software rendering with Cairo. In short, it uses tiles of Core
Animation's CALayer to display contents from an OpenGL or Cairo rendering
so that the window can provide partial damage updates. Partial damage is
not generally available when using OpenGL as the whole buffer is flipped
even if you only submitted a small change using a scissor rect.

Thankfully, this speeds up Cairo rendering a bit too by using IOSurface to
upload contents to the display server. We use the tiling system we do for
OpenGL which reduces overall complexity and differences between them.

A New Buffer
============

GdkMacosBuffer is a wrapper around an IOSurfaceRef. The term buffer was
used because 1) surface is already used and 2) it loosely maps to a
front/back buffer semantic.

However, it appears that IOSurfaceRef contents are being retained in
some fashion (likely in the compositor result) so we can update the same
IOSurfaceRef without flipping as long as we're fast. This appears to be
what Chromium does as well, but Firefox uses two IOSurfaceRef and flips
between them. We would like to avoid two surfaces because it doubles the
GPU VRAM requirements of the application.

Changes to Windows
==================

Previously, the NSWindow would dynamically change between different
types of NSView based on the renderer being used. This is no longer
necessary as we just have a single NSView type, GdkMacosView, which
inherits from GdkMacosBaseView just to keep the tedius stuff separate
from the machinery of GdkMacosView. We can merge those someday if we
are okay with that.

Changes to Views
================

GdkMacosCairoView, GdkMacosCairoSubView, GdkMacosGLView have all been
removed and replaced with GdkMacosView. This new view has a single
CALayer (GdkMacosLayer) attached to it which itself has sublayers.

The contents of the CALayer is populated with an IOSurfaceRef which
we allocated with the GdkMacosSurface. The surface is replaced when
the NSWindow resizes.

Changes to Layers
=================

We now have a dedicated GdkMacosLayer which contains sublayers of
GdkMacosTile. The tile has a maximum size of 128x128 pixels in device
units.

The GdkMacosTile is partitioned by splitting both the transparent
region (window bounds minus opaque area) and then by splitting the
opaque area.

A tile has either translucent contents (and therefore is not opaque) or
has opaque contents (and therefore is opaque). An opaque tile never
contains transparent contents. As such, the opaque tiles contain a black
background so that Core Animation will consider the tile's bounds as
opaque. This can be verified with "Quartz Debug -> Show opaque regions".

Changes to Cairo
================

GTK 4 cannot currently use cairo-quartz because of how CSS borders are
rendered. It simply causes errors in the cairo_quartz_surface_t backend.

Since we are restricted to using cairo_image_surface_t (which happens to
be faster anyway) we can use the IOSurfaceBaseAddress() to obtain a
mapping of the IOSurfaceRef in user-space. It always uses BGRA 32-bit
with alpha channel even if we will discard the alpha channel as that is
necessary to hit the fast paths in other parts of the platform. Note
that while Cairo says CAIRO_FORMAT_ARGB32, it is really 32-bit BGRA on
little-endian as we expect.

OpenGL will render flipped (Quartz Native Co-ordinates) while Cairo
renders with 0,O in the top-left. We could use cairo_translate() and
cairo_scale() to reverse this, but it looks like some cairo things may
not look quite as right if we do so. To reduce the chances of one-off
bugs this continues to draw as Cairo would normally, but instead uses
an CGAffineTransform in the tiles and some CGRect translation when
swapping buffers to get the same effect.

Changes to OpenGL
=================

To simplify things, removal of all NSOpenGL* related components have
been removed and we strictly use the Core GL (CGL*) API. This probably
should have been done long ago anyay.

Most examples found in the browsers to use IOSurfaceRef with OpenGL are
using Legacy GL and there is still work underway to make this fit in
with the rest of how the GSK GL renderer works.

Since IOSurfaceRef bound to a texture/framebuffer will not have a
default framebuffer ID of 0, we needed to add a default framebuffer id
to the GdkGLContext. GskGLRenderer can use this to setup the command
queue in such a way that our IOSurface destination has been
glBindFramebuffer() as if it were the default drawable.

This stuff is pretty slight-of-hand, so where things are and what needs
flushing when and where has been a bit of an experiment to see what
actually works to get synchronization across subsystems.

Efficient Damages
=================

After we draw with Cairo, we unlock the IOSurfaceRef and the contents
are uploaded to the GPU. To make the contents visible to the app,
we must clear the tiles contents with `layer.contents=nil;` and then
re-apply the IOSurfaceRef. Since the buffer has likely not changed, we
only do this if the tile overlaps the damage region.

This gives the effect of having more tightly controlled damage regions
even though updating the layer would damage be the whole window (as it
is with OpenGL/Metal today with the exception of scissor-rect).

This too can be verified usign "Quartz Debug -> Flash screen udpates".

Frame Synchronized Resize
=========================

In GTK 4, we have the ability to perform sizing changes from compute-size
during the layout phase. Since the macOS backend already tracks window
resizes manually, we can avoid doing the setFrame: immediately and instead
do it within the frame clock's layout phase.

Doing so gives us vastly better resize experience as we're more likely to
get the size-change and updated-contents in the same frame on screen. It
makes things feel "connected" in a way they weren't before.

Some additional effort to tweak gravity during the process is also
necessary but we were already doing that in the GTK 4 backend.

Backporting
===========

The design here has made an attempt to make it possible to backport by
keeping GdkMacosBuffer, GdkMacosLayer, and GdkMacosTile fairly
independent. There may be an opportunity to integrate this into GTK 3's
quartz backend with a fair bit of work. Doing so could improve the
situation for applications which are damage-rich such as The GIMP.
2022-02-22 12:01:29 -08:00
Christian Hergert
f9268e8137 gsk/gl: support non-standard default framebuffer
There are situations where our "default framebuffer" is not actually
zero, yet we still want to apply a scissor rect.

Generally, 0 is the default framebuffer. But on platforms where we need
to bind a platform-specific feature to a GL_FRAMEBUFFER, we might have a
default that is not 0. For example, on macOS we bind an IOSurfaceRef to
a GL_TEXTURE_RECTANGLE which then is assigned as the backing store for a
framebuffer. This is different than using gsk_gl_renderer_render_texture()
in that we don't want to incur an extra copy to the destination surface
nor do we even have a way to pass a texture_id into render_texture().
2022-02-22 12:01:24 -08:00
Christian Hergert
b4b282dc81 macos: fix allocation for filechoosernative filter
The GtkFileCHooserNativeQuartz injects a NSComboBox into the NSSavePanel
(which is displayed in a remote process since 10.15 whether or not you are
a sandboxed application). The style has changed and we need more space
here to not clip part of the combobox out of view.

I tried every size from 22 to 30 and this seemed to look the most natural
without skewing the location of the text within the combobox.
2022-02-22 11:53:33 -08:00
Matthias Clasen
d4d328f96f Merge branch 'scale-button-empty-icon-list' into 'main'
Don't crash when updating the icon on a `GtkScaleButton` with a non-`NULL` empty icon list

See merge request GNOME/gtk!4475
2022-02-22 19:39:32 +00:00
Matthias Clasen
553eb55f8a Merge branch 'wip/hadess/app-id-inspector-4' into 'main'
inspector: Show app ID and resource path in the General tab

See merge request GNOME/gtk!4493
2022-02-22 19:37:36 +00:00
Matthias Clasen
9ea43096d4 Merge branch 'wip/chergert/macos-fix-event-filter' into 'main'
macos: improve event filtering for foreign panels

See merge request GNOME/gtk!4495
2022-02-22 19:36:43 +00:00
Matthias Clasen
e9ffe8f212 Merge branch 'wip/chergert/macos-fix-fullscreen' into 'main'
macos: allow windows to enter fullscreen

See merge request GNOME/gtk!4494
2022-02-22 19:36:20 +00:00
Matthias Clasen
931be7d729 Merge branch 'optimise-png-premultiply' into 'main'
gdk: Specialise RGBA8 → premultiplied BGRA8 conversion

See merge request GNOME/gtk!4481
2022-02-22 19:25:41 +00:00
Matthias Clasen
378bb481fa Merge branch 'ebassi/graphene-build-opts' into 'main'
build: Disable graphene tests

See merge request GNOME/gtk!4500
2022-02-22 18:05:14 +00:00
Matthias Clasen
8f83c7e255 Merge branch 'emoji-40' into 'main'
emoji: Update data to CLDRv40 and add more locales

Closes #4568

See merge request GNOME/gtk!4507
2022-02-22 18:04:24 +00:00
Matthias Clasen
3c99b50d2c Merge branch 'wip/chergert/gsk-gl-less-glClear' into 'main'
gsk/gl: avoid clearing opaque regions

See merge request GNOME/gtk!4504
2022-02-22 17:56:40 +00:00
Matthias Clasen
9fccbeaa75 Merge branch 'wip/chergert/macos-fix-backdrop' into 'main'
macos: fix backdrop when displaying popover

See merge request GNOME/gtk!4505
2022-02-22 17:54:20 +00:00
Matthias Clasen
d35bac452b Merge branch 'wip/chergert/macos-fix-toplevel-resize' into 'main'
macos: fix configure, move-resize, and compute-size

See merge request GNOME/gtk!4486
2022-02-22 13:10:34 +00:00
Kévin Commaille
d8c79e91a2 emoji: Add more locales
Based on the locales that are at least 85% translated in Damned Lies:
https://l10n.gnome.org/releases/gnome-41/
Limited by the locales available in emojibase

Closes #4568
2022-02-22 11:28:15 +01:00
Kévin Commaille
7f5a249056 emoji: Update data to CLDR v40
Based on emojibase-data v7.0.1
Contains the changes in Unicode 14.0

https://unicode.org/versions/Unicode14.0.0/
https://cldr.unicode.org/index/downloads/cldr-40
https://github.com/milesj/emojibase/blob/b85382524c/packages/data/CHANGELOG.md
2022-02-22 11:28:15 +01:00
Kévin Commaille
70ce353a58 emoji: Fix the convert-emoji program
The annotation field has been renamed to label in emojibase-data

https://github.com/milesj/emojibase/blob/b85382524c/packages/data/CHANGELOG.md
2022-02-22 11:28:06 +01:00
Luca Bacci
ab65e8e178 GdkWin32: Configure as needed when going fullscreen
Apply the fixes made by Chun-Wei Fan in [1] also for fullscreening /
unfullscreen. Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/4631

Also set the SWP_FRAMECHANGED flag as written by Raymond Chen in "How
do I switch a window between normal and fullscreen?" [2]

> An important flag to pass here is SWP_FRAME­CHANGED, which tells
> the window manager to recalculate the window decorations (which we
> need it to do because we just changed them).

References:
[1] - https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/3712
[2] - https://devblogs.microsoft.com/oldnewthing/20100412-00/?p=14353
2022-02-22 09:15:28 +01:00
Christian Hergert
c0ede8d46e macos: fix backdrop when displaying popover
Previously, the popover would cause the window to go into the :backdrop
state which is not what we want for consistency with other platforms. This
fixes that by walking up the surface chain when we get notified of
loosing or acquiring "key" input from the display server.
2022-02-22 00:08:37 -08:00
Luca Bacci
8f02ea39e5 Merge branch 'gdk-win32-implicit-grabs-cleanup' into 'main'
GdkWin32: Remove implicit_grab_surface

Closes #4188

See merge request GNOME/gtk!4503
2022-02-22 07:53:54 +00:00
Luca Bacci
8a8cd4e248 Merge branch 'win32-ime-fix-popup-positioning' into 'main'
Win32 IME: Fix popup positioning

Closes #374 and #2338

See merge request GNOME/gtk!4501
2022-02-22 07:52:59 +00:00
Christian Hergert
08d0575ed0 gsk/gl: avoid clearing opaque regions
If the rendering operation is over an opaque region, we can potentially
avoid clearing a large section of the framebuffer destination. Some cases
you do want to clear, such as when clearing the whole contents as some
drivers have fast paths for that to avoid bringing data back into the
framebuffer.
2022-02-21 23:43:17 -08:00
Luca Bacci
43476c09ed GdkWin32: Remove implicit_grab_surface 2022-02-21 17:38:50 +01:00
Luca Bacci
6123212a68 Win32 IME: Fix popup position 2022-02-21 16:13:06 +01:00
Luca Bacci
6106207b93 Win32 IME: Rename a variable 2022-02-21 15:53:22 +01:00
Luca Bacci
b5036faa2a Win32 IME: Keep track of the client widget 2022-02-21 15:53:13 +01:00
Luca Bacci
56fd3af4d0 Win32 IME: Remove the get_window_position util function
It always returns (0, 0)
2022-02-21 15:49:52 +01:00
Emmanuele Bassi
26beab6064 build: Disable graphene tests
When building Graphene as a subproject we don't really need
to build tests. Disabling tests also removes the dependency
on mutest.
2022-02-21 13:41:40 +00:00
Emmanuele Bassi
f41fe7b8e4 Merge branch 'msvc-cmake-dep' into 'main'
Meson: Use CMake more for finding deps on Visual Studio-like builds

See merge request GNOME/gtk!4499
2022-02-21 13:37:12 +00:00
Luca Bacci
7d6797c9ed Merge branch 'forward-port-mr-775-to-gtk4' into 'main'
gtkimcontextime.c: Fix preedit window placement on HiDPI

See merge request GNOME/gtk!4498
2022-02-21 12:01:21 +00:00
Chun-wei Fan
2e34d62111 meson.build: Use CMake to find libjpeg on MSVC-like builds
One may be using IJG libjpeg or libjpeg-turbo to build GTK, and their
build files may or may not generate pkg-config files for us.  To make
things easier, we can make use of CMake's built-in support for finding
IJG libjpeg or libjpeg-turbo.
2022-02-21 17:53:50 +08:00
Chun-wei Fan
6eda5deeff meson.build: Use CMake to find libtiff on MSVC-like
The CMake build files for libtiff may or may not generate pkg-config
files for us, so we can use Meson's CMake support to help us find
libtiff, as CMake has built-in support for finding libtiff.
2022-02-21 17:53:40 +08:00
Chun-wei Fan
83b98738b6 meson.build: Consolidate items with MSVC-like compilers
Add a variable in meson.build that covers Visual Studio-like compilers,
so that we can use it to help us find depedencies using CMake rather
than via pkg-config, where applicable.

Change the existing use case for finding libpng accordingly.
2022-02-21 17:53:31 +08:00
Emin Tufan Çetin
a07455aa0d Update Turkish translation 2022-02-20 15:04:41 +00:00
Emin Tufan Çetin
49a4d27245 Update Turkish translation 2022-02-20 14:47:56 +00:00
Danial Behzadi
ff59bf356b Update Persian translation 2022-02-20 11:14:09 +00:00
Chun-wei Fan
c6ce05b782 gtkimcontextime.c: Fix preedit window placement on HiDPI
We must also take the scaling factor into account for placing the IME
preedit window that is often used for Chinese and Japanese input on
Windows.
2022-02-19 18:31:28 +01:00
Christian Hergert
db77204a52 macos: improve event filtering for foreign panels
We might have panels with controls in them where the window is running in
another process. The control could have a wrapper window which we would
see from this process. This can happen with the GtkFileChooserNative, but
any NSSavePanel in macOS 10.15+ is out of process (not just sandboxed
applications).
2022-02-18 03:39:52 -08:00
Christian Hergert
4c08d1643f macos: fix configure, move-resize, and compute-size
This significantly cleans up how we handle various move-resize, compute-
size, and configure (notification of changes) in the macOS GDK backend.

Originally when prototyping this backend, there were some bits that came
over from the quartz backend and some bits which did not. It got confusing
and so this makes an attempt to knock down all that technical debt.

It is much simpler now in that the GdkMacosSurface makes requests of the
GdkMacosWindow, and the GdkMacosWindow notifies the GdkMacosSurface of
changes that happen.

User resizes are delayed until the next compute-size so that we are much
closer to the layout phase, reducing chances for in-between frames.

This also improves the situation of leaving maximized state so that a
grab and drag feels like you'd expect on other platforms.

I removed the opacity hack we had in before, because that is all coming
out anyway and it's a bit obnoxious to maintain through the async flows
here.
2022-02-18 02:50:46 -08:00
Christian Hergert
592436503c macos: allow windows to enter fullscreen
This fixes GTK's NSWindow for toplevels so that they are allowed to enter
fullscreen. We were already handlign the state transitions from the
setStyleMask: halper, but we didn't previously tell the window we are
allowed to transition into that.

There is a bit of a mismatch here in that GTK doesn't have any such flag
that determines if a window is "allowed" by policy to enter fullscreen
since window managers on Linux are free to do that at will.
2022-02-18 01:54:10 -08:00
Bastien Nocera
1877bb8a27 inspector: Show app ID and resource path in the General tab
This makes it easier to figure out those values (which are mentioned in
the GtkApplication documentation) rather than working that out from the
way they're generated (or documented as being generated).
2022-02-17 15:14:16 +01:00
Matthias Clasen
67a5120b5b Merge branch 'wip/chergert/macos-gst-cgl' into 'main'
media: support OpenGL-based video playback on macOS

See merge request GNOME/gtk!4491
2022-02-17 13:54:42 +00:00
Matthias Clasen
9d8f56edaa Merge branch 'wip/chergert/macos-fix-popup-input' into 'main'
macos: fix keyboard input on popovers

See merge request GNOME/gtk!4490
2022-02-17 13:53:04 +00:00
Christian Hergert
7ec9c5181d media: support OpenGL-based video playback on macOS
If we have GStreamer on macOS we likely have support for CGL to get an
OpenGL context we can use. This provides the missing pieces to get
accelerated video playback in gtk4-widget-factory working.
2022-02-16 21:31:20 -08:00
Christian Hergert
853ef43dae macos: fix keyboard input on popovers
GdkPopup can also become the "key" window (just not the "main" window).
2022-02-16 17:53:59 -08:00
Emmanuel Gil Peyrot
1fdf5b7cf8 gdk: Optimise RGBA8 → premultiplied BGRA8 for ARM
This more than halves the total runtime of this function since the
previous commit, from 8.36% to 4.02%, and is most likely memory
bandwidth limited on this specific board now.

I tried to do a SSE2 version as well, but couldn’t find any equivalent
of the LD4/ST4 ARM instruction.
2022-02-16 16:36:33 +01:00
Emmanuel Gil Peyrot
0e3ed7a738 gdk: Specialise RGBA8 → premultiplied BGRA8 conversion
On x86 on a Kaby Lake CPU, this makes it go from 6.63% of the total
execution time (loading some PNGs using the cairo backend) down to
3.20%.

On ARM on a Cortex-A7, on the same workload, this makes it go from 57%
to 8.36%.
2022-02-16 16:35:39 +01:00
Matthias Clasen
9c1a66518b Merge branch 'wip/chergert/for-macos-1' into 'main'
macos: various correctness fixes

See merge request GNOME/gtk!4485
2022-02-16 13:54:43 +00:00
Matthias Clasen
280544b874 Merge branch 'wip/baedert/for-master' into 'main'
gtkgstpaintable: Handle a NULL value

See merge request GNOME/gtk!4484
2022-02-16 13:48:51 +00:00
Christian Hergert
3c9687fcf1 macos: add helper to check if surface is opaque 2022-02-16 03:08:55 -08:00
Christian Hergert
f207402228 macos: use input_region to specify tracking areas
We want our tracking area to be limited to the input region so that we
don't pass along events outside of them for the window. This improves the
chances we click-out of a popover with a large shadow.

This still doesn't let us pass-through clicks for large shadows on top-
level windows though.
2022-02-16 03:07:51 -08:00
Christian Hergert
a080f1197a macos: ignore mouse events outside tracking area
We also need to ignore events outside the tracking areas when we are
translating them from NSevent into GdkEvent.
2022-02-16 03:06:51 -08:00
Christian Hergert
8f0b9bf5ae macos: fix incorrect signal disconnect 2022-02-16 01:46:25 -08:00
Timm Bäder
b74d3c2221 gtkgstpaintable: Handle a NULL value
gst_element_factory_make can return NULL.
2022-02-16 10:02:24 +01:00
Benjamin Otte
49b0ee21c1 Merge branch 'wip/otte/for-main' into 'main'
glcontext: Remove leftover function call

Closes #4697

See merge request GNOME/gtk!4483
2022-02-16 03:07:05 +00:00
Benjamin Otte
481634930c glcontext: Remove leftover function call
That call should have been removed way back when.

Add a testcase to make sure this keeps working.

Fixes #4697
2022-02-16 03:48:15 +01:00
Christian Hergert
d58c038fe8 macos: remove assertion from external API
We only should be asserting in static functions. Furthermore, this function
did not need to have GDK_BEGIN_MACOS_ALLOC_POOL as nothing is being
allocated there which would cause pooling to get used.
2022-02-15 12:38:07 -08:00
Christian Hergert
056e9012d2 macos: improve monitor detection at display coordinates
This needs to handle the boundary case where the value is exactly equal
to the edge of a rectangle (which gdk_rectangle_contains_point() does not
consider to be containing). However, if there is a monitor in the list
that is a better match, we still want to prefer it.
2022-02-15 12:38:07 -08:00
Benjamin Otte
82e4690564 Merge branch 'viewport-scroll-to-focus' into 'main'
scrolledwindow: Set scroll-to-focus on viewports

See merge request GNOME/gtk!4356
2022-02-15 16:05:32 +00:00
Maximiliano Sandoval R
8dc2c4b24a viewport: Set scroll-to-focus to TRUE by default
In GTK 3 this was the default.
2022-02-15 16:29:08 +01:00
Christian Hergert
3e913ff16e Merge branch 'mac-scrolling-fix' into 'main'
gdk: fix reversed and sluggish scrolling on MacOS

See merge request GNOME/gtk!4479
2022-02-14 23:00:27 +00:00
Andy Russell
37702af22b gdk: fix reversed and sluggish scrolling on MacOS
When using an external mouse on MacOS, the scrolling behavior is
reversed from the user's scrolling preference. Additionally, it is
noticeably sluggish.

This commit fixes both issues by negating the deltas and multiplying
them by 32 before constructing a new scroll event. 32 seems to be the
"traditional" scaling factor according to [Druid], but I'm not sure
where that value actually comes from. Regardless, scaling the deltas by
this amount makes scrolling feel a lot more responsive in the GTK demos.

Scrolling with a trackpad is not affected by either issue because it
triggers a different code path that uses more precise deltas, and
already negates them.

[Druid]: https://linebender.gitbook.io/linebender-graphics-wiki/mouse-wheel#external-mouse-wheel-vs-trackpad
2022-02-14 14:05:39 -05:00
Benjamin Otte
12908ab863 docs: Add Since annotations to GDK_VERSION macros 2022-02-14 00:30:50 +01:00
Matej Urbančič
4cb599f378 Update Slovenian translation 2022-02-13 18:58:22 +00:00
Matej Urbančič
fe210fb0dd Update Slovenian translation 2022-02-13 18:56:28 +00:00
Asier Sarasua Garmendia
1fee30af36 Update Basque translation 2022-02-13 09:22:58 +00:00
Sebastian Dröge
3f329b2d0f Don't crash when updating the icon on a GtkScaleButton with a non-NULL empty icon list 2022-02-13 11:16:32 +02:00
Marek Černocký
1fd03acf9d Updated Czech translation 2022-02-12 19:48:40 +01:00
Benjamin Otte
a26c1a5f0d widget-factory: Make <F11> toggle fullscreen 2022-02-12 19:05:19 +01:00
Emmanuele Bassi
7a608bda27 docs: Split dependencies from related libraries
We currently list everything as a dependencies, regardless of whether
it actually is; this is a source of confusion for users that read the
GTK documentation.

Gi-docgen has a new "related" key in the project configuration which
allows us to list libraries that are merely related to the namespace
we are documenting; the "dependencies" key is used to document the
actual namespace dependencies, now.
2022-02-12 17:28:00 +00:00
Jordi Mas i Hernandez
c400dce0b1 Update Catalan translation 2022-02-12 14:41:46 +00:00
Matthias Clasen
5912b2d64a Merge branch 'wip/chergert/fix-text-overdraw' into 'main'
css: reduce overdraws from "textview > text"

See merge request GNOME/gtk!4472
2022-02-12 08:34:18 +00:00
Christian Hergert
e38e8ed73e css: reduce overdraws from "textview > text"
This was causing us to draw the same background content twice which is a
significant amount of bits to flip in the GPU for maximized windows,
especially twice.
2022-02-11 23:06:16 -08:00
Matthias Clasen
5088103d31 4.6.1 2022-02-11 20:09:15 -05:00
Matthias Clasen
76b185e6f6 Merge branch 'wip/chergert/popover-opaque-region' into 'main'
add opaque regions to popovers

Closes #4689

See merge request GNOME/gtk!4468
2022-02-11 23:16:43 +00:00
Christian Hergert
f3999f7ebf popover: use GtkNative opaque region API
This updates GtkPopover to use the new GtkNative abstraction for
reporting opaque regions of the window, in hopes that it can speed
up compositors for things like animated lists, menu transitions,
and more.

Fixes #4689
2022-02-11 14:37:46 -08:00
Christian Hergert
f8e7ecfde1 window: use GtkNative API to update opaque region
This switches to using the new GtkNative machinery for updating the
opaque region. Some amount of local calculation is still required for
determining when we should apply shadows, and this inherits what was
done previous for that.

Related #4689
2022-02-11 14:37:46 -08:00
Christian Hergert
cc49e044a5 native: add API to update opaque region
This abstracts the machinery to update the opaque region for a GtkWindow
into GtkNative so it may be used from other native impelementations such
as GtkPopover.

Related #4689
2022-02-11 14:37:43 -08:00
Matthias Clasen
9205193147 Merge branch 'bilelmoussaoui/entry-completion' into 'main'
entry completion: add checks that entry is set already

See merge request GNOME/gtk!4450
2022-02-11 17:49:26 +00:00
Matthias Clasen
124d689f45 Merge branch 'enum-docs' into 'main'
docs: Use links in enums

See merge request GNOME/gtk!4452
2022-02-11 17:35:42 +00:00
Matthias Clasen
d2a2591d28 Merge branch 'bilelmoussaoui/g-i' into 'main'
g-i: add a couple of missing nullable annotations

See merge request GNOME/gtk!4470
2022-02-11 17:33:05 +00:00
Carlos Garnacho
64a1a1dd6b Merge branch 'primary' into 'main'
gdk: don't leak wayland primary selection offers

See merge request GNOME/gtk!4458
2022-02-11 14:29:19 +00:00
Bilal Elmoussaoui
3b383569a4 g-i: Add nullable annotations to EventControllerKey::im-context
Fixes https://github.com/gtk-rs/gtk4-rs/issues/874
2022-02-11 12:59:55 +01:00
Bilal Elmoussaoui
c2fe438676 g-i: Add nullable annotations to CellArea getters
Fixes https://github.com/gtk-rs/gtk4-rs/issues/891
2022-02-11 12:55:28 +01:00
Emmanuele Bassi
0ade146e26 Merge branch 'bilelmoussaoui/layout-manager' into 'main'
layout manager: add a check if the widget exists

See merge request GNOME/gtk!4469
2022-02-11 11:51:44 +00:00
Bilal Elmoussaoui
ba266325d0 g-i: Mark FileChooser [s|g]et_current_[folder|name] as nullable
The code seems to already check if folder/name is NULL
Fixes https://github.com/gtk-rs/gtk4-rs/issues/896
2022-02-11 12:21:58 +01:00
Bilal Elmoussaoui
e6322e177e g-i: Mark get_print_settings as nullable
Fixes https://github.com/gtk-rs/gtk4-rs/issues/880
2022-02-11 12:07:54 +01:00
Maximiliano Sandoval R
080a4cda49 docs: Use links in enums
Properties already refer to their object, so

    [property@Widget:sensitive] property on [class@Widget]

is redundant.
2022-02-11 12:07:09 +01:00
Bilal Elmoussaoui
6b63868641 g-i: mark get_selected_printer as nullable
There is no selected printer if the user closes the dialog
Fixes https://github.com/gtk-rs/gtk4-rs/issues/882
2022-02-11 12:05:42 +01:00
Bilal Elmoussaoui
cb710f1999 g-i: mark EventController::name as nullable
Fixes https://github.com/gtk-rs/gtk4-rs/issues/893
2022-02-11 12:02:07 +01:00
Bilal Elmoussaoui
85bb9aaefc g-i: add nullable annotation to gtk_single_selection_get_model 2022-02-11 11:56:40 +01:00
Bilal Elmoussaoui
6c02017212 layout manager: add a check if the widget exists
Avoid a crash when calling _gtk_widget_get_first_child
Fixes https://github.com/gtk-rs/gtk4-rs/issues/889
2022-02-11 11:44:16 +01:00
Matthias Clasen
90bccf4e82 Merge branch 'fix-wayland-subproject-build' into 'main'
NEWS: Updates

See merge request GNOME/gtk!4466
2022-02-10 21:57:27 +00:00
Matthias Clasen
18db7ad470 NEWS: Updates 2022-02-10 15:06:37 -05:00
Julian Orth
468ddd4d49 gdk: don't leak wayland primary selection offers
Signed-off-by: Julian Orth <ju.orth@gmail.com>
2022-02-10 20:44:32 +01:00
Matthias Clasen
ff4b5c8996 Merge branch 'fix-wayland-subproject-build' into 'main'
Fix build with wayland-protocols subproject

Closes #4530

See merge request GNOME/gtk!4465
2022-02-10 19:13:33 +00:00
Matthias Clasen
06aa640664 Fix build with wayland-protocols subproject
The missing files() was pointed out in #4530.

Fixes: #4530
2022-02-10 13:21:28 -05:00
Matthias Clasen
9f24229f82 Merge branch 'column-view-column-new-nullable-factory' into 'main'
Allow passing a `NULL` factory to `gtk_column_view_column_new()`

See merge request GNOME/gtk!4454
2022-02-10 11:42:38 +00:00
Matthias Clasen
214370ee23 Merge branch 'icon-view-drag-dest-item-nullable' into 'main'
Mark `path` out parameter of `gtk_icon_view_get_drag_dest_item()` as `(nullable)`

See merge request GNOME/gtk!4451
2022-02-10 11:24:04 +00:00
Matthias Clasen
217d817408 Merge branch 'gwagner/gtkbuilder-rng' into 'main'
tools: updated gtk4builder.rng to current state

See merge request GNOME/gtk!4457
2022-02-09 19:25:32 +00:00
Matthias Clasen
6dfaafc9f2 Merge branch 'update-keysyms' into 'main'
gdk: Update keyboard symbols from libxkbcommon

See merge request GNOME/gtk!4422
2022-02-09 19:23:59 +00:00
Matthias Clasen
287de3844d Merge branch 'gtk_assisten_set_current_page-no-pages-guard' into 'main'
Don't dereference a `NULL` page in `gtk_assistant_set_current_page()` if there are no pages at all

See merge request GNOME/gtk!4464
2022-02-09 19:19:24 +00:00
Sebastian Dröge
878e4a34d3 Don't dereference a NULL page in gtk_assistant_set_current_page() if there are no pages at all 2022-02-09 17:50:55 +02:00
Matthias Clasen
b893dc9552 Merge branch 'bilelmoussaoui/g-i' into 'main'
gdk: mark gdk_device_get_device_tool as nullable

See merge request GNOME/gtk!4463
2022-02-09 13:43:50 +00:00
Matthias Clasen
687b80a037 Merge branch 'revert-misdeprecation' into 'main'
Revert "Deprecate GdkDevice:source"

See merge request GNOME/gtk!4462
2022-02-09 13:13:35 +00:00
Bilal Elmoussaoui
a8a98523db gdk: mark gdk_device_get_device_tool as nullable 2022-02-09 13:09:47 +00:00
Matthias Clasen
0a224964a6 Revert "Deprecate GdkDevice:source"
This reverts commit fd9e0dd13a.
2022-02-09 07:55:28 -05:00
Luca Bacci
0457c37847 Merge branch 'win32-fix-ctrl-shift-gtk4' into 'main'
gdkkeys-win32: Also ignore Ctrl + Shift (etc.)

See merge request GNOME/gtk!4460
2022-02-09 10:08:52 +00:00
Philip Zander
037c0e4005 gdkkeys-win32: Also ignore Ctrl + Shift (etc.)
Some Windows keymaps have bogus mappings for the Ctrl modifier. !4423 attempted
to fix this by ignoring the Ctrl layer, but that was not enough. We also need to
ignore combinations of Ctrl with other modifiers, i.e. Ctrl + Shift. For example,
Ctrl + Shift + 6 is mapped to the character 0x1E on a US keyboard (but it should
be treated as Ctrl + ^). Basically, always ignore Ctrl unless it is used in
conjunction with Alt, i.e. as part of AltGr.

Related issue: #4667
2022-02-09 10:43:07 +01:00
Christian Hergert
b9389d3784 Merge branch 'bilelmoussaoui/macos-gdk-display' into 'main'
macos: Don't set NULL as a display name

See merge request GNOME/gtk!4453
2022-02-09 00:30:04 +00:00
Günther Wagner
86a3400f2e tools: updated gtk4builder.rng to current state 2022-02-08 21:42:41 +01:00
Sebastian Dröge
8245fd4beb Allow passing a NULL factory to gtk_column_view_column_new() 2022-02-08 16:25:28 +02:00
Bilal Elmoussaoui
f41cfd3caa macos: Don't set NULL as a display name
Other GDK backends ensure there is always a default name set.
Fixes https://github.com/gtk-rs/gtk4-rs/issues/868
2022-02-08 13:38:33 +01:00
Sebastian Dröge
07d6ef13c5 Mark path out parameter of gtk_icon_view_get_drag_dest_item() as (nullable)
It can be set to `NULL` and the function body handles `NULL` explictly,
so annotate it accordingly.
2022-02-08 12:50:24 +02:00
Bilal Elmoussaoui
883e8328e0 entry completion: add checks that entry is set already
If any of the APIs that assumes that the entry is set already is used
before having one already set, things break pretty badly.

Fixes a downstream issue reported at https://github.com/gtk-rs/gtk4-rs/issues/873
2022-02-08 11:22:52 +01:00
Benjamin Otte
c6d5816c95 Merge branch 'wip/otte/for-main' into 'main'
gltexture: Only use glGetFramebufferParameter() when available

Closes #4678

See merge request GNOME/gtk!4449
2022-02-08 02:08:26 +00:00
Benjamin Otte
f37c5ebd26 rgba: Fix GDK_RGBA() macro to work with alpha
Previously we dividied by an integer, so alpha was either 0.0 or 1.0.
2022-02-08 01:34:19 +01:00
Benjamin Otte
2c71825324 gltexture: Only use glGetFramebufferParameter() when available
Fixes #4678
2022-02-08 01:34:19 +01:00
Matthias Clasen
38ad56e6a1 Merge branch 'wip/jimmac/selected_text' into 'main'
style: legible text selections

Closes #4664

See merge request GNOME/gtk!4433
2022-02-08 00:15:45 +00:00
Matthias Clasen
84d698464c Merge branch 'antoniof-main-patch-89408' into 'main'
columnviewcolumn: Define autocleanup function

See merge request GNOME/gtk!4440
2022-02-07 23:57:46 +00:00
Matthias Clasen
9363269ceb Merge branch 'more-noexecstack' into 'main'
demos: Make our stack noexec

See merge request GNOME/gtk!4439
2022-02-07 23:57:26 +00:00
Matthias Clasen
59eb9aeb73 Merge branch 'wip/chergert/macos-fixes' into 'main'
various macOS fixes

See merge request GNOME/gtk!4424
2022-02-07 23:56:40 +00:00
Matthias Clasen
d9109a0e92 Merge branch 'mg/gdk-macos-gdkdisplaylinksource' into 'main'
Include `gdk-private.h` to fix error about `g_source_set_static_name`

See merge request GNOME/gtk!4443
2022-02-07 23:54:55 +00:00
Matthias Clasen
f27c0c65b1 Merge branch 'mg/implicit-declaration-free' into 'main'
gdkjpeg: include `stdlib.h` necessary for `free`

See merge request GNOME/gtk!4445
2022-02-07 23:53:36 +00:00
Matej Urbančič
212f629876 Update Slovenian translation 2022-02-07 19:39:08 +00:00
Matej Urbančič
05f2f3ba8c Update Slovenian translation 2022-02-07 19:30:34 +00:00
Emmanuele Bassi
a66072f312 Merge branch 'drop-target-get-formats-transfer-none' into 'main'
Mark `gtk_drop_target_get_formats()` return value as `transfer none`

See merge request GNOME/gtk!4446
2022-02-07 15:17:39 +00:00
Sebastian Dröge
3ba582375d Mark gtk_drop_target_get_formats() return value as transfer none
It was wrongly inferred as `transfer full` by gobject-introspection.
2022-02-07 16:23:01 +02:00
Mosè Giordano
4c211f1872 gdkjpeg: include stdlib.h necessary for free
`free` is defined in `stdlib.h`, see for example
<https://pubs.opengroup.org/onlinepubs/009604499/functions/free.html>.  Without
this include compilation can fail with the following error:

```
../gdk/loaders/gdkjpeg.c: In function ‘gdk_save_jpeg’:
../gdk/loaders/gdkjpeg.c:264:7: warning: implicit declaration of function ‘free’ [-Wimplicit-function-declaration]
       free (data);
       ^
../gdk/loaders/gdkjpeg.c:264:7: warning: incompatible implicit declaration of built-in function ‘free’
../gdk/loaders/gdkjpeg.c:264:7: note: include ‘<stdlib.h>’ or provide a declaration of ‘free’
../gdk/loaders/gdkjpeg.c:302:67: error: ‘free’ undeclared (first use in this function)
   return g_bytes_new_with_free_func (data, size, (GDestroyNotify) free, NULL);
                                                                   ^
../gdk/loaders/gdkjpeg.c:302:67: note: each undeclared identifier is reported only once for each function it appears in
../gdk/loaders/gdkjpeg.c:303:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
```
2022-02-06 15:41:33 +00:00
Mosè Giordano
2ceba0d31c Include gdk-private.h to fix error about g_source_set_static_name
Without this change we get the following error:

```
[1/13] Compiling C object gdk/macos/libgdk-macos.a.p/gdkdisplaylinksource.c.o
ninja: job failed: /opt/bin/aarch64-apple-darwin20-libgfortran5-cxx11/aarch64-apple-darwin20-clang -Igdk/macos/libgdk-macos.a.p -Igdk/macos -I../gdk/macos -I. -I.. -Igdk -I../gdk -Isubprojects/pango/pango -I../subprojects/pango/pango -Isubprojects/pango -I../subprojects/pango -I/workspace/destdir/include/gdk-pixbuf-2.0 -I/workspace/destdir/include -I/workspace/destdir/include/glib-2.0 -I/workspace/destdir/lib/glib-2.0/include -I/workspace/destdir/lib/libffi-3.2.1/include -I/workspace/destdir/include/libpng16 -I/usr/include/libmount -I/usr/include/blkid -I/workspace/destdir/include/cairo -I/workspace/destdir/include/pixman-1 -I/workspace/destdir/include/freetype2 -I/workspace/destdir/include/fribidi -I/workspace/destdir/include/harfbuzz -I/workspace/destdir/include/graphene-1.0 -I/workspace/destdir/lib/graphene-1.0/include -I/workspace/destdir/include/gio-unix-2.0 -fcolor-diagnostics -Wall -Winvalid-pch -std=gnu99 -O2 -g -DG_LOG_USE_STRUCTURED=1 -DGLIB_DISABLE_DEPRECATION_WARNINGS '-DGTK_VERSION="4.6.0"' -D_GNU_SOURCE -DG_ENABLE_DEBUG -DGTK_COMPILATION '-DG_LOG_DOMAIN="Gdk"' -xobjective-c -fno-strict-aliasing -Wno-c++11-extensions -Wno-missing-include-dirs -Wno-typedef-redefinition -Wformat=2 -Wformat-nonliteral -Wformat-security -Wignored-qualifiers -Wimplicit-function-declaration -Wmisleading-indentation -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wnested-externs -Wold-style-definition -Wpointer-arith -Wshadow -Wstrict-prototypes -Wswitch-default -Wswitch-enum -Wundef -Wuninitialized -Wunused -Werror=address -Werror=array-bounds -Werror=empty-body -Werror=implicit -Werror=implicit-fallthrough -Werror=init-self -Werror=int-to-pointer-cast -Werror=main -Werror=missing-braces -Werror=missing-declarations -Werror=missing-prototypes -Werror=nonnull -Werror=pointer-to-int-cast -Werror=redundant-decls -Werror=return-type -Werror=sequence-point -Werror=trigraphs -Werror=vla -Werror=write-strings -Wnull-dereference -fvisibility=hidden -MD -MQ gdk/macos/libgdk-macos.a.p/gdkdisplaylinksource.c.o -MF gdk/macos/libgdk-macos.a.p/gdkdisplaylinksource.c.o.d -o gdk/macos/libgdk-macos.a.p/gdkdisplaylinksource.c.o -c ../gdk/macos/gdkdisplaylinksource.c
../gdk/macos/gdkdisplaylinksource.c:201:3: error: implicit declaration of function 'g_source_set_static_name' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
  g_source_set_static_name (source, "[gdk] quartz frame clock");
  ^
1 error generated.
ninja: subcommand failed
```
2022-02-05 21:51:40 +00:00
Christian Hergert
95168e179c macos: fallback to conversion on WCG colorspace
We don't want to risk having something really weird come out if we have a
WCG colorspace, so instead only do the performance hack on systems where
the output is likely reasonable.

We will want to eventually just be drawing in the appropriate colorspace,
but that is not available yet.
2022-02-05 12:42:57 -08:00
Asier Sarasua Garmendia
34959b58f4 Update Basque translation 2022-02-05 11:21:02 +00:00
Christian Hergert
2be51dc3b1 macos: handle sizing changes when switching monitors
This should make sure that our scales are updated as well as
ensuring we repaint the whole surface.
2022-02-04 12:29:57 -08:00
Benjamin Otte
14bdf82e33 Merge branch 'wip/hadess/inspector-search-by-pointer-gtk4' into 'main'
inspector: Search by pointer address

See merge request GNOME/gtk!4442
2022-02-04 18:07:28 +00:00
Christian Hergert
6b85d501f0 macos: assume monitor colorspace when drawing
When using software rendering w/ cairo, assume we're drawing in
the best-monitor's colorspace rather than RGB to avoid colorspace
conversions on every frame.
2022-02-04 09:46:10 -08:00
Christian Hergert
473aceea68 macos: add API to get monitor colorspace 2022-02-04 09:45:55 -08:00
Bastien Nocera
0621dbc745 inspector: Search by pointer address
Useful to find a widget that corresponds to a pointer address in gdb.
2022-02-04 18:39:56 +01:00
Christian Hergert
8ea0a4fc50 macos: precalculate clip regions as CGRect
We can make our drawRect do less work if we precalculate the clip
and damage regions upfront by intersecting them with the bounds.
2022-02-04 09:31:37 -08:00
António Fernandes
94ef818c9a columnviewcolumn: Define autocleanup function 2022-02-04 11:13:46 +00:00
Christian Hergert
8112b49c36 macos: fix unmaximize opacity around edges of window 2022-02-03 19:26:16 -08:00
Christian Hergert
58b9c3a6d4 macos: use CGContext to draw cairo surfaces
Instead of relying on cairo_t to perform drawing from our backing
image surface to the Core Graphics context, we can convert the
cairo_image_surface_t into a CGImageRef without having to copy
data if we are certain of the alignment of the image up front.

Without this, there are many situations, based on the size of the
window that could cause cairo to take a slow path and malloc/copy
the data to ensure that alignment.

The previous commit titled "macos: align image surface rowstride to
16-bytes" ensures that this invariant is true so that our drawing
code can assume we can reference the framebuffer from the
cairo_image_surface_t using a CGDataProvider.

Since GdkMacosCairoContext and GdkMacosCairoSubview are coordinating,
we can also setup the transformation/scale early when drawing the
cairo_image_surface_t instead of when copying it to Core Graphics.

Furthermore, the CGImageRef is created with an RGB colorspace so
that we are not performing colorspace conversion to the output
device. We don't get color matching between displays, but we don't
expect that anyway, particularly with the software renderer.
2022-02-03 19:26:16 -08:00
Christian Hergert
4373743d4c macos: align image surface rowstride to 16-bytes
When creating a cairo_image_surface_t we want both the framebuffer pointer
and each row to be aligned to 16-bytes so that Core Graphics will use more
optimal paths.

However, cairo_image_surface_create() will not guarantee that the rowstride
is aligned to 16-bytes so we must do that ourselves.
2022-02-03 19:26:16 -08:00
Christian Hergert
58159552ba macos: avoid unnecessarily destroying cairo_t
This avoids destroying a cairo_t when we are within the frame as it
otherwise causes the surface to unnecessarily flush.
2022-02-03 19:26:16 -08:00
Christian Hergert
4bff24f83a macos: cleanup window surface when destroying context
Make sure we release the cairo_surface_t for the window when
disposing the GdkMacosCairoContext.
2022-02-03 19:26:16 -08:00
Christian Hergert
f644925570 macos: be more careful about freezing/thawing surfaces
We need to avoid conflating the managing of frame callbacks from
the freeze/thaw mechanics and ensure we don't perform extra thaw
requests at the wrong time.
2022-02-03 19:26:16 -08:00
Christian Hergert
8a4fd3f2af macos: check for destroyed surfaces in vfuncs 2022-02-03 19:26:16 -08:00
Christian Hergert
b7130a1ce3 macos: be more defensive about freezing updates
We only need to freeze the updates if we weren't in the queue already.
That should be the case, but just better to be defensive here.
2022-02-03 19:26:16 -08:00
Christian Hergert
519a44d224 macos: push to head of awaiting frames
Always add to the head of awaiting frames as the list is processed
in the opposite direction.
2022-02-03 19:26:16 -08:00
Christian Hergert
936034e07a macos: remove popup surface from parent 2022-02-03 19:26:16 -08:00
Christian Hergert
ea43939f52 macos: handle NULL frame-clock when thawing 2022-02-03 19:26:16 -08:00
Jan Alexander Steffens (heftig)
d8befc612f demos: Make our stack noexec
This is similar to https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/4330
and https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/4334, which fixed
the main library but missed the demos.
2022-02-03 19:14:36 +00:00
Emmanuele Bassi
06ec4ec148 Merge branch 'zbrown/its-a-filename' into 'main'
cssprovider: from_path takes a path

See merge request GNOME/gtk!4436
2022-02-02 23:11:44 +00:00
Zander Brown
6fbcb967a0 cssprovider: from_path takes a path
Annotate it as such so that bindings can expose that appropriately

Related: https://github.com/gtk-rs/gtk4-rs/issues/861
2022-02-02 22:47:39 +00:00
Emmanuele Bassi
82e0241c42 Merge branch 'fix-app-launch-context-docs' into 'main'
gdkapplaunchcontext: Fix docs a bit

See merge request GNOME/gtk!4434
2022-02-01 20:34:41 +00:00
Phaedrus Leeds
8e000c2dbf gdkapplaunchcontext: Fix docs a bit
The set_screen() and set_display() methods no longer exist.
2022-02-01 11:17:55 -08:00
Jakub Steiner
1f1aafd5c2 style: legible text selections
- follow adwaita styling

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/4664
2022-02-01 17:12:52 +01:00
Luca Bacci
d314298644 Merge branch 'win32-keys-ignore-ctrl-gtk4' into 'main'
gdkkeys-win32: Ignore CTRL bit for key translation

Closes #4667

See merge request GNOME/gtk!4431
2022-02-01 15:33:01 +00:00
Emmanuele Bassi
3cbe3abf67 Merge branch '4602-fix-kerning-of-gl-rendered-glyphs' into 'main'
Fix kerning of GL rendered glyphs

Closes #4602

See merge request GNOME/gtk!4429
2022-02-01 14:31:47 +00:00
Philip Zander
90ab8b8dd3 gdkkeys-win32: Ignore CTRL bit for key translation
Some keymaps on Windows contain bogus mappings for Ctrl+key for certain
keys, e.g. Ctrl+Backspace = Delete, or Ctrl+[ = 0x1B. These are never
used on Windows, so we should ignore them.

Fixes #4667
2022-02-01 14:12:56 +01:00
Marek Kasik
cb1dd66220 Fix kerning of GL rendered glyphs
Multiple scaled shifts by 1024 too.

Fixes: #4602
2022-02-01 09:31:35 +01:00
Boyuan Yang
d033a099ae Update Chinese (China) translation 2022-01-31 03:51:23 +00:00
Boyuan Yang
78d9e5e181 Update Chinese (China) translation 2022-01-31 03:46:30 +00:00
sicklylife
41270ba8c9 Update Japanese translation 2022-01-30 15:26:50 +00:00
sicklylife
e2277438e9 Update Japanese translation 2022-01-30 15:15:27 +00:00
Piotr Drąg
b0936c913b Update Polish translation 2022-01-29 14:59:17 +01:00
Väinö Mäkelä
4b05eb62c9 gdk: Update keyboard symbols from libxkbcommon
GTK's old key symbol list is missing a few symbols like the per mille
sign that is included in some keyboard layouts. This commit updates
gdkkeyuni.c to match libxkbcommon's current key symbol list.
2022-01-29 14:31:09 +02:00
Aleksandr Melman
fbacf0cb65 Update Russian translation 2022-01-28 11:05:57 +00:00
Emmanuele Bassi
05a53a1582 Merge branch 'infobar-xml' into 'main'
Escape Builder XML in GtkInfoBar docs

See merge request GNOME/gtk!4421
2022-01-28 10:49:37 +00:00
Elliott Sales de Andrade
be5873a057 Escape Builder XML in GtkInfoBar docs 2022-01-28 05:32:16 -05:00
Daniel Mustieles
c97f46bf28 Updated Spanish translation 2022-01-28 11:01:09 +01:00
Emmanuele Bassi
1d47882eab Merge branch 'ebassi/manifest-dep-fix' into 'main'
flatpak: Add wayland-protocols to the manifests

See merge request GNOME/gtk!4420
2022-01-28 02:05:59 +00:00
Emmanuele Bassi
9dcbbb4300 flatpak: Use "main" branch for wayland
The default branch for wayland has changed, but the "master" branch
is still available with an older version.
2022-01-28 01:25:04 +00:00
Matthias Clasen
c9eda02fa1 Merge branch 'tiled-window-bracket-fix' into 'main'
theme: Drop shadow and border fixes for tiled windows

See merge request GNOME/gtk!4418
2022-01-27 17:29:13 +00:00
Matthias Clasen
a37584a404 Merge branch 'wip/baedert/for-master' into 'main'
build: Make GCC ignore fallthrough comments

Closes #4663

See merge request GNOME/gtk!4419
2022-01-27 16:27:12 +00:00
Leônidas Araújo
566f217f6f Update Brazilian Portuguese translation 2022-01-27 16:25:07 +00:00
Matheus Barbosa
ca34c79443 Update Brazilian Portuguese translation 2022-01-27 15:47:53 +00:00
Timm Bäder
4be6c5b197 gesturesingle: Get rid of a fallthrough comment
Fixes #4663
2022-01-27 16:06:56 +01:00
Timm Bäder
7194196100 build: Make GCC ignore fallthrough comments
From the GCC manpage:

> Wimplicit-fallthrough=5 doesn't recognize any comments as
> fallthrough comments, only attributes disable
> the warning.

So, check for the =5 version after checking for the simple version. This
way we get -Wfallhrough with clang and -Wfallthrough -Wfallthrough=5
with GCC, which works.
2022-01-27 16:05:33 +01:00
Yuri Chornoivan
d9d2eb978d Update Ukrainian translation 2022-01-27 14:47:37 +00:00
Carlos Garnacho
c8460c51bd Merge branch 'realize-vs-focus-in' into 'main'
gtktext: Make sure input method sees focus in

See merge request GNOME/gtk!4402
2022-01-27 14:13:55 +00:00
Joonas Henriksson
b4d0235a05 theme: Fix incorrect border color for tiled windows 2022-01-27 06:08:40 +02:00
Joonas Henriksson
a5d1f78bf2 theme: Fix drop shadow for tiled windows
Misplaced curly bracket prevented the :backdrop styling from getting
applied. Also fix the indentation while at it.
2022-01-27 05:50:06 +02:00
Carlos Garnacho
9a7750e339 Merge branch 'hold-gestures' into 'main'
Add hold gestures

See merge request GNOME/gtk!3454
2022-01-26 23:37:28 +00:00
Fran Dieguez
d7c4ac7d02 Update Galician translation 2022-01-26 23:36:27 +00:00
Hugo Carvalho
1a08be066e Update Portuguese translation 2022-01-26 22:48:02 +00:00
José Expósito
fe86aa5f6b gtkgestureswipe: Don't filter hold events
Part-of: <!3454>
2022-01-26 22:49:53 +01:00
José Expósito
34133ec1e8 gtkgesturerotate: Don't filter hold events
Part-of: <!3454>
2022-01-26 22:49:53 +01:00
José Expósito
a99a75827c gtkgesturezoom: Don't filter hold events
Part-of: <!3454>
2022-01-26 22:49:53 +01:00
José Expósito
3bfcc12ec0 gtkgesture: Handle hold gestures
Hold gestures are used to bring existing gestures on touchpad
semantically closer to touchscreen gestures.

Touchpad gestures observe hold gestures with a matching amount of
fingers and emit their begin and end signals when fingers are detected
or removed on/from the touchpad.

When a hold cancel event is detected, it is required to wait a few
milliseconds until the next event(s) are received to avoid emitting
multiple begin signals.

Part-of: <!3454>
2022-01-26 22:49:53 +01:00
José Expósito
382341e1bf gtkgesture: Add hold to EVENT_IS_TOUCHPAD_GESTURE
Part-of: <!3454>
2022-01-26 22:49:53 +01:00
José Expósito
44b0d8b330 scrolledwindow: Stop kinetic scrolling on begin
Stop kinetic scrolling when a scroll begin signal is sent during the
event capture phase.

Part-of: <!3454>
2022-01-26 22:49:53 +01:00
José Expósito
62808722d2 kineticscrolling: Add stop function
Move the logic to stop kinetic scrolling to its own function and allow
to call it from the outside.

Part-of: <!3454>
2022-01-26 22:49:53 +01:00
José Expósito
f09338c8de gtkeventcontrollerscroll: Handle hold gestures
Handle hold events:

 - GDK_TOUCHPAD_GESTURE_PHASE_BEGIN: scroll-begin is emitted.
 - GDK_TOUCHPAD_GESTURE_PHASE_END: A hold gesture ends only when all
   fingers are lifted from the touchpad without movement, so
   scroll-end is emitted right away.
 - GDK_TOUCHPAD_GESTURE_PHASE_CANCEL: A hold gesture is cancelled when
   some fingers are lifted/put down or movement is detected. In this
   case, scroll-end is emitted after a small timeout only if
   GDK_SCROLL wasn't detected.

Part-of: <!3454>
2022-01-26 22:49:53 +01:00
José Expósito
ec91b2de10 gtkeventcontrollerscroll: Refactor scroll end
Move the logic to end scrolling to its own function to be able to
reuse it.

Refactor, no functional changes.

Part-of: <!3454>
2022-01-26 22:49:53 +01:00
José Expósito
5cd289dc1d gtkeventcontrollerscroll: Refactor scroll begin
Move the logic to begin scrolling to its own function to be able to
reuse it.

Refactor, no functional changes.

Part-of: <!3454>
2022-01-26 22:49:53 +01:00
José Expósito
299caaa383 wayland/pointer-gestures: Receive hold gesture
Add the glue code to receive hold gesture events from the compositor,
transform them into GdkEvents and finally enqueue them.

Part-of: <!3454>
2022-01-26 22:49:53 +01:00
José Expósito
0aa2a4ef14 gtkmain: Handle hold events
Part-of: <!3454>
2022-01-26 22:49:53 +01:00
José Expósito
331f1ee722 gdk/events: Add hold GdkEvent
Allow to create hold events as well as the required functions to get
information about the event: gesture phase, finger count, etc

Part-of: <!3454>
2022-01-26 22:49:53 +01:00
José Expósito
0f351508bc build: Bump wayland-protocols to v1.23
Part-of: <!3454>
2022-01-26 22:47:51 +01:00
Matthias Clasen
304527ab01 Merge branch 'sri-main-patch-28302' into 'main'
Update docs/reference/gtk/migrating-3to4.md

See merge request GNOME/gtk!4404
2022-01-26 19:37:28 +00:00
Matthias Clasen
b3d778469a Merge branch 'rafaelff-hig' into 'main'
buildertool: use curly apostrophe

See merge request GNOME/gtk!4414
2022-01-26 19:35:21 +00:00
Matthias Clasen
6f5210afea Merge branch 'wip/carlosg/touchpad-gesture-fixes' into 'main'
Touchpad gesture fixes

See merge request GNOME/gtk!4417
2022-01-26 19:32:33 +00:00
Matthias Clasen
6b1de35c01 Merge branch 'antoniof-main-patch-39484' into 'main'
gtkbitset: Define autocleanup function

See merge request GNOME/gtk!4416
2022-01-26 19:29:08 +00:00
Matthias Clasen
8fccfc7a3d Merge branch 'bilelmoussaoui/g-i' into 'main'
g-i: mark GtkSnapshot to_(node|paintable) as nullable

See merge request GNOME/gtk!4413
2022-01-26 19:19:42 +00:00
Carlos Garnacho
6fd3645713 gtk/gesture: Fix point info lookup on touchpad events
Since the addition of GdkEventSequence in touchpad events, these
are now stored in the gesture using that sequence. This bit of touchpad
gesture handling was however missing to be updated, still looking up
the special NULL sequence.

Use the last sequence here, which will be the one coming from touchpad
gesture events.
2022-01-26 16:02:00 +01:00
Carlos Garnacho
8e86e6325b gtk/main: Do not use touchpad event sequence for pointer focus lookup
Despite touchpad gestures having a sequence, these must use the logical
pointer focus. Avoid using the sequence for GtkPointerFocus lookups with
those events, in order to ensure those events make it all the way to the
intended target.

This is fallout from adding GdkEventSequence information to touchpad
gestures.
2022-01-26 15:59:36 +01:00
Carlos Garnacho
2b41e72196 gdk: Always request "flush events" frame clock phase on events
This change is done for 2 reasons:

- The logic to request this phase when compressing scroll events is
  slightly broken. If there are multiple scroll events that are
  coalesced into one, the surface frame clock will not get this request.
  The worst case is having >= 2 scroll events on every frame, as the
  compressed event will be left in the queue, and be further compressed
  on future events.

- Even scroll events aside, this phase is requested in oddly specific
  places that are not enough to cover all events, others do rely on
  unrelated GdkFrameClock activity that happens to flush the events
  as well.

Unify this phase request so it explicitly happens on the arrival of any
event. This ensures that events (compressed or not) will be handled
promptly after arrival.
2022-01-26 15:49:29 +01:00
António Fernandes
1a64eeb88e gtkbitset: Define autocleanup function 2022-01-25 21:33:31 +00:00
Emmanuele Bassi
2f8eac2c0a Merge branch 'fix-popovermenu-removechild' into 'main'
popovermenu: Fix crash when removing child

See merge request GNOME/gtk!4393
2022-01-25 15:40:28 +00:00
Kévin Commaille
aaba777ad0 popovermenu: Fix crash when removing child
gtk_menu_section_box_remove_custom was looking in the wrong place for the
stack ancestor, causing an assertion error.
2022-01-25 15:31:00 +01:00
Guido Günther
a580547f47 gtktext: Make sure input method sees focus in
Currently when the widget is realized after the focus in event the input
method isn't activated as enable is never sent. The call trace is

  gtk_text_focus_changed ->
    gtk_im_context_focus_in ->
      gtk_im_context_wayland_focus_in

which returns early as self->widget is NULL since it's set up in
gtk_text_realize() via gtk_im_context_set_client_widget(). Handle that
case by invoking gtk_im_context_focus_in() from gtk_text_realize() too.

A case where the above happens is a GtkSearchEntry in a GtkSearchBar.
E.g. in gtk4-demo when starting the demo and then hitting the search
button right away.
2022-01-25 11:15:29 +01:00
Boyuan Yang
00ee7ffa6a Update Chinese (China) translation 2022-01-24 19:46:37 +00:00
Leônidas Araújo
f02b7d55b1 Update Brazilian Portuguese translation 2022-01-24 17:08:46 +00:00
Rafael Fontenelle
bed709a322 buildertool: use curly apostrophe 2022-01-24 17:04:17 +00:00
Bilal Elmoussaoui
b362eeefdf g-i: mark GtkSnapshot to_(node|paintable) as nullable
Fixes an upstream issue reported at https://github.com/gtk-rs/gtk4-rs/issues/845
2022-01-23 22:11:07 +00:00
Matthias Clasen
7b02498963 Merge branch 'matthiasc/for-main' into 'main'
Use pango api better

See merge request GNOME/gtk!4412
2022-01-23 15:19:39 +00:00
Matthias Clasen
6fd53f28f3 Use pango api better
Avoid direct access to PangoLayoutLine members,
use pango api for it where we can.#
2022-01-23 09:55:46 -05:00
Matthias Clasen
fefc8b5a82 Merge branch 'matthiasc/for-main' into 'main'
Use pango api better

See merge request GNOME/gtk!4411
2022-01-23 14:34:58 +00:00
Matthias Clasen
4fe976549e Use pango api better
Avoid direct access to PangoLayoutLine members,
use pango api for it where we can.
2022-01-23 09:09:57 -05:00
Matthias Clasen
044ff82d0b Merge branch 'matthiasc/for-main' into 'main'
Use pango api better

See merge request GNOME/gtk!4409
2022-01-23 04:29:58 +00:00
Matthias Clasen
feac1e5fba Use pango api better
Avoid direct access to PangoLayoutLine members,
use pango api for it where we can.
2022-01-22 23:10:53 -05:00
Yaron Shahrabani
dd5455fcd2 Update Hebrew translation 2022-01-21 16:04:24 +00:00
Yaron Shahrabani
315971f02d Update Hebrew translation 2022-01-21 15:53:39 +00:00
Emmanuele Bassi
a092986af3 Merge branch 'targz' into 'main'
ci: Put gtk dll into an archive

Closes #4653

See merge request GNOME/gtk!4403
2022-01-19 19:58:36 +00:00
Sri Ramkrishna
6633f4e02f Update docs/reference/gtk/migrating-3to4.md 2022-01-19 19:24:01 +00:00
Guido Günther
ee8970f23d ci: Only use letters in "expose_as" 2022-01-19 18:51:29 +01:00
Guido Günther
46f1e4c414 ci: Put gtk dll into an archive
This avoids the wild card that makes the CI fail
2022-01-19 18:51:16 +01:00
Dz Chen
a853e27765 Update Chinese (China) translation 2022-01-19 15:44:00 +00:00
Matthias Clasen
68985d42bb Merge branch 'win32-gl-improvements' into 'main'
Windows: Some fixes to GL context realization (EGL/GLES in particular)

See merge request GNOME/gtk!4386
2022-01-19 13:49:40 +00:00
Matthias Clasen
9146a21738 Merge branch 'bilelmoussaoui/g-i' into 'main'
g-i: mark gtk_text_iter_get_child_anchor as nullable

See merge request GNOME/gtk!4401
2022-01-19 13:48:57 +00:00
Luca Bacci
8c2128703b Merge branch 'provide-libgtk-dll-as-ci-artifact' into 'main'
Provide GTK DLL as GitLab CI artifact

See merge request GNOME/gtk!4395
2022-01-19 11:17:28 +00:00
Luca Bacci
b2d9cae0ec Provide GTK DLL as GitLab CI artifact 2022-01-19 11:17:28 +00:00
Carlos Garnacho
11eb66298d Merge branch 'context-early' into 'main'
gtkimcontextwayland: Remember context on focus-in so enable can happen later

See merge request GNOME/gtk!4397
2022-01-19 10:48:48 +00:00
Bilal Elmoussaoui
0f67e46549 g-i: mark gtk_text_iter_get_paintable as nullable 2022-01-19 10:22:40 +00:00
Guido Günther
45397534eb gtkimcontextwayland: Save context even when text_input isn't around yet
Remember the current context on focus-in even though the text-input
isn't set up yet. This helps in the case where the text-input is not yet
created but a widget already got focused. Without that the enable()
invocation in text_input_enter() woulnd't be invoked leaving the input
method disabled.

This fixes

    gtk4-demo --run=search_entry

which would initially not show the on-screen keyboard when e.g using
phoc/sway as compositor.
2022-01-19 10:20:46 +00:00
Bilal Elmoussaoui
ffa93b87f8 g-i: mark gtk_text_iter_get_child_anchor as nullable 2022-01-19 10:18:40 +00:00
Guido Günther
4d741bac98 wayland: xdg-activation: Don't assume there's a focus surface
Tools like gtk4-launch can't set surface on the activation token so
don't require it. If the compositor requires it we can't do anything
about it anyway. This avoids a critical:

   (gtk4-launch:23497): Gdk-CRITICAL **: 17:07:24.704: gdk_wayland_surface_get_wl_surface: assertion 'GDK_IS_WAYLAND_SURFACE (surface)' failed

Fixes: be4216e051 ("gdk/wayland: Support the xdg-activation wayland protocol")

Signed-off-by: Guido Günther <agx@sigxcpu.org>
2022-01-19 08:57:10 +01:00
Chun-wei Fan
0fe37d1828 gdkdisplay-win32.c: Clean up GL initialization further 2022-01-19 11:56:32 +08:00
Chun-wei Fan
43839898b3 GDK: Force GLES 3.0+ on libANGLE
...when libANGLE is being used on Windows, by checking for a
Windows-specific an ANGLE-specific extension.
2022-01-19 11:56:32 +08:00
Chun-wei Fan
6f2848c311 Cleanup "GDK/Win32: Try to fix initializing GLES contexts"
As per Benjamin's suggestions, cleanup the previous implementation on
initializing the GLES context on Windows, so that we use more items that are
already in GDK proper and integrate two functions into one.
2022-01-19 11:56:32 +08:00
Chun-wei Fan
38c17c1f79 gdkglcontext-win32-wgl.c: Cleanup GL context creation
Instead of first trying to explicitly ask for a WGL 4.1 context, ask for
the WGL context version that matches what is reported via
epoxy_gl_version(), so that we get the maximum WGL version that is
supported by the graphics drivers, and make sure any WGL contexts that
are shared with this (initial) WGL context are created likewise.

We can try to do a default-bog-standard 3.2 core WGL context creation
if the need arises, but let's leave that alone for now.
2022-01-19 11:56:32 +08:00
Chun-wei Fan
b85aa10700 gdkglcontext.c: Ensure EGL contexts are in-sync with shared context
The EGL context that we are actually creating must have matching OpenGL/ES
versions and allowed GL API set with the previously-created EGL context
that will be shared with it so that they can interoperate together, if
applicable.

This will fix the situation by making sure that we request for the
OpenGL/ES version and OpenGL API set that match with what we have in our shared
EGL context.  Otherwise, the newly-created EGL context assumed a OpenGL/ES 2.0
context that supported desktop OpenGL, which may not be what we wanted, such as
in the case of libANGLE.
2022-01-19 11:56:32 +08:00
Chun-wei Fan
598c7d9cf4 GDK/Win32: Try to fix initializing GLES contexts
We are now able to create EGL contexts properly on Windows, but not GLES.  This
tries to fix things by doing the following:

*  Record the GL context type in a more proper fashion, using an Enum.  This
   makes things a bit cleaner.
*  Force GLES-3.0+ contexts, since libANGLE requires this to properly work with
   the shaders-its 2.0 contexts don't work well with our shaders.
2022-01-19 11:56:32 +08:00
Chun-wei Fan
3e9d858af1 gskrenderer.c: Use GL renderer on Windows by default
Since now we have the shaders working on Windows under GLES with libANGLE using
a 3.0+ context, drop the check to fall back to the Cairo renderer when GLES is
being used.
2022-01-19 11:56:32 +08:00
Matthias Clasen
6fd29e6600 Merge branch 'wip/wayland-surface-offset' into 'main'
Fix DND hotspot position under Wayland + EGL/Vulkan

See merge request GNOME/gtk!3705
2022-01-18 23:48:26 +00:00
Matthias Clasen
b67636747b Merge branch 'gdksurface-wayland-assert' into 'main'
gdksurface-wayland: Fix contradictory assert

See merge request GNOME/gtk!4385
2022-01-18 23:46:59 +00:00
Matthias Clasen
ea464c9874 Merge branch 'gsk-transform-nullable' into 'main'
Mark various GskTransform functions as nullable in their return value

See merge request GNOME/gtk!4378
2022-01-18 23:44:23 +00:00
Matthias Clasen
0e9c4a3964 Merge branch 'document_shortcut_func_ret' into 'main'
gtk: document return value of ShortcutFunc

See merge request GNOME/gtk!4389
2022-01-18 23:41:15 +00:00
Matthias Clasen
1b15f89dfd Merge branch 'wip/dont-always-restore-saved-gtk4' into 'main'
wayland: Don't always restore the saved size when floating

Closes #4634

See merge request GNOME/gtk!4394
2022-01-18 23:40:49 +00:00
Matthias Clasen
7192ff672e Merge branch 'build-post-install-query-media-modules' into 'main'
Meson: Also query media modules in post-install

See merge request GNOME/gtk!4380
2022-01-18 23:39:26 +00:00
Matthias Clasen
7a99e03888 Merge branch 'ebassi/fix-release-test' into 'main'
reftest: Avoid assertions being compiled out

See merge request GNOME/gtk!4391
2022-01-18 15:07:37 +00:00
Jonas Ådahl
be7a391a13 wayland: Don't always restore the saved size when floating
We only save the size when we transition from floating to fixed, so that
we can restore the size to the one prior to being fixed.

However, we should not restore to this size whenever we see a 0x0 size
from xdg_toplevel, as it can do that any time it doesn't care about the
size, e.g. when the surface is floating and just changing state.

Fix this by only using the saved size when transitioning from fixed to
floating, not when staying floating while previously floating.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4634
2022-01-18 15:46:10 +01:00
Emmanuele Bassi
23aec81f1a reftest: Avoid assertions being compiled out
Calling functions inside a g_assert() means those functions will be
compiled out when building with G_DISABLE_ASSERT.

This fixes the release job in the CI pipeline.
2022-01-18 14:07:37 +00:00
Alexandros Theodotou
738d962aca gtk: document return value of ShortcutFunc 2022-01-18 10:58:47 +00:00
Luca Bacci
93bc97b7ec Merge branch 'fix-keyboard-shortcuts-win32' into 'main'
Win32 key events cleanup

See merge request GNOME/gtk!4349
2022-01-17 13:34:17 +00:00
Luca Bacci
243bb57a27 GdkWin32: Add translation result w/o CAPS LOCK to key events for accelerator matching 2022-01-17 14:14:55 +01:00
Luca Bacci
4916ebd05e GdkWin32: Remove _gdk_input_codepage variable
It's unused
2022-01-17 14:14:55 +01:00
Luca Bacci
8bbf48eb64 GdkWin32: Code reorganization for gdk_event_translate 2022-01-17 14:14:47 +01:00
Matthias Clasen
56920092b9 Merge branch 'ebassi/issue-4596' into 'main'
i18n: Detect more translatable attribute values

Closes #4596

See merge request GNOME/gtk!4383
2022-01-17 12:58:01 +00:00
Luca Bacci
672ab4fc35 Merge branch 'win32-imcontextime-ignore-control-characters' into 'main'
Fix handling of control characters & remove Win32-specific hacks from gdkkeyuni.c

Closes #2865

See merge request GNOME/gtk!4387
2022-01-17 11:44:12 +00:00
Philip Zander
52616dee8e GtkIMContextIME: Ignore ASCII control characters
Make GtkIMContextIME ignore ASCII control characters just like other
IMContext implementations (e.G. GtkIMContextSimple). Fixes bogus
characters appearing in text input fields (old bug 676077).
2022-01-17 12:03:01 +01:00
Chun-wei Fan
905f021bbd Revert "Bug 676077: Fix handling of Keyboard Input on Windows"
The actual code that does the IM context code handling on Windows now uses the
native Windows APIs to handle keystrokes, so this patch is no longer needed, as
it was found that it instead caused issues.

Pointed out in issue #2865.

This reverts commit fd6ce9975e.
2022-01-17 11:38:37 +01:00
Kritphong Mongkhonvanit
55016ada92 gdksurface-wayland: Fix contradictory assert
gdk_wayland_toplevel_inhibit_idle() contained a contradictory assert
that always fail. More specifically, in the branch that is supposed to
create the idle inhibitor, there is an assertion that it must already
exist and that the refcount must be greater than zero. This causes a
crash on WMs/DEs that use the ZWP idle inhibit manager protocol such as
KDE Plasma and Sway. Fix this by just asserting that the refcount is
zero instead.
2022-01-17 15:50:08 +07:00
Aurimas Černius
3bfaaab4f7 Updated Lithuanian translation 2022-01-16 21:38:08 +02:00
Emmanuele Bassi
9e83eb6501 i18n: Detect more translatable attribute values
GtkBuilder uses GMarkup, which defines a boolean attribute value as:

- yes/no
- true/false
- 1/0

The ITS file for GtkBuilder UI definitions is only using the first pair,
likely because Glade only ever used those values. GTK's own tools, though,
will typically simplify the full yes/no and true/false strings to 1 and 0,
to minimise the parsing time.

Fixes: #4596
2022-01-16 14:03:05 +00:00
Luca Bacci
ef1905a665 post install: query media modules 2022-01-14 18:57:03 +01:00
Sebastian Dröge
c44badd26a Mark various GskTransform functions as nullable in their return value
Various transforms are normalized with their next transform, and if they
end up being the identity transform will return NULL.

For example a translation by (x,y,z) and followed by (-x,-y,-z) will
result in NULL.
2022-01-14 11:57:23 +02:00
Jonas Ådahl
66ebc660b4 wayland/surface: Use wl_surface_offset() instead of x,y of attach()
This makes the hotspot of DND surfaces work when using the Vulkan and
OpenGL renderers.

This bumps the CI image used to the newly built image. This is needed to
install a new enough libwayland-client.so needed for wl_surface.offset.

This is done by adding wayland as a meson subproject, building it
on-demand if the version in the system is not new enough. As
libwayland-client.so is pulled in implicitly when linking to gtk4, the
compile step needs LD_LIBRARY_PATH set to make ld find the right library
to link to.
2022-01-14 09:27:07 +01:00
Luca Bacci
06e5da456f Merge branch 'win32-fix-altgr-gtk4' into 'main'
IMContextSimple/IMContextIME: Fix AltGr not working on Win32 [GTK4]

See merge request GNOME/gtk!4375
2022-01-13 23:02:50 +00:00
Boyuan Yang
689486eae5 Update Chinese (China) translation 2022-01-13 20:20:45 +00:00
Emmanuele Bassi
48dc6ecfe3 Merge branch 'ebassi/docs-repo-link' into 'main'
docs: Point source links to the correct branch

See merge request GNOME/gtk!4373
2022-01-13 16:58:47 +00:00
Philip Zander
b9bc7d9166 IMContextSimple/IMContextIME: Fix AltGr not working on Win32
The old code assumed that any key press containing Ctrl or Alt cannot be
regular text input. This is not correct on Win32 as AltGr = Ctrl + Alt.
2022-01-13 17:26:59 +01:00
Emmanuele Bassi
63ee135a1e Update the link to the development branch
The default development branch for GTK is now "main".
2022-01-13 14:42:34 +00:00
Emmanuele Bassi
ca2aa52ba9 docs: Point to the correct development branch
The default development branch of GTK is now "main".
2022-01-13 14:39:39 +00:00
Emmanuele Bassi
96d28738c9 docs: Point source links to the correct branch
The default development branch for GTK is now "main".
2022-01-13 14:39:03 +00:00
Piotr Drąg
e4b05e55e1 Update POTFILES.in 2022-01-13 13:43:15 +01:00
Luca Bacci
4a4a579fd9 Merge branch 'forward-port-gdk-win32-keymap-bugfixes-to-gtk4' into 'main'
GdkWin32Keymap bugfixes

See merge request GNOME/gtk!4372
2022-01-12 21:36:19 +00:00
Fran Dieguez
df716e5c9f Update Galician translation 2022-01-12 21:35:13 +00:00
Fran Dieguez
52000177d9 Update Galician translation 2022-01-12 21:34:57 +00:00
David Hogan
7d6257cb1e gdkkeys-win32: Perform keyboard layout substitution
For some users, GetKeyboardLayoutNameA() returns an alias instead of the
fully resolved keyboard layout identifier. In that case, we have to
query the registry to resolve the alias before we can look up the DLL
path.

See comments under https://gitlab.gnome.org/GNOME/gtk/-/issues/4610
2022-01-12 21:44:28 +01:00
Philip Zander
db0234ecb4 gdkkeys-win32: Fix handling of SGCAPS
Contrary to what you can read on the internet, SGCAPS keys don't work
by having capslock toggle the KBDCTRL bit, they actually have two
consecutive table entries, the first of which is for the normal
version and the second of which is for the capslocked version.

Background: SGCAPS is short for Swiss German caps because Swiss German
was the first layout to use this feature. For keys with the SGCAPS flag,
capslock has a different effect than pressing shift. For example:
Shift + ü = è,  CapsLock + ü = Ü,  CapsLock + Shift + ü = È
2022-01-12 21:44:24 +01:00
Philip Zander
438fad803e gdkkeys-win32: Fix crash when keyboard DLL failed to load
DLL loading failures should not happen under normal circumstances, but
we should at least try not to crash and and print better diagnostic
messages if they do happen.

See https://gitlab.gnome.org/GNOME/gtk/-/issues/4610
2022-01-12 21:44:15 +01:00
Philip Zander
82f8f878bc gdkkeys-win32: Add keysym mapping for capslock key
Add missing mapping between VK_CAPITAL and GDK_KEY_Caps_Lock, so
applications get a meaningful keyval rather than ffffff.
2022-01-12 21:44:07 +01:00
Philip Zander
b0818f9535 gdkkeys-win32: Fix capslock handling
Previously, we treated CapsLock and KanaLock as part of the global
keyboard state, much like NumLock and ScrollLock, rather than using
the supplied modifier mask. This was because GDK does not have a
modifier mask for KanaLock, only for CapsLock, so it would not have been
possible to properly support it.

However, this approach ended up causing problems, with certain keyboard
shortcuts not registering when capslock was active. This was first
observed in Inkscape [0] and appears to affect shortcuts consisting of a
single key (like 'a') with no additional modifiers (wheareas shortcuts
like 'ctrl+a' work).

So now we are using the supplied GDK_LOCK_MASK instead, and dropped
support for KanaLock, which we probably don't need anyway (since regular
text input should be handled by the IME input module -- the keymap is
mainly for shortcuts and keybindings, where you don't really want
KanaLock).

[0] https://gitlab.com/inkscape/inkscape/-/issues/3082
2022-01-12 21:43:53 +01:00
Luca Bacci
c71cb35e9d Merge branch 'forward-port-rewrite-gdkwin32keymap-to-gtk4' into 'main'
Rewrite GdkWin32Keymap (V2)

Closes #1033 and #2055

See merge request GNOME/gtk!4338
2022-01-12 19:53:54 +00:00
Luca Bacci
5bf5d25bc1 Merge branch 'fix-build-no-pangoft' into 'main'
Improve and fix building font features on Windows (was: Fix builds without PangoFT2)

Closes #4605

See merge request GNOME/gtk!4339
2022-01-12 19:53:39 +00:00
Matthias Clasen
45d6b3ba51 Merge branch 'fabian.kirsch-main-patch-28134' into 'main'
corrected small typo input-handling.md

See merge request GNOME/gtk!4368
2022-01-12 19:38:10 +00:00
Matthias Clasen
e4e1b9ccbe Merge branch '4627-printing-Unref-old-spool_io-before-setting-new-one' into 'main'
printing: Unref old spool_io before setting new one

Closes #4627

See merge request GNOME/gtk!4370
2022-01-12 19:37:18 +00:00
Matthias Clasen
d50df7db37 Merge branch 'revert-texture-annotations' into 'main'
Revert "gir: Annotate `GdkTexture` constructors for reading from a...

See merge request GNOME/gtk!4371
2022-01-12 19:34:18 +00:00
Matthias Clasen
7257d1c15f Revert "gir: Annotate GdkTexture constructors for reading from a file/memory/resource to return a GdkMemoryTexture"
This reverts commit ae8e844dec.

No agreement that this will stay this way going forward.
2022-01-12 14:11:20 -05:00
Philip Zander
ea65abc7e2 Rewrite GdkWin32Keymap (load table directly from layout DLL)
The old code used repeated calls to `ToUnicodeEx` to populate
the translation table, which is slow and buggy. The new code
directly loads the layout driver DLLs from Windows.

See https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/4338
2022-01-12 19:01:35 +01:00
Marek Kasik
915090f118 printing: Unref old spool_io before setting new one
Unref private spool_io of GtkPrintJob before setting it to a new one
in gtk_print_job_set_source_file() and gtk_print_job_set_source_fd()
to prevent a leak.

Fixes: #4627
2022-01-12 12:47:28 +01:00
Chun-wei Fan
629dcd3dcf meson.build: Don't apply iso-codes cflag on Windows
They are no longer applicable for Windows builds.
2022-01-12 17:29:30 +08:00
Chun-wei Fan
169172a9e0 demos: Always build font explorer demo
We are no longer using PangoFT2 APIs in this demo, so make sure that we build
it on all builds since we already depend on a HarfBuzz/Pango version that
provide everything that we need here.

Drop the unnecessary pangofc-font.h include as a result.
2022-01-12 17:29:30 +08:00
Chun-wei Fan
0a3fad4d47 gtk-demo/language-names.c: Acquire language names natively on Windows
Like what was done on gtk/language-names.c, acquire the language names via the
native Windows NLS APIs, eliminating a run-time dependency on iso-codes on
Windows.
2022-01-12 17:29:30 +08:00
Chun-wei Fan
b666a767e4 language-names: Use Windows APIs to acquire language names
Instead of relying on the iso-codes package, use the native Windows NLS APIs to
acquire the localized (translated) language names so that we do not need to
incur an extra runtime dependency on Windows.  It's not coverering 100% of the
languages that we would like to support through this, but should cover much of
the things that are required.
2022-01-12 17:29:30 +08:00
Chun-wei Fan
ee2dd1acc7 gtk/meson.build: Fix builds without PangoFT2
We aren't really using PangoFT2 for [language|script]-names.c, and are
always using items from them, so make sure they are being built.

Also always include the pangoft2 dependency in gtk_dep if it is found.
2022-01-12 17:29:28 +08:00
Fabian Kirsch
4f36583898 corrected small typo input-handling.md 2022-01-12 09:02:01 +00:00
Matthias Clasen
21d40fc038 Merge branch 'fix-directory-list' into 'main'
directorylist: Fix several issues

Closes #3784

See merge request GNOME/gtk!4367
2022-01-12 02:58:25 +00:00
Matthias Clasen
93ff65c685 Merge branch 'should_be_mapped' into 'main'
gdk/wayland/surface: Remove redundant `should_be_mapped` code

See merge request GNOME/gtk!4203
2022-01-12 02:48:10 +00:00
Matthias Clasen
7e7201745d Merge branch 'wip/keep-scale' into 'main'
wayland/surface: Only update the scale if on any outputs

See merge request GNOME/gtk!4352
2022-01-12 02:46:43 +00:00
Matthias Clasen
50a986605c Merge branch 'ebassi/for-main' into 'main'
tests: Don't drop chdir()'s return value on the floor

See merge request GNOME/gtk!4328
2022-01-12 02:45:15 +00:00
Matthias Clasen
96994568fd Merge branch 'bilelmoussaoui/build' into 'main'
meson: only update-icon-cache when the demos are built

See merge request GNOME/gtk!4358
2022-01-12 02:44:29 +00:00
Matthias Clasen
b494d94bdb Merge branch 'drop-script-names' into 'main'
Drop the script name data

See merge request GNOME/gtk!4361
2022-01-12 02:43:54 +00:00
Matthias Clasen
9d6ccc0fe0 Merge branch 'texture-new-return-types' into 'main'
gir: Annotate `GdkTexture` constructors for reading from a...

See merge request GNOME/gtk!4365
2022-01-12 02:42:17 +00:00
Matthias Clasen
a56e187352 Merge branch 'nielsdg/gsk-gl-renderer-assertion' into 'main'
gsk: Document gsk_renderer_realize()

See merge request GNOME/gtk!4363
2022-01-12 02:41:32 +00:00
Matthias Clasen
dcdcc659ef directorylist: Fix several issues
We were handling events in the wrong order,
by doing async calls for some of them, but not
for all of them.

And we were not taking into account that GFileMonitors
RENAMED events may or may not move a file on top
of an existing file.

Fixes: #3784
2022-01-11 21:35:19 -05:00
Sebastian Dröge
ae8e844dec gir: Annotate GdkTexture constructors for reading from a file/memory/resource to return a GdkMemoryTexture 2022-01-11 15:46:22 +02:00
Niels De Graef
e566ba54d9 gsk: Document gsk_renderer_realize()
Document the return value and more importantly, specify that a call to
`gsk_renderer_realize()` needs to be matched with a call
`gsk_renderer_unrealize()`.

Prevents issues like https://gitlab.gnome.org/GNOME/gtk/-/issues/4625
2022-01-11 13:09:53 +01:00
Matthias Clasen
70732afb95 Drop the script name data
It is not used in GTK itself, and gtk4-demo
has its own copy.
2022-01-10 10:43:05 -05:00
Danial Behzadi
f2aed69f87 Update Persian translation 2022-01-10 11:39:53 +00:00
Emmanuele Bassi
6bd96522e8 Merge branch 'docs-typo-list' into 'main'
Fix typo in IconView docs

See merge request GNOME/gtk!4360
2022-01-09 13:28:57 +00:00
Sebastian Dröge
1e26c352d6 Fix typo in IconView docs
g_lsit_free_full() -> g_list_free_full()
2022-01-09 13:59:59 +02:00
Timm Bäder
2de65ebd4d Merge branch 'wip/smcv/png-endian' into 'main'
png: Correct endianness for big-endian machines

Closes #4616

See merge request GNOME/gtk!4357
2022-01-09 08:21:54 +00:00
Bilal Elmoussaoui
ed3d9aaaed meson: only update-icon-cache when the demos are built
Without building the demos, nothing gets installed into $prefix/share/icons/hicolor. Which makes running 
`gtk4-update-icon-cache` on the machine causes an error. This is easily reproducible on a Windows machine with MSVC where 
there is nothing pre-installed on hicolor icon theme and that makes building gtk without the demos fails with "No such file or directory".
2022-01-09 07:27:59 +00:00
Jordi Mas
27a3998c8f Update Catalan translation 2022-01-08 22:55:05 +01:00
Simon McVittie
979c124e57 png: Correct endianness for big-endian machines
libpng wants to receive samples in either RGB or RGBA order, whether
each sample is big-endian or not. This resolves test failures in
testsuite/gdk/memorytexture.c (and a lot of reftests) on s390x, and
probably the PowerPC family too.

Modifying the test to show the color in use and write out the PNG bytes
to a file, and running the memorytexture test on s390x, produces a PNG
that loads with the correct color values in GIMP (on an x86_64 machine),
which seems like evidence that this is the correct change and not just
compensating errors.

Resolves: https://gitlab.gnome.org/GNOME/gtk/-/issues/4616
Signed-off-by: Simon McVittie <smcv@debian.org>
2022-01-08 17:09:29 +00:00
Emmanuele Bassi
20ad839075 tests: Don't drop chdir()'s return value on the floor
Avoid a compile time warning, and ensure that the test suite is actually
doing its job.
2022-01-08 15:17:25 +00:00
Emmanuele Bassi
bed67edd2e Merge branch 'ebassi/docs-for-main' into 'main'
Document side effect of GLArea:has-depth-buffer

Closes #838

See merge request GNOME/gtk!4351
2022-01-07 19:14:59 +00:00
Jonas Ådahl
6efcc02806 wayland/surface: Only update the scale if on any outputs
If we ended up on no output at all, keep the HiDPI scale as is, as it
likely means we were on a workspace that was switched away from. By
keeping the same scale, we avoid unnecessary scale changes that would
otherwise take place if the scale when on monitors would end up being
more than 1.
2022-01-07 19:32:04 +01:00
Emmanuele Bassi
8a6dd2805f Document side effect of GLArea:has-depth-buffer
We enable depth testing when creating a depth buffer.

Fixes: #838
2022-01-07 18:30:54 +00:00
Matthias Clasen
464219c0fa Merge branch 'wip/baedert/for-master' into 'main'
label: Remove a redundant assignment

See merge request GNOME/gtk!4348
2022-01-07 16:47:07 +00:00
Timm Bäder
e602768794 Merge branch 'ebassi/docs-for-main' into 'main'
docs: Clean up the ToggleButton description

See merge request GNOME/gtk!4347
2022-01-07 16:25:41 +00:00
Timm Bäder
262f2a1453 Make some code samples compile 2022-01-07 17:21:37 +01:00
Timm Bäder
b408967278 label: Remove a redundant assignment
clang-tidy says:

gtklabel.c:1188:15: warning: Although the value stored to 'mid' is used in the enclosing expression, the value is never actually read from 'mid'
        min = mid = text_width;
              ^     ~~~~~~~~~~

Which seems right since mid will be assigned to at the beginning of the
next loop iteration anyway.
2022-01-07 17:21:37 +01:00
Emmanuele Bassi
1fd97fed91 docs: Clean up the ToggleButton description
- Use different headings
- Fix the coding style of the example
2022-01-07 15:42:08 +00:00
Matthias Clasen
fef179b625 Merge branch 'matthiasc/for-main' into 'main'
docs; Update supported backends

See merge request GNOME/gtk!4344
2022-01-07 03:16:47 +00:00
Matthias Clasen
87ac411c50 Merge branch 'doc-improvs-ii' into 'main'
Doc improvements on textures

See merge request GNOME/gtk!4342
2022-01-07 03:16:19 +00:00
Matthias Clasen
46a7aaac76 Merge branch 'wip/chergert/fix-textview-dnd-move-same-view' into 'main'
textview: remove drag selection after dnd move action

See merge request GNOME/gtk!4346
2022-01-07 03:15:48 +00:00
Christian Hergert
e14d6fe9d5 textview: remove drag selection after dnd move action
If we have a GDK_ACTION_MOVE, we need to delete the selection. However,
previously this only worked when the drop target and drag source were
different applications, as the selection would get messed up along the
way.

Instead, we stash marks for the duration of the operation so that we can
delete the appropriate selection when completing the move.
2022-01-06 16:30:34 -08:00
Matthias Clasen
fb5b2d3d8e docs; Update supported backends
Some strings have changed here.
2022-01-06 14:56:16 -05:00
Matthias Clasen
9dccdd1008 Merge branch 'docs-improvs-i' into 'main'
docs: Improve docs for four classes

See merge request GNOME/gtk!4337
2022-01-06 19:19:31 +00:00
Benjamin Otte
8e8a746cce Merge branch 'wip/otte/for-main' into 'main'
testsuite: clear_current() when done

See merge request GNOME/gtk!4343
2022-01-06 19:07:58 +00:00
Maximiliano Sandoval R
ee71effe98 docs: State that Textures are thread safe gobjects 2022-01-06 19:30:54 +01:00
Maximiliano Sandoval R
ce2c4f0f08 docs: Improve docs for MemoryTexture 2022-01-06 19:30:30 +01:00
Maximiliano Sandoval R
ef9dbf73cc gir: Add type annotations for {GL,Memory}Texture 2022-01-06 19:30:29 +01:00
Maximiliano Sandoval R
3bed5334bf docs: Improve docs for gdktexture.c 2022-01-06 19:30:28 +01:00
Benjamin Otte
5dc940ead2 glcontext: Don't spew warnings on surfaceless contexts
Get the display directly instead of via the nonexisting surface.
2022-01-06 19:23:29 +01:00
Benjamin Otte
7872b41f16 testsuite: clear_current() when done
That way we ensure that the GL context(s) get disposed, which they
previously weren't due to them still being the current context.

This also implicitly adds testing of gLContext destruction, which
previously wasn't ever done by any test.
2022-01-06 19:22:47 +01:00
Jordi Mas
be81f6b4ab Update Catalan translation 2022-01-06 08:25:29 +01:00
Maximiliano Sandoval R
1229032b4e docs: Add misc links 2022-01-05 14:06:43 +01:00
Maximiliano Sandoval R
ad73e2d07b docs: Improve docs for gskrendernode.c 2022-01-05 14:06:42 +01:00
Maximiliano Sandoval R
6d80135342 docs: Improve docs for gtksnapshot.c 2022-01-05 14:06:41 +01:00
Maximiliano Sandoval R
c36a10da83 docs: Improve docs for gtkversion.h 2022-01-05 13:24:32 +01:00
Maximiliano Sandoval R
c30d09cef4 docs: Improve docs for gtkactionable.c 2022-01-05 13:24:30 +01:00
Aleksandr Melman
716e0b97bd Update Russian translation 2022-01-05 11:03:11 +00:00
Matthias Clasen
ff862dc926 Merge branch 'wip/smcv/gresource-internal' into 'main'
build: Tell glib-compile-resources to make symbols internal where possible

See merge request GNOME/gtk!4334
2022-01-04 18:58:14 +00:00
Simon McVittie
17c2a1cb4e build: Tell glib-compile-resources to make symbols internal where possible
Partial solution to https://gitlab.gnome.org/GNOME/gtk/-/issues/4598

Signed-off-by: Simon McVittie <smcv@debian.org>
2022-01-04 18:08:22 +00:00
Aleksandr Melman
895e640fd0 Update Russian translation 2022-01-04 17:00:55 +00:00
Emmanuele Bassi
e8f5f86ad5 Merge branch 'label-fix-section-link' into 'main'
docs: Fix link to section in GtkLabel

See merge request GNOME/gtk!4333
2022-01-04 15:54:05 +00:00
Marco Melorio
5055b41ee7 docs: Fix link to section in GtkLabel 2022-01-04 16:33:00 +01:00
Matthias Clasen
7efd08ca2e Merge branch 'fix-hc-warning' into 'main'
gdk/display-wayland: Don't bypass portal for theme entries

Closes #4593

See merge request GNOME/gtk!4331
2022-01-04 14:51:05 +00:00
Hugo Carvalho
76b421e064 Update Portuguese translation 2022-01-04 14:12:59 +00:00
Luca Bacci
063e6baa0a Merge branch 'gtk-grab-file-chooser-native-win32' into 'main'
GTK grab for GtkFileChooserNativeWin32

Closes #4582

See merge request GNOME/gtk!4329
2022-01-04 13:59:08 +00:00
Florian Müllner
9e5d412a8b gdk/display-wayland: Don't bypass portal for theme entries
When commit 49589e1da added support for the new high-contrast key,
it missed that the getter should only use the setting directly when
not going through the portal.

https://gitlab.gnome.org/GNOME/gtk/-/issues/4593
2022-01-04 14:58:58 +01:00
Daniel Mustieles
fa9b634d8f Updated Spanish translation 2022-01-04 14:38:09 +01:00
Matthias Clasen
d76379428d Merge branch 'noexecstack' into 'main'
Make our stack noexec

Closes #4598

See merge request GNOME/gtk!4330
2022-01-04 13:09:39 +00:00
Matthias Clasen
46509b6dd2 Make our stack noexec
The change to use ld and objcopy for resources
had some side-effects: it leaked a few symbols
and made our stack executable. We don't want that.

Use -z nonexecstack and --strip-all to avoid this.

Fixes: #4598
2022-01-04 07:51:56 -05:00
Daniel Mustieles
89dbf9cc81 Updated Spanish translation 2022-01-04 12:18:11 +01:00
Luca Bacci
c138aaabf3 Use a GTK grab when showing a modal GtkFileChooserNativeWin32 2022-01-04 10:46:20 +01:00
Yuri Chornoivan
7cef454c86 Update Ukrainian translation 2022-01-03 20:51:23 +00:00
Emmanuele Bassi
5cb8d15505 Merge branch 'fredmorcos-master-patch-48389' into 'main'
Minor doc fix

See merge request GNOME/gtk!4325
2022-01-03 13:34:00 +00:00
Luca Bacci
2aab55983d Merge branch 'wgl-legacy' into 'main'
GSK/GL: Relax check for GL 3.x+ legacy contexts

See merge request GNOME/gtk!4187
2022-01-03 13:11:04 +00:00
Fred Morcos
31714e5c1d Minor doc fix 2022-01-03 10:27:51 +00:00
Luca Bacci
96c351e792 Merge branch 'for-main' into 'main'
For main

See merge request GNOME/gtk!4322
2022-01-03 09:51:10 +00:00
Matthias Clasen
edd57004d3 Merge branch 'matthiasc/for-main' into 'main'
fontchooser: Use new hb api

See merge request GNOME/gtk!4323
2022-01-03 02:52:45 +00:00
Matthias Clasen
234d20641c fontbutton: Pass the fontmap to the dialog 2022-01-02 21:37:32 -05:00
Matthias Clasen
dd802f21e7 fontchooser: Cosmetics
Use harfbuzz api to format variations and features.
That matches what pango uses to parse them.
2022-01-02 21:37:32 -05:00
Matthias Clasen
dbbc990c72 fontchooser: Use new hb api
Use hb_font_get_var_coords_design if we have it.
This should fix our handling of fonts with AVAR.
2022-01-02 21:37:32 -05:00
Matthias Clasen
3a6e772cba Merge branch 'wip/antoniof/expression-autocleanup' into 'main'
gtk: Define the GtkExpression autocleanup func

See merge request GNOME/gtk!4319
2022-01-02 17:49:49 +00:00
António Fernandes
c9fa16fcfa gtk: Define the GtkExpression autocleanup func 2022-01-02 17:49:48 +00:00
Luca Bacci
07b04fbea9 Remove some unneeded files from gdk/win32
bdfcursor.c, cursor.bdf and libwntab32x.la
2022-01-02 18:49:44 +01:00
Luca Bacci
1c633cbea2 Add hid.lib to pkg-config file listing 2022-01-02 18:45:17 +01:00
Luca Bacci
2f685d5d2a Remove leftover code dealing with input-only windows 2022-01-02 18:42:33 +01:00
Luca Bacci
0fdf2cc195 Fix compilation with clang
From https://github.com/msys2/MINGW-packages/pull/9509
2022-01-02 18:42:33 +01:00
Luca Bacci
4f7d18a28f Do not use GetProcAddress for FlashWindowEx
It's available since Windows XP
2022-01-02 18:42:32 +01:00
Luca Bacci
c77272a7d7 Remove call to ShowOwnedPopups (FALSE) to hide owned windows
This is needed to fully support windows with the property
"destroy-with-parent" set to FALSE.
2022-01-02 18:42:31 +01:00
Luca Bacci
7a1004df73 Remove WM_SYNCPAINT message handler
It was added to work around what seemed to be an OS or graphics
driver issue on Windows XP. The issue was not reproducible on
Windows Vista anyway.

References:
* https://bugzilla.gnome.org/show_bug.cgi?id=153567
* https://gitlab.gnome.org/GNOME/gtk/-/commit/c8fef535
* https://devblogs.microsoft.com/oldnewthing/20120723-00/?p=7073
2022-01-02 18:42:31 +01:00
Matthias Clasen
0e86d2b345 Merge branch 'ebassi/issue-4576' into 'main'
Update the accessible description of MenuButton

Closes #4576

See merge request GNOME/gtk!4317
2022-01-02 01:12:53 +00:00
Matthias Clasen
2441bdb900 Merge branch 'radioactiveman-main-patch-13472' into 'main'
texture: Fix typo in error message

See merge request GNOME/gtk!4311
2022-01-02 00:51:43 +00:00
Matthias Clasen
57679b7b7f Merge branch 'wip-fontchooser-tewaks' into 'main'
Revert "fontchoserwidget: Do our own face filtering"

See merge request GNOME/gtk!4314
2022-01-02 00:50:57 +00:00
Emmanuele Bassi
37063e7a05 Update the accessible description of MenuButton
We update the labelled-by relation, but we never update the described-by
one.

Fixes: #4576
2022-01-02 00:35:53 +00:00
Matthias Clasen
791dc7b9be fontchooser: Speed up fature examples
We were doing unnecessary work here, which could
get really slow with some fonts. Just compute
the reverse charmap once and reuse it.
2022-01-01 15:38:04 -05:00
Matthias Clasen
ff24dfb2e7 Revert "fontchooserwidget: Revise handling of named instances"
This reverts commit 2dc56a6e9b.

This wasn't ready yet.
2022-01-01 15:36:29 -05:00
Matthias Clasen
4db60fa5a8 Revert "fontchoserwidget: Do our own face filtering"
This reverts commit b7b6c147f9.

This was premature.
2022-01-01 15:36:27 -05:00
Emmanuele Bassi
5301367630 Merge branch 'bilelmoussaoui/g-i' into 'main'
gdk: add missing nullable annotations

See merge request GNOME/gtk!4310
2022-01-01 20:22:18 +00:00
Bilal Elmoussaoui
9409b7ef7d gtk: mark few GtkPrinterSettings as nullable
Everything that makes use of gtk_printer_settings_get should be nullable
Because the hashtable might not contain the key and there's no default value provided
2022-01-01 19:20:29 +01:00
Bilal Elmoussaoui
afeb7f668b gtk: mark few GtkFileChooser functions as nullable
- get_file, if no file is selected returns a NULL
- get_id, if the interface doesn't implement such function returns NULL
2022-01-01 19:11:10 +01:00
Bilal Elmoussaoui
38b8da0f5f gtk: mark gtk_flatten_list_model_get_model_for_item as nullable 2022-01-01 19:07:13 +01:00
Bilal Elmoussaoui
d029b62d23 gtk: mark gtk_mount_operation_get_parent as nullable 2022-01-01 19:05:33 +01:00
Bilal Elmoussaoui
1e9bdb4647 gtk: mark gtk_list_box_get_adjustment as nullable
similar to its setter function
2022-01-01 19:05:06 +01:00
Bilal Elmoussaoui
1d72024605 gtk: mark MenuButton::get_label/get_icon_name as nullable 2022-01-01 18:38:56 +01:00
Bilal Elmoussaoui
06570443b7 gtk: mark gtk_icon_view_create_drag_icon as nullable 2022-01-01 18:33:29 +01:00
Bilal Elmoussaoui
77f7caf18d gtk: mark gtk_glarea_get_context as nullable 2022-01-01 18:26:40 +01:00
Thomas Lange
8767ffde2f texture: Fix typo in error message 2022-01-01 17:23:22 +00:00
Bilal Elmoussaoui
d58b7fa779 gtk: mark gtk_text_mark_get_buffer as nullable 2022-01-01 18:19:41 +01:00
Bilal Elmoussaoui
dcbf3f8879 gtk: mark gtk_lock_button_get_permission as nullable
like the constructor/setter
2022-01-01 18:17:31 +01:00
Bilal Elmoussaoui
30d8c8e17c gtk: mark buildable_get_id as nullable
the vfunc can return a nullable
2022-01-01 18:12:05 +01:00
Bilal Elmoussaoui
b803bb5edb gtk: mark MultiSelection::get_model as nullable
the constructor & setter takes a nullable model
2022-01-01 18:04:24 +01:00
Bilal Elmoussaoui
985a39d41f gtk: mark gtk_native_get_for_surface as nullable 2022-01-01 17:59:35 +01:00
Bilal Elmoussaoui
f846eec894 gtk: mark gtk_no_selection_get_model nullable
The constructor is nullable so should the getter be
2022-01-01 17:56:07 +01:00
Bilal Elmoussaoui
e7fc8ad1f5 gtk: fix PasswordEntry annotation 2022-01-01 17:49:11 +01:00
Bilal Elmoussaoui
95169ad54b gtk: add nullable annotations to PopoverMenuBar/PopoverMenu
The constructor/setter accepts a null as a model so should the getter
2022-01-01 17:47:21 +01:00
Bilal Elmoussaoui
ddb2e91a42 gtk: add nullable annotations for Scrollable getters
The adjustment setters takes a nullable and so should the getters be annotated
2022-01-01 17:39:45 +01:00
Bilal Elmoussaoui
90357193c9 gtk: add nullable annotation to gtk_css_section_get_file
The constructor takes a nullable file param
2022-01-01 17:31:38 +01:00
Bilal Elmoussaoui
a336fe2850 gdk: add missing nullable annotations 2022-01-01 17:03:10 +01:00
Matthias Clasen
fcb8e4cf37 Merge branch 'fontchooser-tweaks' into 'main'
fontchooserwidget: Avoid a crash

See merge request GNOME/gtk!4309
2021-12-31 18:32:49 +00:00
Matthias Clasen
b7b6c147f9 fontchoserwidget: Do our own face filtering
Pango may not do this for us, so don't rely on it.
We only show one face with a given name, and we
prefer a variable face over a non-variable one.

The check for variable faces requires new Pango
API that will be in Pango 1.52.
2021-12-31 09:58:26 -05:00
Emmanuele Bassi
35ee82ca07 Merge branch 'wip/baedert/for-master' into 'main'
baseline = -1 means no baseline

Closes #4385

See merge request GNOME/gtk!4307
2021-12-31 14:55:20 +00:00
Matthias Clasen
2dc56a6e9b fontchooserwidget: Revise handling of named instances
Allowing to tweak the axes of named instances does
not do any harm. If we don't, we have to worry that
we need at least one non-named-instance in the face
list, and make it more obvious how to pick it out.
2021-12-31 09:50:47 -05:00
Matthias Clasen
e12ef76de5 fontchooserwidget: Avoid a crash
languages may be NULL, we need to be more careful here.
2021-12-31 09:49:40 -05:00
Matthias Clasen
536b05e35b maplistmodel: Cosmetics 2021-12-31 09:48:34 -05:00
Timm Bäder
1354854d23 inspector: Fix coding style
ffs
2021-12-31 14:41:35 +01:00
Timm Bäder
2b062d60f2 baseline = -1 means no baseline
Fixes #4385
2021-12-31 13:08:01 +01:00
Matthias Clasen
c8bdb4c7fb Merge branch 'fontchooser-cleanups' into 'main'
fontchooser: Stop using pangofc api

See merge request GNOME/gtk!4306
2021-12-31 04:30:04 +00:00
Matthias Clasen
80328e8a4f fontchooser: Stop using pangofc api
Pango now has backend-independent api for all
we need, so we can drop all the ifdefs.
2021-12-30 22:52:52 -05:00
Emmanuele Bassi
1138e3770b Merge branch 'bilelmoussaoui/g-i' into 'main'
g-i: add missing nullable annotation

See merge request GNOME/gtk!4304
2021-12-30 17:12:59 +00:00
Bilal Elmoussaoui
ec58013b22 g-i: add missing nullable annotation
the constructor takes a nullable expression parameter, so should the getter be
2021-12-30 16:52:53 +00:00
Matthias Clasen
70cb61fb71 4.6.0 2021-12-30 10:31:52 -05:00
Yuri Chornoivan
8e6a0ec23d Update Ukrainian translation 2021-12-29 22:17:32 +00:00
Matthias Clasen
e2ab334636 Merge branch 'doc-window' into 'main'
Document built-in actions on GtkWindow

See merge request GNOME/gtk!4297
2021-12-29 17:23:16 +00:00
Matthias Clasen
dd0effe957 Merge branch 'wip/chergert/4575-fix-texthistory-selection' into 'main'
testsuite: ignore texthistory selection on delete/backspace

Closes #4575

See merge request GNOME/gtk!4287
2021-12-29 14:58:53 +00:00
Hofer-Julian
ac210c1765 docs: Add missing star to block comment 2021-12-29 15:46:59 +01:00
Hofer-Julian
c58e48e648 doc: Fix docs of window.minimize 2021-12-29 15:45:44 +01:00
Hofer-Julian
acdadab617 docs: Document built-in actions on GtkWindow 2021-12-29 15:45:43 +01:00
Matthias Clasen
aa19194f7b Merge branch 'wip/exalm/inspector' into 'main'
inspector: Register extension on startup

See merge request GNOME/gtk!4296
2021-12-29 14:38:28 +00:00
Matthias Clasen
9319a6e39b Merge branch 'matthiasc/for-main' into 'main'
tests: Make fontchooser test build on macOS

See merge request GNOME/gtk!4300
2021-12-29 14:34:26 +00:00
Matthias Clasen
b41206abab tests: Make fontchooser test build on macOS
Not sure what changed here, but we want to
be able to build this without fontconfig too.
2021-12-29 09:15:26 -05:00
Matthias Clasen
07c3dc6b6f Merge branch 'nullable' into 'main'
popover: Add missing nullable annotation

Closes #4556

See merge request GNOME/gtk!4295
2021-12-29 00:28:09 +00:00
Matthias Clasen
fa71a2a993 Merge branch 'wip/baedert/for-master' into 'main'
application demo: Resolve a keyboard shortcut conflict

See merge request GNOME/gtk!4290
2021-12-29 00:24:46 +00:00
Alexander Mikhaylenko
b997d1e892 inspector: Register extension on startup 2021-12-29 04:42:51 +05:00
Alexander Mikhaylenko
4b71fba540 Revert "inspector: Export gtk_inspector_init"
This reverts commit 3f5107cea5.
2021-12-29 04:12:16 +05:00
Ian Douglas Scott
48d39c0a57 popover: Add missing nullable annotation
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/4556.

Looks like the other `Popover` methods are have correct nullable
annotations.
2021-12-28 09:43:06 -08:00
Hugo Carvalho
0aad053507 Update Portuguese translation 2021-12-27 22:53:20 +00:00
Matthias Clasen
6ed14b2a5f Merge branch 'm-shinder-master-patch-90567' into 'main'
gdk_content_provider_get_value() argument should have 'out' direction

See merge request GNOME/gtk!4283
2021-12-27 15:08:48 +00:00
Matthias Clasen
c7df5ef957 Merge branch 'get-key-capture-widget-nullable' into 'main'
GtkSearchBar - Mark get_key_capture_widget() return value as nullable

See merge request GNOME/gtk!4286
2021-12-27 15:06:56 +00:00
Yuri Chornoivan
a9013febcf Update Ukrainian translation 2021-12-27 14:08:03 +00:00
Benjamin Otte
815c430ba1 Merge branch 'wip/otte/for-main' into 'main'
inspector: Add dnd inspection support

See merge request GNOME/gtk!4289
2021-12-27 13:54:27 +00:00
Timm Bäder
e94d5bf006 applicationwindow: Don't pass for_size < -1 to measure()
If the application window is measured with for_size -1 horizontally,
this code clearly passes something lower to the parent class measure()
implementation. Only subtract the menubar_height if we're passed a
for_size > -1.
2021-12-27 12:15:02 +01:00
Timm Bäder
a00480f4a1 application demo: Resolve a keyboard shortcut conflict
There were two menu entries side-by-side with the same keyboard shortcut
2021-12-27 10:02:03 +01:00
Benjamin Otte
6da952100c inspector: Add dnd inspection support
This has lots of issues:
 * It randomly crashes when data is loading while the dnd goes away.
 * The data gets randomly reset at the wrong time
 * Can't scroll the window on Wayland
 * ...

But it's better than nothing, so better get it committed.
2021-12-27 05:59:16 +01:00
Benjamin Otte
df8588e9b7 Merge branch 'wip/otte/for-main' into 'main'
widget: Don't queue an allocate on a nonexisting parent

See merge request GNOME/gtk!4288
2021-12-26 23:20:34 +00:00
Benjamin Otte
fce9b35e4d css: Don't crash on invalid rotate3d() 2021-12-26 22:58:09 +01:00
m-shinder
6fd4421add Merge branch 'main' into 'm-shinder-master-patch-90567'
# Conflicts:
#   NEWS
2021-12-26 21:20:33 +00:00
Benjamin Otte
7149bfd100 widget: Don't queue an allocate on a nonexisting parent
No test, no idea how to trigger this reliably.
2021-12-26 22:17:54 +01:00
Christian Hergert
344ad0355e textview: scroll insert onscreen after undo/redo
After performing an action such as undo/redo, we need to actually scroll
to the position where the operation occurred.

I do note that the scroll here seems to often get invalidated if it is
pages away, and we never make the full scroll. But I've seen this all over
the place elsewhere too and that needs to be handled, most likely, as a
more comprehensive fix for scrolling during line validation.

Related #4575
2021-12-26 12:56:42 -08:00
Christian Hergert
e7871fbc43 texthistory: always track selection bounds
It's cheap to store the selection position, so always set it even if we
are in a user section. Otherwise, we risk not having the right position
when starting a delete action within a begin_user_action(),
end_user_action() pair.

Related #4575
2021-12-26 12:47:45 -08:00
Christian Hergert
99d8dd751e testsuite: add failing test for delete selection
This adds a test to expose the failure of #4575 which results in the
selection being incorrect when performing a delete as we are likely
already in a begin_user_action()/end_user_action() pair.

Related #4575
2021-12-26 12:46:16 -08:00
Christian Hergert
22b1abb36d testsuite: ignore texthistory selection on delete/backspace
We don't need to apply these here, as it will clear the selection which is
needed for the undo. Otherwise we won't be able to test that we end up at
the right selection afterwards.
2021-12-26 12:43:22 -08:00
Sebastian Dröge
aa289d1023 GtkSearchBar - Mark get_key_capture_widget() return value as nullable
The setter allows setting NULL so this can clearly also return NULL
under normal circumstances.

Same for the corresponding API in GtkSearchEntry.
2021-12-26 11:06:34 +02:00
Emmanuele Bassi
ef51e02767 Merge branch 'ebassi/build-fixes' into 'main'
build: Replace source_root()

See merge request GNOME/gtk!4281
2021-12-25 17:26:06 +00:00
Benjamin Otte
7118127139 Merge branch 'wip/otte/gles' into 'main'
Fix GLES

Closes #4571

See merge request GNOME/gtk!4285
2021-12-25 15:34:01 +00:00
Benjamin Otte
2ce2afa036 gles: Be picky abpout glGetFramebufferAttachmentParameter()
This function does not at all work like in OpenGL - if it works at all.
So make it behave accordingly.

Fixes #4571
2021-12-25 15:07:44 +01:00
Benjamin Otte
5803dd765d gles: glGetTexLevelParameter() isn't supported 2021-12-25 15:07:44 +01:00
Benjamin Otte
6a310b5069 gles: GLES 2 doesn't have glDrawBuffers()
So don't call it.
2021-12-25 15:07:44 +01:00
Benjamin Otte
2caab68be9 gl: Change gdk_gl_context_check_version()
Instead of just passing major/minor, pass them twice, once for GL and
once for GLES. This way, we don't need to check for GL and GLES
separately.

If something is supported unconditionally, passing 0/0 works fine.

That said, I'd like to group the arguments somehow, because otherwise
it's just a confusing list of numbers - but I have no idea how to do
that.
2021-12-25 15:07:44 +01:00
Benjamin Otte
4e2dbc1258 glcontext: Use different log levels for GL debug
We want critical GL debug messages to be critical, so that the testsuite
sudokus itself when they appear.

This is relevant in particular for GLES warnings in the GLES runner,
because its warnings can cause crashes on GL drivers less forgiving than
Mesa.

Related: #4571
2021-12-25 15:07:44 +01:00
Emmanuele Bassi
40eca1a68e Apply 1 suggestion(s) to 1 file(s) 2021-12-25 13:29:07 +00:00
m-shinder
98f937ba15 Fix: Set direction for value parameter 2021-12-25 10:04:43 +00:00
Emmanuele Bassi
a70988ecd5 build: Remove deprecated get_pkgconfig_variable()
Replace it with `get_variable(pkgconfig:...)`.
2021-12-24 15:55:26 +00:00
Emmanuele Bassi
6f2ff620bd build: Replace deprecated 'gui_app'
Use `win_subsystem: 'windows'` instead.
2021-12-24 15:51:11 +00:00
Emmanuele Bassi
bd772610b1 build: Replace source_root()
Use project_source_root(), which replaces the deprecated source_root().
2021-12-24 15:48:06 +00:00
Matthias Clasen
de42b5bfae sizerequest: Remove critical warning for now
At last as long as widgets like GtkFlowBox and
GtkGrid still trigger this, it is not a great
idea to have this warning in a stable release.
So remove it for 4.6
2021-12-23 16:59:26 -05:00
Benjamin Otte
fcdd5173bd Merge branch 'wip/otte/for-main' into 'main'
gl: Clear current when destroying current's surface

Closes #4554

See merge request GNOME/gtk!4279
2021-12-22 19:45:53 +00:00
Benjamin Otte
c419799313 gl: Clear current when destroying current's surface
When destroying the EGLSurface or GLXDrawable of a GdkSurface, make sure
the current context is not still bound to it.

If it is, clear the current context.

Fixes #4554
2021-12-22 20:00:52 +01:00
Matthias Clasen
c5973a630b Merge branch 'wip/baedert/for-master' into 'main'
label: Fix get_natural_wrap_mode() precondition check

See merge request GNOME/gtk!4278
2021-12-22 16:54:18 +00:00
Timm Bäder
e5a88b64b1 label: Fix get_natural_wrap_mode() precondition check 2021-12-22 17:38:33 +01:00
Hugo Carvalho
74f58a49b9 Update Portuguese translation 2021-12-22 14:05:50 +00:00
Yuri Chornoivan
cff9d9f5eb Update Ukrainian translation 2021-12-22 12:52:52 +00:00
Timm Bäder
ddd64f2918 Merge branch 'fix_typos' into 'main'
Fix minor typo

See merge request GNOME/gtk!4275
2021-12-22 08:08:38 +00:00
Yuri Chornoivan
9f06f53a59 Fix minor typo 2021-12-21 23:42:12 +02:00
Yuri Chornoivan
4c00d7a306 Update Ukrainian translation 2021-12-21 21:36:53 +00:00
Matthias Clasen
88726e12f7 Merge branch 'high-contrast-4' into 'main'
gdk/wayland: Support new `high-contrast` key

See merge request GNOME/gtk!4271
2021-12-21 19:20:34 +00:00
Matthias Clasen
248bb148af Merge branch 'discrete-scroll' into 'main'
Don't keep discrete scroll events in the queue

See merge request GNOME/gtk!4274
2021-12-21 18:22:53 +00:00
Florian Müllner
49589e1da1 gdk/wayland: Support new high-contrast key
We now have a boolean setting that determines whether the high-contrast
theme should be used. Support it by automatically setting the existing
`gtk-theme-name` and `gtk-icon-theme-name` properties when enabled.

With that, it is no longer necessary to change the regular theme settings
for high-contrast, so toggling between high-contrast and a non-default
theme finally works reliably.
2021-12-21 14:02:02 +01:00
Matthias Clasen
552267b93d Don't keep discrete scroll events in the queue
We are not going to compress those anyway.
2021-12-20 14:51:37 -05:00
Matthias Clasen
855357f871 Merge branch 'testsuite-introspection-extend-envvars' into 'main'
testsuite: introspection: Do not override environment variables.

See merge request GNOME/gtk!4268
2021-12-20 19:08:59 +00:00
Benjamin Otte
c83cba2322 Merge branch 'wip/otte/diff' into 'main'
Make render node diffing not slow

Closes #4560 and #2396

See merge request GNOME/gtk!4269
2021-12-20 19:01:52 +00:00
Benjamin Otte
20dcc31d19 rendernode: Limit diff region
Limit the diff region to 30 rectangles (randomly chosen because it
looked big enough to not trigger by accident and small enough to not
cause performance issues).

If the diff region gets more complicated, we abort to the parent node
and use its bounds as the diff region instead and then continue diffing
the rest of the node tree.

Fixes: #4560
Fixes: #2396
2021-12-20 18:40:02 +01:00
Maxim Cournoyer
29e6cc5808 testsuite: introspection: Do not override environment variables.
Functional package managers such as GNU Guix rely on environment
variables such as GI_TYPELIB_PATH to discover the system libraries and
resources; extend rather than override them.

* testsuite/introspection/meson.build (env): New variable that extends
rather than override the GI_TYPELIB_PATH and LD_PRELOAD environment
variables.
(api): Use the above as the value of the 'env' keyword argument.
2021-12-20 11:22:41 -05:00
Benjamin Otte
4e6ee28bcb gsk: Allow diffing code to abort
Now the vfuncs can decide they don't want to diff anymore, not just the
actual diff function.
2021-12-20 17:08:15 +01:00
Hugo Carvalho
4b3247576a Update Portuguese translation 2021-12-20 16:07:31 +00:00
Matthias Clasen
69edf17c2a Merge branch 'wip/otte/wrapping-is-natural' into 'main'
label: Add gtk_label_set_natural_wrap_mode()

See merge request GNOME/gtk!4267
2021-12-20 15:49:05 +00:00
Matthias Clasen
d91a4ad1dd Merge branch 'progressbar-queue-allocate' into 'main'
progressbar: Queue allocate when setting "inverted"

See merge request GNOME/gtk!4264
2021-12-20 15:45:36 +00:00
Matthias Clasen
9b750ef69f Merge branch 'ebassi/find-gi' into 'main'
build: Check for the gi python module

See merge request GNOME/gtk!4266
2021-12-20 15:41:51 +00:00
Fran Dieguez
0bf22ee3ce Update Galician translation 2021-12-20 08:50:36 +00:00
Benjamin Otte
981ed22dff label: Add gtk_label_set_natural_wrap_mode()
Allows influencing natural size requests so that labels can request more
width than necessary for a given height.

Related: !4245
Related: #4535
2021-12-20 02:28:37 +01:00
Emmanuele Bassi
d40321ef63 ci: Add pygobject to the MSYS2 job 2021-12-19 16:26:37 +00:00
Emmanuele Bassi
c94996e8e8 build: Check for the gi python module
The introspection tests depend on the pygobject module, but we currently
are not checking if it's available at configuration time, which means we
can get build failures like:

> ModuleNotFoundError: No module named 'gi'

when running the test suite.
2021-12-19 16:06:49 +00:00
Marco Melorio
4b19dd46dd progressbar: Queue allocate when setting "inverted" 2021-12-18 18:45:28 +01:00
Piotr Drąg
942e841cbc Update POTFILES.skip 2021-12-18 13:36:19 +01:00
Yuri Chornoivan
e0a595273a Update Ukrainian translation 2021-12-18 06:29:43 +00:00
Matthias Clasen
92ca52822c Merge branch 'meson-msvc-cleanup' into 'main'
Remove Visual Studio 2013 bits from Meson files

See merge request GNOME/gtk!4249
2021-12-17 12:58:01 +00:00
Hugo Carvalho
f89dbce93c Update Portuguese translation 2021-12-17 12:41:33 +00:00
Matthias Clasen
28f0e2eb2a 4.5.1 2021-12-16 21:43:20 -05:00
Matthias Clasen
47ac080565 Merge branch 'wip/otte/for-main' into 'main'
label: word-char wrapping should word-wrap for natural size

Closes #4535

See merge request GNOME/gtk!4245
2021-12-17 02:11:50 +00:00
Matthias Clasen
afdf5cfde9 NEWS: Updates 2021-12-16 21:00:47 -05:00
Matthias Clasen
a4760bcff7 Merge branch 'toolbar-combobox' into 'main'
Don't make all buttons in toolbars flat

Closes #4384

See merge request GNOME/gtk!4103
2021-12-17 00:35:18 +00:00
Matthias Clasen
72e571a3de Merge branch 'main' into 'main'
docs: Mention GtkImage and GtkPicture changes

Closes #4415

See merge request GNOME/gtk!4251
2021-12-17 00:32:08 +00:00
Jakub Kulík
484c0fdd15 docs: Mention GtkImage and GtkPicture changes 2021-12-17 00:32:08 +00:00
Matthias Clasen
2636fb7c8d Merge branch 'wip/baedert/for-master' into 'main'
settings test: Print expected and seen values

See merge request GNOME/gtk!4259
2021-12-17 00:31:20 +00:00
Benjamin Otte
99c2936e90 Merge branch 'wip/otte/inspector' into 'main'
inspector: Add measure graph

See merge request GNOME/gtk!4260
2021-12-16 21:46:52 +00:00
Benjamin Otte
66c74d6091 inspector: Add measure graph
Generates a graph visualizing calls to gtk_widget_measure().

Generation of the graph can be slow - like when it forces Pango to wrap
a huge label 1000s of times.

You can dnd the graph to look at it closer or to impress people in
gitlab issues.
2021-12-16 19:36:54 +01:00
Benjamin Otte
a43ba245e2 inspector: Remove a stray g_print() 2021-12-16 19:36:54 +01:00
Benjamin Otte
810d734eda label: Fix docs 2021-12-16 19:36:54 +01:00
Hugo Carvalho
687d6c5dc4 Update Portuguese translation 2021-12-16 15:48:11 +00:00
Luca Bacci
5e090c1fac Merge branch 'fix-3728-3799' into 'main'
GDK-Win32: Force toplevel surfaces to configure as needed (fix issues #3728 and #3799)

Closes #3728 and #3799

See merge request GNOME/gtk!3712
2021-12-16 14:58:03 +00:00
Timm Bäder
ceb61e6600 gskglcommandqueue: Mark some variables G_GNUC_UNUSED
These are unused if sysprof isn't being used.
2021-12-16 11:06:50 +01:00
Timm Bäder
ae60293c24 textlayout: Remove unused-but-set variables 2021-12-16 11:06:50 +01:00
Timm Bäder
e411081c84 settings test: Print expected and seen values
That test breaks locally (and in CI it seems?), so at least print the
values we see.
2021-12-16 11:06:50 +01:00
Matthias Clasen
0682a5e45e Merge branch 'event-recorder' into 'main'
inspector: Add axes to event details in recorder

See merge request GNOME/gtk!4258
2021-12-16 04:34:01 +00:00
Matthias Clasen
4f751aa53d inspector: Highlight event sequences
Optionally, highlight rows of events whose
event sequences match the selected event.
2021-12-15 22:07:07 -05:00
Matthias Clasen
27fa51cfa6 wayland: Add sequences for touchpad gestures
It makes sense.
2021-12-15 21:58:57 -05:00
Matthias Clasen
2772ff624f gdk: Prepare touchpad events for sequences
It makes sense to connect the begin/update/end events
for touchpad swipes and pinches in a sequence. This
commit adds the plumbing for it, but not backends
are setting sequences yet.
2021-12-15 21:58:57 -05:00
Matthias Clasen
69b160cfe8 inspector: Details about touchpad events
Useful to have for debugging these.
2021-12-15 21:58:57 -05:00
Matthias Clasen
ee7541c032 inspector: Add axes to event details in recorder
This is useful information if you have devices
producing such events.
2021-12-15 21:58:57 -05:00
Matthias Clasen
abf6068d91 docs: Add some information about event axes 2021-12-15 21:58:57 -05:00
Sveinn í Felli
9d5f3e787d Update Icelandic translation 2021-12-15 19:44:49 +00:00
Sveinn í Felli
ab2b9ba444 Update Icelandic translation 2021-12-15 18:37:57 +00:00
Matthias Clasen
6ab1aff531 Merge branch 'event-recorder' into 'main'
inspector: Tweaks to the recorder

See merge request GNOME/gtk!4256
2021-12-15 05:51:28 +00:00
Matthias Clasen
6012276093 Fix event history
Collecting of history wasn't working correctly
for either motion or scroll events.
2021-12-15 00:30:50 -05:00
Matthias Clasen
9648cf226b inspector: Show event history in recorder
This was instrumental in debugging why
scroll compression does not work.
2021-12-14 23:43:29 -05:00
Matthias Clasen
56532a505d Cosmetrics: Remove mention of a nonexisting type
No such thing as GdkScrollHistory.
2021-12-14 23:42:35 -05:00
Matthias Clasen
6bb2e5625a inspector: Remove debug spew 2021-12-14 22:03:52 -05:00
Matthias Clasen
d57a5dffa1 inspector: Add event recording
Make the recorder also keep track of events,
and show them in some detail.
2021-12-14 22:01:40 -05:00
Matthias Clasen
1028ca0841 inspector: More tweaks to the recorder
Put the two left columns in a stack, and add
an empty page there. This will let us add
other recording types in the future, with
their own pages.
2021-12-14 19:51:35 -05:00
Matthias Clasen
6dbe6b42c2 inspector: Tweaks to the recorder
Don't show the profiler data in the frame list,
instead show timestamps there.
2021-12-14 19:34:53 -05:00
Matthias Clasen
7611c3ea03 Merge branch 'matthiasc/for-main' into 'main'
inspector: Use a listview in the recorder

See merge request GNOME/gtk!4255
2021-12-15 00:06:11 +00:00
Christian Hergert
2fa9f934b6 a11y: return -1 if parent is NULL 2021-12-14 21:18:13 +01:00
Matthias Clasen
e9fd7b7ed6 inspector: Use a listview in the recorder
Its the awesome new list widget, lets use it!
2021-12-14 15:10:11 -05:00
Matthias Clasen
075e954b71 Merge branch 'ebassi/issue-4543' into 'main'
Add a boxed GType for GtkBitsetIter

Closes #4543

See merge request GNOME/gtk!4253
2021-12-14 18:09:01 +00:00
Emmanuele Bassi
3f7122b3d2 Add a boxed GType for GtkBitsetIter
This way language bindings have a chance at managing the memory of
GtkBitset iterators.

Fixes: #4543
2021-12-14 15:51:13 +00:00
Hugo Carvalho
35251c6d9c Update Portuguese translation 2021-12-14 14:20:25 +00:00
Hugo Carvalho
173594365c Update Portuguese translation 2021-12-14 14:03:49 +00:00
Yuri Chornoivan
2fc44fb27d Update Ukrainian translation 2021-12-14 13:21:33 +00:00
Aurimas Černius
0264630c90 Updated Lithuanian translation 2021-12-14 13:41:59 +02:00
Matthias Clasen
208769f70f Merge branch 'optimize-precompile' into 'main'
builder: Use a string chunk for precompile

See merge request GNOME/gtk!4233
2021-12-14 06:34:49 +00:00
Matthias Clasen
c5bffb9fb5 builder: Drop empty text chunks when precompiling
These don't add any value either.
2021-12-14 01:21:06 -05:00
Matthias Clasen
c7afa5452b builder: Drop irrelevant whitespace in precompile
Drop text nodes that won't contribute to the end result.
This gets rid of a lot of text nodes in the replay.
2021-12-14 00:35:35 -05:00
Matthias Clasen
c7c6e83779 Merge branch 'matthiasc/for-main' into 'main'
builder: Use GMarkup properly

See merge request GNOME/gtk!4250
2021-12-14 04:58:06 +00:00
Garrett Regier
fcb6adaaaa builder: Use g_slice_free_chain() for strings in precompile 2021-12-13 23:44:02 -05:00
Garrett Regier
9c12b58e32 builder: Remove root special case from precompile 2021-12-13 23:44:02 -05:00
Garrett Regier
6c8b505f93 builder: Avoid g_hash_table_get_values() in precompile
Embed the GList link in the RecordDataString.
2021-12-13 23:44:02 -05:00
Garrett Regier
8b228e7471 builder: Use a flexible array for attributes in precompile 2021-12-13 23:44:02 -05:00
Garrett Regier
4ce07f41ca builder: Reduce memory usage in precompile
Split the Element and Text nodes into separate structures.
2021-12-13 23:44:02 -05:00
Garrett Regier
1bfd0e5e38 builder: Use a GQueue in precompile
This avoids g_list_last() and
embeds the GList link in the RecordDataTree.
2021-12-13 23:44:02 -05:00
Garrett Regier
b962d37f79 builder: Use a reasonable default string size in precompile 2021-12-13 23:44:02 -05:00
Garrett Regier
c6ecf02a07 builder: Embed text length in precompile 2021-12-13 23:44:02 -05:00
Garrett Regier
8b7d4b423c builder: Combine attribute name and value allocations 2021-12-13 23:44:02 -05:00
Garrett Regier
83dc126565 builder: Use a string chunk for precompile
Also use an explicit length and avoid g_strndup().
2021-12-13 23:44:02 -05:00
Garrett Regier
f2d3d7e710 builder: Avoid double string lookup in precompile 2021-12-13 23:44:02 -05:00
Matthias Clasen
f991428cb9 builder: Use GMarkup properly
We must call end_parse to ensure we get errors
for incomplete documents.
2021-12-13 23:42:47 -05:00
Chun-wei Fan
e2b4108377 Revert "gtk/meson.build: Fix linking on Visual Studio 2013"
We now require a Pango version that requires Visual Studio 2015 or later to
build, and non-UCRT-based (VS2013) binaries may not bode well with
UCRT-based binaries (VS2015+). Drop the support for VS2013 as a result.

This reverts commit e208e0e07886248d4d86118aa5591c9882f0ed5c.
2021-12-14 10:29:28 +08:00
Matthias Clasen
c9cf7b1e08 Merge branch 'matthiasc/for-main' into 'main'
tiff loader: Catch more errors

See merge request GNOME/gtk!4248
2021-12-14 00:31:49 +00:00
Matthias Clasen
4d865cd7ba tiff loader: Catch more errors
tiff_open_read may fail, and we should not crash
in that case but return an error.
2021-12-13 17:54:11 -05:00
Matthias Clasen
a55458a84a Merge branch 'builder-tool-fixes' into 'main'
builderparser: Be more robust

See merge request GNOME/gtk!4247
2021-12-13 21:29:48 +00:00
Matthias Clasen
66d8631c23 buildertool: Be more robust
Don't pass a NULL string to gtk_builder_value_from_string.
2021-12-13 15:09:48 -05:00
Matthias Clasen
5c1ad88137 builderparser: Be more robust
If a document contains no useful content,
just say so instead of crashing.
2021-12-13 15:09:48 -05:00
Matthias Clasen
e230c9c6f0 Merge branch 'builder-tool-fixes' into 'main'
buildertool: Fix a possible crash

See merge request GNOME/gtk!4246
2021-12-13 19:54:56 +00:00
Matthias Clasen
6d24a2c942 buildertool: Be more robust
A lot of crashes in simplify can be avoided
if get_class_name does not return NULL.
2021-12-13 14:33:19 -05:00
Matthias Clasen
5222dc0cd1 buildertool: Fix a possible crash
We need to call g_markup_parse_context_end_parse
to catch incomplete documents that we might not
handle well later.
2021-12-13 13:52:50 -05:00
Benjamin Otte
02c484e844 label: Fix docs 2021-12-13 18:23:32 +01:00
Benjamin Otte
5face79cd0 label: word-char wrapping should word-wrap for natural size
Testcase added

Fixes #4535
2021-12-13 14:49:39 +01:00
Yuri Chornoivan
51a72a9c53 Update Ukrainian translation 2021-12-13 13:16:42 +00:00
Matthias Clasen
f609d9cd59 Merge branch 'wip/baedert/for-master' into 'main'
gl: Imply that node_supports_transforms() means 2D transforms

Closes #4501

See merge request GNOME/gtk!4232
2021-12-13 12:55:04 +00:00
Matthias Clasen
3901c6ab91 Merge branch 'fix-x11-drag-icons' into 'main'
colorswatch: Make drag source optional

See merge request GNOME/gtk!4244
2021-12-13 03:39:48 +00:00
Matthias Clasen
da6f86bd79 colorbutton: No nested drag sources, please
This is causing trouble on X11.
2021-12-12 22:23:31 -05:00
Matthias Clasen
42fd499af4 dragicon: Make color icons work in X11
We need to disable the DND support in
GtkColorSwatch completely for this to work
in X11.
2021-12-12 22:09:28 -05:00
Matthias Clasen
de5b88477a colorswatch: Make drag source optional
When using a colorswatch as a drag icon,
this can get in the way, so make it optional.
2021-12-12 22:09:16 -05:00
Matthias Clasen
cd49a7f9e9 Merge branch 'matthiasc/for-main' into 'main'
dragicon: Provide default icons for paintables

See merge request GNOME/gtk!4243
2021-12-13 02:43:48 +00:00
Matthias Clasen
df025fcb88 dragicon: Provide default icons for more types
Provide default icons for paintables and files.
This is easy to do, and makes sense.

fixup drag icon
2021-12-12 21:29:36 -05:00
Matthias Clasen
bbb1404bd3 dragicon: No events, please
We run into trouble on X11 if the widgets
in the drag icon have drop targets attached.
Prevent this by suppressing event delivery
to drag icons outright.
2021-12-12 21:28:34 -05:00
Benjamin Otte
af2a172197 Merge branch 'wip/otte/for-main' into 'main'
x11: Fix a deadlock in INCR transfers

See merge request GNOME/gtk!4242
2021-12-13 01:17:00 +00:00
Benjamin Otte
252b9fc39c x11: Don't delete important signal handlers randomly
We finish the write to the output stream long after the stream has been
closed, so we want to keep the event handler around to do just that.

Instead, remove the handler on finalize.
2021-12-13 01:54:21 +01:00
Benjamin Otte
6fc5e04d7c x11: Explicitly track end of stream
The OutputStream needs to write a 0 byte end of stream Property. We need
to track if that has been written, and we do that with that new
property.

We also use that property to always request flushes when the stream is
being closed, so that we don't wait for another flush() call.
2021-12-13 01:52:30 +01:00
Benjamin Otte
66f1fef083 x11: Explicitly close_async() the output stream
We need to be very careful when writing data, because if we aren't, sync
functions will be called on the output stream and X11 does not like that
at all.
2021-12-13 01:51:35 +01:00
Benjamin Otte
645d4807c3 x11: Keep a reference to the SelectionOutputStream while writing
This ensures close() isn't called from dispose() while we're still busy
writing.

In theory this should never happen, but in practice it just did.
2021-12-13 01:42:45 +01:00
Matthias Clasen
e2c360ada0 Merge branch 'clipboard-demo-improvements' into 'main'
inspector: Show more datatypes for the clipboard

See merge request GNOME/gtk!4241
2021-12-12 23:51:30 +00:00
Matthias Clasen
a463ead739 gdk: Drop some pointless code
There is no point in sorting png first when
registering (de)serializers, since we ignore
the png format now when walking the list.
2021-12-12 18:36:58 -05:00
Matthias Clasen
dbe5e57b8e inspector: Show more datatypes for the clipboard
It is easy enough to show colors, files and pixbufs.
2021-12-12 18:36:58 -05:00
Matthias Clasen
99b99d7b23 Merge branch 'clipboard-demo-improvements' into 'main'
droptarget: Improve the docs

See merge request GNOME/gtk!4240
2021-12-12 21:42:31 +00:00
Matthias Clasen
787111a145 gtk-demo: Add dnd back to the clipboard demo 2021-12-12 16:27:36 -05:00
Matthias Clasen
9a872f059f droptarget: Improve the docs
Add the signal connection to the example.
2021-12-12 16:27:36 -05:00
Matthias Clasen
eadc94e0a1 Merge branch 'clipboard-demo-improvements' into 'main'
gtk-demo: Small followup fixes

See merge request GNOME/gtk!4239
2021-12-12 18:58:07 +00:00
Matthias Clasen
f8855e892a gtk-demo: Small followup fixes
Make image copy work remotely.
2021-12-12 13:41:24 -05:00
Matthias Clasen
27d05014e3 Merge branch 'new-clipboard-demo' into 'main'
docs: Small improvement

See merge request GNOME/gtk!4238
2021-12-12 18:30:27 +00:00
Matthias Clasen
ebb58b7cbc gtk-demo: Rewrite the clipboard demo
This is more in line with the current clipboard
api, and shows handling colors and files.
2021-12-12 13:13:11 -05:00
Yuri Chornoivan
7f6895a4bb Update Ukrainian translation 2021-12-12 17:18:14 +00:00
Hugo Carvalho
80ae4c1a69 Update Portuguese translation 2021-12-12 16:26:05 +00:00
Matthias Clasen
e72df9cd5f docs: Small improvement
I could not find the attributes of the <binding>
element mentioned anywhere in the docs.
2021-12-12 09:03:11 -05:00
Piotr Drąg
80ba529fb9 Update POTFILES.in and POTFILES.skip 2021-12-12 13:54:41 +01:00
Timm Bäder
fd6b3ef5a0 gl: Linear gradients don't support 3d transforms
Add another helper similar to the one for transforms, but that only
works on 2d transforms.

Fixes #4501
2021-12-12 12:57:44 +01:00
Benjamin Otte
4cd0a39794 Merge branch 'wip/otte/inspector' into 'main'
inspector: Add a clipboard page

See merge request GNOME/gtk!4237
2021-12-11 22:46:30 +00:00
Benjamin Otte
5fbc510f94 contentformats: Make sure 0 elements means the array is NULL
Don't return arrays with 0 elements, return NULL.
2021-12-11 23:21:53 +01:00
Benjamin Otte
600ab5ba5f inspector: Add a clipboard page
Shows all the formats supported by the clipboard (and primary clipboard)
and allows displaying them (by potentially downloading them)
2021-12-11 23:01:42 +01:00
Matthias Clasen
ae92181d02 Merge branch 'fix-textchild-abi' into 'main'
Restore the GtkTextchild abi

Closes #4531

See merge request GNOME/gtk!4236
2021-12-11 16:32:45 +00:00
Matthias Clasen
66910ed998 Restore the GtkTextchild abi
Move the new chars field to a private struct.

Fixes: #4531
2021-12-11 10:58:58 -05:00
Matthias Clasen
5371e4403e Merge branch 'deprecate-device-source' into 'main'
Deprecate GdkDevice:source

See merge request GNOME/gtk!4207
2021-12-10 18:35:00 +00:00
Matthias Clasen
79375dd7dd Merge branch 'fix-printer-enumeration' into 'main'
Fix dialog-less printing

Closes #4439

See merge request GNOME/gtk!4215
2021-12-10 18:01:59 +00:00
Matthias Clasen
6889609ab9 Merge branch 'bump-meson-dep' into 'main'
Require meson 0.59

Closes #4486

See merge request GNOME/gtk!4230
2021-12-10 18:00:50 +00:00
Matthias Clasen
0bf87281e0 Merge branch 'missing-since-tag' into 'main'
Add a missing since tag

See merge request GNOME/gtk!4229
2021-12-10 17:15:32 +00:00
Matthias Clasen
bc7bed7517 ci: Use meson 0.59 for msvc 2021-12-10 12:14:04 -05:00
Matthias Clasen
cfac6fd752 ci: Use meson 0.59 on macos 2021-12-10 12:12:52 -05:00
Matthias Clasen
97c09c827b Fix the targets variable in pc files
This is meant as a space-separated list of
string, so escaping the spaces is uncalled
for.

Fixes: #4486
2021-12-10 11:36:07 -05:00
Matthias Clasen
0370672886 Require meson 0.59
This is needed to fix a regression in our pc file
generation.
2021-12-10 11:34:23 -05:00
Matthias Clasen
2d062fedd9 Add a missing since tag
gtk_text_child_anchor_new_with_replacement was
recently added.
2021-12-10 11:26:46 -05:00
Matthias Clasen
c6a68f3de2 Fix dialog-less printing
We were sometimes ending printer enumeration prematurely,
and the code was confused about the meaning of found_printer.

The new setup follows these rules:
- We *only* end the search prematurely if found_printer
  is set, which indicates that we found the right printer
- We *always* call find_printer_idle exactly once, and
  make it return less than perfect matches like the
  default printer, or the first printer we found

Fixes: #4439
2021-12-10 11:26:23 -05:00
Matthias Clasen
d6181b2335 Merge branch 'wip/jimmac/unfocused-selection-dejavu' into 'main'
Revert "styling: Have unfocused selections"

Closes #4393

See merge request GNOME/gtk!4228
2021-12-10 13:17:32 +00:00
Jakub Steiner
d74e62886c selections: have unfocused state
- text selections for unfocused elements - textview, label, entry,
  spinbutton

fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/4393
2021-12-10 12:00:12 +01:00
Jakub Steiner
d8505f09eb Revert "styling: Have unfocused selections"
This reverts commit 96f63a6bf3.
2021-12-10 11:36:10 +01:00
Matthias Clasen
935c6aade0 Merge branch 'bilelmoussaoui/header' into 'main'
gdk: drop removed method from the header

See merge request GNOME/gtk!4225
2021-12-09 23:50:21 +00:00
Matthias Clasen
a35c35f849 Merge branch 'wip/chergert/fix-macos-crash' into 'main'
macos: fix crash in imcontextquartz

See merge request GNOME/gtk!4226
2021-12-09 23:49:39 +00:00
Bilal Elmoussaoui
57518a2bb4 gdk: drop removed method from the header 2021-12-09 20:29:17 +00:00
Christian Hergert
99a8202015 macos: fix crash in imcontextquartz 2021-12-09 12:26:33 -08:00
Benjamin Otte
17c903e246 Merge branch 'fix-picture-natural-size-0' into 'main'
picture: Return natural size 0 for size 0

See merge request GNOME/gtk!4177
2021-12-08 19:33:28 +00:00
Benjamin Otte
4de5d225db reftests: Add center-center reftests without GtkOverlay 2021-12-08 22:16:52 +03:00
Benjamin Otte
7741df9963 reftests: Rename a bunch of tests
They use a GtkOverlay, so reflect that in the name.
2021-12-08 22:16:52 +03:00
Ivan Molodetskikh
7ef54e9c53 picture: Return natural size 0 for size 0
It was returning the full natural size (same as -1) due to default value
handling in the code below.

Tests have been updated to match this output.
2021-12-08 19:20:24 +01:00
Matthias Clasen
12bb700c62 Merge branch 'wip/chergert/fix-recursive-action-muxer' into 'main'
actionmuxer: avoid duplicate and recursive work

Closes #4422, #4519, and gnome-text-editor#220

See merge request GNOME/gtk!4223
2021-12-08 10:47:40 +00:00
Matthias Clasen
e3ba7250f1 Merge branch 'wip/chergert/layout-marshaller' into 'main'
surface: add missing va_marshaller for layout signal

See merge request GNOME/gtk!4221
2021-12-08 10:46:35 +00:00
Matthias Clasen
54842095c3 Merge branch 'wip/chergert/reduce-action-muxer-allocations' into 'main'
menutracker: reduce allocations and signal emission

See merge request GNOME/gtk!4222
2021-12-08 10:45:56 +00:00
Christian Hergert
d1aec0c3f1 actionmuxer: avoid duplicate and recursive work
If we've already done the tracking into the parent muxer, there is no need
to do it again. This can save a great deal of recursive work when adding
items to the muxer.

This makes showing the context menu in gnome-text-editor repeatedly fast
even as spelling corrections are changed.

It is likely that this could fix #4422 as well.

Fixes #4519
Fixes https://gitlab.gnome.org/GNOME/gnome-text-editor/-/issues/220
2021-12-08 00:32:36 -08:00
Christian Hergert
00d5f72d6e menutracker: reduce allocations and signal emission
When handling action-added callbacks the code was previously using a
freeze_notify/thaw_notify in all cases. This turns out to allocate a
significant amount of memory when called a lot.

That said, it shouldn't be getting called this much but given the current
state of affairs elsewhere in GtkActionMuxer, this brought temporary
allocations down from 9MiB to 9KiB in gnome-text-editor after showing
the context menu a few times.

Related #4422
2021-12-07 22:42:04 -08:00
Christian Hergert
15d01d4315 surface: add missing va_marshaller for layout signal
I saw this coming across through a ffi boundary in Sysprof, and we wanted
to keep most things within GDK using native marshalling to improve
profiler results when frame pointers are not used.
2021-12-07 22:21:19 -08:00
Benjamin Otte
348e34f221 Merge branch 'wip/otte/viewport' into 'main'
viewport: Handle things differently

See merge request GNOME/gtk!4220
2021-12-07 23:31:06 +00:00
Benjamin Otte
ce7b0656c0 viewport: Allocate properly
Instead of allocation width for height for width for height or whatever
that code was doing, actually allocate the size we were given or the
requested size, whatever is larger.
2021-12-08 00:12:35 +01:00
Benjamin Otte
fd0d360f9b Revert "viewport: Actually report the size we're gonna allocate"
This reverts commit b8468af411.
2021-12-07 23:52:21 +01:00
Benjamin Otte
f26cae3838 Merge branch 'wip/otte/viewport' into 'main'
viewport: Use array for member variables

See merge request GNOME/gtk!4219
2021-12-07 21:19:58 +00:00
Benjamin Otte
b8468af411 viewport: Actually report the size we're gonna allocate
Don't just pass on measure() calls, but actually behave in the way we
behave during size allocate.

This should improve cases where GtkScrolledWindow is used with GTK_POLICY_NEVER.
2021-12-07 21:58:42 +01:00
Benjamin Otte
9fd7e319f3 viewport: Use array for member variables
That way we can index them by orientation in future commits.
2021-12-07 21:58:42 +01:00
Benjamin Otte
80a8b59f24 Merge branch 'wip/otte/for-main' into 'main'
gtktypes: GTK_INVALID_LIST_POSITION should be an int

See merge request GNOME/gtk!4218
2021-12-07 15:30:48 +00:00
Benjamin Otte
b9d4da9cfe gtktypes: GTK_INVALID_LIST_POSITION should be an int
GListModel uses guint, so the macros we define for it should match that.

Related: !3738
2021-12-07 16:15:17 +01:00
Emmanuele Bassi
5bf5b58eb3 Merge branch 'gi-const' into 'main'
gtk: fix GTK_INVALID_LIST_POSITION type

See merge request GNOME/gtk!3738
2021-12-07 14:22:40 +00:00
Hugo Carvalho
b2c227e9c5 Update Portuguese translation 2021-12-04 19:46:16 +00:00
Yuri Chornoivan
d854228d58 Update Ukrainian translation 2021-12-04 16:46:08 +00:00
Benjamin Otte
a0c09bc2a9 Merge branch 'check-for-unknown-duration' into 'main'
gstmediafile: Correctly report unknown duration

See merge request GNOME/gtk!4217
2021-12-04 09:45:34 +00:00
Anders Jonsson
aca3b2da58 Update Swedish translation 2021-12-04 09:34:37 +00:00
Ivan Molodetskikh
604541863c gstmediafile: Correctly report unknown duration
When loading .mp3 files the duration is initially unknown. Before this
change it was reported as a large integer (since GST_CLOCK_TIME_NONE is
-1). Now it's correctly reported as 0.
2021-12-04 11:48:30 +03:00
Matthias Clasen
fc67b5a8cf Merge branch 'wip/carlosg/im-wayland-module-priority' into 'main'
gtkimcontextwayland: Set a higher IO extension priority

Closes #4443

See merge request GNOME/gtk!4216
2021-12-03 23:55:31 +00:00
Carlos Garnacho
ce1b970b46 gtkimcontextwayland: Set a higher IO extension priority
We want this to take precedence in the wayland platform to other
modules that might be loaded via the IO extension point. None of
those is going to bode well in this platform.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4443
2021-12-04 00:21:53 +01:00
Matthias Clasen
ceb77d6100 Merge branch 'wip/hadess/listbox-fixes' into 'main'
listbox: Explain behaviour of GtkListBoxCreateWidgetFunc

See merge request GNOME/gtk!4194
2021-12-03 23:05:13 +00:00
Matthias Clasen
02579a1333 Merge branch 'wip/chergert/inspector-im-module' into 'main'
inspector: add im-module

Closes #4512

See merge request GNOME/gtk!4214
2021-12-03 22:51:32 +00:00
Matthias Clasen
2f7fa10434 Merge branch 'textview-im-surrounding' into 'main'
textview: Provide more context to input methods

See merge request GNOME/gtk!4209
2021-12-03 20:26:54 +00:00
Christian Hergert
6be352f446 inspector: add im-module
This adds a new row to the Global/Information section which displays the
GTK im-module that is likely to be in use unless changed by an application.
It responds to updates of GtkSettings:gtk-im-module unless the
GTK_IM_MODULE environment variable is set.

Fixes #4512
2021-12-03 12:11:25 -08:00
Matthias Clasen
4d2be2e322 Merge branch 'text-scroll-test' into 'main'
Improve scroll-to mark behavior

Closes #4325

See merge request GNOME/gtk!4208
2021-12-03 20:00:05 +00:00
Matthias Clasen
d5c01098fd textview: Provide more context to input methods
When returning surrounding context to input methods,
include at least 2 words before and after the insertion
point.

Update the affected input method tests.
2021-12-03 14:44:05 -05:00
Matthias Clasen
d2bda8ea77 Merge branch 'text-anchor-replacement-char' into 'main'
textchildanchor: allow to specify replacement character

See merge request GNOME/gtk!4213
2021-12-03 16:02:49 +00:00
Georg Vienna
c517e945de textchildanchor: allow to specify replacement character 2021-12-03 16:02:48 +00:00
Matthias Clasen
e3a1a2e0c6 Merge branch 'better-tabs-demo' into 'main'
Beef up the tabs demo

See merge request GNOME/gtk!4200
2021-12-03 13:30:22 +00:00
Matthias Clasen
b9c2a925e2 Beef up the tabs demo
Show various alignments, including numeric.
2021-12-03 07:55:20 -05:00
Benjamin Otte
59238c6e73 Merge branch 'gtk4-win32-egl' into 'main'
Fix running GTK4 under EGL on Windows

See merge request GNOME/gtk!4188
2021-12-03 10:48:50 +00:00
Chun-wei Fan
652ab1ac72 gskglcompiler.c: Force GLSL version 300 es as needed
For libANGLE to work with our shaders, we must use "300 es" for
the #version directive in our shaders, as well as using the non-legacy/
non-GLES codepath in the shaders.  In order to check whether we are
using the GLSL 300 es shaders, we check whether we are using a GLES 3.0+
context.  As a result, make ->glsl_version a const char* and make sure
the existing shader version macros are defined apprpriately, and add a
new macro for the "300 es" shader version string.

This will allow the gtk4 programs to run under Windows using EGL via
libANGLE.  Some of the GL demos won't work for now, but at least this
makes things a lot better for using GL-accelerated graphics under Windows
for those that want to or need to use libANGLE (such as those with
graphics drivers that aren't capable of our Desktop (W)GL requirements in
GTK.
2021-12-03 10:39:59 +08:00
Chun-wei Fan
bdf879427c gdksurface-win32.c: Call gdk_surface_set_egl_native_window()
.. when creating the surface (with the HWND associated with the
newly-created surface) as well as destroying the surface (with NULL,
since the HWND is going to be destroyed), so that we can tie the EGL
calls to the HWND that we want to do the EGL stuff.
2021-12-03 10:39:59 +08:00
Matthias Clasen
4058b80d56 Bump pango req
Require pango 1.50.
2021-12-02 21:24:24 -05:00
Matthias Clasen
be949496ac Merge branch 'issue-4376' into 'main'
Update placeholder visibility when setting a buffer

Closes #4376

See merge request GNOME/gtk!4211
2021-12-02 17:38:16 +00:00
Emmanuele Bassi
b57b12fdb7 Update placeholder visibility when setting a buffer
If we set the placeholder text before setting a buffer, we end up with
both the placeholder *and* the buffer's contents visible at the same
time.

Fixes: #4376
2021-12-02 17:17:12 +00:00
Matthias Clasen
e64bb40d0b Merge branch 'wip/carlosg/tablet-fixes' into 'main'
Wayland tablet device modifier fixes

Closes #4103 and #4102

See merge request GNOME/gtk!4210
2021-12-02 16:34:35 +00:00
Carlos Garnacho
c8d83b7a63 gesturestylus: Use GtkEventControllerEvent events to track changes
We use gtk_gesture_get_last_event() underneath at places that need to
work during ::proximity emission. Since GtkGesture only tracks events
while there are button/touch presses involved, this is not going to
bring the right result there.

Use gtk_event_controller_get_current_event() consistently inside,
which always pokes at the event being handled (which is the correct
intent here).
2021-12-02 17:06:35 +01:00
Carlos Garnacho
9539cc4a93 gdk/wayland: Unset GDK_BUTTON1_MASK on proximity_in
In some circumstances (e.g. activating with a stylus something that
closes a window), we can receive zwp_tablet_tool.proximity_out without
receiving a zwp_tablet_tool.up beforehand.

In those cases, we are not expecting neither .up nor .button, so
reset the stylus device button modifiers on proximity_out.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4103
2021-12-02 17:06:35 +01:00
Carlos Garnacho
72cf304a86 gdk/wayland: Use right modifiers for tablet button events
We are looking up the seat logical pointer modifiers (i.e. the wl_pointer),
not the ones for the tablet tool device. This breaks accounting further
along in GTK leaving stuck implicit grabs.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4102
2021-12-02 17:06:35 +01:00
Matthias Clasen
67ad566188 textview: Improve scroll-to-mark behavior
The idea of within-margin is to scroll as little
as possible to bring the mark within the margins
defined by the factor. The code was achieving
that when scrolling down, but not when scrolling
up. This change makes things symmetrical.

Fixes: #4325
2021-12-01 19:35:11 -05:00
Matthias Clasen
db46a8dd06 Add a testcase for scroll-to-mark
This should help for figuring out #4325.
2021-12-01 17:22:19 -05:00
Matthias Clasen
fd9e0dd13a Deprecate GdkDevice:source
GdkDeviceTool is more consistently supported across
backends, and provides the same information.
2021-12-01 14:04:35 -05:00
Chun-wei Fan
da535164b4 gdksurface-win32.c: Rename window->surface as appropriate
Update the functions that were updated in the previous commit to have all
GdkSurface variables named as 'surface' instead of the GTK-3.x-era window, to
make things more consistent across the board.  Also fix formatting a bit.
2021-12-01 17:32:40 +08:00
Chun-wei Fan
82d9570ed4 GDK-Win32: Make surface ready for updates
Make the toplevel surface respond to size computations unless it is just being
created, or maximized, made fullscreen or underwent an AeroSnap operation.

This will ensure that the surface size is properly computed in time, so that
surfaces can be resized as needed.

This will fix issues 3728 and 3799.
2021-12-01 17:32:40 +08:00
Chun-wei Fan
a619e8af4a gskglcompiler.c: Relax check for GL 3.x+ legacy contexts
On Windows with nVidia drivers at least, when we create a legacy context
via wglCreateContext(), we may still get a (W)GL 4.x context.  Allow
such contexts to also use GLSL version 130 instead of 110, so that
things do continue to work.
2021-12-01 17:29:02 +08:00
Matthias Clasen
2611a996ff Merge branch 'matthiasc/for-main' into 'main'
textbuffer: Fix pasting text

Closes #4357

See merge request GNOME/gtk!4205
2021-12-01 02:59:10 +00:00
Matthias Clasen
3e7618fef7 textbuffer: Try harder to fix pasting
It turns out we can't just use the size returned
by the memory stream as-is, since it may contain
unfilled garbage at the end, which utf8 validation
will choke on. So, cut it off at the first '\0'
we find.
2021-11-30 21:42:19 -05:00
Matthias Clasen
5b1b75b055 textbuffer: Fix pasting text
The memory stolen from a memory outputstream
isn't guaranteed to be 0-terminated, so don't
make that assumption.

Fixes: #4357
2021-11-30 20:37:25 -05:00
Matthias Clasen
f1612e36ee Merge branch 'update_focus_indicators_in_popovers' into 'main'
update focus indicators in popovers

See merge request GNOME/gtk!4124
2021-12-01 01:21:32 +00:00
Matthias Clasen
bfd3d714b9 Merge branch 'matthiasc/for-main' into 'main'
textview: Respect editability for Emoji

Closes #4479 and #4503

See merge request GNOME/gtk!4204
2021-12-01 01:13:48 +00:00
Matthias Clasen
5a42ccc575 docs: Clarify a sentence in the migration guide
Make it clear that we are giving examples of
no-longer existing APIs here.

Fixes: #4479
2021-11-30 19:51:22 -05:00
Matthias Clasen
b3b0321620 textview: Avoid misplacing the Emoji chooser
When the iter is at the end of the buffer,
gtk_text_view_get_iter_location returns a
rectangle with width 0, which in turn makes
gdk_rectangle_intersect return FALSE.

Avoid that by always giving the rectangle
non-empty dimensions.

Fixes: #4503
2021-11-30 19:44:26 -05:00
Matthias Clasen
e0deacd236 inspector: Make dropdowns bigger
If there's enough values to warrant scrolling,
the dropdown was much too small for comfort.
2021-11-30 18:38:33 -05:00
Matthias Clasen
f66172451d textview: Respect editability for Emoji
Switch the Emoji chooser keybinding to use the
action, so that disabling the action has the
desired effect.
2021-11-30 18:37:33 -05:00
Ian Douglas Scott
25ec20d861 gdk/wayland/surface: Remove redundant should_be_mapped code
As far as I can tell, the code here is redundant and probably ended up
this way for historical reasons. A drag surface without
`->is_drag_surface` would be created if `gdk_display_create_surface`
were called with `GDK_SURFACE_TEMP`, but drag surfaces never seem to be
created that way.

In `gtk4-demos`, drag and drop and popovers seem to be working normally
with this.
2021-11-30 10:36:46 -08:00
Benjamin Otte
e80238120e Merge branch 'wip/otte/for-main' into 'main'
texture: Remove gdk_texture_download_float()

See merge request GNOME/gtk!4202
2021-11-30 14:25:22 +00:00
Benjamin Otte
07cfdd8ca0 label: Don't set ellipsized size as natural size
Natural size should never ellipsize.

Tests added.
2021-11-30 15:10:02 +01:00
Benjamin Otte
ade7509b97 GL renderer: Remove noperspective usage
It causes issues with compilation of GLES shaders and isn't in any
way correct.
2021-11-30 14:12:10 +01:00
Benjamin Otte
8d1956921d node-editor: Display errors
When opening a file or pasting DND fails, display the error as the
actual node.
2021-11-30 14:12:10 +01:00
Benjamin Otte
354fa6544a texture: Remove gdk_texture_download_float()
The download API is not well thought out yet, so postpone it until
there's an actual usecase for it.

Remove testcases, too.
2021-11-30 14:12:10 +01:00
Benjamin Otte
291c50202a rendernode: Simplify conic gradient code 2021-11-30 14:12:10 +01:00
Benjamin Otte
ce8faa2e90 testsuite: Make function arguments const 2021-11-30 14:12:10 +01:00
Matthias Clasen
0579220546 Mention 'main' branch in NEWS
The default development branch is now `main`.
This commit only exists on `master` to point people
towards that.
2021-11-29 18:13:06 -05:00
Matthias Clasen
50e4ca8593 Mention main in NEWS and README.md 2021-11-29 17:42:40 -05:00
Matthias Clasen
ddd5704c92 Update references to master in the repository 2021-11-29 17:37:49 -05:00
Benjamin Otte
3ba6d2bd27 Merge branch 'wip/otte/hfw-min-size' into 'master'
window: Implement height-for-width for min size

See merge request GNOME/gtk!4183
2021-11-29 10:31:42 +00:00
Matthias Clasen
cd9b730735 Merge branch 'font-chooser-variations-fix' into 'master'
fontchooser: Avoid setting variations needlessly

See merge request GNOME/gtk!4197
2021-11-28 12:56:09 +00:00
Piotr Drąg
f593f3da0a Update POTFILES.skip 2021-11-28 13:30:19 +01:00
Matthias Clasen
e9d8bf96e0 fontchooser: Avoid setting variations needlessly
Setting variations to their default value causes
them to show up in the serialization of the font
description - a font description has no idea about
the default values, so can't filter them out.

Avoid that.
2021-11-27 17:13:23 -05:00
Bastien Nocera
6b3a612bbc listbox: Explain behaviour of GtkListBoxCreateWidgetFunc
It might be an interesting shortcut for applications to use, but it
needs to be documented to be useful and agreed.
2021-11-25 12:33:10 +01:00
Emmanuele Bassi
c742debea8 Merge branch 'fix_typo_gesture' into 'master'
gesture: fix typo in docs

See merge request GNOME/gtk!4191
2021-11-24 19:56:42 +00:00
Alexandros Theodotou
cd60ec1576 gesture: fix typo in docs 2021-11-24 19:34:49 +00:00
Fabio Tomat
95e6453823 Update Friulian translation 2021-11-22 09:19:32 +00:00
Aurimas Černius
7e0279b15c Updated Lithuanian translation 2021-11-21 21:58:20 +02:00
Quentin PAGÈS
791f0d70ac Update Occitan translation 2021-11-21 19:38:33 +00:00
Benjamin Otte
0709dc7a6a window: Add a new fancy way to compute min size
Try to compute a min size that matches the current aspect ratio.

This means that when interactively resizing, we adapt the min size to
the current window area dynamically.

And that means that we always have a min size that is large enough, but
users can interactively cause it to be small-width x large-height,
large-width x small-width or anything inbetween.
2021-11-21 18:52:42 +00:00
Benjamin Otte
15528599f4 Merge branch 'wip/otte/for-master' into 'master'
window: Always clamp to max size

See merge request GNOME/gtk!4185
2021-11-21 18:44:26 +00:00
Emmanuele Bassi
031aab3ef6 Merge branch 'ebassi/issue-4421' into 'master'
Unrealize ATContext on unroot

Closes #4421

See merge request GNOME/gtk!4136
2021-11-21 15:36:25 +00:00
Benjamin Otte
c990134e49 window: Properly distribute size between title and child
Otherwise we can end up with a window that's too small in certain corner
cases after resizing.
2021-11-21 08:19:07 +01:00
Benjamin Otte
822508f33e widget: Clear size request cache on queue_resize()
... and not later.

Otherwise future calls to sizing fucntions will reuse an outdated cache
and compute wrong values.
2021-11-21 06:08:06 +01:00
Benjamin Otte
358893aa84 window: Always clamp to max size
When computing the window size, always try to clamp to the max size.
This will shrink a window down into a sane size if it was too big
before.
2021-11-21 05:33:28 +01:00
Benjamin Otte
344fac5aa7 Merge branch 'wip/otte/for-master' into 'master'
Fixes

Closes #4469

See merge request GNOME/gtk!4182
2021-11-21 03:55:28 +00:00
Benjamin Otte
27965d5fdc builder-tool: Don't simplify enums too much
Store the enum nick, not the enum value. That way the file remains
human-readable.

Updated reftests to new expected output.
2021-11-21 02:19:57 +01:00
Benjamin Otte
c025bc5098 paned: Compute the right handle size
Testcase included

Fixes #4469
2021-11-21 01:49:40 +01:00
Benjamin Otte
170bc0a8de window: properly compute desired size
Previously, the code did not expand the size properly when a default
size was already set.

Reftest included.
2021-11-21 01:31:06 +01:00
Matthias Clasen
891fd5c604 Merge branch 'missing-the-missing-glyphs' into 'master'
Go back to using pango for glyph rendering

See merge request GNOME/gtk!4181
2021-11-20 21:56:37 +00:00
Matthias Clasen
5b1cd335bb Go back to using pango for glyph rendering
Using just cairo makes us lose hexboxes. So, until
we implement that ourselves, go back to using pango.
2021-11-20 11:13:52 -05:00
Benjamin Otte
eefb6a0dd4 sizerequest: Change critical message
Printing the affected widget leads people to assume that it is to blame
for the error. However, the widget is the object the function is being
called on, not the caller. And the caller is doing it wrong.

Usually the caller is the parent widget, so we could print that one, but
it's only usually, it can be an issue propagating from a grandparent and
it doesn't tell you from where the function is called (allocation or
measuring), so you need a debugger anyway.

So don't put anything there instead.
2021-11-20 17:05:36 +01:00
Matthias Clasen
9aaf54140f Merge branch 'wip/fix-randr-race' into 'master'
x11: Trap error when getting CRTC info

See merge request GNOME/gtk!4169
2021-11-20 14:43:48 +00:00
Samuel Thibault
c5786916f7 Revert "a11y: return -1 if parent is NULL"
This reverts commit 22847563ce.
2021-11-20 10:59:00 +01:00
Samuel Thibault
b8e009eb05 Merge branch 'wip/chergert/fix-a11y-critical' into 'master'
a11y: return -1 if parent is NULL

See merge request GNOME/gtk!4179
2021-11-20 08:14:35 +00:00
Asier Sarasua Garmendia
256d226d4b Update Basque translation 2021-11-20 07:52:06 +00:00
Benjamin Otte
7b3208092c Merge branch 'wip/otte/for-master' into 'master'
Lots of sizing fixes

See merge request GNOME/gtk!4180
2021-11-20 06:06:08 +00:00
Benjamin Otte
1eb86d6394 widget: Remove a check
That consistency check is entirely outdated and just prints confusing
stuff.
2021-11-20 06:04:10 +01:00
Benjamin Otte
a0ca936e8d sizerequestcache: Increase size
This is a quickfix to avoid infinite runtime in nested boxes with
wrapped labels.

Test included
2021-11-20 06:04:10 +01:00
Benjamin Otte
de3c50a237 sizerequest: Use g_printerr() for debug messages
glib doesn't print debug messages by default anymore.
2021-11-20 06:04:10 +01:00
Benjamin Otte
244ddea0ea paned: Always query at least min size
For shrinking children, we would not make sure of this and just throw
the current size at them.
2021-11-20 06:04:10 +01:00
Benjamin Otte
6c94835f5d stack: Make sure to not under-measure children
When the stack is homogeneous in only one direction, the other direction
may produce min sizes to small for all children. Make sure to query at
least the min size for those.
2021-11-20 06:04:10 +01:00
Benjamin Otte
617566128d stack: Index the homogeneous array by orientation 2021-11-20 06:04:10 +01:00
Benjamin Otte
7bf772111c stack: Turn the homogenenous variables into an array
that way, we can index them by orientation.
2021-11-20 06:04:10 +01:00
Benjamin Otte
50e0893497 widget: force adjustment method is one size is FILL
If halign=fill, force adjustment to height-for-width.
If valign=fill, force adjustment to width-for-height.
Otherwise look at request mode.

This way we don't try to adapt the filled dimension and only adjust
the one that is not set to fill.
2021-11-20 06:04:10 +01:00
Benjamin Otte
7459d430eb widget: Don't forget margins when adjusting
This could lead to the wrong values being passed and computing invalid
sizes which would then lead to very unhappy code.

Test included.
2021-11-19 23:46:59 +01:00
Benjamin Otte
163616cc0a sizerequest: Add a critical when for_size is too small
It's not expensive to check it because we'll cache the dfault size
request anyway, and people do it wrong a lot.
As a bonus, don't do any return_if_fail(), just use the min size
instead.
2021-11-19 23:46:59 +01:00
Fran Dieguez
e378dc4c28 Update Galician translation 2021-11-19 22:23:26 +00:00
Fran Dieguez
4876028f29 Update Galician translation 2021-11-19 22:23:10 +00:00
Christian Hergert
22847563ce a11y: return -1 if parent is NULL 2021-11-19 11:59:29 -08:00
Emmanuele Bassi
0996113d14 Merge branch 'gtk-init-doc-update' into 'master'
Documentation fix and whitespace cleanup

See merge request GNOME/gtk!4176
2021-11-19 13:40:07 +00:00
Fred Morcos
f019e9d856 Documentation fix and whitespace cleanup
- gtk_init() does not parse command-line options anymore.
- Gitlab's  WebIDE automatically cleans up whitespace.
2021-11-19 13:21:56 +00:00
Luca Bacci
48b83d3e97 Merge branch 'win32-egl-cleanup' into 'master'
GDK-Win32: Port EGL code to newer common GDK code

See merge request GNOME/gtk!4040
2021-11-19 08:42:40 +00:00
Danial Behzadi
c3211e32ae Update Persian translation 2021-11-18 22:55:28 +00:00
Matthias Clasen
c1790bf0d8 Merge branch 'matthiasc/for-master' into 'master'
node-editor: Don't make paned shrinkable

See merge request GNOME/gtk!4175
2021-11-18 22:42:25 +00:00
Matthias Clasen
6690197673 node-editor: Don't make paned shrinkable
When the handle is dragged all the way to the left,
it is impossible to get it back. Which is not fun.
2021-11-18 17:25:29 -05:00
Luca Bacci
384196efb1 Merge branch 'fix-aerosnap-4' into 'master'
GDK-Win32: Fix AeroSnap indicator and positioning

See merge request GNOME/gtk!3795
2021-11-18 12:40:21 +00:00
Chun-wei Fan
b801125797 GDK-Win32: Fix AeroSnap indicator and positioning
Ensure that we take the DPI scaling into account so that surfaces will
be placed at their correct positions upon an AeroSnap operation on HiDPI
displays.

Also, use the X coordinate of the surface as-is during snap up so that
we do not inadvertently move the surface to the very left.  Also fix the
AeroSnap indicator drawing for snap up so that it is drawn at the
correct places.

Since we are updating these functions, make the old GdkWindow-era
variable names to match better the names we use nowadays.
2021-11-18 12:40:57 +01:00
Benjamin Otte
aecdd6f68f Merge branch 'wip/otte/for-master' into 'master'
label: Don't add a pixel where none should be added

See merge request GNOME/gtk!4173
2021-11-18 07:38:53 +00:00
Benjamin Otte
899cb44519 label: Don't add a pixel where none should be added
When the text width is larger than the measuring width, set the min
width to that value, don't also add 1 to it.
2021-11-18 07:16:09 +00:00
Matthias Clasen
86175f043c Merge branch 'msal4-master-patch-74685' into 'master'
docs: use px unit for font size

See merge request GNOME/gtk!4171
2021-11-18 04:54:43 +00:00
Matthias Clasen
74c6b8e9bc Merge branch 'picture-ratio-redraw' into 'master'
picture: Setting keep-aspect-ratio requires a redraw

See merge request GNOME/gtk!4172
2021-11-18 03:43:54 +00:00
Marco Melorio
d3347e64ba picture: Setting keep-aspect-ratio requires a redraw 2021-11-18 02:39:15 +01:00
Mohammed Salman
4c8081bafc Update section-text-widget.md 2021-11-17 22:48:14 +00:00
Matthias Clasen
5995e89a80 Merge branch 'matthiasc/for-master' into 'master'
Don't spam debug messages into TAP output

See merge request GNOME/gtk!4167
2021-11-17 11:59:15 +00:00
Jonas Ådahl
b9bdbe9aae x11: Trap error when getting CRTC info
This should fix a race happening when RANDR changes quickly, e.g. during
unit testing where tests change monitor configurations rapidly.
2021-11-17 11:15:40 +01:00
Matthias Clasen
c86789427d Don't spam debug messages into TAP output
g_log_writer_standard_streams just puts all the logs
out onto stderr and stdout if we don't stop it. Pango
recently grew a bunch of g_debug calls, and those were
now showing up, making all the reftests fail.
2021-11-16 18:45:34 -05:00
Matthias Clasen
0852084884 Merge branch 'matthiasc/for-master' into 'master'
Fix formatting error in demo about dialogs

See merge request GNOME/gtk!4166
2021-11-16 22:23:31 +00:00
Matthias Clasen
96778fca92 Fix formatting error in demo about dialogs
Try harder to format things nicely.
2021-11-16 16:45:56 -05:00
Matthias Clasen
0c53b608f9 Merge branch 'bilelmoussaoui/since-annotations' into 'master'
g-i: add missing since annotations

See merge request GNOME/gtk!4154
2021-11-16 21:34:58 +00:00
Matthias Clasen
27350ad71b Merge branch 'wip/otte/for-master' into 'master'
build: Actually use the extra warnings

See merge request GNOME/gtk!4157
2021-11-16 21:31:48 +00:00
Matthias Clasen
d9d220cfc9 Merge branch 'wip/carlosg/x11-wm-drags' into 'master'
gtkmain: Disable implicit grab active state on CROSSING_GRAB leave events

Closes #4416

See merge request GNOME/gtk!4162
2021-11-16 17:21:38 +00:00
Matthias Clasen
2026256823 Merge branch 'compose-cache-symlinks' into 'master'
composetable: invalidate cache based on symlink mtime too

See merge request GNOME/gtk!4163
2021-11-16 17:21:04 +00:00
Matthias Clasen
012baeb909 Merge branch 'wip/carlosg/cancelled-gestures' into 'master'
gtkwidget: Do not check event sequence state before cancelling gesture

Closes #4387

See merge request GNOME/gtk!4160
2021-11-16 17:19:55 +00:00
Asier Sarasua Garmendia
7249961aa4 Update Basque translation 2021-11-16 16:28:52 +00:00
Emmanuele Bassi
3d77e526d6 Merge branch 'ebassi/docs-fixes' into 'master'
Small documentation fixes

See merge request GNOME/gtk!4158
2021-11-16 14:04:50 +00:00
Emmanuele Bassi
c4b2fe6ee5 docs: Add blurb for GtkEditableProperties. 2021-11-16 13:50:52 +00:00
Emmanuele Bassi
cea320af24 docs: Fix description for CellRendererAccelMode
Link to the property, instead of copy-pasting its description.
2021-11-16 13:41:52 +00:00
Emmanuele Bassi
a5bf0591ee docs: Fix link in GtkSymbolicColor description 2021-11-16 13:37:33 +00:00
Naïm Favier
22f5236943 composetable: invalidate cache based on symlink mtime too
When the compose file is a symbolic link, take the link itself's
modification time into account (in addition to its target's) in
determining whether to invalidate the compose cache.

This is useful e.g. on NixOS systems where the compose file might point
to a store path with an irrelevant modification time, and we want the
cache to expire when the symlink itself changes.
2021-11-16 12:53:38 +01:00
Carlos Garnacho
f84bcfbb97 gtkmain: Disable implicit grab active state on CROSSING_GRAB leave events
This grab-induced crossing event may come from outer means while there are
buttons pressed (e.g. WM window drags/resizes in X11), the implicit active
state should be undone in that situation.

Also, separate the handling of GDK_LEAVE_NOTIFY, as it's fundamentally
different from GDK_TOUCH_END/CANCEL handling.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4416
2021-11-16 10:58:03 +01:00
Carlos Garnacho
f36ee67226 gtkgesture: Do not cancel gesture when setting DENIED state
Touchpoint state and tracking are tangential, this is mixing up both.
This change was added in the fixes for
https://gitlab.gnome.org/GNOME/gtk/-/issues/3016 but is now unnecessary.
2021-11-16 00:47:57 +01:00
Carlos Garnacho
615b8fc569 gtkwidget: Do not check event sequence state before cancelling gesture
The sequence should be cancelled from the gesture despite its current state.
Also, there was a piece of pointer emulation that was not dropped here,
maybe breaking things further for the pointer emulated touchpoint.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4387
2021-11-16 00:41:17 +01:00
Emmanuele Bassi
ff3bb7f671 docs: Annotate Label.get_selection_bounds() out arguments
They are optional, and should be marked as such.

See issue: #4452
2021-11-15 15:35:13 +00:00
Emmanuele Bassi
39e4e48fdc docs: Enable OpenSearch on our references
By adding the `docs_url` key in the project configuration file,
gi-docgen will generate an OpenSearch XML file, which allows to add
docs.gtk.org/<reference> as a "search engine" in web browsers.
2021-11-15 15:31:35 +00:00
Benjamin Otte
300a88922e build: Disable gcc warnings as warnings, too
We use -Werror in the build, so even if some warnings are just warnings,
they'd be errors.
2021-11-15 15:35:10 +01:00
Benjamin Otte
c003260d63 build: Actually use the extra warnings
I forgot to remove the '-Werror=' part from all the extra warnings, so
the warning/error flags we generated were '-Werror=-Werror=warning-flag'
or 'W-Werror=warning-flag' - but because our compiler flag checking
infrastructure works so nicely, it just ignored these obviously wrong
flags.

Fixes commit 362e91c40b
2021-11-15 14:59:18 +01:00
Bilal Elmoussaoui
40c08954db g-i: add missing since annotations 2021-11-13 17:50:53 +01:00
Goran Vidović
fd69b41748 Update Croatian translation 2021-11-12 13:58:59 +00:00
Goran Vidović
a2191c0a68 Update Croatian translation 2021-11-12 13:06:50 +00:00
Yaron Shahrabani
c17451557f Update Hebrew translation 2021-11-11 22:30:08 +00:00
Yaron Shahrabani
b91dca9ad0 Update Hebrew translation 2021-11-11 22:29:14 +00:00
Piotr Drąg
7586e535ff Update POTFILES.skip 2021-11-11 14:23:08 +01:00
Benjamin Otte
7859b88f19 Merge branch 'wip/otte/for-master' into 'master'
label: Don't do more work than necessary

See merge request GNOME/gtk!4149
2021-11-11 04:39:58 +00:00
Benjamin Otte
7f7809f523 label: Don't do more work than necessary
We only want to determine the size pixel-exact, not pango-unit-exact, so
don't spend lots of time wondering if text is half a pixel or a quarter
pixel wider.
2021-11-11 05:24:58 +01:00
Matthias Clasen
b4c2d1dabb Merge branch 'wip/otte/no-errors-ever-again' into 'master'
build: Don't use any -Werror in release builds

Closes #4388

See merge request GNOME/gtk!4148
2021-11-11 00:50:09 +00:00
Benjamin Otte
362e91c40b build: Don't use any -Werror in release builds
Do kep them for debug and debugoptimized builds though.

Keeping -Werror flags in release builds causes issues with forward
compatibility, when new compiler releases or different toolchains
suddenly cause those warnings to be emitted during compilation.

While we certainly want those issues to be investigated and fixed, they
should not prevent anyone from building GTK until they are.

Resolves #4388
2021-11-10 20:04:07 +01:00
Quentin PAGÈS
acf6d47b6f Update Occitan translation
(cherry picked from commit 7520524aed)
2021-11-10 18:18:00 +00:00
Benjamin Otte
0903ad48f0 Merge branch 'wip/otte/for-master' into 'master'
css: Don't crash when color stop offsets descend

Closes #4424

See merge request GNOME/gtk!4143
2021-11-10 16:44:56 +00:00
Benjamin Otte
46f8600b6a css: Don't crash when color stop offsets descend
Testcase included.

Fixes #4424
2021-11-10 17:28:14 +01:00
Daniel Mustieles
fcb3638ac3 Updated Spanish translation 2021-11-10 11:32:36 +01:00
Matthias Clasen
e599b2548a Merge branch 'flatpak-build-fix' into 'master'
flatpak: Add pango to manifest

See merge request GNOME/gtk!4142
2021-11-09 20:49:31 +00:00
Matthias Clasen
98d14b4655 flatpak: Add pango to manifest
We have a tight coupling with pango, whenever new
pango API appears, our build usually breaks. So
just make our flatpak manifests build pango from git.
2021-11-09 15:25:48 -05:00
Benjamin Otte
96f7e59832 Merge branch 'wip/otte/for-master' into 'master'
gtk-demo: Don't use deprecated librsvg API

See merge request GNOME/gtk!4141
2021-11-09 19:49:37 +00:00
Benjamin Otte
061026f21f gtk-demo: Don't use deprecated librsvg API
New API requires a newer librsvg version, so require that one.
2021-11-09 20:29:49 +01:00
Benjamin Otte
330e9a8424 Merge branch 'wip/otte/for-master' into 'master'
label: Handle width-chars > text width

See merge request GNOME/gtk!4139
2021-11-09 18:31:42 +00:00
Benjamin Otte
1e47b1c610 label: Handle width-chars > text width
This was broken in wrapping labels.

Testcase included.
2021-11-09 18:34:35 +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
Emmanuele Bassi
018388d321 Unrealize ATContext on unroot
Non-root widgets should unrealize their ATContext, if they have one,
when they are unrooted, as they don't have a connection to a top level
any more.

Fixes: #4421
2021-11-08 10:18:22 +00:00
Daniel Mustieles
cf69d917c1 Updated Spanish translation 2021-11-08 10:32:50 +01:00
Chun-wei Fan
41599e5e90 GDK-Win32: Make EGL a runtime opt-in
Use the debug envvar 'GDK_DEBUG=gl-egl' to determine whether we want to try to
initialize EGL first before trying WGL, as a means for people to more easily
enable EGL support on Windows to test EGL there (such as to debug the shaders,
for instance)
2021-11-08 15:40:59 +08:00
Chun-wei Fan
1b2e69f6c0 GDK-Win32: Realize EGL using common realization code
This will clean up the EGL code in GDK-Win32, as well as fixing crashes caused
by using an invalid EGL context in gdk_gl_context_make_current() as we did not
store up the EGL context in the correct place (lost during the transition to
the common EGL initialization code).

On the Windows/libANGLE side, the initialization of EGL has now fully moved to
the common code in GDK, but we will still default on WGL for now.  Help is
really appreciated for fixing the shaders on libANGLE!
2021-11-08 15:40:49 +08:00
Chun-wei Fan
ee45869759 gdkdisplay.c: Fix builds without EGL
We need to ensure that gdk_display_get_egl_display() is available even if EGL
is not enabled in the build, so that things will continue to link and work.

For builds without EGL, just return NULL.
2021-11-08 15:25:24 +08:00
Chun-wei Fan
048fe84888 GDK-Win32: Port to common EGL handling code
This will port the EGL code in GDK-Win32 to use the common GDK code to
initialize EGL.  However, at the current state, although EGL is
correctly initialized, this code is disabled for now since
gdk_gl_context_make_current() fails as the shaders do not work for EGL
via libANGLE on Windows.

We can now clean things up in gdkglcontext-win32-egl.c as a result.
2021-11-08 15:25:24 +08:00
Chun-wei Fan
480031439f GDK-Win32: Drop GDK_WIN32_ENABLE_EGL flag
Instead, use HAVE_EGL check macro instead, which is used by the other
platforms as well.
2021-11-08 15:25:24 +08: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
Caolán McNamara
155b791d43 update focus indicators in popovers
https://gitlab.gnome.org/GNOME/gtk/-/issues/4383
2021-11-05 13:50:48 +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
Matthias Clasen
031c37c7b0 theme: Remove GtkToolbar remnants
We don't ship a widget with css name 'toolbar'
anymore, so don't waste selectors on it.
2021-10-29 11:51:18 -04:00
Matthias Clasen
860821114a Don't make all buttons in toolbars flat
When a combobox is put in a toolbar, we don't want
its button to lose its border.

Fixes: #4384
2021-10-29 11:51:18 -04:00
Matthias Clasen
73bba62d82 widget-factory: Add a color button to the toolbar
This is to check that our 'nested' buttons come out as
expected in a toolbar context.
2021-10-29 11:51:18 -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
Marc-André Lureau
42249ce28e gtk: fix GTK_INVALID_LIST_POSITION type
Unless there is an explicit front cast, constants are generally int for g-i.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-07-08 13:08:43 +04:00
1181 changed files with 192419 additions and 184152 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:v36"
FLATPAK_IMAGE: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master"
.only-default:
@@ -88,9 +88,10 @@ fedora-x86_64:
- meson compile -C _build
- meson install -C _build
- PKG_CONFIG_PATH=${CI_PROJECT_DIR}/_install/lib64/pkgconfig:${CI_PROJECT_DIR}/_install/share/pkgconfig meson setup _build_hello examples/hello
- meson compile -C _build_hello
- LD_LIBRARY_PATH=${CI_PROJECT_DIR}/_install/lib64 meson compile -C _build_hello
- .gitlab-ci/run-tests.sh _build x11
- .gitlab-ci/run-tests.sh _build wayland
- .gitlab-ci/run-tests.sh _build waylandgles
- .gitlab-ci/run-tests.sh _build broadway
release-build:
@@ -155,6 +156,11 @@ msys2-mingw64:
variables:
MSYSTEM: "MINGW64"
CHERE_INVOKING: "yes"
artifacts:
when: always
expose_as: 'Windows_DLL_MSYS2_64_bit_toolchain'
paths:
- "${CI_PROJECT_DIR}/_build/gtkdll.tar.gz"
macos:
extends: .only-default
@@ -166,7 +172,7 @@ macos:
needs: []
before_script:
- bash .gitlab-ci/show-info-osx.sh
- pip3 install --user meson==0.56
- pip3 install --user meson==0.59
- pip3 install --user ninja
- export PATH=/Users/gitlabrunner/Library/Python/3.7/bin:$PATH
- export MESON_FORCE_BACKTRACE=1
@@ -220,11 +226,11 @@ vs2017-x64:
extends: .flatpak-defaults
when: manual
# Only build Flatpak bundles automatically on master
.flatpak-master:
# Only build Flatpak bundles automatically on main
.flatpak-main:
extends: .flatpak-defaults
only:
- master
- main
flatpak-manual:demo:
extends: .flatpak-manual
@@ -232,8 +238,8 @@ flatpak-manual:demo:
variables:
APPID: org.gtk.Demo4
flatpak-master:demo:
extends: .flatpak-master
flatpak-main:demo:
extends: .flatpak-main
needs: []
variables:
APPID: org.gtk.Demo4
@@ -244,8 +250,8 @@ flatpak-manual:widget-factory:
variables:
APPID: org.gtk.WidgetFactory4
flatpak-master:widget-factory:
extends: .flatpak-master
flatpak-main:widget-factory:
extends: .flatpak-main
needs: []
variables:
APPID: org.gtk.WidgetFactory4
@@ -256,8 +262,8 @@ flatpak-manual:icon-browser:
variables:
APPID: org.gtk.IconBrowser4
flatpak-master:icon-browser:
extends: .flatpak-master
flatpak-main:icon-browser:
extends: .flatpak-main
needs: []
variables:
APPID: org.gtk.IconBrowser4
@@ -267,18 +273,18 @@ flatpak-master:icon-browser:
# https://gitlab.gnome.org/GNOME/Initiatives/-/wikis/DevOps-with-Flatpak
nightly demo:
extends: '.publish_nightly'
dependencies: ['flatpak-master:demo']
needs: ['flatpak-master:demo']
dependencies: ['flatpak-main:demo']
needs: ['flatpak-main:demo']
nightly factory:
extends: '.publish_nightly'
dependencies: ['flatpak-master:widget-factory']
needs: ['flatpak-master:widget-factory']
dependencies: ['flatpak-main:widget-factory']
needs: ['flatpak-main:widget-factory']
nightly icon-browser:
extends: '.publish_nightly'
dependencies: ['flatpak-master:icon-browser']
needs: ['flatpak-master:icon-browser']
dependencies: ['flatpak-main:icon-browser']
needs: ['flatpak-main:icon-browser']
static-scan:
image: $FEDORA_IMAGE
@@ -345,4 +351,4 @@ publish-docs:
- "curl -X POST -F token=${PAGES_TRIGGER_TOKEN} -F ref=docs-gtk-org https://gitlab.gnome.org/api/v4/projects/665/trigger/pipeline"
only:
refs:
- master
- main

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 \
@@ -93,6 +95,8 @@ RUN dnf -y install \
weston-libs \
which \
xorg-x11-server-Xvfb \
&& dnf install -y 'dnf-command(builddep)' \
&& dnf builddep -y wayland \
&& dnf clean all
# Enable sudo for wheel users

View File

@@ -43,6 +43,6 @@ flatpak build-bundle \
${appid}
# to be consumed by the nightly publish jobs
if [[ $CI_COMMIT_BRANCH == master ]]; then
if [[ $CI_COMMIT_BRANCH == main ]]; then
tar cf repo.tar ${repodir}
fi

View File

@@ -268,7 +268,7 @@ aparser.add_argument('--job-id', metavar='ID',
default=None)
aparser.add_argument('--branch', metavar='NAME',
help='Branch of the project being tested',
default='master')
default='main')
aparser.add_argument('--output', metavar='FILE',
help='The output HTML file, stdout by default',
type=argparse.FileType('w', encoding='UTF-8'),

View File

@@ -27,7 +27,7 @@ aparser.add_argument('--job-id', metavar='ID',
default='Unknown')
aparser.add_argument('--branch', metavar='NAME',
help='Branch of the project being tested',
default='master')
default='main')
aparser.add_argument('--output', metavar='FILE',
help='The output file, stdout by default',
type=argparse.FileType('w', encoding='UTF-8'),

View File

@@ -2,7 +2,7 @@
set -e
# We need to add a new remote for the upstream master, since this script could
# We need to add a new remote for the upstream main, since this script could
# be running in a personal fork of the repository which has out of date branches.
if [ "${CI_PROJECT_NAMESPACE}" != "GNOME" ]; then
echo "Retrieving the current upstream repository from ${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}..."
@@ -16,7 +16,7 @@ fi
# Work out the newest common ancestor between the detached HEAD that this CI job
# has checked out, and the upstream target branch (which will typically be
# `upstream/master` or `upstream/gtk-3-24`).
# `upstream/main` or `upstream/gtk-3-24`).
#
# `${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}` is only defined if were running in
# a merge request pipeline; fall back to `${CI_DEFAULT_BRANCH}` otherwise.
@@ -36,7 +36,7 @@ exit_status=$?
echo ""
echo "Note that clang-format output is advisory and cannot always match the"
echo "GTK coding style, documented at:"
echo " https://gitlab.gnome.org/GNOME/gtk/blob/master/docs/CODING-STYLE"
echo " https://gitlab.gnome.org/GNOME/gtk/blob/main/docs/CODING-STYLE"
echo "Warnings from this tool can be ignored in favour of the documented "
echo "coding style, or in favour of matching the style of existing"
echo "surrounding code."

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

@@ -5,8 +5,8 @@ call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliar
@echo on
:: FIXME: make warnings fatal
pip3 install --upgrade --user meson==0.56.2 || goto :error
meson -Dmedia-gstreamer=disabled _build || goto :error
pip3 install --upgrade --user meson==0.59 || goto :error
meson -Ddebug=false -Dmedia-gstreamer=disabled _build || goto :error
ninja -C _build || goto :error
goto :EOF

View File

@@ -15,9 +15,9 @@ pacman --noconfirm -Suy
pacman --noconfirm -S --needed \
base-devel \
git \
mingw-w64-$MSYS2_ARCH-toolchain \
mingw-w64-$MSYS2_ARCH-cc \
mingw-w64-$MSYS2_ARCH-ccache \
mingw-w64-$MSYS2_ARCH-pkg-config \
mingw-w64-$MSYS2_ARCH-pkgconf \
mingw-w64-$MSYS2_ARCH-gobject-introspection \
mingw-w64-$MSYS2_ARCH-meson \
mingw-w64-$MSYS2_ARCH-adwaita-icon-theme \
@@ -30,8 +30,9 @@ pacman --noconfirm -S --needed \
mingw-w64-$MSYS2_ARCH-libepoxy \
mingw-w64-$MSYS2_ARCH-pango \
mingw-w64-$MSYS2_ARCH-fribidi \
mingw-w64-$MSYS2_ARCH-gst-plugins-bad \
mingw-w64-$MSYS2_ARCH-shared-mime-info
mingw-w64-$MSYS2_ARCH-gst-plugins-bad-libs \
mingw-w64-$MSYS2_ARCH-shared-mime-info \
mingw-w64-$MSYS2_ARCH-python-gobject
mkdir -p _ccache
export CCACHE_BASEDIR="$(pwd)"
@@ -48,7 +49,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.50.0 pango; then
git clone https://gitlab.gnome.org/GNOME/pango.git _pango
meson setup _pango_build _pango
meson compile -C _pango_build
@@ -72,3 +73,5 @@ unset CCACHE_DISABLE
ninja -C _build
ccache --show-stats
tar zcf _build/gtkdll.tar.gz _build/gtk/libgtk*.dll

View File

@@ -1,7 +1,7 @@
<!--
Please, read the CONTRIBUTING.md guide on how to file a new issue.
https://gitlab.gnome.org/GNOME/gtk/-/blob/master/CONTRIBUTING.md
https://gitlab.gnome.org/GNOME/gtk/-/blob/main/CONTRIBUTING.md
-->
## Steps to reproduce
<!--

View File

@@ -1,7 +1,7 @@
<!--
Please, read the CONTRIBUTING.md guide on how to file a new issue.
https://gitlab.gnome.org/GNOME/gtk/-/blob/master/CONTRIBUTING.md
https://gitlab.gnome.org/GNOME/gtk/-/blob/main/CONTRIBUTING.md
-->
## Steps to reproduce

View File

@@ -256,7 +256,7 @@ people committing to GTK to follow a few rules:
0. Always write a meaningful commit message. Changes without a sufficient
commit message will be reverted.
0. Never push to the `master` branch, or any stable branches, directly; you
0. Never push to the `main` branch, or any stable branches, directly; you
should always go through a merge request, to ensure that the code is
tested on the CI infrastructure at the very least. A merge request is
also the proper place to get a comprehensive code review from the core

303
NEWS
View File

@@ -1,19 +1,318 @@
Overview of Changes
===================
Overview of Changes in 4.6.1, 11-02-2022
========================================
* GtkFontChooser:
- Stop using PangoFc api
- Fix a crash
- Use new HarfBuzz api
* GtkMenuButton:
- Update accessible description
* GtkTextView:
- Fix intra-widget dnd
* Printing:
- Fix an fd leak
* Input:
- Make sure input methods get focus-in events
- Always flush events to avoid scroll event pileup
- Support hold events
- Update keysyms from libxkbcommon
* Theme:
- Improve text selection legibility
* Introspection:
- Add missing nullable annotations everywhere
* Build:
- Make stack noexec again
- Avoid symbol leaks
- Drop unneeded script data
* Windows:
- Stop using WM_SYNCPAINT
- Relax check for GL 3.x legacy contexts
- Use native apis for language names
- Rewrite the keymap code
- Use the GL renderer by default
* Wayland:
- Fix support for the new high-contrast setting
- Avoid redundant scale changes
- Fix DND hotspot handling
- Don't always restore the saved size when floating
* MacOS:
- Various performance improvements
* Translation updates:
Brazilian Portuguese
Catalan
Chinese (China)
Galician
Hebrew
Japanese
Lithuanian
Persian
Polish
Portuguese
Russian
Slovenian
Spanish
Ukrainian
Overview of Changes in 4.6.0, 30-12-2021
========================================
* GtkProgressBar:
- Fix handling of "inverted"
* GtkLabel:
- Add a "natural wrap mode" property to influence how
natural width is determined
* GtkTextView
- Scroll insertion on-screen after undo / redo
* gsk:
- Abort region diffing when changes are too complex
* gdk:
- Avoid compressing discrete scroll events
- Fix problems with hiding windows
- Improve GL and GLES version checks
* Wayland:
- Support new high-contrast setting
* Inspector:
- Add DND inspection support
* build:
- Avoid deprecated meson apis
* Translation updates
Galician
Portuguese
Ukrainian
Overview of Changes in 4.5.1, 16-12-2021
========================================
* GtkWidget sizing has been rewritten to implement
width-for-height more properly. This had some fallout,
and some widgets may still not react kindly to the
new way of doing things.
See https://blog.gtk.org/2021/12/03/sizable-news/
for details, and please file issues if you notice fallout.
* Rename git `master` branch to `main`
* Css:
- Fully support font-variant-caps
- Fix a crash with gradients
* Make various widgets activatable:
- GtkComboBox
- GtkDropDown
* GtkPopover:
- Make focus indicators not disappear
* GtkTextView:
- Don't leave embedded children stranded when scrolling
- Don't insert Emoji into non-editable textviews
- Fix Emoji chooser positioning
- Fix problems with pasting text
- Improve scroll-to-mark behavior
- Support right-aligned, centered and decimal tabs
- Make child anchor replacement character settable
- Provide more context to input methods
* GtkDragIcon:
- Provide default icons for paintables and files
* GtkBuilder:
- Speed up template precompilation
* Actions:
- Reduce allocations during signal emissions
- Avoid duplication and unnecessary recursion
* Inspector:
- Show the selected im-module in the General tab
- Add a clipboard viewer
- Make the recorder record events too
- Add a graph visualizing gtk_widget_measure()
* Gsk:
- Fix hexbox rendering
- Fix transformed linear gradient rendering
* Printing:
- Fix dialog-less printing
* Windows:
- Use the common EGL setup code
- Respect GDK_DEBUG=gl-egl
- Fix AeroSnap indicator and positioning
* X11:
- Improve behavior of windows drags on headerbar controls
- Trap errors for RANDR changes
- Fix problems with drag icons
* Wayland:
- Ensure we prefer the Wayland im-module over others
* Translation updates
Basque
Catalan
Croatian
Friulian
Galician
Hebrew
Icelandic
Italian
Latvian
Lithuanian
Occitan
Persian
Portuguese
Spanish
Swedish
Ukrainian
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

@@ -1,7 +1,7 @@
GTK — The GTK toolkit
=====================
[![Build status](https://gitlab.gnome.org/GNOME/gtk/badges/master/pipeline.svg)](https://gitlab.gnome.org/GNOME/gtk/-/commits/master)
[![Build status](https://gitlab.gnome.org/GNOME/gtk/badges/main/pipeline.svg)](https://gitlab.gnome.org/GNOME/gtk/-/commits/main)
General information
-------------------
@@ -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
@@ -38,7 +40,7 @@ Nightly documentation can be found at
Nightly flatpaks of our demos can be installed from the
[GNOME Nightly](https://wiki.gnome.org/Apps/Nightly) repository:
- `flatpak remote-add --if-not-exists gnome-nightly https://nightly.gnome.org/gnome-nightly.flatpakrepo`
- `flatpak remote-add --if-not-exists gnome-nightly https://nightly.gnome.org/gnome-nightly.flatpakrepo`
- `flatpak install gnome-nightly org.gtk.Demo4`
- `flatpak install gnome-nightly org.gtk.WidgetFactory4`
- `flatpak install gnome-nightly org.gtk.IconBrowser4`
@@ -112,7 +114,21 @@ 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)
Default branch renamed to `main`
--------------------------------
The default development branch of GTK has been renamed to `main`.
To update your local checkout, use:
```sh
git checkout master
git branch -m master main
git fetch
git branch --unset-upstream
git branch -u origin/main
git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main
```
How to report bugs
------------------
@@ -151,6 +167,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

@@ -43,7 +43,8 @@
"sources" : [
{
"type" : "git",
"url" : "https://gitlab.freedesktop.org/wayland/wayland.git"
"url" : "https://gitlab.freedesktop.org/wayland/wayland.git",
"branch" : "main"
}
]
},
@@ -164,6 +165,21 @@
}
]
},
{
"name" : "pango",
"buildsystem" : "meson",
"builddir" : true,
"config-opts" : [
"--libdir=/app/lib"
],
"sources" : [
{
"type" : "git",
"url" : "https://gitlab.gnome.org/GNOME/pango.git",
"branch" : "main"
}
]
},
{
"name" : "gtk",
"buildsystem" : "meson",
@@ -177,7 +193,8 @@
"sources" : [
{
"type" : "git",
"url" : "https://gitlab.gnome.org/GNOME/gtk.git"
"url" : "https://gitlab.gnome.org/GNOME/gtk.git",
"branch" : "main"
}
]
}

View File

@@ -43,7 +43,8 @@
"sources" : [
{
"type" : "git",
"url" : "https://gitlab.freedesktop.org/wayland/wayland.git"
"url" : "https://gitlab.freedesktop.org/wayland/wayland.git",
"branch" : "main"
}
]
},
@@ -93,6 +94,21 @@
}
]
},
{
"name" : "pango",
"buildsystem" : "meson",
"builddir" : true,
"config-opts" : [
"--libdir=/app/lib"
],
"sources" : [
{
"type" : "git",
"url" : "https://gitlab.gnome.org/GNOME/pango.git",
"branch" : "main"
}
]
},
{
"name" : "gtk",
"buildsystem" : "meson",
@@ -106,7 +122,8 @@
"sources" : [
{
"type" : "git",
"url" : "https://gitlab.gnome.org/GNOME/gtk.git"
"url" : "https://gitlab.gnome.org/GNOME/gtk.git",
"branch" : "main"
}
]
}

View File

@@ -43,7 +43,8 @@
"sources" : [
{
"type" : "git",
"url" : "https://gitlab.freedesktop.org/wayland/wayland.git"
"url" : "https://gitlab.freedesktop.org/wayland/wayland.git",
"branch" : "main"
}
]
},
@@ -93,6 +94,21 @@
}
]
},
{
"name" : "pango",
"buildsystem" : "meson",
"builddir" : true,
"config-opts" : [
"--libdir=/app/lib"
],
"sources" : [
{
"type" : "git",
"url" : "https://gitlab.gnome.org/GNOME/pango.git",
"branch" : "main"
}
]
},
{
"name" : "gtk",
"buildsystem" : "meson",
@@ -106,7 +122,8 @@
"sources" : [
{
"type" : "git",
"url" : "https://gitlab.gnome.org/GNOME/gtk.git"
"url" : "https://gitlab.gnome.org/GNOME/gtk.git",
"branch" : "main"
}
]
}

View File

@@ -13,7 +13,7 @@ if 'DESTDIR' not in os.environ:
gtk_moduledir = os.path.join(gtk_libdir, 'gtk-' + gtk_api_version, gtk_abi_version)
gtk_printmodule_dir = os.path.join(gtk_moduledir, 'printbackends')
gtk_immodule_dir = os.path.join(gtk_moduledir, 'immodules')
gtk_mediamodule_dir = os.path.join(gtk_moduledir, 'media')
print('Compiling GSettings schemas...')
glib_compile_schemas = subprocess.check_output(['pkg-config',
@@ -40,6 +40,6 @@ if 'DESTDIR' not in os.environ:
gio_querymodules = 'gio-querymodules'
subprocess.call([gio_querymodules, gtk_printmodule_dir])
print('Updating module cache for input methods...')
os.makedirs(gtk_immodule_dir, exist_ok=True)
subprocess.call([gio_querymodules, gtk_immodule_dir])
print('Updating module cache for media backends...')
os.makedirs(gtk_mediamodule_dir, exist_ok=True)
subprocess.call([gio_querymodules, gtk_mediamodule_dir])

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

@@ -17,7 +17,7 @@ executable('gtk4-constraint-editor',
c_args: common_cflags,
dependencies: libgtk_dep,
include_directories: confinc,
gui_app: true,
win_subsystem: 'windows',
link_args: extra_demo_ldflags,
install: false,
)

View File

@@ -1,12 +1,10 @@
/* Clipboard
*
* GdkClipboard is used for clipboard handling. This demo shows how to
* copy and paste text to and from the clipboard.
* copy and paste text, images, colors or files to and from the clipboard.
*
* It also shows how to transfer images via the clipboard or via
* drag-and-drop, and how to make clipboard contents persist after
* the application exits. Clipboard persistence requires a clipboard
* manager to run.
* You can also use Drag-And-Drop to copy the data from the source to the
* target.
*/
#include <glib/gi18n.h>
@@ -14,22 +12,103 @@
#include <string.h>
#include "demoimage.h"
static GtkWidget *window = NULL;
static void
copy_button_clicked (GtkStack *source_stack,
gpointer user_data)
{
GdkClipboard *clipboard;
const char *visible_child_name;
GtkWidget *visible_child;
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (source_stack));
visible_child = gtk_stack_get_visible_child (source_stack);
visible_child_name = gtk_stack_get_visible_child_name (source_stack);
if (strcmp (visible_child_name, "Text") == 0)
{
gdk_clipboard_set_text (clipboard, gtk_editable_get_text (GTK_EDITABLE (visible_child)));
}
else if (strcmp (visible_child_name, "Image") == 0)
{
GtkWidget *child;
for (child = gtk_widget_get_first_child (visible_child); child; child = gtk_widget_get_next_sibling (child))
{
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (child)))
{
GtkWidget *image = gtk_widget_get_first_child (child);
GdkPaintable *paintable = gtk_image_get_paintable (GTK_IMAGE (image));
if (GDK_IS_TEXTURE (paintable))
gdk_clipboard_set (clipboard, GDK_TYPE_TEXTURE, paintable);
else
gdk_clipboard_set (clipboard, GDK_TYPE_PAINTABLE, paintable);
break;
}
}
}
else if (strcmp (visible_child_name, "Color") == 0)
{
GdkRGBA color;
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (visible_child), &color);
gdk_clipboard_set (clipboard, GDK_TYPE_RGBA, &color);
}
else if (strcmp (visible_child_name, "File") == 0)
{
gdk_clipboard_set (clipboard, G_TYPE_FILE, g_object_get_data (G_OBJECT (visible_child), "file"), NULL);
}
else
{
g_print ("TODO");
}
}
static void
copy_button_clicked (GtkWidget *button,
gpointer user_data)
present_value (GtkStack *dest_stack,
const GValue *value)
{
GtkWidget *entry;
GdkClipboard *clipboard;
GtkWidget *child;
entry = GTK_WIDGET (user_data);
if (G_VALUE_HOLDS (value, G_TYPE_FILE))
{
GFile *file;
/* Get the clipboard object */
clipboard = gtk_widget_get_clipboard (entry);
gtk_stack_set_visible_child_name (dest_stack, "File");
child = gtk_stack_get_visible_child (dest_stack);
/* Set clipboard text */
gdk_clipboard_set_text (clipboard, gtk_editable_get_text (GTK_EDITABLE (entry)));
file = g_value_get_object (value);
g_object_set (child, "label", g_file_peek_path (file), NULL);
}
else if (G_VALUE_HOLDS (value, GDK_TYPE_RGBA))
{
GdkRGBA *color;
gtk_stack_set_visible_child_name (dest_stack, "Color");
child = gtk_widget_get_first_child (gtk_stack_get_visible_child (dest_stack));
color = g_value_get_boxed (value);
g_object_set (child, "rgba", color, NULL);
}
else if (G_VALUE_HOLDS (value, GDK_TYPE_TEXTURE) ||
G_VALUE_HOLDS (value, GDK_TYPE_PAINTABLE))
{
GdkPaintable *paintable;
gtk_stack_set_visible_child_name (dest_stack, "Image");
child = gtk_stack_get_visible_child (dest_stack);
paintable = g_value_get_object (value);
g_object_set (child, "paintable", paintable, NULL);
}
else if (G_VALUE_HOLDS (value, G_TYPE_STRING))
{
gtk_stack_set_visible_child_name (dest_stack, "Text");
child = gtk_stack_get_visible_child (dest_stack);
gtk_label_set_label (GTK_LABEL (child), g_value_get_string (value));
}
}
static void
@@ -37,149 +116,259 @@ paste_received (GObject *source_object,
GAsyncResult *result,
gpointer user_data)
{
GtkStack *dest_stack = user_data;
GdkClipboard *clipboard;
GtkWidget *entry;
char *text;
const GValue *value;
GError *error = NULL;
clipboard = GDK_CLIPBOARD (source_object);
entry = GTK_WIDGET (user_data);
/* Get the resulting text of the read operation */
text = gdk_clipboard_read_text_finish (clipboard, result, &error);
if (text)
value = gdk_clipboard_read_value_finish (clipboard, result, &error);
if (value)
{
/* Set the entry text */
gtk_editable_set_text (GTK_EDITABLE (entry), text);
g_free (text);
present_value (dest_stack, value);
}
else
{
GtkWidget *dialog;
/* Show an error about why pasting failed.
* Usually you probably want to ignore such failures,
* but for demonstration purposes, we show the error.
*/
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Could not paste text: %s",
error->message);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (dialog);
g_print ("%s\n", error->message);
g_error_free (error);
}
}
static void
paste_button_clicked (GtkWidget *button,
gpointer user_data)
paste_button_clicked (GtkStack *dest_stack,
gpointer user_data)
{
GtkWidget *entry;
GdkClipboard *clipboard;
GdkContentFormats *formats;
entry = GTK_WIDGET (user_data);
clipboard = gtk_widget_get_clipboard (GTK_WIDGET (dest_stack));
formats = gdk_clipboard_get_formats (clipboard);
/* Get the clipboard object */
clipboard = gtk_widget_get_clipboard (entry);
if (gdk_content_formats_contain_gtype (formats, GDK_TYPE_TEXTURE))
gdk_clipboard_read_value_async (clipboard, GDK_TYPE_TEXTURE, 0, NULL, paste_received, dest_stack);
else if (gdk_content_formats_contain_gtype (formats, GDK_TYPE_PAINTABLE))
gdk_clipboard_read_value_async (clipboard, GDK_TYPE_PAINTABLE, 0, NULL, paste_received, dest_stack);
else if (gdk_content_formats_contain_gtype (formats, GDK_TYPE_RGBA))
gdk_clipboard_read_value_async (clipboard, GDK_TYPE_RGBA, 0, NULL, paste_received, dest_stack);
else if (gdk_content_formats_contain_gtype (formats, G_TYPE_FILE))
gdk_clipboard_read_value_async (clipboard, G_TYPE_FILE, 0, NULL, paste_received, dest_stack);
else if (gdk_content_formats_contain_gtype (formats, G_TYPE_STRING))
gdk_clipboard_read_value_async (clipboard, G_TYPE_STRING, 0, NULL, paste_received, dest_stack);
}
/* Request the contents of the clipboard, contents_received will be
called when we do get the contents.
*/
gdk_clipboard_read_text_async (clipboard, NULL, paste_received, entry);
static void
update_copy_button_sensitivity (GtkWidget *source_stack)
{
GtkButton *copy_button;
const char *visible_child_name;
GtkWidget *visible_child;
gboolean sensitive;
copy_button = GTK_BUTTON (g_object_get_data (G_OBJECT (source_stack), "copy-button"));
visible_child = gtk_stack_get_visible_child (GTK_STACK (source_stack));
visible_child_name = gtk_stack_get_visible_child_name (GTK_STACK (source_stack));
if (strcmp (visible_child_name, "Text") == 0)
{
sensitive = strlen (gtk_editable_get_text (GTK_EDITABLE (visible_child))) > 0;
}
else if (strcmp (visible_child_name, "Color") == 0 ||
strcmp (visible_child_name, "Image") == 0)
{
sensitive = TRUE;
}
else if (strcmp (visible_child_name, "File") == 0)
{
sensitive = g_object_get_data (G_OBJECT (visible_child), "file") != NULL;
}
else
{
sensitive = FALSE;
}
gtk_widget_set_sensitive (GTK_WIDGET (copy_button), sensitive);
}
static void
source_changed_cb (GtkButton *copy_button,
GParamSpec *pspec,
GtkWidget *source_stack)
{
update_copy_button_sensitivity (source_stack);
}
static void
text_changed_cb (GtkButton *copy_button,
GParamSpec *pspec,
GtkWidget *entry)
{
update_copy_button_sensitivity (gtk_widget_get_ancestor (entry, GTK_TYPE_STACK));
}
static void
file_button_set_file (GtkButton *button,
GFile *file)
{
gtk_label_set_label (GTK_LABEL (gtk_button_get_child (button)), g_file_peek_path (file));
g_object_set_data_full (G_OBJECT (button), "file", g_object_ref (file), g_object_unref);
}
static void
file_chooser_response (GtkNativeDialog *dialog,
int response,
GtkButton *button)
{
gtk_native_dialog_hide (dialog);
if (response == GTK_RESPONSE_ACCEPT)
{
GFile *file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
file_button_set_file (button, file);
g_object_unref (file);
update_copy_button_sensitivity (gtk_widget_get_ancestor (GTK_WIDGET (button), GTK_TYPE_STACK));
}
gtk_native_dialog_destroy (dialog);
}
static void
open_file_cb (GtkWidget *button)
{
GtkFileChooserNative *chooser;
chooser = gtk_file_chooser_native_new ("Choose a file",
GTK_WINDOW (gtk_widget_get_ancestor (button, GTK_TYPE_WINDOW)),
GTK_FILE_CHOOSER_ACTION_OPEN,
"_Open",
"_Cancel");
g_signal_connect (chooser, "response", G_CALLBACK (file_chooser_response), button);
gtk_native_dialog_show (GTK_NATIVE_DIALOG (chooser));
}
static void
update_paste_button_sensitivity (GdkClipboard *clipboard,
GtkWidget *paste_button)
{
GdkContentFormats *formats;
gboolean sensitive = FALSE;
formats = gdk_clipboard_get_formats (clipboard);
if (gdk_content_formats_contain_gtype (formats, G_TYPE_FILE) ||
gdk_content_formats_contain_gtype (formats, GDK_TYPE_RGBA) ||
gdk_content_formats_contain_gtype (formats, GDK_TYPE_TEXTURE) ||
gdk_content_formats_contain_gtype (formats, GDK_TYPE_PAINTABLE) ||
gdk_content_formats_contain_gtype (formats, G_TYPE_STRING))
sensitive = TRUE;
gtk_widget_set_sensitive (paste_button, sensitive);
}
static void
unset_clipboard_handler (gpointer data)
{
GdkClipboard *clipboard = gtk_widget_get_clipboard (GTK_WIDGET (data));
g_signal_handlers_disconnect_by_func (clipboard, update_paste_button_sensitivity, data);
}
static gboolean
on_drop (GtkStack *dest_stack,
const GValue *value,
double x,
double y,
gpointer data)
{
present_value (dest_stack, value);
return TRUE;
}
static GdkContentProvider *
drag_prepare (GtkDragSource *drag_source,
double x,
double y,
gpointer data)
{
GtkWidget *button;
GValue value = G_VALUE_INIT;
button = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (drag_source));
if (GTK_IS_TOGGLE_BUTTON (button))
{
GtkWidget *image = gtk_widget_get_first_child (button);
GdkPaintable *paintable = gtk_image_get_paintable (GTK_IMAGE (image));
if (GDK_IS_TEXTURE (paintable))
{
g_value_init (&value, GDK_TYPE_TEXTURE);
g_value_set_object (&value, paintable);
}
else
{
g_value_init (&value, GDK_TYPE_PAINTABLE);
g_value_set_object (&value, paintable);
}
}
else
{
GFile *file = g_object_get_data (G_OBJECT (button), "file");
if (file)
{
g_value_init (&value, G_TYPE_FILE);
g_value_set_object (&value, file);
}
else
return NULL;
}
return gdk_content_provider_new_for_value (&value);
}
GtkWidget *
do_clipboard (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
if (!window)
{
GtkWidget *vbox, *hbox;
GtkWidget *label;
GtkWidget *entry, *button;
GtkWidget *image;
GtkBuilderScope *scope;
GtkBuilder *builder;
GtkWidget *button;
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_title (GTK_WINDOW (window), "Clipboard");
scope = gtk_builder_cscope_new ();
gtk_builder_cscope_add_callback_symbols (GTK_BUILDER_CSCOPE (scope),
"copy_button_clicked", G_CALLBACK (copy_button_clicked),
"paste_button_clicked", G_CALLBACK (paste_button_clicked),
"source_changed_cb", G_CALLBACK (source_changed_cb),
"text_changed_cb", G_CALLBACK (text_changed_cb),
"open_file_cb", G_CALLBACK (open_file_cb),
"on_drop", G_CALLBACK (on_drop),
"drag_prepare", G_CALLBACK (drag_prepare),
NULL);
builder = gtk_builder_new ();
gtk_builder_set_scope (builder, scope);
gtk_builder_add_from_resource (builder, "/clipboard/clipboard.ui", NULL);
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
gtk_widget_set_margin_start (vbox, 8);
gtk_widget_set_margin_end (vbox, 8);
gtk_widget_set_margin_top (vbox, 8);
gtk_widget_set_margin_bottom (vbox, 8);
button = GTK_WIDGET (gtk_builder_get_object (builder, "copy_button"));
g_object_set_data (gtk_builder_get_object (builder, "source_stack"), "copy-button", button);
gtk_window_set_child (GTK_WINDOW (window), vbox);
button = GTK_WIDGET (gtk_builder_get_object (builder, "paste_button"));
g_signal_connect (gtk_widget_get_clipboard (button), "changed",
G_CALLBACK (update_paste_button_sensitivity), button);
g_object_set_data_full (G_OBJECT (button), "clipboard-handler", button, unset_clipboard_handler);
label = gtk_label_new ("\"Copy\" will copy the text\nin the entry to the clipboard");
gtk_box_append (GTK_BOX (vbox), label);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
gtk_widget_set_margin_start (hbox, 8);
gtk_widget_set_margin_end (hbox, 8);
gtk_widget_set_margin_top (hbox, 8);
gtk_widget_set_margin_bottom (hbox, 8);
gtk_box_append (GTK_BOX (vbox), hbox);
/* Create the first entry */
entry = gtk_entry_new ();
gtk_box_append (GTK_BOX (hbox), entry);
/* Create the button */
button = gtk_button_new_with_mnemonic (_("_Copy"));
gtk_box_append (GTK_BOX (hbox), button);
g_signal_connect (button, "clicked",
G_CALLBACK (copy_button_clicked), entry);
label = gtk_label_new ("\"Paste\" will paste the text from the clipboard to the entry");
gtk_box_append (GTK_BOX (vbox), label);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
gtk_widget_set_margin_start (hbox, 8);
gtk_widget_set_margin_end (hbox, 8);
gtk_widget_set_margin_top (hbox, 8);
gtk_widget_set_margin_bottom (hbox, 8);
gtk_box_append (GTK_BOX (vbox), hbox);
/* Create the second entry */
entry = gtk_entry_new ();
gtk_box_append (GTK_BOX (hbox), entry);
/* Create the button */
button = gtk_button_new_with_mnemonic (_("_Paste"));
gtk_box_append (GTK_BOX (hbox), button);
g_signal_connect (button, "clicked",
G_CALLBACK (paste_button_clicked), entry);
label = gtk_label_new ("Images can be transferred via the clipboard, too");
gtk_box_append (GTK_BOX (vbox), label);
hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 4);
gtk_widget_set_margin_start (hbox, 8);
gtk_widget_set_margin_end (hbox, 8);
gtk_widget_set_margin_top (hbox, 8);
gtk_widget_set_margin_bottom (hbox, 8);
gtk_box_append (GTK_BOX (vbox), hbox);
/* Create the first image */
image = demo_image_new ("dialog-warning");
gtk_box_append (GTK_BOX (hbox), image);
/* Create the second image */
image = demo_image_new ("process-stop");
gtk_box_append (GTK_BOX (hbox), image);
/* Create the third image */
image = demo_image_new ("weather-clear");
gtk_box_append (GTK_BOX (hbox), image);
g_object_unref (builder);
g_object_unref (scope);
}
if (!gtk_widget_get_visible (window))

288
demos/gtk-demo/clipboard.ui Normal file
View File

@@ -0,0 +1,288 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkWindow" id="window">
<property name="resizable">1</property>
<property name="title">Clipboard</property>
<child>
<object class="GtkBox">
<property name="orientation">vertical</property>
<property name="margin-start">12</property>
<property name="margin-end">12</property>
<property name="margin-top">12</property>
<property name="margin-bottom">12</property>
<property name="spacing">12</property>
<child>
<object class="GtkLabel">
<property name="label">“Copy” will copy the selected data the clipboard, “Paste” will show the current clipboard contents. You can also drag the data to the bottom.</property>
<property name="wrap">1</property>
<property name="max-width-chars">40</property>
</object>
</child>
<child>
<object class="GtkBox">
<property name="spacing">12</property>
<child>
<object class="GtkDropDown" id="source_chooser">
<property name="valign">center</property>
<property name="model">
<object class="GtkStringList">
<items>
<item>Text</item>
<item>Color</item>
<item>Image</item>
<item>File</item>
</items>
</object>
</property>
</object>
</child>
<child>
<object class="GtkStack" id="source_stack">
<signal name="notify::visible-child" handler="source_changed_cb" object="copy_button"/>
<property name="vexpand">1</property>
<binding name="visible-child-name">
<lookup name="string" type="GtkStringObject">
<lookup name="selected-item">
source_chooser
</lookup>
</lookup>
</binding>
<child>
<object class="GtkStackPage">
<property name="name">Text</property>
<property name="child">
<object class="GtkEntry" id="source_text">
<property name="valign">center</property>
<signal name="notify::text" handler="text_changed_cb" object="copy_button"/>
<property name="text">Copy this!</property>
</object>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">Color</property>
<property name="child">
<object class="GtkColorButton" id="source_color">
<property name="valign">center</property>
<property name="rgba">purple</property>
</object>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">Image</property>
<property name="child">
<object class="GtkBox">
<property name="valign">center</property>
<style>
<class name="linked"/>
</style>
<child>
<object class="GtkToggleButton" id="image_rose">
<property name="active">1</property>
<child>
<object class="GtkDragSource">
<signal name="prepare" handler="drag_prepare"/>
</object>
</child>
<child>
<object class="GtkImage">
<style>
<class name="large-icons"/>
</style>
<property name="paintable">resource:///transparent/portland-rose.jpg</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkToggleButton" id="image_floppy">
<property name="group">image_rose</property>
<child>
<object class="GtkDragSource">
<signal name="prepare" handler="drag_prepare"/>
</object>
</child>
<child>
<object class="GtkImage">
<style>
<class name="large-icons"/>
</style>
<property name="paintable">resource:///images/floppybuddy.gif</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkToggleButton" id="image_logo">
<property name="group">image_floppy</property>
<child>
<object class="GtkDragSource">
<signal name="prepare" handler="drag_prepare"/>
</object>
</child>
<child>
<object class="GtkImage">
<style>
<class name="large-icons"/>
</style>
<property name="paintable">resource:///images/org.gtk.Demo4.svg</property>
</object>
</child>
</object>
</child>
</object>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">File</property>
<property name="child">
<object class="GtkButton" id="source_file">
<child>
<object class="GtkDragSource">
<property name="propagation-phase">capture</property>
<signal name="prepare" handler="drag_prepare"/>
</object>
</child>
<property name="valign">center</property>
<property name="child">
<object class="GtkLabel">
<property name="label">—</property>
<property name="xalign">0</property>
<property name="ellipsize">start</property>
</object>
</property>
<signal name="clicked" handler="open_file_cb"/>
</object>
</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkButton" id="copy_button">
<property name="valign">center</property>
<property name="label" translatable="yes">_Copy</property>
<signal name="clicked" handler="copy_button_clicked" object="source_stack"/>
<property name="use-underline">1</property>
</object>
</child>
</object>
</child>
<child>
<object class="GtkSeparator">
</object>
</child>
<child>
<object class="GtkBox">
<property name="spacing">12</property>
<child>
<object class="GtkDropTarget">
<property name="actions">copy</property>
<property name="formats">GdkTexture GdkPaintable GFile GdkRGBA gchararray</property>
<signal name="drop" handler="on_drop" object="dest_stack"/>
</object>
</child>
<child>
<object class="GtkButton" id="paste_button">
<property name="label" translatable="yes">_Paste</property>
<signal name="clicked" handler="paste_button_clicked" object="dest_stack"/>
<property name="use-underline">1</property>
</object>
</child>
<child>
<object class="GtkLabel">
<property name="xalign">0</property>
<binding name="label">
<lookup name="visible-child-name" type="GtkStack">
dest_stack
</lookup>
</binding>
</object>
</child>
<child>
<object class="GtkStack" id="dest_stack">
<property name="halign">end</property>
<property name="valign">center</property>
<child>
<object class="GtkStackPage">
<property name="name"></property>
<property name="child">
<object class="GtkLabel">
</object>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">Text</property>
<property name="child">
<object class="GtkLabel">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="xalign">0</property>
<property name="ellipsize">end</property>
</object>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">Image</property>
<property name="child">
<object class="GtkImage">
<property name="halign">end</property>
<property name="valign">center</property>
<style>
<class name="large-icons"/>
</style>
</object>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">Color</property>
<property name="child">
<object class="GtkBox">
<property name="halign">end</property>
<property name="valign">center</property>
<child>
<object class="GtkColorSwatch">
<property name="accessible-role">img</property>
<property name="can-focus">0</property>
<property name="selectable">0</property>
<property name="has-menu">0</property>
</object>
</child>
</object>
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">File</property>
<property name="child">
<object class="GtkLabel">
<property name="halign">end</property>
<property name="valign">center</property>
<property name="xalign">0</property>
<property name="hexpand">1</property>
<property name="ellipsize">start</property>
</object>
</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</interface>

View File

@@ -24,6 +24,7 @@ do_cursors (GtkWidget *do_widget)
builder = gtk_builder_new_from_resource ("/cursors/cursors.ui");
window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
g_signal_connect (window, "destroy",
@@ -34,9 +35,7 @@ do_cursors (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
else
{
gtk_window_destroy (GTK_WINDOW (window));
}
gtk_window_destroy (GTK_WINDOW (window));
return window;
}

View File

@@ -15,6 +15,7 @@
<file>demo.ui</file>
</gresource>
<gresource prefix="/clipboard">
<file>clipboard.ui</file>
<file>demoimage.c</file>
<file>demoimage.h</file>
</gresource>

View File

@@ -12,7 +12,6 @@
*/
#include <gtk/gtk.h>
#include <pango/pangofc-font.h>
#include <hb.h>
#include <hb-ot.h>
#include <glib/gi18n.h>

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

@@ -7,7 +7,8 @@
* shows.
*
* We also demonstrate adding other things to a text view, such as
* clickable icons.
* clickable icons and widgets which can also replace a character
* (try copying the ghost text).
*/
#include <gtk/gtk.h>
@@ -94,13 +95,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,
@@ -114,7 +114,12 @@ show_page (GtkTextView *text_view,
gtk_level_bar_set_value (GTK_LEVEL_BAR (child), 50);
gtk_widget_set_size_request (child, 100, -1);
gtk_text_view_add_child_at_anchor (text_view, child, anchor);
gtk_text_buffer_insert (buffer, &iter, ".", -1);
gtk_text_buffer_insert (buffer, &iter, " and labels with ", -1);
anchor = gtk_text_child_anchor_new_with_replacement ("👻");
gtk_text_buffer_insert_child_anchor (buffer, &iter, anchor);
child = gtk_label_new ("ghost");
gtk_text_view_add_child_at_anchor (text_view, child, anchor);
gtk_text_buffer_insert (buffer, &iter, " text.", -1);
}
else if (page == 2)
{

View File

@@ -18,15 +18,81 @@
#include "language-names.h"
#ifdef G_OS_WIN32
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#else
#ifndef ISO_CODES_PREFIX
#define ISO_CODES_PREFIX "/usr"
#endif
#define ISO_CODES_DATADIR ISO_CODES_PREFIX "/share/xml/iso-codes"
#define ISO_CODES_LOCALESDIR ISO_CODES_PREFIX "/share/locale"
#endif
static GHashTable *language_map;
#ifdef G_OS_WIN32
/* if we are using native Windows use native Windows API for language names */
static BOOL CALLBACK
get_win32_all_locales_scripts (LPWSTR locale_w, DWORD flags, LPARAM param)
{
wchar_t *langname_w = NULL;
wchar_t locale_abbrev_w[9];
gchar *langname, *locale_abbrev, *locale, *p;
gint i;
const LCTYPE iso639_lctypes[] = { LOCALE_SISO639LANGNAME, LOCALE_SISO639LANGNAME2 };
GHashTable *ht_scripts_langs = (GHashTable *) param;
PangoLanguage *lang;
gint langname_size, locale_abbrev_size;
langname_size = GetLocaleInfoEx (locale_w, LOCALE_SLOCALIZEDDISPLAYNAME, langname_w, 0);
if (langname_size == 0)
return FALSE;
langname_w = g_new0 (wchar_t, langname_size);
if (langname_size == 0)
return FALSE;
GetLocaleInfoEx (locale_w, LOCALE_SLOCALIZEDDISPLAYNAME, langname_w, langname_size);
langname = g_utf16_to_utf8 (langname_w, -1, NULL, NULL, NULL);
locale = g_utf16_to_utf8 (locale_w, -1, NULL, NULL, NULL);
p = strchr (locale, '-');
lang = pango_language_from_string (locale);
if (g_hash_table_lookup (ht_scripts_langs, lang) == NULL)
g_hash_table_insert (ht_scripts_langs, lang, langname);
/*
* Track 3+-letter ISO639-2/3 language codes as well (these have a max length of 9 including terminating NUL)
* ISO639-2: iso639_lctypes[0] = LOCALE_SISO639LANGNAME
* ISO639-3: iso639_lctypes[1] = LOCALE_SISO639LANGNAME2
*/
for (i = 0; i < 2; i++)
{
locale_abbrev_size = GetLocaleInfoEx (locale_w, iso639_lctypes[i], locale_abbrev_w, 0);
if (locale_abbrev_size > 0)
{
GetLocaleInfoEx (locale_w, iso639_lctypes[i], locale_abbrev_w, locale_abbrev_size);
locale_abbrev = g_utf16_to_utf8 (locale_abbrev_w, -1, NULL, NULL, NULL);
lang = pango_language_from_string (locale_abbrev);
if (g_hash_table_lookup (ht_scripts_langs, lang) == NULL)
g_hash_table_insert (ht_scripts_langs, lang, langname);
g_free (locale_abbrev);
}
}
g_free (locale);
g_free (langname_w);
return TRUE;
}
#else /* non-Windows */
static char *
get_first_item_in_semicolon_list (const char *list)
{
@@ -210,6 +276,7 @@ languages_variant_init (const char *variant)
g_free (filename);
g_free (buf);
}
#endif
static void
languages_init (void)
@@ -218,8 +285,13 @@ languages_init (void)
return;
language_map = g_hash_table_new_full (NULL, NULL, NULL, g_free);
#ifdef G_OS_WIN32
g_return_if_fail (EnumSystemLocalesEx (&get_win32_all_locales_scripts, LOCALE_ALL, (LPARAM) language_map, NULL));
#else
languages_variant_init ("iso_639");
languages_variant_init ("iso_639_3");
#endif
}
const char *

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

@@ -192,7 +192,7 @@ activate_about (GSimpleAction *action,
glib_micro_version);
g_string_append_printf (s, "\tPango\t%s\n",
pango_version_string ());
g_string_append_printf (s, "\tGTK\t%d.%d.%d\n",
g_string_append_printf (s, "\tGTK \t%d.%d.%d\n",
gtk_get_major_version (),
gtk_get_minor_version (),
gtk_get_micro_version ());
@@ -512,7 +512,7 @@ load_file (const char *demoname,
info_buffer = gtk_text_buffer_new (NULL);
gtk_text_buffer_create_tag (info_buffer, "title",
"font", "Sans 18",
"size", 18 * 1024,
"pixels-below-lines", 10,
NULL);
@@ -1040,7 +1040,7 @@ out:
g_signal_connect_swapped (G_OBJECT (demo), "destroy", G_CALLBACK (g_application_quit), app);
}
else
gtk_widget_show (GTK_WIDGET (window));
gtk_window_present (GTK_WINDOW (window));
if (autoquit)
g_timeout_add_seconds (1, auto_quit, app);

View File

@@ -21,7 +21,7 @@
<item>
<attribute name="label" translatable="yes">Save _As...</attribute>
<attribute name="action">app.save-as</attribute>
<attribute name="accel">&lt;Control&gt;s</attribute>
<attribute name="accel">&lt;Control&gt;&lt;Shift&gt;s</attribute>
</item>
</section>
<section>

View File

@@ -98,6 +98,7 @@ demos = files([
'transparent.c',
'tree_store.c',
'video_player.c',
'font_features.c',
])
gtkdemo_deps = [ libgtk_dep, ]
@@ -128,19 +129,14 @@ extra_demo_sources = files([
'script-names.c',
'unicode-names.c',
'suggestionentry.c',
'language-names.c',
])
if harfbuzz_dep.found() and pangoft_dep.found()
demos += files(['font_features.c'])
extra_demo_sources += files(['language-names.c'])
gtkdemo_deps += [ harfbuzz_dep, epoxy_dep ]
endif
if os_unix
demos += files('pagesetup.c')
endif
librsvg_dep = dependency('librsvg-2.0', version: '>= 2.46.0', required: false)
librsvg_dep = dependency('librsvg-2.0', version: '>= 2.52.0', required: false)
if librsvg_dep.found()
demos += files('paintable_svg.c')
@@ -156,15 +152,85 @@ 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 not meson.is_cross_build() and build_machine.cpu_family() != 'arm' and 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',
'--internal',
'--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',
'--internal',
'--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,
'-z', 'noexecstack',
'-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,
'--strip-all',
'--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 = []
foreach flag: common_cflags
if flag not in ['-Werror=missing-prototypes', '-Werror=missing-declarations', '-fvisibility=hidden']
if flag not in ['-Werror=missing-prototypes', '-Wmissing-prototypes',
'-Werror=missing-declarations', '-Wmissing-declarations',
'-fvisibility=hidden']
demo_cflags += flag
endif
endforeach
@@ -176,7 +242,7 @@ executable('gtk4-demo',
c_args: gtkdemo_args + demo_cflags,
dependencies: gtkdemo_deps,
include_directories: confinc,
gui_app: true,
win_subsystem: 'windows',
link_args: extra_demo_ldflags,
install: true,
)
@@ -186,7 +252,7 @@ executable('gtk4-demo-application',
c_args: gtkdemo_args + common_cflags,
dependencies: gtkdemo_deps,
include_directories: confinc,
gui_app: true,
win_subsystem: 'windows',
link_args: extra_demo_ldflags,
install: true,
)

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

@@ -47,22 +47,24 @@ static int
svg_paintable_get_intrinsic_width (GdkPaintable *paintable)
{
SvgPaintable *self = SVG_PAINTABLE (paintable);
RsvgDimensionData data;
double width;
rsvg_handle_get_dimensions (self->handle, &data);
if (!rsvg_handle_get_intrinsic_size_in_pixels (self->handle, &width, NULL))
return 0;
return data.width;
return ceil (width);
}
static int
svg_paintable_get_intrinsic_height (GdkPaintable *paintable)
{
SvgPaintable *self = SVG_PAINTABLE (paintable);
RsvgDimensionData data;
double height;
rsvg_handle_get_dimensions (self->handle, &data);
if (!rsvg_handle_get_intrinsic_size_in_pixels (self->handle, NULL, &height))
return 0;
return data.height;
return ceil (height);
}
static void

View File

@@ -1,6 +1,11 @@
/* Text View/Tabs
*
* GtkTextView can position text at fixed positions, using tabs.
* Tabs can specify alignment, and also allow aligning numbers
* on the decimal point.
*
* The example here has three tabs, with left, numeric and right
* alignment.
*/
#include <gtk/gtk.h>
@@ -22,7 +27,7 @@ do_tabs (GtkWidget *do_widget)
gtk_window_set_title (GTK_WINDOW (window), "Tabs");
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
gtk_window_set_default_size (GTK_WINDOW (window), 330, 330);
gtk_window_set_default_size (GTK_WINDOW (window), 330, 130);
gtk_window_set_resizable (GTK_WINDOW (window), FALSE);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
@@ -35,17 +40,18 @@ do_tabs (GtkWidget *do_widget)
tabs = pango_tab_array_new (3, TRUE);
pango_tab_array_set_tab (tabs, 0, PANGO_TAB_LEFT, 0);
pango_tab_array_set_tab (tabs, 1, PANGO_TAB_LEFT, 100);
pango_tab_array_set_tab (tabs, 2, PANGO_TAB_LEFT, 200);
pango_tab_array_set_tab (tabs, 1, PANGO_TAB_DECIMAL, 150);
pango_tab_array_set_decimal_point (tabs, 1, '.');
pango_tab_array_set_tab (tabs, 2, PANGO_TAB_RIGHT, 290);
gtk_text_view_set_tabs (GTK_TEXT_VIEW (view), tabs);
pango_tab_array_free (tabs);
buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
gtk_text_buffer_set_text (buffer, "one\ttwo\tthree\nfour\tfive\tsix\nseven\teight\tnine", -1);
gtk_text_buffer_set_text (buffer, "one\t2.0\tthree\nfour\t5.555\tsix\nseven\t88.88\tnine", -1);
sw = gtk_scrolled_window_new ();
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
gtk_window_set_child (GTK_WINDOW (window), sw);
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), view);

View File

@@ -72,7 +72,7 @@ about_activated (GSimpleAction *action,
glib_micro_version);
g_string_append_printf (s, "\tPango\t%s\n",
pango_version_string ());
g_string_append_printf (s, "\tGTK\t%d.%d.%d\n",
g_string_append_printf (s, "\tGTK \t%d.%d.%d\n",
gtk_get_major_version (),
gtk_get_minor_version (),
gtk_get_micro_version ());

View File

@@ -16,7 +16,7 @@ executable('gtk4-icon-browser',
c_args: common_cflags,
dependencies: [ libgtk_dep, demo_conf_h ],
include_directories: confinc,
gui_app: true,
win_subsystem: 'windows',
link_args: extra_demo_ldflags,
install: true,
)

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

@@ -3,7 +3,7 @@ demo_profile = get_option('profile')
demo_conf_h = declare_dependency(
sources: custom_target('demo-header',
command: [gen_demo_header, meson.source_root(), demo_profile],
command: [gen_demo_header, meson.project_source_root(), demo_profile],
capture: true,
output: 'demo_conf.h',
build_by_default: true,
@@ -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

@@ -17,7 +17,7 @@ executable('gtk4-node-editor',
c_args: [
'-DNODE_EDITOR_SOURCE_DIR="@0@/../../testsuite/gsk/compare/"'.format(meson.current_source_dir())
] + common_cflags,
gui_app: true,
win_subsystem: 'windows',
link_args: extra_demo_ldflags,
install: false,
)

View File

@@ -79,7 +79,7 @@ activate_about (GSimpleAction *action,
glib_micro_version);
g_string_append_printf (s, "\tPango\t%s\n",
pango_version_string ());
g_string_append_printf (s, "\tGTK\t%d.%d.%d\n",
g_string_append_printf (s, "\tGTK \t%d.%d.%d\n",
gtk_get_major_version (),
gtk_get_minor_version (),
gtk_get_micro_version ());

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
@@ -336,12 +336,39 @@ text_view_query_tooltip_cb (GtkWidget *widget,
}
}
static gboolean
load_bytes (NodeEditorWindow *self,
GBytes *bytes);
static void
load_error (NodeEditorWindow *self,
const char *error_message)
{
PangoLayout *layout;
GtkSnapshot *snapshot;
GskRenderNode *node;
GBytes *bytes;
layout = gtk_widget_create_pango_layout (GTK_WIDGET (self), error_message);
pango_layout_set_width (layout, 300 * PANGO_SCALE);
snapshot = gtk_snapshot_new ();
gtk_snapshot_append_layout (snapshot, layout, &(GdkRGBA) { 0.7, 0.13, 0.13, 1.0 });
node = gtk_snapshot_free_to_node (snapshot);
bytes = gsk_render_node_serialize (node);
load_bytes (self, bytes);
gsk_render_node_unref (node);
g_object_unref (layout);
}
static gboolean
load_bytes (NodeEditorWindow *self,
GBytes *bytes)
{
if (!g_utf8_validate (g_bytes_get_data (bytes, NULL), g_bytes_get_size (bytes), NULL))
{
load_error (self, "Invalid UTF-8");
g_bytes_unref (bytes);
return FALSE;
}
@@ -359,11 +386,16 @@ static gboolean
load_file_contents (NodeEditorWindow *self,
GFile *file)
{
GError *error = NULL;
GBytes *bytes;
bytes = g_file_load_bytes (file, NULL, NULL, NULL);
bytes = g_file_load_bytes (file, NULL, NULL, &error);
if (bytes == NULL)
return FALSE;
{
load_error (self, error->message);
g_clear_error (&error);
return FALSE;
}
return load_bytes (self, bytes);
}
@@ -473,17 +505,18 @@ node_editor_window_load (NodeEditorWindow *self,
{
GError *error = NULL;
g_clear_object (&self->file_monitor);
if (!load_file_contents (self, file))
return FALSE;
g_clear_object (&self->file_monitor);
self->file_monitor = g_file_monitor_file (file, G_FILE_MONITOR_NONE, NULL, &error);
if (error)
{
g_warning ("couldn't monitor file: %s", error->message);
g_error_free (error);
g_clear_object (&self->file_monitor);
}
else
{
@@ -646,7 +679,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 +691,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 +870,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 +905,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

@@ -161,9 +161,10 @@
</child>
<child>
<object class="GtkPaned">
<property name="shrink-start-child">false</property>
<property name="shrink-end-child">false</property>
<property name="position">400</property>
<child>
<property name="start-child">
<object class="GtkScrolledWindow">
<property name="hscrollbar-policy">never</property>
<property name="hexpand">1</property>
@@ -184,8 +185,8 @@
</object>
</child>
</object>
</child>
<child>
</property>
<property name="end-child">
<object class="GtkBox">
<child>
<object class="GtkScrolledWindow">
@@ -198,6 +199,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>
@@ -230,7 +232,7 @@
</object>
</child>
</object>
</child>
</property>
</object>
</child>
</template>

View File

@@ -3,7 +3,7 @@ executable('gtk4-print-editor',
c_args: common_cflags,
dependencies: [ libgtk_dep, demo_conf_h ],
include_directories: confinc,
gui_app: true,
win_subsystem: 'windows',
link_args: extra_demo_ldflags,
install: true,
)

View File

@@ -42,7 +42,7 @@ update_statusbar (void)
const char *print_str;
gtk_statusbar_pop (GTK_STATUSBAR (statusbar), 0);
gtk_text_buffer_get_iter_at_mark (buffer,
&iter,
gtk_text_buffer_get_insert (buffer));
@@ -56,7 +56,7 @@ update_statusbar (void)
GtkPrintOperation *op = active_prints->data;
print_str = gtk_print_operation_get_status_string (op);
}
msg = g_strdup_printf ("%d, %d%s %s",
row, col,
file_changed?" - Modified":"",
@@ -188,10 +188,10 @@ save_file (GFile *save_filename)
"Error saving to file %s:\n%s",
display_name,
error->message);
g_signal_connect (error_dialog, "response", G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (error_dialog);
g_error_free (error);
g_object_unref (info);
}
@@ -229,7 +229,7 @@ begin_print (GtkPrintOperation *operation,
pango_font_description_free (desc);
pango_layout_set_width (print_data->layout, width * PANGO_SCALE);
pango_layout_set_text (print_data->layout, print_data->text, -1);
num_lines = pango_layout_get_line_count (print_data->layout);
@@ -241,7 +241,7 @@ begin_print (GtkPrintOperation *operation,
{
PangoRectangle ink_rect, logical_rect;
double line_height;
layout_line = pango_layout_get_line (print_data->layout, line);
pango_layout_line_get_extents (layout_line, &ink_rect, &logical_rect);
@@ -258,7 +258,7 @@ begin_print (GtkPrintOperation *operation,
page_breaks = g_list_reverse (page_breaks);
gtk_print_operation_set_n_pages (operation, g_list_length (page_breaks) + 1);
print_data->page_breaks = page_breaks;
}
@@ -287,11 +287,11 @@ draw_page (GtkPrintOperation *operation,
end = pango_layout_get_line_count (print_data->layout);
else
end = GPOINTER_TO_INT (pagebreak->data);
cr = gtk_print_context_get_cairo_context (context);
cairo_set_source_rgb (cr, 0, 0, 0);
i = 0;
start_pos = 0;
iter = pango_layout_get_iter (print_data->layout);
@@ -307,12 +307,12 @@ draw_page (GtkPrintOperation *operation,
pango_layout_iter_get_line_extents (iter, NULL, &logical_rect);
baseline = pango_layout_iter_get_baseline (iter);
if (i == start)
start_pos = logical_rect.y / 1024.0;
cairo_move_to (cr, logical_rect.x / 1024.0, baseline / 1024.0 - start_pos);
pango_cairo_show_layout_line (cr, line);
}
i++;
@@ -383,9 +383,9 @@ print_done (GtkPrintOperation *op,
{
GtkWidget *error_dialog;
gtk_print_operation_get_error (op, &error);
error_dialog = gtk_message_dialog_new (GTK_WINDOW (main_window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
@@ -405,13 +405,13 @@ print_done (GtkPrintOperation *op,
g_free (print_data->text);
g_free (print_data->font);
g_free (print_data);
if (!gtk_print_operation_is_finished (op))
{
g_object_ref (op);
active_prints = g_list_append (active_prints, op);
update_statusbar ();
/* This ref is unref:ed when we get the final state change */
g_signal_connect (op, "status_changed",
G_CALLBACK (status_changed_cb), NULL);
@@ -628,7 +628,7 @@ activate_about (GSimpleAction *action,
glib_micro_version);
g_string_append_printf (sysinfo, "\tPango\t%s\n",
pango_version_string ());
g_string_append_printf (sysinfo, "\tGTK\t%d.%d.%d\n",
g_string_append_printf (sysinfo, "\tGTK \t%d.%d.%d\n",
gtk_get_major_version (),
gtk_get_minor_version (),
gtk_get_micro_version ());
@@ -871,7 +871,7 @@ activate (GApplication *app)
update_ui ();
gtk_widget_show (main_window);
gtk_window_present (GTK_WINDOW (main_window));
}
static void

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 MiB

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

View File

@@ -1,16 +1,84 @@
# 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 not meson.is_cross_build() and build_machine.cpu_family() != 'arm' and 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',
'--internal',
'--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',
'--internal',
'--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,
'-z', 'noexecstack',
'-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,
'--strip-all',
'--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],
c_args: common_cflags,
dependencies: [ libgtk_dep, demo_conf_h ],
include_directories: confinc,
gui_app: true,
win_subsystem: 'windows',
link_args: extra_demo_ldflags,
install: true,
)

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

View File

@@ -78,6 +78,21 @@ change_theme_state (GSimpleAction *action,
NULL);
}
static void
change_fullscreen (GSimpleAction *action,
GVariant *state,
gpointer user_data)
{
GtkWindow *window = user_data;
if (g_variant_get_boolean (state))
gtk_window_fullscreen (window);
else
gtk_window_unfullscreen (window);
g_simple_action_set_state (action, state);
}
static GtkWidget *page_stack;
static void
@@ -283,7 +298,7 @@ activate_about (GSimpleAction *action,
glib_micro_version);
g_string_append_printf (s, "\tPango\t%s\n",
pango_version_string ());
g_string_append_printf (s, "\tGTK\t%d.%d.%d\n",
g_string_append_printf (s, "\tGTK \t%d.%d.%d\n",
gtk_get_major_version (),
gtk_get_minor_version (),
gtk_get_micro_version ());
@@ -384,7 +399,7 @@ print_operation_done (GtkPrintOperation *op,
g_clear_error (&error);
break;
case GTK_PRINT_OPERATION_RESULT_APPLY:
break;
break;
case GTK_PRINT_OPERATION_RESULT_CANCEL:
g_print ("Printing was canceled\n");
break;
@@ -2012,11 +2027,12 @@ activate (GApplication *app)
GMenuModel *model;
static GActionEntry win_entries[] = {
{ "dark", NULL, NULL, "false", change_dark_state },
{ "theme", NULL, "s", "'current'", change_theme_state },
{ "theme", NULL, "s", "'current'", change_theme_state },
{ "transition", NULL, NULL, "true", change_transition_state },
{ "search", activate_search, NULL, NULL, NULL },
{ "delete", activate_delete, NULL, NULL, NULL },
{ "busy", get_busy, NULL, NULL, NULL },
{ "fullscreen", NULL, NULL, "false", change_fullscreen },
{ "background", activate_background, NULL, NULL, NULL },
{ "open", activate_open, NULL, NULL, NULL },
{ "record", activate_record, NULL, NULL, NULL },
@@ -2037,6 +2053,7 @@ activate (GApplication *app)
{ "win.open", { "<Control>o", NULL } },
{ "win.record", { "<Control>r", NULL } },
{ "win.lock", { "<Control>l", NULL } },
{ "win.fullscreen", { "F11", NULL } },
};
struct {
const char *action_and_target;
@@ -2182,7 +2199,7 @@ activate (GApplication *app)
g_object_set_data (G_OBJECT (window), "searchbar", widget);
widget = (GtkWidget *)gtk_builder_get_object (builder, "infobar");
g_signal_connect (widget, "response", G_CALLBACK (info_bar_response), NULL);
g_signal_connect (widget, "response", G_CALLBACK (info_bar_response), NULL);
g_object_set_data (G_OBJECT (window), "infobar", widget);
dialog = (GtkWidget *)gtk_builder_get_object (builder, "info_dialog");
@@ -2343,7 +2360,7 @@ activate (GApplication *app)
model = (GMenuModel *)gtk_builder_get_object (builder, "new_style_context_menu_model");
set_up_context_popover (widget, model);
gtk_widget_show (GTK_WIDGET (window));
gtk_window_present (window);
g_object_unref (builder);
}

File diff suppressed because it is too large Load Diff

View File

@@ -7,20 +7,21 @@ authors = "GTK Development Team"
logo_url = "gtk-logo.svg"
license = "GPL-2.1-or-later"
description = "The GTK toolkit"
dependencies = [ "GObject-2.0" ]
devhelp = true
[dependencies."GObject-2.0"]
name = "GObject"
description = "The base type system library"
docs_url = "https://docs.gtk.org/gobject/"
dependencies = ["Gdk-4.0"]
[dependencies."Gdk-4.0"]
name = "GDK"
description = "The GTK drawing kit"
docs_url = "https://docs.gtk.org/gdk/"
[theme]
name = "basic"
show_index_summary = true
[source-location]
base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/master/"
base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/main/"
[extra]
content_images = [

View File

@@ -7,20 +7,20 @@ authors = "GTK Development Team"
logo_url = "gtk-logo.svg"
license = "GPL-2.1-or-later"
description = "The GTK toolkit"
dependencies = [ "GObject-2.0" ]
dependencies = ["Gdk-4.0"]
devhelp = true
[dependencies."GObject-2.0"]
name = "GObject"
description = "The base type system library"
docs_url = "https://docs.gtk.org/gobject/"
[dependencies."Gdk-4.0"]
name = "GDK"
description = "The GTK drawing kit"
docs_url = "https://docs.gtk.org/gdk4/"
[theme]
name = "basic"
show_index_summary = true
[source-location]
base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/master/"
base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/main/"
[extra]
content_images = [

View File

@@ -3,11 +3,12 @@ version = "@version@"
browse_url = "https://gitlab.gnome.org/GNOME/gtk/"
repository_url = "https://gitlab.gnome.org/GNOME/gtk.git"
website_url = "https://www.gtk.org"
docs_url = "https://docs.gtk.org/gdk4/"
authors = "GTK Development Team"
logo_url = "gtk-logo.svg"
license = "LGPL-2.1-or-later"
description = "The GTK toolkit"
dependencies = [ "GObject-2.0", "cairo-1.0", "Pango-1.0", "GdkWayland-4.0", "GdkX11-4.0" ]
dependencies = ["GObject-2.0", "Gio-2.0", "cairo-1.0", "Pango-1.0", "GdkPixbuf-2.0"]
devhelp = true
search_index = true
@@ -16,6 +17,11 @@ search_index = true
description = "The base type system library"
docs_url = "https://docs.gtk.org/gobject/"
[dependencies."Gio-2.0"]
name = "GIO"
description = "GObject Interfaces and Objects, Networking, IPC, and I/O"
docs_url = "https://docs.gtk.org/gio/"
[dependencies."cairo-1.0"]
name = "Cairo"
description = "A 2D graphics library with support for multiple output devices"
@@ -26,12 +32,19 @@ search_index = true
description = "Text shaping and rendering"
docs_url = "https://docs.gtk.org/Pango/"
[dependencies."GdkWayland-4.0"]
[dependencies."GdkPixbuf-2.0"]
name = "GdkPixbuf"
description = "Image data loading"
docs_url = "https://docs.gtk.org/gdk-pixbuf/"
related = ["GdkWayland-4.0", "GdkX11-4.0"]
[related."GdkWayland-4.0"]
name = "GdkWayland"
description = "GDK Wayland Backend"
docs_url = "https://docs.gtk.org/gdk4-wayland/"
[dependencies."GdkX11-4.0"]
[related."GdkX11-4.0"]
name = "GdkX11"
description = "GDK X11 Backend"
docs_url = "https://docs.gtk.org/gdk4-x11/"
@@ -42,7 +55,7 @@ show_index_summary = true
show_class_hierarchy = true
[source-location]
base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/master/"
base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/main/"
[extra]
content_files = [

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

@@ -3,29 +3,21 @@ version = "@version@"
browse_url = "https://gitlab.gnome.org/GNOME/gtk/"
repository_url = "https://gitlab.gnome.org/GNOME/gtk.git"
website_url = "https://www.gtk.org"
docs_url = "https://docs.gtk.org/gsk4/"
authors = "GTK Development Team"
logo_url = "gtk-logo.svg"
license = "LGPL-2.1-or-later"
description = "The GTK toolkit"
dependencies = [ "GObject-2.0", "Graphene-1.0", "Pango-1.0", "Gdk-4.0" ]
devhelp = true
search_index = true
[dependencies."GObject-2.0"]
name = "GObject"
description = "The base type system library"
docs_url = "https://docs.gtk.org/gobject/"
dependencies = ["Graphene-1.0", "Gdk-4.0"]
[dependencies."Graphene-1.0"]
name = "Graphene"
description = "A thin layer of mathematical types for 3D libraries"
docs_url = "https://ebassi.github.io/graphene/docs/"
[dependencies."Pango-1.0"]
name = "Pango"
description = "Text shaping and rendering"
docs_url = "https://docs.gtk.org/Pango/"
[dependencies."Gdk-4.0"]
name = "GDK"
description = "The GTK windowing system abstraction"
@@ -37,7 +29,7 @@ show_index_summary = true
show_class_hierarchy = true
[source-location]
base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/master/"
base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/main/"
[extra]
content_images = [

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)
@@ -739,7 +752,7 @@ templates, resources, application menus, settings, [class@Gtk.HeaderBar], [class
The full, buildable sources for these examples can be found in the
`examples` directory of the GTK source distribution, or
[online](https://gitlab.gnome.org/GNOME/gtk/blob/master/examples) in the GTK
[online](https://gitlab.gnome.org/GNOME/gtk/blob/main/examples) in the GTK
source code repository. You can build each example separately by using make
with the `Makefile.example` file. For more information, see the `README`
included in the examples directory.
@@ -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.
@@ -959,11 +972,11 @@ example_app_window_class_init (ExampleAppWindowClass *class)
...
```
([full source](https://gitlab.gnome.org/GNOME/gtk/blob/master/examples/application2/exampleappwin.c))
([full source](https://gitlab.gnome.org/GNOME/gtk/blob/main/examples/application2/exampleappwin.c))
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.
@@ -1030,7 +1043,7 @@ example_app_window_class_init (ExampleAppWindowClass *class)
...
```
([full source](https://gitlab.gnome.org/GNOME/gtk/blob/master/examples/application3/exampleappwin.c))
([full source](https://gitlab.gnome.org/GNOME/gtk/blob/main/examples/application3/exampleappwin.c))
Now we revisit the `example_app_window_open()` function that is called for each
commandline argument, and construct a GtkTextView that we then add as a page
@@ -1074,14 +1087,14 @@ example_app_window_open (ExampleAppWindow *win,
...
```
([full source](https://gitlab.gnome.org/GNOME/gtk/blob/master/examples/application3/exampleappwin.c))
([full source](https://gitlab.gnome.org/GNOME/gtk/blob/main/examples/application3/exampleappwin.c))
Lastly, we add a [class@Gtk.StackSwitcher] to the titlebar area in the UI file, and we
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
@@ -1175,11 +1188,11 @@ example_app_class_init (ExampleAppClass *class)
...
```
([full source](https://gitlab.gnome.org/GNOME/gtk/blob/master/examples/application4/exampleapp.c))
([full source](https://gitlab.gnome.org/GNOME/gtk/blob/main/examples/application4/exampleapp.c))
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
@@ -1246,7 +1258,7 @@ example_app_window_init (ExampleAppWindow *win)
...
```
([full source](https://gitlab.gnome.org/GNOME/gtk/blob/master/examples/application5/exampleappwin.c))
([full source](https://gitlab.gnome.org/GNOME/gtk/blob/main/examples/application5/exampleappwin.c))
The code to connect the font setting is a little more involved, since there
is no simple object property that it corresponds to, so we are not going to
@@ -1417,7 +1429,7 @@ preferences_activated (GSimpleAction *action,
...
```
([full source](https://gitlab.gnome.org/GNOME/gtk/blob/master/examples/application6/exampleapp.c))
([full source](https://gitlab.gnome.org/GNOME/gtk/blob/main/examples/application6/exampleapp.c))
After all this work, our application can now show a preference dialog
like this:
@@ -1537,7 +1549,7 @@ example_app_window_init (ExampleAppWindow *win)
...
```
([full source](https://gitlab.gnome.org/GNOME/gtk/blob/master/examples/application7/exampleappwin.c))
([full source](https://gitlab.gnome.org/GNOME/gtk/blob/main/examples/application7/exampleappwin.c))
With the search bar, our application now looks like this:
@@ -1670,7 +1682,7 @@ example_app_window_init (ExampleAppWindow *win)
...
```
([full source](https://gitlab.gnome.org/GNOME/gtk/blob/master/examples/application8/exampleappwin.c))
([full source](https://gitlab.gnome.org/GNOME/gtk/blob/main/examples/application8/exampleappwin.c))
What our application looks like now:
@@ -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
@@ -1747,10 +1760,10 @@ example_app_window_init (ExampleAppWindow *win)
...
```
([full source](https://gitlab.gnome.org/GNOME/gtk/blob/master/examples/application9/exampleappwin.c))
([full source](https://gitlab.gnome.org/GNOME/gtk/blob/main/examples/application9/exampleappwin.c))
We also need a function that counts the lines of the currently active tab,
and updates the `lines` label. See the [full source](https://gitlab.gnome.org/GNOME/gtk/blob/master/examples/application9/exampleappwin.c)
and updates the `lines` label. See the [full source](https://gitlab.gnome.org/GNOME/gtk/blob/main/examples/application9/exampleappwin.c)
if you are interested in the details.
This brings our example application to this appearance:

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,113 @@
.. _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>
| **gtk4-builder-tool** screenshot [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 definition 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.
Screenshot
^^^^^^^^^^
The ``screenshot`` command saves a rendering of the UI definition file
as a png image or node file. The name of the file to write can be specified as
a second FILE argument.
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.
``--node``
Write a serialized node file instead of a png image.
``--force``
Overwrite an existing 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

@@ -3,28 +3,15 @@ version = "@version@"
browse_url = "https://gitlab.gnome.org/GNOME/gtk/"
repository_url = "https://gitlab.gnome.org/GNOME/gtk.git"
website_url = "https://www.gtk.org"
docs_url = "https://docs.gtk.org/gtk4/"
authors = "GTK Development Team"
logo_url = "gtk-logo.svg"
license = "LGPL-2.1-or-later"
description = "The GTK toolkit"
dependencies = [ "GObject-2.0", "Graphene-1.0", "Pango-1.0", "Gdk-4.0", "Gsk-4.0" ]
devhelp = true
search_index = true
[dependencies."GObject-2.0"]
name = "GObject"
description = "The base type system library"
docs_url = "https://docs.gtk.org/gobject/"
[dependencies."Graphene-1.0"]
name = "Graphene"
description = "A thin layer of mathematical types for 3D libraries"
docs_url = "https://ebassi.github.io/graphene/docs"
[dependencies."Pango-1.0"]
name = "Pango"
description = "Text shaping and rendering"
docs_url = "https://docs.gtk.org/Pango/"
dependencies = ["Gdk-4.0", "Gsk-4.0"]
[dependencies."Gdk-4.0"]
name = "GDK"
@@ -36,13 +23,35 @@ search_index = true
description = "The GTK rendering abstraction"
docs_url = "https://docs.gtk.org/gsk4/"
related = ["Pango-1.0", "Graphene-1.0", "GObject-2.0", "Gio-2.0"]
[related."GObject-2.0"]
name = "GObject"
description = "The base type system library"
docs_url = "https://docs.gtk.org/gobject/"
[related."Gio-2.0"]
name = "GIO"
description = "GObject Interfaces and Objects, Networking, IPC, and I/O"
docs_url = "https://docs.gtk.org/gio/"
[related."Graphene-1.0"]
name = "Graphene"
description = "A thin layer of mathematical types for 3D libraries"
docs_url = "https://ebassi.github.io/graphene/docs"
[related."Pango-1.0"]
name = "Pango"
description = "Text shaping and rendering"
docs_url = "https://docs.gtk.org/Pango/"
[theme]
name = "basic"
show_index_summary = true
show_class_hierarchy = true
[source-location]
base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/master/"
base_url = "https://gitlab.gnome.org/GNOME/gtk/-/blob/main/"
[extra]
# The same order will be used when generating the index

View File

@@ -42,7 +42,7 @@ univocally identifies events that are related to the same
interaction.
When GTK creates a `GdkSurface`, it connects to the ::event
signal on it, which receives all of these input events. Surfaces have
signal on it, which receives all of these input events. Surfaces
have signals and properties, e.g. to deal with window management
related events.

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', 'rst2man.py', 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
@@ -410,8 +410,8 @@ have been removed. Update your code accordingly.
Any APIs that deal with global (or root) coordinates have been
removed in GTK 4, since not all backends support them. You should
replace your use of such APIs with surface-relative equivalents.
Examples of this are `gdk_surface_get_origin()`, `gdk_surface_move()`
or `gdk_event_get_root_coords()`.
Examples of such removed APIs are `gdk_window_get_origin()`,
`gdk_window_move()` or `gdk_event_get_root_coords()`.
### Adapt to `GdkKeymap` API changes
@@ -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].
@@ -1273,6 +1276,15 @@ is provided in the form of a `GtkIconPaintable` (this can be checked with
[method@Gtk.IconPaintable.is_symbolic]), you have to call
[method@Gtk.IconPaintable.get_icon_name] and set the icon name on a `GtkImage`.
### Adapt to GtkImage changes
`GtkPicture`'s behaviour was "split out" of `GtkImage` as the latter was covering
too many use cases; if you're loading an icon, [class@Gtk.Image] in GTK3 and GTK4 are
perfectly equivalent. If you are loading a more complex image asset, like a picture
or a thumbnail, then [class@Gtk.Picture] is the appropriate widget.
One noteworthy distinction is that while `GtkImage` has its size computed by
GTK, `GtkPicture` lets you decide about the size.
### Update to GtkFileChooser API changes
`GtkFileChooser` moved to a GFile-based API. If you need to convert a path
@@ -1332,6 +1344,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
@@ -1358,5 +1382,5 @@ a new family of widgets for this purpose that uses list models instead
of tree models, and widgets instead of cell renderers.
To learn more about the new list widgets, you can read the [List Widget
Overview](#ListWidget).
Overview](https://docs.gtk.org/gtk4/section-list-widget.html).

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

@@ -26,7 +26,7 @@ GTK with your code applied, and run the test suite, on multiple platforms
and architectures, and verify that nothing breaks. They also allow us to
do proper code reviews, so we can iterate over the changes.
You should follow the [contribution guide](https://gitlab.gnome.org/GNOME/gtk/blob/master/CONTRIBUTING.md)
You should follow the [contribution guide](https://gitlab.gnome.org/GNOME/gtk/blob/main/CONTRIBUTING.md)
for GTK, available on GitLab.
If you want to discuss your approach before or after working on it,

View File

@@ -286,7 +286,7 @@ requires that GTK is compiled with support for that backend.
The following backends can be selected, provided they are
included in the GDK libraries you are using:
`quartz`
`macos`
: Selects the native Quartz backend
`win32`
@@ -336,9 +336,6 @@ using and the GDK backend supports them:
`gl`
: Selects the "gl" OpenGL renderer
`ngl`
: Selects the "ngl" OpenGL renderer
`vulkan`
: Selects the Vulkan renderer
@@ -375,7 +372,7 @@ library you are using:
The `test` accessibility backend is recommended for test suites and remote
continuous integration pipelines.
### `XDG_DTA_HOME`, `XDG_DATA_DIRS`
### `XDG_DATA_HOME`, `XDG_DATA_DIRS`
GTK uses these environment variables to locate icon themes
and MIME information. For more information, see the

View File

@@ -133,7 +133,7 @@ gtk_text_buffer_set_text (buffer, "Hello, this is some text", -1);
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider,
"textview {"
" font: 15 serif;"
" font: 15px serif;"
" color: green;"
"}",
-1);
@@ -149,9 +149,9 @@ gtk_text_view_set_left_margin (GTK_TEXT_VIEW (view), 30);
tag = gtk_text_buffer_create_tag (buffer, "blue_foreground",
"foreground", "blue",
NULL);
gtk_text_buffer_get_iter_at_offset (buffer, &amp;start, 7);
gtk_text_buffer_get_iter_at_offset (buffer, &amp;end, 12);
gtk_text_buffer_apply_tag (buffer, tag, &amp;start, &amp;end);
gtk_text_buffer_get_iter_at_offset (buffer, &start, 7);
gtk_text_buffer_get_iter_at_offset (buffer, &end, 12);
gtk_text_buffer_apply_tag (buffer, tag, &start, &end);
```
The `gtk4-demo` application that comes with

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

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