Compare commits

...

1136 Commits

Author SHA1 Message Date
Simon McVittie
00f5171a4f node-editor: Save test data relative to current working directory
This avoids hard-coding the GTK source directory into the binary, which
would make the binary non-reproducible across different source paths,
particularly in a distro build environment where the source directory
used by autobuilders will often not exist on end-user systems. The node
editor can still be used to create new test-cases by running it with the
GTK source directory as its current working directory.

Resolves: https://gitlab.gnome.org/GNOME/gtk/-/issues/5403
Signed-off-by: Simon McVittie <smcv@debian.org>
2022-12-06 11:19:12 +00:00
Benjamin Otte
a9c9678e1f Merge branch 'workaround-glx-issue' into 'main'
GLX: Add extra glXMakeContextCurrent () call to work around a DRI issue

Closes #4499, #5387, and #5170

See merge request GNOME/gtk!5285
2022-12-02 15:32:22 +00:00
Luca Bacci
f788e994a9 GLX: Add extra glXMakeContextCurrent () call to work around a DRI issue
Reference: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7808

Fixes #4499, #5387, #5170
2022-12-02 14:20:43 +01:00
Benjamin Otte
c977f5cbb0 Merge branch 'wip/corey/tree-expander-bug' into 'main'
Improve treeexpanders

See merge request GNOME/gtk!5282
2022-11-30 19:06:12 +00:00
Corey Berla
c541de3e05 list: Remove active state handling in listitemwidget and treeexpander
Active state is handled by main now.  It appears that listitem and
treeexpander handled it manually (probably before main did).  This
is unnecessary now, so let's remove it.
2022-11-30 10:48:14 -08:00
Corey Berla
fdfd76774e treeexpander: Scroll to expanded item
If the anchor is below the expanded item, the expanded item will
go out of view if there are sufficient children items.  This is not
ideal, so make sure to scroll to the item to ensure it remains in
view.
2022-11-30 09:43:20 -08:00
Corey Berla
7eac27e5ee listitemwidget: Add listitem.scroll-to action
This is the matching action for list.scroll-to-item
2022-11-30 09:43:20 -08:00
Corey Berla
847b3261fc treeexpander: Toggle expand on release instead of pressed
With the introduction of the hide-expander property, I noticed that
the active state would persist in many cases because the release
signal was never emitted.  In gtk3 tree expanders, expanded
on release.  gtk4 expanded on press to match window explorer.
Per irc chat, the designers didn't have a strong preference
for press or release.  In order to keep consistency and
fix this bug, let's move back to release.
2022-11-30 09:41:18 -08:00
Corey Berla
63a655e345 treeexpander: Fix typo and GestureClick type
"canceled" should be "cancelled".  Also, "cancel" is a signal on
GtkGesture.
2022-11-29 20:52:46 -08:00
Emmanuele Bassi
75454adbe2 Merge branch 'ebassi/for-main' into 'main'
docs: Fix property cross-links in GtkTreeExpander

See merge request GNOME/gtk!5279
2022-11-29 14:08:13 +00:00
Emmanuele Bassi
9bce5f0462 docs: Fix property cross-links in GtkTreeExpander 2022-11-29 13:49:35 +00:00
Matthias Clasen
d2158e825b Merge branch 'matthiasc/for-main' into 'main'
testsuite: Skip tests that miss charset support

See merge request GNOME/gtk!5277
2022-11-29 12:09:33 +00:00
Matthias Clasen
36a4bb0341 Merge branch 'ccook/spelling-fixes' into 'main'
docfix: Various spelling errors that show up in docs

See merge request GNOME/gtk!5272
2022-11-29 08:57:48 +00:00
Matthias Clasen
be324cc665 testsuite: Skip tests that miss charset support
This came up when running the tests in a fresh
toolbox missing the glibc-gconv-extra package.
2022-11-29 03:52:27 -05:00
Matthias Clasen
d9f4bd5490 Merge branch 'wip/corey/at-spi-context' into 'main'
atspicontext: Cache empty atspi bus address

See merge request GNOME/gtk!5276
2022-11-29 07:51:23 +00:00
Matthias Clasen
23a3bf7a3c Merge branch 'show-hide-cleanup' into 'main'
gtk: Stop using gtk_widget_show/hide

See merge request GNOME/gtk!5273
2022-11-29 07:30:04 +00:00
Corey Berla
44e297488f atspicontext: Log more helpful warnings when the a11y bus doesn't exist 2022-11-28 17:02:18 -08:00
Corey Berla
8072d202e3 atspicontext: Cache empty atspi bus address
We are caching the bus address as data on the display object when it
exists, but fail to set the data when the bus address doesn't exist.
That causing excessive calls to GetAddress when the accesssbility
bus doesn't exist. Make sure to cache a non-existent accessibility
bus by setting the "" string.
2022-11-28 17:02:13 -08:00
Matthias Clasen
b82fa26373 Merge branch 'matthiasc/for-main' into 'main'
Revert "builder: Stop using GtkBuildable.get_id"

See merge request GNOME/gtk!5274
2022-11-28 23:08:58 +00:00
Matthias Clasen
f624897589 Merge branch 'wip/carlosg/osk-activation-in-widgets' into 'main'
Handle OSK activation in GtkText/GtkTextView widgets

See merge request GNOME/gtk!5269
2022-11-28 19:43:19 +00:00
Matthias Clasen
a46bee1285 Revert "builder: Stop using GtkBuildable.get_id"
This reverts commit 92edd4c476.

This commit changed behavior that GNOME Builder relies on.
2022-11-28 14:36:47 -05:00
Matthias Clasen
1ee39d7555 tools: Stop using gtk_widget_show/hide 2022-11-28 14:34:55 -05:00
Matthias Clasen
1018b43724 constraint editor: Stop using gtk_widget_show/hide 2022-11-28 14:34:55 -05:00
Matthias Clasen
c823ea4a70 icon browser: Stop using gtk_widget_show/hide 2022-11-28 14:34:55 -05:00
Matthias Clasen
fb8e52f0c9 gtk-demo: Stop using gtk_widget_show/hide 2022-11-28 14:34:55 -05:00
Matthias Clasen
352ace83bc widget-factory: Stop using gtk_widget_show/hide 2022-11-28 14:34:55 -05:00
Matthias Clasen
f339cc276c gtk: Stop using gtk_widget_show/hide
gtk_widget_set_visible and gtk_window_present
are better alternatives, and calling gtk_widget_show
on newly created widgets is no longer necessary
anyway.
2022-11-28 14:34:55 -05:00
Cam Cook
5b45efb49b Merge remote-tracking branch 'origin' into ccook/spelling-fixes 2022-11-28 12:34:38 -05:00
Benjamin Otte
57ac4740b3 Merge branch 'wip/corey/tree-expander' into 'main'
treeexpander: Add hide-expander and indent-for-depth properties

Closes #4969

See merge request GNOME/gtk!5268
2022-11-28 15:53:17 +00:00
Carlos Garnacho
929a51addb imcontextwayland: Set up OSK activation gesture on non text widgets
With GtkText and GtkTextView (and in extension, all their subclasses)
handling OSK activation activation, this gesture is only useful for
all text input widgets that are not subclasses of these 2 widgets,
e.g. the VTEs and crosswords of the world.

These still do need a hand in handling OSK activation, so only
set up the gesture for such cases.
2022-11-28 15:46:41 +01:00
Carlos Garnacho
6cbb7b848a gtktextview: Invoke OSK on button/touch taps that move/undo selection
If the ::release handler is invoked, the press/release happened without
drags in between. Additionally check that there is no selection at all.

This makes OSK invoked on taps that move the caret around, while tapping
in the selection invokes edition popup and text handles without bringing
in the OSK.
2022-11-28 15:46:41 +01:00
Carlos Garnacho
ed81c265ac gtktextview: Claim drag gesture after an actual selection change
This way, the drag gesture lets the click gesture ::release handler
happen if there was no actual changes to the selected text (i.e.
too short drags). This matches the ::release handler behavior match
the situations in which the OSK was being invoked by the wayland
GtkIMContext.
2022-11-28 15:46:41 +01:00
Carlos Garnacho
ee6d9478c8 gtktext: Invoke OSK on button/touch taps that move/undo selection
If the ::release handler is invoked, the press/release happened without
drags in between. Additionally check that the press did not happen within
the selection, and that there is no selection at all.

This makes OSK invoked on taps that move the caret around, while tapping
in the selection invokes edition popup and text handles without bringing
in the OSK.
2022-11-28 15:46:41 +01:00
Carlos Garnacho
76d80f7544 gtktext: Claim drag gesture after an actual selection change
This way, the drag gesture lets the click gesture ::release handler
happen if there was no actual changes to the selected text (i.e.
too short drags). This matches the ::release handler behavior match
the situations in which the OSK was being invoked by the wayland
GtkIMContext.
2022-11-28 15:46:41 +01:00
Carlos Garnacho
e3b0d57ce7 imcontextwayland: Implement activate_osk() vmethod
This method does explicitly what the builtin GtkClickGesture in
the IM context is doing implicitly. The gesture will be dropped
after porting is done.
2022-11-28 15:46:41 +01:00
Carlos Garnacho
6d0f7a2d31 immulticontext: Implement activate_osk() vmethod
The multicontext lets this call go through to the active
underlying GtkIMContext.
2022-11-28 15:46:41 +01:00
Carlos Garnacho
459583ba9e imcontext: Add private activate_osk() vmethod
This method is so far private for both external GtkIMContext
implementations and external GtkIMContext users, and is meant
to activate the OSK in the environments where this may happen.
2022-11-28 15:46:41 +01:00
Carlos Garnacho
59af80ab8b Revert "gtktext: Claim gesture more selectively"
This reverts commit ae54374a51.
2022-11-28 15:46:41 +01:00
Matthias Clasen
005574b1b2 Merge branch 'bilelmoussaoui/gi-since' into 'main'
g-i: Add missing since annotations

See merge request GNOME/gtk!5271
2022-11-28 11:17:51 +00:00
Bilal Elmoussaoui
0919320086 g-i: Add missing since annotations 2022-11-28 07:54:48 +00:00
Corey Berla
72bc97fff5 treeexpander: Minor formatting changes 2022-11-27 19:39:20 -08:00
Corey Berla
648b38761c treeexpander: Add indent-for-depth property
When set to TRUE, indent-for-depth indents each level of
depth with an additional indent
2022-11-27 19:36:20 -08:00
Corey Berla
2b578a24e4 treeexpander: Add hide-expander property
When set to TRUE hide-expander hides the expander icon in a
GtkTreeListRow.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4969
2022-11-27 19:36:11 -08:00
Matthias Clasen
90c986e493 Merge branch 'wip/corey/spi-logging' into 'main'
atspicontext: Log failure to connect to a11y

See merge request GNOME/gtk!5270
2022-11-28 01:29:10 +00:00
Matthias Clasen
ed6798e94c Merge branch 'work/zzag/wl-output-release' into 'main'
gdk/wayland: Prefer wl_output_release() over wl_output_destroy()

See merge request GNOME/gtk!5243
2022-11-27 22:21:29 +00:00
Corey Berla
16fd72e606 atspicontext: Log failure to connect to a11y
GTK depends on the a11y infrastructure to be in place unless GTK_A11Y is
set to none.  It appears that despite that, users attempt to
get around the a11y requirement without setting GTK_A11Y.
This can cause, amongst other issues, performance problems
with gtk applications.  Log failure to connect to the a11y
bus.
2022-11-27 14:13:13 -08:00
Matthias Clasen
3dae22efdb Merge branch 'fix-keymap-notify' into 'main'
Don't emit ::notify from a getter

See merge request GNOME/gtk!5267
2022-11-27 19:04:13 +00:00
Cam Cook
b876b4f568 | domain | current | suggestion |
|--------|---------|------------|
| [GtkListBox](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtklistbox.c#L1469)| (attributes org.gtk.Metthod.get_property=activate-on-single-click) | (attributes org.gtk.Method.get_property=activate-on-single-click) |
2022-11-27 07:42:12 -05:00
Cam Cook
dd780b3ce0 | domain | current | suggestion |
|--------|---------|------------|
| [GtkHeaderBar](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkheaderbar.c#L780) | "specifies a icon" | "specifies an icon" |
2022-11-27 06:49:40 -05:00
Cam Cook
0663758566 | domain | current | suggestion |
|--------|---------|------------|
| [GtkGridView](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkgridview.c#L1241)             | "Sets the imodel to use." | "Sets the model to use." |
2022-11-27 06:30:30 -05:00
Cam Cook
ccfe889ba9 Merge branch 'main' into ccook/spelling-fixes 2022-11-27 06:30:04 -05:00
Matthias Clasen
fe56f3413a Don't emit ::notify from a getter
GdkX11Keymap ddetermines the direction of the
keymap on demand, and was emitting notify::direction
2022-11-26 21:53:33 -05:00
Cam Cook
47bbc7e944 | domain | current | suggestion |
|--------|---------|------------|
| (GtkLevel](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtklevelbar.c#L1139)     | "between [property@Gtk.LevelBar:min-value[" | "between [property@Gtk.LevelBar:min-value]"|
2022-11-26 14:51:34 -05:00
Cam Cook
c89cdb680d | domain | current | suggestion |
|--------|---------|------------|
| [GtkLevel](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtklevelbar.c#L1104)     | "Returns the \`min-value of the \`GtkLevelBar\`." | "Returns the \`min-value\' of the \`GtkLevelBar\`."|
2022-11-26 14:35:40 -05:00
Cam Cook
d19426d399 | domain | current | suggestion |
|--------|---------|------------|
| [GtkLabel](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtklabel.c#L3142)        | "the [property@Gtk.Label:use-underline property]" | "the [property@Gtk.Label:use-underline] property" |
2022-11-26 13:32:27 -05:00
Matthias Clasen
3b9eba6d9a Merge branch 'wip/corey/demo-file-dialog' into 'main'
gtk-demo: Application demo use open_finish()

See merge request GNOME/gtk!5264
2022-11-26 18:11:41 +00:00
Corey Berla
586c3c3cbd gtk-demo: Application demo use open_finish() 2022-11-26 18:11:40 +00:00
Matthias Clasen
b5644c2596 Merge branch 'matthiasc/for-main' into 'main'
gtk-demo: Cosmetics

See merge request GNOME/gtk!5265
2022-11-26 13:15:28 +00:00
Cam Cook
cb303895aa Various spelling mistakes (and one use of the wrong verb) across a few domains that show up in documentation.
| domain | current | suggestion |
|--------|---------|------------|
| [GtkBitset](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkbitset.c#L363)       | "Value to add" | "Value to remove" |
| [GtkEntry](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkentry.c#L3626)        | "\`GtkEntry"   | "\`GtkEntry\`"    |
| [GtkEntry](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkentry.c#L3566)        | "will be applies" | "will be applied" |
| [GtkEntry](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkentry.c#L2232)        | "is is in" | "is in" |
| [GtkInfoBar](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/deprecated/gtkinfobar.c#L772) | "in the info bars’s action area" | "in the info bar’s action area |
| [GtkLabel](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtklabel.c#L3210)        | "Gets the labels attribute list." | "Gets the label's attribute list."
2022-11-26 06:54:47 -05:00
Matthias Clasen
e5cf55bdb4 gtk-demo: Cosmetics 2022-11-26 06:40:47 -05:00
Matthias Clasen
79a2e31635 Merge branch 'bilelmoussaoui/g-i' into 'main'
g-i: Add missing since annotation

See merge request GNOME/gtk!5259
2022-11-25 14:43:19 +00:00
Matthias Clasen
56dfc6c5ba Merge branch 'wip/smcv/xfail' into 'main'
testsuite: Avoid using should_fail

See merge request GNOME/gtk!5248
2022-11-25 14:40:33 +00:00
Bilal Elmoussaoui
5ede8dd1eb g-i: Add missing since annotation 2022-11-25 10:16:37 +00:00
Matthias Clasen
4fdeec118a Merge branch 'dialog-improvements' into 'main'
gtk-demo: Test cancellation support for file dialog

See merge request GNOME/gtk!5257
2022-11-25 03:48:04 +00:00
Matthias Clasen
e73f0f6974 file dialog: Handle Escape better
Closing the dialog by hitting Escape should
have the same effect as clicking the cancel
button. Make it so.
2022-11-24 10:29:43 -05:00
Matthias Clasen
ff14c51950 color dialog: Handle Escape better
Closing the dialog by hitting Escape should
have the same effect as clicking the cancel
button. Make it so.
2022-11-24 10:29:03 -05:00
Matthias Clasen
4fa53bd041 gtk-demo: Test cancellation support for file dialog
Add a timeout that closes the file dialog after
20 seconds, to test programmatic cancellation.
2022-11-24 10:26:43 -05:00
Simon McVittie
94b57a967c testsuite: Don't create .test files for flaky or failing tests
These tests can be run manually, but are not suitable for use as an
acceptance test, so let's not make frameworks like Debian's autopkgtest
run these when they run ginsttest-runner in the most obvious way.

Signed-off-by: Simon McVittie <smcv@debian.org>
2022-11-24 13:46:33 +00:00
Simon McVittie
957dd49ef7 testsuite: Use separate setups for unstable tests instead of should_fail
There are two possible interpretations of "expected failure": either
the test *must* fail (exactly the inverse of an ordinary test, with
success becoming failure and failure becoming success), or the test
*may* fail (with success intended, but failure possible in some
environments). Autotools had the second interpretation, which seems
more useful in practice, but Meson has the first.

Instead of using should_fail, we can put the tests in one of two new
suites: "flaky" is intended for tests that succeed or fail unpredictably
according to the test environment or chance, while "failing" is for
tests that ought to succeed but currently never do as a result of a
bug or missing functionality. With a sufficiently new version of Meson,
the flaky and failing tests are not run by default, but can be requested
by running a setup that does not exclude them, with a command like:

    meson test --setup=x11_unstable --suite=flaky --suite=failing

As a bonus, now that we're setting up setups and their excluded suites
programmatically, the gsk-compare-broadway tests are also excluded by
default when running the test setup for a non-broadway backend.

When running the tests in CI, --suite=gtk overrides the default
exclude_suites, so we have to specify --no-suite=flaky and
--no-suite=failing explicitly.

This arrangement is inspired by GNOME/glib!2987, which was contributed
by Marco Trevisan.

Signed-off-by: Simon McVittie <smcv@debian.org>
2022-11-24 13:46:33 +00:00
Matthias Clasen
5e534306e4 Merge branch 'deprecate-infobar' into 'main'
Deprecate GtkInfoBar

See merge request GNOME/gtk!5246
2022-11-24 03:43:11 +00:00
Matthias Clasen
d3fbe80510 Merge branch 'wip/carlosg/gsk-clipping' into 'main'
gsk: Extend the blur radius for outset shadow extents

See merge request GNOME/gtk!5247
2022-11-23 22:38:49 +00:00
Vlad Zahorodnii
433734de21 gdk/wayland: Improve readability of wl_output binding code
Provide OUTPUT_VERSION macro to indicate the implemented version of
wl_output in gtk rather than use a magical number.
2022-11-23 22:53:00 +02:00
Carlos Garnacho
b9448b06b4 gsk: Extend the blur radius for outset shadow extents
By dividing the blur radius to obtain the clip radius, we may end up
with halved values that result in an overshunk clip mask. Extend this
so that we ensure to cover the last pixel.

Fixes artifacts seen with the cairo renderer in X11 when resizing
windows horizontally, a black 1px high line would be seen in the
top of the window due to these outset bounds being used in clipping.

More mysteriously, also seems to fix resize lag in the GL renderer
(also X11), if e.g. the bottom-right corner of a window is resized
diagonally in bottom-left -> top-right direction, or
bottom-right -> top-left.

Related: https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2175#note_1599335
2022-11-23 19:27:49 +01:00
Matthias Clasen
942f8d4b4b Deprecate GtkInfoBar
This widget has a dialog-like API, which is something
we want to get rid of in GTK 5, and libadwaita has
a replacement with AdwBanner incoming.
2022-11-23 13:00:09 -05:00
Carlos Garnacho
35744d87a2 gsk: Also ceil() top side when converting graphene to cairo rectangles
The outset border for all sides is ceil()ed, except for the top side.
Most often values are already nicely rounded here, but this seems an
oversight.
2022-11-23 18:56:45 +01:00
Vlad Zahorodnii
261bcd40bd gdk/wayland: Prefer wl_output_release() over wl_output_destroy()
By using wl_output_release(), GDK lets the compositor to clean up the
output global more nicely.

For example, currently, most compositors remove the global and then
destroy it later after N seconds expire. With this, the compositor could
experiment with destroying the output global once all its resources are
destroyed.
2022-11-22 14:12:22 +02:00
Matthias Clasen
200f31f285 Merge branch 'work/zzag/wl-output-cleanup' into 'main'
gdk/wayland: Destroy zxdg_output_v1 upon GdkWaylandMonitor destruction

See merge request GNOME/gtk!5242
2022-11-22 12:01:43 +00:00
Vlad Zahorodnii
1d94aefe2b gdk/wayland: Clear GdkWaylandMonitor::output using g_clear_pointer()
Use g_clear_pointer() to make tear down code consistent.
2022-11-22 11:23:08 +02:00
Vlad Zahorodnii
e82e7823a8 gdk/wayland: Destroy zxdg_output_v1 upon GdkWaylandMonitor destruction
It prevents potentially leaking memory.
2022-11-22 11:18:32 +02:00
Matthias Clasen
0de172f03d Merge branch 'file-filter-properties' into 'main'
filefilter: Add properties for the criteria

See merge request GNOME/gtk!5241
2022-11-22 04:00:40 +00:00
Matthias Clasen
d34ac99916 filefilter: Add properties for the criteria
Add construct-only properties for patterns,
suffixes and mime-types. This provides an
alternative way to specify these in ui files.

Related: #5350
2022-11-21 22:44:03 -05:00
Matthias Clasen
055f3e5d97 Merge branch 'color-picker-portal' into 'main'
colorpicker: Always try the portal first

See merge request GNOME/gtk!5240
2022-11-21 19:46:17 +00:00
Matthias Clasen
205b718fe5 colorpicker: Always try the portal first
It does not hurt., and going forward, we want to
prefer portals.
2022-11-21 14:26:29 -05:00
Matthias Clasen
01ae136a4c Merge branch 'bilelmoussaoui/g-i' into 'main'
g-i: add missing array annotation to AlertDialog.set_buttons

See merge request GNOME/gtk!5234
2022-11-21 10:49:05 +00:00
Matthias Clasen
74806ed324 Merge branch 'fix-upside-down-labels' into 'main'
gsk: Avoid a crash with negative scales

See merge request GNOME/gtk!5236
2022-11-21 10:48:29 +00:00
Matthias Clasen
83839cb219 Merge branch 'drop-buildable-get-id' into 'main'
builder: Stop using GtkBuildable.get_id

See merge request GNOME/gtk!5239
2022-11-21 10:35:16 +00:00
Matthias Clasen
f22db024a8 Merge branch 'stringlist-prop' into 'main'
stringlist: Add a construct-only strings property

See merge request GNOME/gtk!5238
2022-11-21 10:34:54 +00:00
Matthias Clasen
e357ff6055 Drop gtk_widget_buildable_parser_finished
No need to have this no-op implementation.
This was the only implementation of this vfunc
in GTK.
2022-11-20 14:36:35 -05:00
Matthias Clasen
92edd4c476 builder: Stop using GtkBuildable.get_id
Drop the only implementation of this vfunc,
and stop using it. It isn't needed, and the
only implementation did the same thing GtkBuilder
does anyway.
2022-11-20 14:35:36 -05:00
Matthias Clasen
f0aefe2f7f stringlist: Add a construct-only strings property
This enables creating string lists in ui files
without using custom markup.

Related: #5350
2022-11-20 14:07:45 -05:00
Matthias Clasen
8f24072354 Merge branch 'center-box-props' into 'main'
centerbox: Add properties for child widgets

See merge request GNOME/gtk!5237
2022-11-20 18:25:12 +00:00
Matthias Clasen
8dc89ba3d8 centerbox: Add properties for child widgets
This provides and alternative to add children
in ui files.

Related: #5350
2022-11-20 12:54:31 -05:00
Matthias Clasen
b441c684ab gsk: Avoid a crash with negative scales
Don't crash when both scale_x and scale_y are -1.

A test is included.
2022-11-20 12:13:02 -05:00
Bilal Elmoussaoui
97d76417fa g-i: add missing array annotation to AlertDialog.(s|g)et_buttons 2022-11-19 14:33:19 +01:00
Matthias Clasen
ab530b9e5a Merge branch 'builder-parse-attributes' into 'main'
builder: Parse PangoAttrList values

See merge request GNOME/gtk!5228
2022-11-19 02:49:23 +00:00
Matthias Clasen
21a69e7107 Merge branch 'wip/carlosg/osk-activation' into 'main'
gtktext: Claim gesture more selectively

Closes #5351

See merge request GNOME/gtk!5230
2022-11-18 19:33:55 +00:00
Matthias Clasen
d45155364e Merge branch 'kjellahl/menubar' into 'main'
gtk_popover_menu_bar_set_menu_model(): Accept model == NULL

See merge request GNOME/gtk!5232
2022-11-18 19:33:37 +00:00
Matthias Clasen
4a71957c1f Merge branch 'shorter-im-context-ids' into 'main'
immmodule: Warn if GTK_IM_MODULE is bad

See merge request GNOME/gtk!5229
2022-11-18 19:33:17 +00:00
Matthias Clasen
e53c9e4832 Merge branch 'wayland-foreign-v2' into 'main'
wayland: Also support the v2 of the importer

See merge request GNOME/gtk!5231
2022-11-18 18:00:42 +00:00
Matthias Clasen
b3821b19b5 wayland: Also support the v2 of the importer
Commit 0ba8e16e14 added support for the export
part of zxdg_foreign_v2, but neglected that the importer
has a v2 as well. Support it.
2022-11-18 12:10:56 -05:00
Kjell Ahlstedt
8911015549 gtkpopovermenubar: Make model nullable
The description of gtk_popover_menu_bar_new_from_model() and
gtk_popover_menu_bar_set_menu_model() says that model is nullable.
Make it so.
2022-11-18 18:09:42 +01:00
Carlos Garnacho
f1168c5012 gdksurface: Do not consider GDK_TOUCH_END/CANCEL as popup-dismiss worthy
GDK_TOUCH_END deserves the same treatment than GDK_BUTTON_RELEASE, since it's
subject to the same circumstances (popping up a menu on long press would be
immediately dismissed on release if we handled them there). Ideally, we would
want to match releases that we obtained a press for while grabbed, but as
the popup is also dismissed on GDK_BUTTON_PRESS/GDK_TOUCH_BEGIN, there's no
use for this tracking.

And GDK_TOUCH_CANCEL sounds weird as a reason to dismiss popups, just like
crossing events would.

Related: https://gitlab.gnome.org/GNOME/mutter/-/issues/2512
2022-11-18 17:56:14 +01:00
Carlos Garnacho
ae54374a51 gtktext: Claim gesture more selectively
Even though button 1 (or touch down) presses do most often have
an effect in one way or another (starting drag, moving focus,
starting selection, ...), there is one situation that they do
immediately nothing: When clicking on the entry does not move
the text caret around. Dragging might start a selection, but
the entry did not do anything just yet, and an immediate
button/touch release should remain at "did nothing".

And that is precisely the hint that the Wayland IM context's click
gesture takes, clicks that do not scroll nor move the caret around,
having the GtkText not claim the gesture in that situation makes
the IM gesture able to do its thing without in-fighting.

This is typically not a problem when the GtkText is embedded in
another GtkEditable implementation (e.g. GtkEntry), since the
IM gesture is inactive and capturing from the parent widget, so
gets a pass that it otherwise doesn't get when both gestures are
in the same widget. This makes it work regardless of GtkText not
being a child of a composite widget, like NautilusQueryEditor
and AdwRowEntry.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5351
2022-11-18 17:56:14 +01:00
Matthias Clasen
64b8a8740f Merge branch 'wip/fix-tiling-without-gtk-shell' into 'main'
wayland/surface: Set the tiling state from xdg-shell too

See merge request GNOME/gtk!5227
2022-11-18 16:33:25 +00:00
Matthias Clasen
1f97714293 immodule: Accept 'simple' and 'none'
Everybody (including myself) gets this wrong,
so accept 'simple' and 'none' as shorthands
for the official IDs 'gtk-im-context-simple'
and 'gtk-im-context-none'.
2022-11-18 11:18:48 -05:00
Matthias Clasen
9af8c6fb25 immmodule: Warn if GTK_IM_MODULE is bad
If we don't find an immodule matching the
ids in the GTK_IM_MODULE envvar, print a
warning.
2022-11-18 11:18:48 -05:00
Matthias Clasen
9682085e09 builder: Parse PangoAttrList values
Allow specifying PangoAttrList properties in the
serialized format supported by pango_attr_list_to_string().

Test included.
2022-11-18 10:42:50 -05:00
Jonas Ådahl
07a59da6e4 wayland/surface: Set the tiling state from xdg-shell too
We plumbed it from the gtk-shell configure event, but didn't for the
equivalent state passed via xdg_toplevel.configure.
2022-11-18 13:11:25 +01:00
Matthias Clasen
dfbaeefc64 Merge branch 'matthiasc/for-main' into 'main'
gsk: Add an assertion to help static analysis

See merge request GNOME/gtk!5224
2022-11-18 05:22:44 +00:00
Matthias Clasen
9cbfbbdf39 stringsorter: Fix one case of collation handling
When not ignoring case, and not collating, we were
returning sort keys that were already freed. Oops.

Pointed out by clang.
2022-11-18 00:04:23 -05:00
Matthias Clasen
8c1a041104 gdk: Fix possible memory errors
clang complained that we may end up jumping
to the cleanup code without initializing data
in the jpeg code. Always initialize data to
NULL to prevent that eventuality.
2022-11-18 00:04:23 -05:00
Matthias Clasen
95fc5109bb composetable: Fix a memory leak
Pointed out by clang.
2022-11-18 00:04:23 -05:00
Matthias Clasen
ce57150203 gsk: Add an assertion to help static analysis
clang gets wild ideas about negative radii otherwise.
2022-11-18 00:04:23 -05:00
Matthias Clasen
203685a46a Merge branch 'matthiasc/for-main' into 'main'
Fix spelling errors

See merge request GNOME/gtk!5223
2022-11-18 04:56:57 +00:00
Matthias Clasen
ebe6d52252 Drop redundant glib version checks
We require GLib 2.72 now.
2022-11-17 22:49:56 -05:00
Matthias Clasen
60aaf38f39 gdk: Clean up gdkprivate.h
Move apis to more specific headers.
2022-11-17 22:49:56 -05:00
Matthias Clasen
2bab8cca5f gdk: Rename GDK_SURFACE_TEMP
We use this value only for drag surfaces, so call it that.
2022-11-17 22:49:56 -05:00
Matthias Clasen
b12d31d189 Fix spelling errors
These were pointed out by codespell.
2022-11-17 22:49:45 -05:00
Matthias Clasen
0d2161ee40 Merge branch 'file-dialog-portals' into 'main'
file dialog: Use portals

See merge request GNOME/gtk!5221
2022-11-18 03:49:30 +00:00
Matthias Clasen
cda06f375e Merge branch 'matthiasc/for-main' into 'main'
gtk-demo: Add some keywords

See merge request GNOME/gtk!5220
2022-11-17 20:53:51 +00:00
Matthias Clasen
b0148972fd filedialog: Use portals
We want this new API to be portal-first.
Make it so.
2022-11-17 15:52:53 -05:00
Matthias Clasen
ea3c58f0ec gtk-demo: Add folders to the clipboard demo
This is handy for testing a case where folder
dnd does not work with the file transfer portal.

See #5348
2022-11-17 06:31:09 -05:00
Matthias Clasen
af8ad1efe8 gtk-demo: Add some keywords
Make sure that dnd and drag-and-drop yield the right
(and the same) set of demos.
2022-11-17 05:50:34 -05:00
Matthias Clasen
12a50735da Merge branch 'ccook/doc-spelling-fixes' into 'main'
doc fix: various spelling mistakes corrected

See merge request GNOME/gtk!5215
2022-11-17 10:28:38 +00:00
Luca Bacci
7c62eaa528 Merge branch 'win32-hotspot' into 'main'
gdk/win32: fix cursor hotspot

See merge request GNOME/gtk!5216
2022-11-17 09:06:55 +00:00
Cam Cook
2a14753739 Merge branch 'main' into ccook/doc-spelling-fixes 2022-11-16 23:23:42 -05:00
Cam Cook
4ccc3b53eb doc/spelling changes: gtkselectionmodel.c, 'call this when the* selection changes' 2022-11-16 23:20:50 -05:00
Matthias Clasen
793954055e Merge branch 'radioactiveman-main-patch-52462' into 'main'
label: Fix markup doc example

See merge request GNOME/gtk!5201
2022-11-17 03:46:43 +00:00
Thomas Lange
7adf720f08 label: Fix markup doc example 2022-11-17 03:46:01 +00:00
Emmanuele Bassi
dc168767b0 Merge branch 'ebassi/list-doc-links' into 'main'
docs: Add links to the list widgets table

See merge request GNOME/gtk!5210
2022-11-16 21:51:59 +00:00
Matthias Clasen
501577196a Merge branch 'matthiasc/for-main' into 'main'
Inspector: Add a missing event type

See merge request GNOME/gtk!5218
2022-11-16 19:24:54 +00:00
Matthias Clasen
69d59d9b8b Merge branch 'filechooser-set-choice-fix' into 'main'
filechooser: Fix gtk_file_chooser_set_choice again

Closes #5346

See merge request GNOME/gtk!5219
2022-11-16 19:23:05 +00:00
robxnano
adc0264dac filechooser: Fix gtk_file_chooser_set_choice again
If the choice was in the form of a GtkDropDown, the code failed to
find the widget and so the choice never got set. Fixes #5346.
2022-11-16 18:07:20 +00:00
Marc-André Lureau
437a359f1b gdk/win32: fix cursor hotspot
This seems to be a regression from commit c06b1cc103 "Win32: Re-work cursor handling".

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-11-16 11:50:56 +04:00
Matthias Clasen
4eb017904b Alertdialog: Cosmetics 2022-11-15 10:36:32 +00:00
Matthias Clasen
5aeb6c31c0 events: Drop an unused variable 2022-11-15 10:26:25 +00:00
Matthias Clasen
c9df9978d2 Inspector: Add a missing event type
We did not have a name for the new touchpad hold
events.

To prevent this from happening again in the future,
add a static assertion.
2022-11-15 07:18:41 +01:00
Cam Cook
d1bb927286 Documentation fix: Various spelling mistakes (and one use of the wrong verb) across a few domains that show up in documentation.
| domain | current | suggestion |
|--------|---------|------------|
| [GtkButton](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkbutton.c#L691)       | "Buttons can has a flat appearance" | "Buttons can have a flat appearance" |
| [GtkCenterBox](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkcenterbox.c#L275) | "pas %NULL" | "pass %NULL" |
| [GtkEditable](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkeditable.c#L466)   | "the text to append" | "the text to insert" |
| [GtkFlowbox](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkflowbox.c#L4921)    | "the are equal" | "they are equal" |
| [GtkSelectionModel](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkselectionmodel.c#L550) | "Call this when a the selection changes" | "Call this when a selection changes" |
| [GtkWIndow](https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gtk/gtkwindow.c#L5321)                | "(e.g. the user or the window manager" | "(e.g. the user or the window manager)" |
2022-11-13 11:55:05 -05:00
Emmanuele Bassi
bd66198b88 docs: Add more links to the list widgets description 2022-11-11 11:30:41 +00:00
Emmanuele Bassi
5193846787 docs: Add links to the list widgets table
Make it easier for readers to go to the appropriate replacement for the
old GtkTreeView-and-friends API.
2022-11-11 11:21:17 +00:00
Matthias Clasen
2daea9e459 Merge branch 'focus-no-parent' into 'main'
focus: fall back to old behaviour if we didn't focus anything

See merge request GNOME/gtk!5189
2022-11-11 10:29:00 +00:00
Matthias Clasen
2d48793641 Merge branch 'docs-update' into 'main'
docs: Update Common Questions section on list views

See merge request GNOME/gtk!5209
2022-11-11 10:28:11 +00:00
Arjan Molenaar
920f49e993 Fix typo in 4 to 5 migration page 2022-11-10 22:41:26 +01:00
Arjan Molenaar
29d7f93e38 Update Common Questions section on tree views
Point users to GtkListView instead of the
deprecated GtkTreeView.
2022-11-10 22:41:26 +01:00
Matthias Clasen
df5a13806d Merge branch 'gdkwaylandtoplevel' into 'main'
gdk/wayland/surface: Move more members to `GdkWaylandPopup` and `GdkWaylandToplevel`

See merge request GNOME/gtk!4227
2022-11-10 13:58:24 +00:00
Luca Bacci
aebbf7cc61 Merge branch 'win32-inhibit' into 'main'
gdk-win32: implement basic inhibit-system-shortcuts

See merge request GNOME/gtk!5206
2022-11-10 11:18:23 +00:00
Matthias Clasen
fc8ef02bb5 Merge branch 'export-handle-refactor' into 'main'
Refactor surface handle export

See merge request GNOME/gtk!5205
2022-11-10 08:00:07 +00:00
Marc-André Lureau
cf04a3c99d gdk-win32: implement basic inhibit-system-shortcuts
This is largely adapted from commit 83027c68f1 ("11: Implement
inhibit_system_shortcuts API"), with similar rationale:

    To implement the inhibit_system_shortcuts API on X11, we emulate the
    same behavior using grabs on the keyboard.

    To avoid keeping active grabs on the keyboard that would affect
    other X11 applications even when the surface isn't focused, the X11
    implementation takes care of releasing the grabs as soon as the
    toplevel loses focus.

Note that Windows has low-level keyboard hooks that could help achieve
the expected behaviour. This is implemented by spice-gtk & gtk-vnc for
example, but correctness isn't obvious. I left a TODO comment.

This patch helps implementing remote desktop widgets with GTK4, since
currently on win32 backend Alt-Tab and such are always left to the
system unless there is keyboard grab (which can't be requested by the
client API anymore, afaict).

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-11-09 19:29:03 +04:00
Matthias Clasen
43d6682e45 wayland: Reimplement export_handle
Reimplement the backend API on top of the new async
calls.
2022-11-09 16:28:30 +01:00
Matthias Clasen
d1bdc36331 window: fixups 2022-11-09 16:28:30 +01:00
Matthias Clasen
dcc3b638aa wayland: fixups 2022-11-09 16:28:30 +01:00
Matthias Clasen
4b40aeb0c6 wayland: Support the v2 protocol in both places
The old api should better support both versions of the
foreign protocol too.
2022-11-09 16:28:29 +01:00
Matthias Clasen
0ba8e16e14 wayland: Add zxdg_foreign_v2 protocol support 2022-11-09 16:28:29 +01:00
Matthias Clasen
f9982a61e6 window: Use gdk_toplevel_export_handle 2022-11-09 16:28:29 +01:00
Matthias Clasen
1c99ed542a Add gdk_toplevel_export_handle
This code is backend-specific, and should not live
in gtkwindow.c.
2022-11-09 16:28:29 +01:00
Marc-André Lureau
a92aea4c0e gdk-win32: fix unused variable warnings
../gdk/win32/gdksurface-win32.c: In function 'gdk_win32_get_window_size_and_position_from_client_rect':
../gdk/win32/gdksurface-win32.c:3753:20: warning: unused variable 'impl' [-Wunused-variable]
 3753 |   GdkWin32Surface *impl = GDK_WIN32_SURFACE (window);
      |                    ^~~~
../gdk/win32/gdksurface-win32.c: In function 'gdk_win32_surface_get_queued_window_rect':
../gdk/win32/gdksurface-win32.c:5129:20: warning: unused variable 'impl' [-Wunused-variable]
 5129 |   GdkWin32Surface *impl = GDK_WIN32_SURFACE (surface);

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-11-09 19:19:44 +04:00
Matthias Clasen
956100017c Merge branch 'wayland_display_geometry' into 'main'
wayland: calculate union of geometry of all monitors for toplevel bounds

See merge request GNOME/gtk!4790
2022-11-08 16:29:15 +00:00
Matthias Clasen
514ec8942d Merge branch 'cursor-size' into 'main'
GtkSettings: Provide settings in logical pixels also on X11

Closes #5223 and #5230

See merge request GNOME/gtk!5172
2022-11-08 16:27:06 +00:00
Matthias Clasen
7caa211d6a Merge branch 'wip/carlosg/back-forward-mask' into 'main'
gdk/wayland: Fix button mask calculation on button events

Closes #5301

See merge request GNOME/gtk!5191
2022-11-08 16:14:18 +00:00
Matthias Clasen
cb7b57635b Merge branch 'add-link-to-docs' into 'main'
Link the file mentioned as a reference for key values

See merge request GNOME/gtk!5198
2022-11-08 16:05:59 +00:00
Matthias Clasen
9e28a407df Merge branch 'ebassi/since-for-main' into 'main'
docs: Add deprecation notices for properties

See merge request GNOME/gtk!5204
2022-11-08 16:01:11 +00:00
Matthias Clasen
a5780beba7 Merge branch 'ccook/gtk_aspect_frame_doc_fix' into 'main'
doc/comment fix: @self misspelled as self@

See merge request GNOME/gtk!5200
2022-11-08 15:28:08 +00:00
Matthias Clasen
304f1e43af Merge branch 'matthiasc/for-main' into 'main'
Add new printf patterns to make-pot

See merge request GNOME/gtk!5188
2022-11-08 15:23:03 +00:00
Emmanuele Bassi
5a51cbe673 docs: Add deprecation notices for properties 2022-11-08 10:45:09 +00:00
Matthias Clasen
901c968b97 Merge branch 'fix-color-dialog-button-new' into 'main'
colordialogbutton: Actually accept NULL

Closes #5321

See merge request GNOME/gtk!5202
2022-11-07 14:51:34 +00:00
Matthias Clasen
2c6ac137a3 gtk-demo: Improve language handlng
In the font features demo, don't add a
item for the default language to the dropdown,
that does not make sense.
2022-11-07 15:42:38 +01:00
Matthias Clasen
5bd264d532 gtk-demo: Add a few mssing language names 2022-11-07 15:42:38 +01:00
Matthias Clasen
e908a117a9 gtk4-demo: Tweak the pickers demo
Redo the file picker a bit.
2022-11-07 15:42:38 +01:00
Matthias Clasen
14a97accf1 po: Match make-pot
We are not normally using the gtk40-pot target to
generate the gtk40.pot file. On the off chance that
somebody does, lets make sure we pass the same
arguments to xgettext here as in the make-pot script
that is used on damn lies.
2022-11-07 15:42:38 +01:00
Matthias Clasen
e619d45ddc Add a test for picker button constructors
This turns out to be hard enough that a test
is useful.
2022-11-07 15:32:51 +01:00
Matthias Clasen
e00b96053b colordialogbutton: Actually accept NULL
As pointed out in #5321, my previous fix was not
good enough.

Fixes: #5321
2022-11-07 15:24:13 +01:00
Colin Kinloch
293b91e515 wayland: calculate union of geometry of all monitors for toplevel bounds
Signed-off-by: Colin Kinloch <colin.kinloch@collabora.com>
2022-11-07 11:08:18 +00:00
Cam Cook
ed16946685 doc/comment fix: the ref to @self was misspelled as self@ for gtkaspectframe.h/gtk_aspect_frame_get_child
Noticed this while reviewing the gi-docgen docs for GtkAspectFrame while developing some java bindings.
It's my understanding that @self was intended; as it would cause gi-docgen to interpret it as a reference to
the the GtkAspectFrame pointer named 'self'.
2022-11-06 17:59:23 -05:00
Matthias Clasen
18ee4d97fc Merge branch 'fix-color-button-new' into 'main'
color/fontdialogbutton: Fix constructors

Closes #5321

See merge request GNOME/gtk!5199
2022-11-06 13:36:49 +00:00
Matthias Clasen
466db31aac color/fontdialogbutton: Fix constructors
The arguments were meant to be nullable.
Make it so!

Fixes: #5321
2022-11-06 14:12:02 +01:00
Pedro Sader Azevedo
32e138689e Link the file mentioned as a reference for key values 2022-11-06 01:54:38 +00:00
Balázs Úr
06409cf18f Update Hungarian translation 2022-11-05 22:21:06 +00:00
Goran Vidović
0041329f4d Update Croatian translation 2022-11-05 18:55:57 +00:00
Matthias Clasen
d1c943153c Merge branch 'make-pot-update' into 'main'
Add new printf patterns to make-pot

See merge request GNOME/gtk!5197
2022-11-05 10:50:51 +00:00
Matthias Clasen
baac6ef871 Add new printf patterns to make-pot
This script is used to extract our strings for translators
on damn lines, and passing these flags to xgettext makes
it put a hint into the pot file about strings that are
used as printf format strings.
2022-11-05 11:23:53 +01:00
Luca Bacci
b209e5117d Merge branch 'gdk-win32-settings-rework' into 'main'
GdkWin32 settings rework

See merge request GNOME/gtk!5193
2022-11-04 16:00:25 +00:00
Luca Bacci
440929daea GdkWin32: Add more GDK_NOTE calls for settings 2022-11-04 16:11:27 +01:00
Luca Bacci
1506de5669 GdkWin32: Set the "gtk-hint-font-metrics" property
Helps for https://gitlab.gnome.org/GNOME/gtk/-/issues/5257
2022-11-04 16:03:11 +01:00
Luca Bacci
41f9f1d623 GdkWin32: Set the "gtk-cursor-blink" setting 2022-11-04 15:57:25 +01:00
Luca Bacci
24047d7f61 GdkWin32: Set the "gtk-cursor-theme-size" setting
Note that we have to set the logical value, that's why
we use GetSystemMetrics and not GetSystemMetricsForDpi.
2022-11-04 15:56:20 +01:00
Luca Bacci
45681c4fe5 GdkWin32: Detect the high contrast setting
And set the theme name accordingly ("Default-hc")
2022-11-04 15:54:02 +01:00
Luca Bacci
95c121b6d6 GdkWin32: Fix leak of screen HDC 2022-11-04 15:41:11 +01:00
Luca Bacci
6b569afdfe GdkWin32: Remove special-casing for old Pango versions
We require Pango 1.50 now
2022-11-04 15:35:04 +01:00
Luca Bacci
429017ad16 GdkWin32: Remove old code 2022-11-04 15:31:40 +01:00
Luca Bacci
fe1d86f23c GdkWin32: Sort settings alphabetically 2022-11-04 15:30:12 +01:00
Adam Williamson
e07f8ef506 focus: fall back to old behaviour if we didn't focus anything
8455b9ac74 seems to have introduced a problem where we can wind
up focusing no widget at all if the `while (parent)` loop doesn't
find a widget it can successfully move the focus to. This 'fixes'
that by falling back to doing the previous thing if we make it
all the way through that loop without moving the focus. Thanks to
@coreyberla for a hint to improve the implementation.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
2022-11-02 09:32:32 -07:00
Carlos Garnacho
ece28bea74 gdk/wayland: Fix button mask calculation on button events
There's 2 things broken here:
- The mask was calculated on top of the GDK button (i.e. skipping
  4-7 buttons), so GDK_BUTTON4_MASK and GDK_BUTTON5_MASK were not
  assigned. This is now calculated on the (continuous) BTN_ evcodes
  so it is guaranteed that the next 2 physical buttons (i.e.
  back/forward) get these two places in the mask assigned.
- Furthermore, these buttons would be pushed to places in the
  modifier mask that they didn't belong to. It is now checked hard
  that only the first 5 buttons enable a modifier flag.

Overall, this ensures that no event masks with bonkers values are
forwarded, and that no stale implicit grabs are left after additional
buttons are pressed.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5301
2022-11-02 17:17:43 +01:00
Sabri Ünal
a272887c34 Update Turkish translation 2022-11-02 06:06:38 +00:00
Nathan Follens
c4c9a44d7a Update Dutch translation
(cherry picked from commit 381c056070)
2022-11-01 23:10:53 +00:00
Luca Bacci
ac60bc6095 X11: Provide settings in logical pixels
This makes GtkSettings values on X11 match what we get on
other backends.

Reporting size settings in logical pixels (i.e for scale
== 1) is useful for properly supporting mixed-DPI setups.
As X11 doesn't support mixed-DPI setups anyway, XSettings
doesn't bother providing logical values. Thus we scale
from physical to logical values ourselves.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5223
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5230
2022-11-01 13:09:28 +01:00
Matthias Clasen
9c5ba5544e Post-release version bump 2022-10-31 22:22:06 -04:00
Matthias Clasen
0af8d7cf06 4.9.1 2022-10-31 22:07:15 -04:00
Matthias Clasen
fcf00391b4 Merge branch 'matthiasc/for-main' into 'main'
Revert "modules: Fix build on Visual Studio"

See merge request GNOME/gtk!5187
2022-11-01 01:09:51 +00:00
Matthias Clasen
16b95939f9 gdk: Bump the jpeg malloc limit
Bump the limit for memory use during jpeg loading
to 1GB, matching what gdk-pixbuf has for this.
2022-10-31 20:35:15 -04:00
Matthias Clasen
0a6f3944a0 Revert "modules: Fix build on Visual Studio"
This reverts commit acd9c12667.

This commit breaks the build with GLib main on all platforms,
and defining _GLIB_EXTERN arguably invades the GLib namespace.

A different fix for msvc will have to be found.
2022-10-31 20:20:32 -04:00
Matthias Clasen
1a8ff606f2 Merge branch 'matthiasc/for-main' into 'main'
Be consistent in preconditions for async API

See merge request GNOME/gtk!5186
2022-10-31 21:15:10 +00:00
Matthias Clasen
030e8c0bf9 Be consistent in preconditions for async API
Do the same checks in all our finish functions.
2022-10-31 16:40:54 -04:00
Aleksandr Melman
4b29972d31 Update Russian translation 2022-10-31 12:30:25 +00:00
Matthias Clasen
d1bff928f6 Merge branch 'ebassi/since-for-main' into 'main'
Ebassi/since for main

See merge request GNOME/gtk!5185
2022-10-30 23:22:19 +00:00
Emmanuele Bassi
d665b0e042 docs: Add missing Deprecated annotations 2022-10-30 20:08:39 +00:00
Emmanuele Bassi
37fadb20a9 docs: Add missing Since annotations 2022-10-30 20:08:21 +00:00
Matthias Clasen
1c3f179a20 Merge branch 'matthiasc/for-main' into 'main'
alertdialog: Small refactoring

See merge request GNOME/gtk!5184
2022-10-30 13:29:35 +00:00
Matthias Clasen
5cb84afaa9 Add a test for POTFILES.in
Add a test that runs make-pot. This will only pass
if you've updated po/POTFILES.in and .skip after
moving source files around.

Unfortunately, it won't catch new source files that
are missing.
2022-10-30 08:52:02 -04:00
Matthias Clasen
a36bf22134 alertdialog: Small refactoring
Move the deprecated code out into its own function.
2022-10-30 08:52:02 -04:00
Piotr Drąg
8ef8514036 Update POTFILES.in 2022-10-30 12:34:21 +01:00
Matthias Clasen
c1b1e96a9a Merge branch 'deprecate-gtkdialog2' into 'main'
Deprecate GtkDialog

See merge request GNOME/gtk!5182
2022-10-29 20:39:18 +00:00
Matthias Clasen
9948053cd7 Deprecate GtkDialog
GtkDialog is too flexible in terms of UI (headerbars vs action bar,
etc), and has archaic APIs. It is time to retire it.
2022-10-29 15:27:53 -04:00
Matthias Clasen
f1af8046d0 Merge branch 'matthiasc/for-main' into 'main'
Docs updates

See merge request GNOME/gtk!5180
2022-10-29 19:22:50 +00:00
Matthias Clasen
8324a93c73 Update docs
Mention new deprecations in the future migration guide.
2022-10-29 14:14:59 -04:00
Matthias Clasen
251dcc2f86 Merge branch 'async-dialog-api2' into 'main'
Add new async APIs to replace chooser dialogs

See merge request GNOME/gtk!5174
2022-10-29 17:52:13 +00:00
Matthias Clasen
2ca168d680 NEWS: Updates 2022-10-29 13:31:41 -04:00
Matthias Clasen
f54ab91ff3 Deprecate GtkFileChooser and implementations
These are being replaced by GtkFileDialog.

This commit only moves the headers for GtkFileChooserWidget and
GtkFileChooserDialog to deprecated/, and keeps the implementations
in gtk/, since they will eventually be salvaged into a private
GtkFileChooserWindow.
2022-10-29 13:31:41 -04:00
Matthias Clasen
66b062a976 Deprecate GtkMessageDialog
It is getting replaced by GtkAlertDialog

This commit only moves the header to deprecated/,
and keeps the implementation in gtk/, since it will
eventually be salvaged into a private, dialog-free
widget.
2022-10-29 13:31:41 -04:00
Matthias Clasen
15572b0183 Deprecate GtkFontChooser and implementations
These are being replaced by GtkFontDialog
and GtkFontDialogButton

This commit only moves the headers for GtkFontChooserWidget and
GtkFontChooserDialog to deprecated/, and keeps the implementations
in gtk/, since they will eventually be salvaged into a private
GtkFontChooserWindow.
2022-10-29 13:31:41 -04:00
Matthias Clasen
a51a6a3ee2 Deprecate GtkColorChooser and implementations
These are being replaced by GtkColorDialog
and GtkColorDialogButton.

This commit only moves the headers for GtkColorChooserWidget
and GtkColorChooserDialog to deprecated/, and keeps the
implementations in gtk/, since they will eventually be
salvaged into a private GtkColorChooserWindow.
2022-10-29 13:31:41 -04:00
Matthias Clasen
8bee62dd36 examples: Port to async dialog API 2022-10-29 13:31:41 -04:00
Matthias Clasen
4248380538 print-editor: Port to async dialog API 2022-10-29 13:31:41 -04:00
Matthias Clasen
e7de4c1f99 node-editor: Port to async dialog API 2022-10-29 13:31:41 -04:00
Matthias Clasen
d620197ae1 constraint-editor: Port to async dialog API 2022-10-29 13:31:41 -04:00
Matthias Clasen
ad2552ee43 widget-factory: Port to async dialog API 2022-10-29 13:31:41 -04:00
Matthias Clasen
756888a53d gtk-demo: Port to async dialog API 2022-10-29 13:31:41 -04:00
Matthias Clasen
99e1643cdd gtk-demo: Rewrite the pickers demo
This needs some more work. For now, just have
very simple test cases for some of the new async
APIs.
2022-10-29 13:31:41 -04:00
Matthias Clasen
9839aca0bd inspector: Port to async dialog API 2022-10-29 13:31:41 -04:00
Matthias Clasen
9ab732ce2d gtk: Port to async dialog API 2022-10-29 13:31:41 -04:00
Matthias Clasen
6ed2d2b232 Add GtkFileDialog
Add an async API for picking a file, together with
a builder object for it. This is meant to replace direct
use of GtkFileChooserDialog.
2022-10-29 13:31:41 -04:00
Matthias Clasen
cccc74786f Add GtkAlertDialog
This is replacing GtkMessageDialog with an
async API for showing informational messages.
2022-10-29 13:31:41 -04:00
Matthias Clasen
aeacc8f3c5 Add GtkFontDialogButton
This is like GtkColorDialogButton, but for fonts.
2022-10-29 13:31:41 -04:00
Matthias Clasen
7d0ebe02db Add GtkFontDialog
This is similar to GtkColorDialog, but for fonts.
2022-10-29 13:31:41 -04:00
Matthias Clasen
655675e6a1 Add GtkColorDialogButton
This is a new color button implementation
built around GtkColorDialog.
2022-10-29 13:02:15 -04:00
Matthias Clasen
f877f33c19 Add GtkColorDialog
Add an async API for picking a color, together with
a builder object for it. This is meant to replace direct
use of GtkColorChooserDialog.
2022-10-29 10:18:37 -04:00
Matthias Clasen
2fce117d15 Add GtkDialogError
This error domain will be used by async apis
in future commits.
2022-10-29 10:18:37 -04:00
Matthias Clasen
bd5dedce12 fontchooser: Add a way to set a GtkFilter
We keep this private, since the chooser apis
are going away. This will be used in GtkFontDialog.
2022-10-29 10:18:37 -04:00
Matthias Clasen
bdc91c2339 messagedialog: Cosmetics 2022-10-28 22:23:04 -04:00
Matthias Clasen
8be7515610 Merge branch 'matthiasc/for-main' into 'main'
ci: Try to fix the macos build

See merge request GNOME/gtk!5179
2022-10-29 02:08:19 +00:00
Matthias Clasen
2cef677aef ci: Require macos to build again 2022-10-28 21:39:13 -04:00
Matthias Clasen
a2e2673809 ci: Try to fix the macos build
It seems that libjpeg-turbo first finds nasm,
and then doesn't find it. Turn off simd to keep
it from looking for it in the first place.
2022-10-28 21:07:58 -04:00
Matthias Clasen
2c844e961f Merge branch 'matthiasc/for-main' into 'main'
printeroptionwidget: Drop unused include

See merge request GNOME/gtk!5178
2022-10-28 23:41:03 +00:00
Matthias Clasen
5c9d68a550 printeroptionwidget: Drop unused include 2022-10-28 18:24:48 -04:00
Matthias Clasen
0248a7e43f Merge branch 'matthiasc/for-main' into 'main'
gtk4-demo: Avoid a critical from a11y code

See merge request GNOME/gtk!5177
2022-10-28 16:20:18 +00:00
Matthias Clasen
b972decf82 gtk4-demo: Avoid a critical from a11y code
Even though we want to be accessible,
we must not divide by zero.
2022-10-28 12:02:23 -04:00
Emmanuele Bassi
66ec091461 Merge branch 'bilelmoussaoui/file-chooser-gi' into 'main'
g-i: Add missing since annotation

See merge request GNOME/gtk!5175
2022-10-27 17:06:22 +00:00
Bilal Elmoussaoui
6ca33c639e g-i: Add missing since annotation 2022-10-27 15:38:14 +00:00
Matthias Clasen
a13a681910 Merge branch 'revert-9c919ffa462dd4511da0bfd19d36d2e15c51651b-main' into 'main'
Revert "treepopover: Do not propagate natural width of content"

See merge request GNOME/gtk!5171
2022-10-26 18:22:43 +00:00
Mat
f6eb84189f Revert "treepopover: Do not propagate natural width of content"
This reverts commit 9c919ffa46.
2022-10-26 13:58:10 +03:00
Matthias Clasen
114e2b607b Merge branch 'ebassi/glade-docs' into 'main'
docs: Remove mentions of Glade

See merge request GNOME/gtk!5168
2022-10-25 00:39:57 +00:00
Emmanuele Bassi
21bc2c5078 docs: Remove mentions of Glade
Glade does not support GTK4, so we should not link to it when discussing
developing GTK4 applications.
2022-10-24 20:11:50 +01:00
Мирослав Николић
a95cfb1c45 Update Serbian translation
(cherry picked from commit b760f57ae1)
2022-10-23 09:21:37 +00:00
Matthias Clasen
799fb41937 Merge branch 'deprecation-cleanups' into 'main'
gtk-demo: Replace combo boxes in font features

See merge request GNOME/gtk!5164
2022-10-22 19:23:45 +00:00
Matthias Clasen
e6f4c596fa gtk-demo: Use global style in font_features 2022-10-22 11:38:46 -04:00
Matthias Clasen
3d7fb26588 gtk-demo: Replace combo boxes in font features
This is a slightly more complicated combo box,
so we need an auxiliary object.
2022-10-22 11:35:35 -04:00
Matthias Clasen
93f9b2d519 Merge branch 'deprecation-cleanups' into 'main'
gtk-demo: Remove deprecations from dnd

See merge request GNOME/gtk!5160
2022-10-22 02:32:23 +00:00
Matthias Clasen
6f3613a06f bloatpad: Stop using a combobox
Replace GtkComboBoxText with GtkDropDown+GtkStringList.
2022-10-21 22:03:17 -04:00
Matthias Clasen
3723778f42 fontchooser: Stop using deprecated harfbuzz api
The replacement is very straightforward.
2022-10-21 21:54:38 -04:00
Matthias Clasen
3fc3f8d2ff gtk-demo: Replace combobox in font rendering
Out with the combobox, in with the dropdown.
2022-10-21 21:48:39 -04:00
Matthias Clasen
2868f1b509 placesview: Drop deprecation guards
We got rid of all deprecated api here.
2022-10-21 21:48:39 -04:00
Matthias Clasen
f44570e71a filechooserwidget: Drop deprecation guards
We got rid of all deprecated api here.
2022-10-21 21:48:39 -04:00
Matthias Clasen
15d39dddc5 filesystemmodel: Drop outdated comments
Drop a long comment describing an implementation
that no longer exists.
2022-10-21 21:48:39 -04:00
Matthias Clasen
1028449bcc filesystemmodel: Drop unneded deprecation guards
Nothing deprecated is used here anymore.
2022-10-21 21:48:39 -04:00
Matthias Clasen
01cca279f9 searchenginemodel: Drop unneeded deprecation guards
Nothing deprecated is used here anymore.
2022-10-21 21:48:39 -04:00
Matthias Clasen
a7cae4bffa gtk-demo: Remove deprecations from characters
Make the characters demo use global style providers.
2022-10-21 21:48:39 -04:00
Matthias Clasen
3e2e29a1dc gtk-demo: Remove deprecations from sizegroup demo
Out with the comboboxes, in with the dropdowns.
2022-10-21 21:48:39 -04:00
Matthias Clasen
de069e15c2 gtk-demo: Remove deprecation from textview demo
Use a dropdown instead of a combobox for the widget
embedding. It's better!
2022-10-21 21:48:39 -04:00
Matthias Clasen
f8edefd7c0 gtk-demo: Remove deprecations from gltransitions
Make the GL transitions demo use global style providers.
2022-10-21 21:48:39 -04:00
Matthias Clasen
24a15b51fe gtk-demo: Remove deprecations from solitaire
Make the solitaire game use global style providers.
2022-10-21 21:48:39 -04:00
Matthias Clasen
1f7aba345d gtk=demo: Drop unneeded deprecation guards
Nothing deprecated in the pixbuf paintable demo.
2022-10-21 21:48:39 -04:00
Matthias Clasen
230212c59c gtk-demo: Remove deprecations from dnd
Make the dnd demo use global style providers.
2022-10-21 21:48:39 -04:00
Matthias Clasen
86f7c19b91 Merge branch 'wip/corey/file-chooser-popup' into 'main'
filechooserwidget: Fix popup issues

See merge request GNOME/gtk!5161
2022-10-22 00:36:26 +00:00
Corey Berla
e5cea4e39d filechooserwidget: Show popup when clicking on empty space
Add gesture to right click or long press in the empty space
in the FileChooserWidget.  Only show the global settings when
clicking on the empty space.
2022-10-21 13:57:21 -07:00
Corey Berla
22aca8952f filechoosercell: Select item when right click or long press 2022-10-21 13:57:15 -07:00
Corey Berla
c0e437d163 filechoosercell: Only use long press when in touch mode 2022-10-21 13:57:11 -07:00
Corey Berla
ffe97a453f filechoosercell: Claim sequence on click 2022-10-21 13:57:06 -07:00
Matthias Clasen
c09ba28b06 Merge branch 'gbsneto/filechooser-column-view' into 'main'
Port filechooser to GtkColumnView

See merge request GNOME/gtk!5108
2022-10-21 19:42:24 +00:00
Matthias Clasen
81de43eba5 Merge branch 'matthiasc/for-main' into 'main'
Bump the GLib requirement

See merge request GNOME/gtk!5158
2022-10-21 16:26:57 +00:00
Matthias Clasen
788be8b945 filesystemmodel: Fix a compiler warning 2022-10-21 12:15:36 -04:00
Matthias Clasen
0370979225 theme: Fix up padding for the file chooser
We need the padding inside the filelistcell, so that
its event controllers cover the whole area.

Introduce a .complex style class for columnviews that
achieves that, and make the filechooser use it.
2022-10-21 08:28:58 -04:00
Matthias Clasen
943014074c Bump the GLib requirement
We now use GSignalGroup, which was introduced
in GLib 2.72.
2022-10-21 07:59:47 -04:00
Matthias Clasen
c0e8523a01 filesystemmodel: Fix a compiler warning 2022-10-21 07:44:13 -04:00
Matthias Clasen
8374ebe4c4 Merge branch 'gtkcompostable-c-fix-c4013' into 'main'
gtkcomposetable.c: Fix build on non-X11

See merge request GNOME/gtk!5156
2022-10-21 11:40:52 +00:00
Chun-wei Fan
611d14108d gtkcomposetable.c: Fix build on non-X11
The build breaks with a C4013 warning/error on Visual Studio because we don't
have a prototype defined for _gtk_get_datadir(), so include gtkprivate.h.

The vs2017-x64 CI did not catch this error because it is building GLib as a
fallback subproject, causing the msvc_recommended_pragmas.h header not to be
found, which is used to detect problems like this.
2022-10-21 12:29:19 +08:00
Matthias Clasen
25cf702345 filechooser: Make search results show up
The tracker search engine implementation was not
setting all the custom attributes that we require
now.

The quartz search engine will need similar fixes.
2022-10-20 22:34:41 -04:00
Matthias Clasen
1d9c61cada filechooserwidget: Remember sort columns and order
These settings existed before, we keep using them.
This loses some information about sorting by multiple
columns, but it is sufficient to get the same primary
sort column back.
2022-10-20 22:34:41 -04:00
Corey Berla
71adb26a0d filechooserwidget: Fix time_sort_func 2022-10-20 22:34:41 -04:00
Corey Berla
e27fa33690 filechooser: Add show-time property
The "Show Time" setting does not take immediate effect (only after
changing folders) because it's set as a single call to
column_view_get_time_visible() on the FileChooserCell creation.
Instead create a bind a show-time property that gets updated
as the setting is changed.
2022-10-20 22:34:41 -04:00
Corey Berla
f7dfead861 filechoosercell: Add a GtkDragSource
Allow dragging one or more items.  If the item dragged is not part of
the current selection, only drag that item.
2022-10-20 22:34:41 -04:00
Corey Berla
aac04a0995 filechoosercell: Bind "item" and "selected" to cell 2022-10-20 22:34:41 -04:00
Corey Berla
8af191e52d filechooserwidget: Expose selection model
FileChooserCell may need to change the selection during a DND.
2022-10-20 22:34:41 -04:00
Corey Berla
06382ff836 filechooserwidget: Rename and expose get_selected_files()
GtkFileChooserCell will need this function
2022-10-20 22:34:41 -04:00
Matthias Clasen
cd469788c3 filechooserwidget: Make rename popover work
Make the rename popover operate on the file that
the context menu was opened for, and pop up at
the same position.
2022-10-20 22:34:40 -04:00
Matthias Clasen
44b5076cf2 filechooserwidget: Make context menus mostly work
Move the gestures to the individual cells, and
make them trigger the context menu via an action
that takes item position and coordinates.

The semantics are changed slightly: the menu actions
now operate on the clicked item, not on the selection.

Still to do: Fix up keyboard activation.
2022-10-20 22:34:40 -04:00
Matthias Clasen
e5be9e1035 filesystemmodel: Drop the model types
We are no longer storing extra values, so no need
to take their types in the api.
2022-10-20 22:34:40 -04:00
Matthias Clasen
b831d01f0d filesystemmodel: Drop unused arguments
Drop the unused get_func arguments in constructors.

Update all callers.
2022-10-20 22:34:40 -04:00
Matthias Clasen
278bcf2680 filechooserentry: Simplify model construction
Don't pass a get_value callback when creating the
filesystem model. It isn't called anymore, and things
continue to work.
2022-10-20 22:34:40 -04:00
Matthias Clasen
c19d0dc9ea filesystemmodel: Drop more unused api
Drop all apis that operate on tree iters.
We are no longer a tree model.
2022-10-20 22:34:40 -04:00
Matthias Clasen
edd5ed169e filesystemmodel: Drop _gtk_file_system_model_get_value
This function is unused, so drop it, and its callback.
2022-10-20 22:34:40 -04:00
Matthias Clasen
8ec9c3fdc6 filechooser: Some work on popup menus
This is a start towards placing menus properly.

We once again center keyboard-triggered menus
on the file list.
2022-10-20 22:34:40 -04:00
Matthias Clasen
e95022040f filechooser: Drop deprecated includes
We no longer use cell renderers and tree models
here. Yay.
2022-10-20 22:34:40 -04:00
Matthias Clasen
3a2ce620e2 filesystemmodel: Fix a possible problem
If the async query fails to reproduce a file info,
we still need to thaw the model, otherwise it ends
up frozen forever.

This was deduced by reading the code, I haven't
actually seen it happen.
2022-10-20 22:34:40 -04:00
Matthias Clasen
df49bf9eec filechooserwidget: Use a string sorter for names
We can use the new collation property of GtkStringSorter,
and get the benefit of sort key caching. This commit
also fixes an accidental leak of all sorters, and
removes the sorter from the location column - we never
show that column when individual colummns are sortable.
2022-10-20 22:34:40 -04:00
Matthias Clasen
53327f3aea filechooser: Drop unnecessary theme tracking
The widgets we are using handle theme changes
themselves, so there is no need for the filechooser
to do anything.
2022-10-20 22:34:40 -04:00
Matthias Clasen
c0c3d75062 filechooser: Bring back sorting
Add a sort model between the filter model and the
file system model, and set it up to sort according
to the circumstances.
2022-10-20 22:34:40 -04:00
Corey Berla
d0d0409f9d filechooserwidget: Reimplement DnD Drop Target
This reverts commit 34752a15a71597d00a8d08befc545ac1c178b81b.

Leaving out the drag source portion as that needs a total
reimplementation.  The GtkDropTarget only required minor
modifications.
2022-10-20 22:34:40 -04:00
Matthias Clasen
3a7d094542 filechooserwidget: Reinstate show_and_select_files
Now that we have information about visible and
filtered-out status of items, we can make this
function work again.
2022-10-20 22:34:40 -04:00
Matthias Clasen
280adcbb8c filechooserwidget: Add a filter model
Put a filter model between the selection model and
the filesystem model, and make it filter on the
filechooser::visible attribute. This makes the filer
combo in the filterchooser and the 'show hidden files'
item work. But we need to prod the filter to trigger
a refiltering every now and then.
2022-10-20 22:34:40 -04:00
Matthias Clasen
83431a999c filesystemmodel: Make filtering info available
Provide the filtered-out and visible bits as a file attributes
under the names filechooser::filtered-out and filechooser::visible,
so that we can filter on it.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
eeeee99aa8 filechooserwidget: Connect to the right model
When recreating the browse_files_model model, connect to that
model's item-changed signal, instead of connecting to the selection
model.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
0f503e0ba2 filechooserwidget: Connect to items-changed when changing model
Just like previous commit, we need to call list_items_changed()
even if we change from single selection to multi selection or
vice-versa.
2022-10-20 22:34:40 -04:00
Matthias Clasen
3e4ae62b44 filesystemmodel: Drop an unused include 2022-10-20 22:34:40 -04:00
Matthias Clasen
ec4f814bd4 filechooserwidget: Listen to items-changed too
To track changes of the selected items in a selection
model, we need to listen to both ::selection-changed
and ::items-changed.

This fixes the open button not turning sensitive
when initially loading a new folder.
2022-10-20 22:34:40 -04:00
Matthias Clasen
0141ba4e00 filechooser: Prevent recursion when activating items
When a list item is activated, we activate the default widget.
Unfortunately, due to some other bug, sometimes the open button
is not made sensitive, and then default.activate falls back
to activating the focus widget (which is the item we are just
coming from). Boom
2022-10-20 22:34:40 -04:00
Matthias Clasen
52ef16c21b actionmuxer: Add debug spew for action activation
This helps tracking down whe activation goes wrong.
2022-10-20 22:34:40 -04:00
Matthias Clasen
6ca7104015 filesystemmodel: Drop the tree model implementation
This is no longer used.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
07d6166ab8 filechooserwidget: Use GListModel API for post-renaming selection 2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
dc651c3dc3 filechooserentry: Use separate GtkTreeStore for completion
Soon GtkFileSystemModel will not be a GtkTreeModel implementation,
so preemptively remove any usage of this interface. Populate the
list store using the GListModel's 'items-changed' signal.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
f520801626 filesystemmodel: Retire GtkFileSystemItem
This has to be the shortest-living object in GTK history!

It helped us greatly during the transition to GtkColumnView, but
now we can remove it in favour of GFileInfo directly. Perhaps I
could have never introduced GtkFileSystemItem in the first place,
but we're 30 commits deep and it's too late to just redo the whole
thing that will get us exactly here anyway.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
4e3fbd0b0f filesystemmodel: Always set standard::file attribute
This will help us greatly when porting GtkFileSystemModel to
GtkDirectoryList.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
8a24fdea38 filesystemmodel: Trivial cleanup
Use g_set_object() which does exactly what the code there does.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
b26222b6ba filechooserutils: Add helper to get GFile from info
This will be used extensively starting from next commit!
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
c8d291ab86 filechooserentry: Trivial cleanups
Use g_clear_object() in a couple of places. No functional changes.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
0a87438432 searchenginemodel: Use GListModel API to filter
We now start a mini-series of commits that will ultimately remove
the GtkTreeModel implementation of GtkFileSystemModel.

As a first step, port GtkSearchEngineModel iter through the files
using GListModel API.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
ddf1cd6678 filechooserwidget: Remove treeview
Now that most of the treeview usage is gone, remove the remaining
code that uses it - mostly event handling code, which for now won't
work, but will be fixed by next commits - and drop the tree view
entirely.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
9c6d5e2ca5 filechooserwidget: Use GtkSelectionModel for selection
So far, GtkFileChooserWidget has relied on GtkTreeView's selection
management. This commit moves it away from GtkTreeView, and that's
a massive surgery - sorry :(

The most important aspect of this commit is that 'selection_model'
is now the main model we deal with. Changing between directories,
recent files, and search, all sets the selection_model's model.

Selections are entirely handled by GtkSelectionModel now.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
1f2561b08e filesystemmodel: Add more GtkFileSystemItem getters
They'll help us further remove GtkTreeModel code.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
d5b31a30fd filechooserwidget: Stop centering on selected files 2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
39c678988d filechooserwidget: Don't queue redraw / resize on tree view 2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
9052c191cb filechooserwidget: Compare focus against column view
This effectively doesn't work, but focus will be reworked at some
point, and this gets us a tiny bit closer to that.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
766f442636 gtkfilechooserwidget: Don't set size request 2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
27a3d2d09e filesystemmodel: Don't implement GtkTreeDragSource 2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
3a3482e41e filechooserwidget: Remove DnD code
Another case where we'll reimplement it later.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
44c37fa34a filesystemmodel: Drop GtkTreeSortable interface
Stop implementing this interface. We'll be able to reimplement
sorting once we fully transition to GListModel.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
5c41dbfaa5 filechooserwidget: Remove sorting
This will be reimplemented later using list models. For now, let's
remove it so we can untangle all this code properly.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
c9d2ff7a0f filechooserwidget: Stop autosizing treeview 2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
174af596c5 filechooserwidget: Use column view scrolled window
One less hook to treeview widgetry.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
de2624faa7 filechooserwidget: Move tooltip text to column view
Use a closure binding to query the tooltip.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
cda784a5f4 filechooserwidget: Move folder navigation to column view
React to column view's 'activate' signal, instead of treeview's
'row-activated'. It doesn't handle file sensitivity yet, but that
will probably be dropped later.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
cc33dbef03 filechooserwidget: Move keynav handling to column view 2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
ce36611c4e filechooserwidget: Set rubberbanding on column view
And stop setting it on the tree view.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
038cb31d27 filesystemmodel: Don't expose cache
With this commit we start slowly cleaning up the sattelite code
surrounding GtkFileChooserWidget, so that we eventually drop it
all.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
3b53a6b0a9 filechooserwidget: Remove extra action bar 2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
619ff2338e filechooserwidget: Move date and time to column view
Because this is the last treeview column, some pending tasks
are marked as TODO. We're getting close to dropping the tree
view!
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
2bcd6949df filechooserwidget: Move file type to column view 2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
abd78ce5f5 filechooserwidget: Move size to column view
This was one of the easier ones. We merely delegate the hard work
to g_format_size(), like we already do for treeview.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
7899fc03c4 filechooserwidget: Move location to column view
Move the entire location column, which only contains the location
renderer, to the column view. The code to generate locations from
the current folder is essentially intact.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
9984f00781 filechooserwidget: Drop name column from treeview
It is now entirely handled by the column view.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
a0d3bdc911 filechooserwidget: Move file icon to column view
This commit moves the icon loading code into a new private
widget called GtkFileThumbnail, which is bound to the GFileInfo
of the model, and asynchronously loads the file icon from that.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
b96317b872 filechooserwidget: Move file name to column view
And remove it from the tree view. Next commits will look a lot like
this, until all columns are moved.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
6c84958b9f filechooserwidget: Replace 'list' page with column view
Replace the 'list' page of the main stack with another page, this
one containing a GtkColumnView. This, again, is the very minimal
code to achieve a column view - and validate the GListModel code
introduced in the previous commit - but there's a long way until
this column view covers the full range of features of the file
chooser.

The tree view still lives in an unused 'list2' page. From now on,
commits will "cannibalize" the treeview, each commit porting any
particular feature - be it a column, an event controller, etc -
to the column view, and dropping the corresponding feature from
the treeview.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
f2559b1dbb filesystemmodel: Implement GListModel
This is a trivial implementation of the GListModel interface. It
does not do anything fancy, like filtering out hidden files, nor
sorting.

The purpose of this minimal implementation is to bootstrap the
initial work to port GtkFileChooserWidget to GtkColumnView.
2022-10-20 22:34:40 -04:00
Georges Basile Stavracas Neto
ed2ade4801 filesystemmodel: Use g_clear_* on finalize
Trivial cleanup, no functional changes.
2022-10-20 22:34:40 -04:00
Matthias Clasen
4549172825 Merge branch 'matthiasc/for-main' into 'main'
inspector: Fix accessibility calls

See merge request GNOME/gtk!5154
2022-10-21 02:28:02 +00:00
Matthias Clasen
b877804eb6 Merge branch 'completion' into 'main'
entrycompletion: Fix inserted-text handler

See merge request GNOME/gtk!4892
2022-10-21 02:13:42 +00:00
Matthias Clasen
5310abbcf7 filechooserentry: Fix completions
Before we can drop them, lets make them work.

This was broken since 4.0, I assume :(
2022-10-20 21:41:18 -04:00
Matthias Clasen
490d4b0b9e inspector: Fix accessibility calls
The argument list of gtk_accessible_update_property
is -1-terminated, not NULL-terminated.
2022-10-20 21:19:13 -04:00
Matthias Clasen
375432f0b6 Merge branch 'columnview-sorter-api' into 'main'
gtk-demo: Add more sort columns

Closes #5149

See merge request GNOME/gtk!5152
2022-10-20 19:18:26 +00:00
Matthias Clasen
c00a23ebbc Merge branch 'fix-wayland-keycode-mapping' into 'main'
wayland: Fix keycode->keyval mapping

Closes #5277

See merge request GNOME/gtk!5147
2022-10-20 19:15:38 +00:00
Matthias Clasen
4cd2e2a11f Merge branch 'ebassi/tree-deprecation-docs' into 'main'
docs: Add deprecation messages to GtkTreeStore

See merge request GNOME/gtk!5115
2022-10-20 18:39:29 +00:00
Matthias Clasen
ae7bf4dcf7 Merge branch 'wip/jtojnar/compose-consistent-system' into 'main'
Improve composetable inclusions

See merge request GNOME/gtk!5150
2022-10-20 18:28:47 +00:00
Matthias Clasen
9ed1505073 columnviewtitle: Clean up interactions
Separate the apis we use for updating title,
menu and sort indicator.
2022-10-20 13:57:33 -04:00
Matthias Clasen
e040d3663e columnviewsorter: Add public API
This API should be sufficient to serialize
a columnviews sort configuration.

Fixes: #5149
2022-10-20 13:06:45 -04:00
Matthias Clasen
6af69a7b7d Make GtkColumnViewSorter public
API is yet to come.
2022-10-20 13:01:18 -04:00
Matthias Clasen
a116e0dd26 columnviewsorter: Cosmetics 2022-10-20 13:01:18 -04:00
Matthias Clasen
3e2b962a36 columnviewcolumn: Add an ID
This string can be used when storing columnview
configuration.
2022-10-20 13:01:18 -04:00
Matthias Clasen
abb60ec579 columnviewcolumn: Remove some unused code 2022-10-20 11:44:05 -04:00
Matthias Clasen
b738d4a6ac columnviewcolumn: Cosmetics 2022-10-20 11:44:05 -04:00
Matthias Clasen
0149bd49ca gtk-demo: Add more sort columns
Add a second sort column to the Settings demo,
to make it easier to test column view sorting.
2022-10-20 11:44:05 -04:00
Emmanuele Bassi
e05157437f Add more messages to the deprecation warnings
Point to replacement types for the old GtkTree* API.
2022-10-20 15:39:07 +01:00
Emmanuele Bassi
e045e798a2 Mark GtkStyleContext type as deprecated
Add the Deprecated tag to the type docblock
2022-10-20 15:39:07 +01:00
Emmanuele Bassi
7908a72fa9 Mark GtkEntryCompletion type as deprecated
Add the Deprecated tag to the type docblock.
2022-10-20 15:39:07 +01:00
Emmanuele Bassi
593bf2bc6d Mark GtkTreeView-related types as deprecated
Add the Deprecated annotation to the type docblock.
2022-10-20 15:39:07 +01:00
Jan Tojnar
cf701d5db4 imcontextsimple: Document that Compose file support is incomplete
And that `include "%L"` does something different as introduced in
3b4b1c6878

Note that user can still use `include "/.%L"` as a workaround.
2022-10-20 16:19:13 +02:00
Emmanuele Bassi
bf8d4c5418 Mark GtkAppChooser-related types as deprecated
The type docblock needs a Deprecated annotation.
2022-10-20 14:38:31 +01:00
Emmanuele Bassi
912145c81b Mark GtkCellRenderer-related types as deprecated
The docblock for the type needs a Deprecated annotation, and we can use
it to point to the appropriate replacement.
2022-10-20 14:38:31 +01:00
Emmanuele Bassi
913127b553 Point at the replacement for GtkIconView
In the symbol annotations and in the docblocks.
2022-10-20 14:38:31 +01:00
Emmanuele Bassi
62f85e2f49 Point at the replacements for GtkTreeView
In the symbol annotations and in the docblocks.
2022-10-20 14:38:31 +01:00
Emmanuele Bassi
4b1212eb4a Point to replacement for GtkComboBoxText
GtkDropDown and GtkStringList replace GtkComboBoxText with a simpler
API.
2022-10-20 14:38:31 +01:00
Jan Tojnar
94a096ec4c composetable: Support non-FHS paths for Compose tables
On platforms like NixOS, the libX11 installation prefix may differ from /usr/share,
breaking the hardcoded placeholders. Let’s re-use the X11 path definition from imcontextsimple.
2022-10-20 12:59:17 +02:00
Emmanuele Bassi
404ee55ec4 Point to GtkDropDown as the GtkComboBox replacement 2022-10-20 11:10:57 +01:00
Emmanuele Bassi
5fbd52da49 docs: Add deprecation message for GtkListStore
Point to GListStore and list models instead.
2022-10-20 11:02:29 +01:00
Emmanuele Bassi
7bf094c117 docs: Add deprecation messages to GtkTreeStore
Point to GtkTreeListModel, and while we're at it, let's fix some of the
gtk-doc-isms that are still there.
2022-10-20 11:02:29 +01:00
Matthias Clasen
4bb79decf3 Merge branch 'label-selection-fix' into 'main'
label: Tweak selection behavior

Closes #2024

See merge request GNOME/gtk!5148
2022-10-19 21:37:08 +00:00
Matthias Clasen
60fb93e063 label: Tweak selection behavior
Arrange for double-click-followed-by-drag to do
select by words, not select-and-dnd. This matches
the behavior in GtkTextView better and feels
intuitive.

Fixes: #2024
2022-10-19 16:22:55 -04:00
Matthias Clasen
1894a8960e wayland: Fix keycode->keyval mapping
We were looping over the levels, but not using
the current level value to obtain the keymap
entries. Oops.

Fixes: #5277
2022-10-19 15:46:27 -04:00
Matthias Clasen
4ba5c90bc9 Merge branch 'filechooser-amberol' into 'main'
filechooser: Improve "Open in File Manager"

Closes #5260

See merge request GNOME/gtk!5140
2022-10-19 19:41:15 +00:00
Matthias Clasen
1d16bd7d30 Merge branch 'matthiasc/for-main' into 'main'
docs: Remove mention of ~/.gtk-4.0

Closes #3266

See merge request GNOME/gtk!5146
2022-10-19 19:11:57 +00:00
Matthias Clasen
17819ad4f6 filechooser: Improve "Open in File Manager"
Just relying on GAppInfo leads to suboptimal
results. Instead, call either the OpenURI portal
or the org.freedesktop.FileManager1 interface
directly, and only fall back to GAppInfo.

The wrapper code for the OpenURI portal is taken
from gio, with small adjustments.

Fixes: #5260
2022-10-19 15:01:21 -04:00
Matthias Clasen
ac1ea6faca docs: Remove mention of ~/.gtk-4.0
We are not looking there anymore, for a long time.

Fixes: #3266
2022-10-19 14:36:48 -04:00
Matthias Clasen
8a3f1a1fa1 Merge branch 'builder-tool-scope' into 'main'
docs: Update gtk4-builder-tool docs

See merge request GNOME/gtk!5145
2022-10-19 18:34:25 +00:00
Matthias Clasen
46c7c0c4e6 docs: Document new buildertool options 2022-10-19 13:36:14 -04:00
Matthias Clasen
dd60a9abd6 buildertool: Support enumerating callbacks
The new scope approach makes this easy, and
it can be useful to know what functions are
needed.
2022-10-19 13:36:14 -04:00
Matthias Clasen
50835ffbf6 buildertool: Improve validate implementation
Reimplement deprecation checking via a scope.
This lets us ignore missing callbacks, and helps
for validating templates.
2022-10-19 13:36:14 -04:00
Matthias Clasen
637713fe72 buildertool: Add a builder scope implementation
This will be used in future commits.
2022-10-19 13:36:14 -04:00
Matthias Clasen
7e71c868ab buildertool: Use --deprecations for templates
Use this option for templates too.

We still can't parse most templates, since they are
missing their callbacks.
2022-10-19 13:36:14 -04:00
Matthias Clasen
aaf5c43e78 Merge branch 'matthiasc/for-main' into 'main'
docs: Update gtk4-builder-tool docs

See merge request GNOME/gtk!5144
2022-10-19 17:13:23 +00:00
Matthias Clasen
5fb6f0e410 Merge branch 'wip/clipboard-serials' into 'main'
gdk/wayland: Use serial of the latest implicit grab available

Closes #5250

See merge request GNOME/gtk!5143
2022-10-19 13:57:19 +00:00
Matthias Clasen
cd031de680 docs: Update gtk4-builder-tool docs
Mention the new --deprecations option of the
validate command.
2022-10-19 08:50:34 -04:00
Carlos Garnacho
eeda25ab04 gdk/wayland: Use serial of the latest implicit grab available
When getting the serial for primary/clipboard selections we used a
function that largely relied on a GdkEvent being passed. We have
another available function that looks up the most recent serial
given the ongoing touch/tablet input as well.

This is the second best, compared to actually knowing the
input/device from the event that was received by the UI an triggered
the clipboard operation, and is already in use in other places
(e.g. window dragging). It is valid for these situations too.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5250
2022-10-19 13:54:07 +02:00
Matthias Clasen
acaf04a24e Merge branch 'builder-deprecations' into 'main'
buildertool: Fix template handling

Closes #5256

See merge request GNOME/gtk!5141
2022-10-19 11:20:37 +00:00
Matthias Clasen
bcabe77799 buildertool: Warn about deprecations
Add a new option --deprecations to the validate
command that will warn about use of deprecated types.

The list of current deprecations is unfortunately
hardcoded in the source, so this list will have to
be kept up-to-date.

Fixes: #5256
2022-10-19 02:51:29 -04:00
Matthias Clasen
64cf31f348 buildertool: Fix template handling
We were not properly parsing the error message
here, leading to badness.
2022-10-19 02:51:29 -04:00
Matthias Clasen
e037155a94 Merge branch 'text-overwrite-undo' into 'main'
testsuite: Fix tiff pixbuf tests

Closes #4411

See merge request GNOME/gtk!5138
2022-10-19 05:59:13 +00:00
Matthias Clasen
55cbb8a8d6 Merge branch 'clarify-gapplication-docs' into 'main'
docs: Clarify a point in GtkApplication docs

See merge request GNOME/gtk!5139
2022-10-19 03:54:36 +00:00
Matthias Clasen
db599f2ae6 Merge branch 'fix-pixbuf-tiff-tests' into 'main'
testsuite: Fix tiff pixbuf tests

Closes #4615

See merge request GNOME/gtk!5137
2022-10-19 03:53:08 +00:00
Matthias Clasen
741567868e Merge branch 'modelbutton-tooltip' into 'main'
widgetfactory: Add text to iconic model buttons

Closes #5220

See merge request GNOME/gtk!5136
2022-10-19 03:51:21 +00:00
Matthias Clasen
1e5e0480fd text: Make overwrite undo-friendly
In overwrite mode, every typed character gets
handled as a delete+insert, but we should not
record these as two individually undoable
steps.

This matches how we handle overwrite mode in
GtkTextView.

Fixes: #4411
2022-10-18 23:49:16 -04:00
Matthias Clasen
917aa7928d docs: Clarify a point in GtkApplication docs
Clarify that loading of automatic resources uses
the resource base path that was set at construction
time.

Fixes: #4300
2022-10-18 23:47:48 -04:00
Matthias Clasen
cd4dbd67a2 testsuite: Skip known-broken tests
The tiff pixbuf tests fail because of known
issues with the pixbuf tiff loader. Skip them.

Fixes: #4615
2022-10-18 23:22:47 -04:00
Matthias Clasen
5a6eab05e9 testsuite: Fix tiff pixbuf tests
This test wasn't actually testing what it claims,
since that functionality is broken in gdk-pixbuf.

Test it anyway.
2022-10-18 23:21:28 -04:00
Matthias Clasen
55ccaf9df9 modelbutton: Set up tooltips
Use the text of iconic model buttons as tooltip.

Fixes: #5220
2022-10-18 22:35:28 -04:00
Matthias Clasen
af0e056eec widgetfactory: Add text to iconic model buttons
We want to use this for tooltips in the future.
2022-10-18 22:35:02 -04:00
Matthias Clasen
77d1f0d982 Merge branch 'matthiasc/for-main' into 'main'
fontchooser: Drop a few errant translations

Closes #5146

See merge request GNOME/gtk!5135
2022-10-19 01:53:56 +00:00
Matthias Clasen
d4d7d5eafd fontchooser: Drop a few errant translations
No point in translating these properties, they
are not strings.

Fixes: #5146
2022-10-18 16:40:37 -04:00
Matthias Clasen
f658027c51 Merge branch 'fix-editable-label-spurious-focus-out' into 'main'
window: Keep a reference to move_focus_widget

Closes #4864

See merge request GNOME/gtk!5134
2022-10-18 19:45:19 +00:00
Matthias Clasen
7be993b728 editablelabel: Defer changes on focus-out
We can get spurious focus-out/-in pairs when
the editable label is in a popover that gets
a Wayland keyboard enter event as a result of
clicking the editable label.

A timeout isn't a great solution, but nothing
better is available right now.

Fixes: #4864
2022-10-18 14:23:22 -04:00
Matthias Clasen
e1d78821f6 window: Keep a reference to move_focus_widget
If we don't take a reference, it can happen that
the pointer is no longer valid by the time we
dereference it in after_paint.
2022-10-18 14:23:11 -04:00
Matthias Clasen
94ac1af293 Merge branch 'fix-focus-changes' into 'main'
window: Fix focus updates

Closes #4903

See merge request GNOME/gtk!5127
2022-10-18 11:02:08 +00:00
Matthias Clasen
b4db48935d Merge branch 'fix-windows-build-testmountoperation' into 'main'
tests/testmountoperation.c: Fix build on Windows

See merge request GNOME/gtk!5126
2022-10-18 10:53:21 +00:00
Matthias Clasen
f5063c1435 window: Don't focus invisible widgets
Only clear a queued move_focus if the widget
we are focusing is actually visible.

This was happening in some cases when popovers
are dismissed by clicking outside, and it was
causing us to miss proper focus updates that
were already queued.
2022-10-18 06:42:17 -04:00
Benjamin Otte
8092a6858e Merge branch 'bilelmoussaoui/gi-deprecated' into 'main'
g-i: Fix deprecated version of GtkTreeView

See merge request GNOME/gtk!5131
2022-10-18 09:53:53 +00:00
Bilal Elmoussaoui
0fbaeaabd0 g-i: Fix deprecated version of GtkTreeView 2022-10-18 11:27:39 +02:00
Luca Bacci
995f00d23f Merge branch 'forward-port-mr-991-to-gtk4-2' into 'main'
Use native Windows API for converting keystrokes to characters

Closes #2944

See merge request GNOME/gtk!4986
2022-10-17 19:20:08 +00:00
Matthias Clasen
100605ef0c window: Fix focus updates
This partially undoes changes from 3dbf5038fa.

That commit did two things:
1) Move the focus update to after-paint time
2) Change from grabbing focus to the visible parent
   to  calling move_focus (TAB)

The second part did have the unintended consequence
of moving focus laterally.

Fixes: #4903
2022-10-17 15:10:41 -04:00
Benjamin Otte
1246cd5e73 Merge branch 'wip/otte/for-main' into 'main'
singleselection: Be more careful about notifies

See merge request GNOME/gtk!5129
2022-10-17 18:34:40 +00:00
Benjamin Otte
f30e59fed9 dropdown: Handle ::selected and ::selected-item separately
GtkSingleSelection will only emit either of those signals if they
change. But it is possible that only one of those properties changes,
and in those cases we want to only notify for that property changing in
the dropdown, too.
2022-10-17 20:11:27 +02:00
Benjamin Otte
5e8b294faf singleselection: Be more careful about notifies
We don't want to notify::selected or notify::selected-item if they
didn't change.
This will bring performance benefits on frequently changing lists.

In particular, if lists get filtered or reordered, but the selected item
stays in the list, not doing a notify::selected-item will avoid updates
in connected handlers like GtkDropdown (and its handlers), thereby
avoiding lots of unnecessary updates.
2022-10-17 20:11:27 +02:00
Philip Zander
c84c469b78 Use native Windows API for converting keystrokes to characters 2022-10-17 19:36:48 +02:00
Chun-wei Fan
1a5a65acd0 tests/testmountoperation.c: Fix build on Windows
Sadly, we can't just use an interger for a GPid on Windows, so just cast
it.  Sounds silly for non-Windows, but that's life...
2022-10-17 12:36:17 +08:00
Matthias Clasen
6f5d18a9f5 macos: Fix clipboard data size handling
We were using the allocated memory size, not
the amount of data that has been written.

Fixes: #5261
2022-10-16 23:45:28 -04:00
Matthias Clasen
004f22a51c Merge branch 'matthiasc/for-main' into 'main'
Rename gtk_widget_get_style_color

See merge request GNOME/gtk!5125
2022-10-17 03:26:21 +00:00
Matthias Clasen
d775caff7f Rename gtk_widget_get_style_color
This name wasn't everybody's favorite, so go with
the generic name gtk_widget_get_color() instead.
2022-10-16 21:41:43 -04:00
Piotr Drąg
baf3a3eecd Update POTFILES.in 2022-10-16 14:34:34 +02:00
Benjamin Otte
ca2e14788d Merge branch 'antoniof-main-patch-03677' into 'main'
columnview: Don't be focusable

See merge request GNOME/gtk!5022
2022-10-14 22:39:49 +00:00
Matthias Clasen
c57d8fc6be Merge branch 'gtk_widget_get_style_color-docs-fix' into 'main'
Fix documentation for `gtk_widget_get_style_color()`

See merge request GNOME/gtk!5119
2022-10-14 10:49:15 +00:00
Sebastian Dröge
294e5bb79f Fix documentation for gtk_widget_get_style_color()
It was pointing at `gtk_widget_get_css_style()` instead.
2022-10-14 12:36:11 +03:00
Matthias Clasen
bde19f9b2a Fix blank popovers
This was a typo in 2b00b64e8c, making
us render the background on the wrong snapshot.
2022-10-13 16:38:41 -04:00
Matthias Clasen
1d2071b892 NEWS: Updates 2022-10-12 23:27:36 -04:00
Matthias Clasen
b46eb5c20a Merge branch 'matthiasc/for-main' into 'main'
filechooser: Update the settings docs

See merge request GNOME/gtk!5118
2022-10-13 03:09:47 +00:00
Matthias Clasen
3d605615ce filechooser: Update the settings docs
Document the window-position setting as unused.
2022-10-12 22:47:51 -04:00
Matthias Clasen
c502d7fca6 Merge branch 'matthiasc/for-main' into 'main'
docs: Add a cross-reference

See merge request GNOME/gtk!5117
2022-10-13 02:43:48 +00:00
Matthias Clasen
9f8abc5d74 docs: Add a cross-reference
Note that GtkTreeView is deprecated and link to the
list view introduction from 'Tree and List Widget Overview'.
2022-10-12 22:26:40 -04:00
Matthias Clasen
c8cbb3fbba Merge branch 'matthiasc/for-main' into 'main'
filechooserentry: Add a set_text api

See merge request GNOME/gtk!5116
2022-10-13 02:25:19 +00:00
Matthias Clasen
fa3c8ed5f9 filechooser: Stop using entrycompletion api
The file chooser entry now has an api for this.
2022-10-12 21:59:35 -04:00
Matthias Clasen
8ac5f1983e filechooserentry: Add a set_text api
This function prevents the completion popup
from coming up when setting the entry text.
2022-10-12 21:59:19 -04:00
Matthias Clasen
eccc02d084 Merge branch 'matthiasc/for-main' into 'main'
Start a migration guide for GTK 5

See merge request GNOME/gtk!5114
2022-10-12 21:02:56 +00:00
Matthias Clasen
0c94db7147 Start a migration guide for GTK 5
No need to panic, GTK 5 is still years away!
But it is good to write this material down while
it is fresh in mind.
2022-10-12 16:39:28 -04:00
Matthias Clasen
ed87473bf9 Merge branch 'deprecate-render' into 'main'
wip: Deprecate gtk_render apis

See merge request GNOME/gtk!5100
2022-10-12 20:38:19 +00:00
Matthias Clasen
812a879ec2 inspector: Use gtk_widget_get_style_color
The graph renderer in the statistics page needs
the CSS foreground color to draw the graph. Use
the just introduced api for it.
2022-10-12 15:35:00 -04:00
Matthias Clasen
5627542d7c Add gtk_widget_get_style_color
There is a widespread need to access the CSS foreground
color for custom drawing in snapshot functions, so make
it available after gtk_style_context_get_color was
deprecated with a new widget api.
2022-10-12 15:35:00 -04:00
Matthias Clasen
f42fe500c9 cssnode: Avoid style context api
Duplicate the print flags in gtkcssnodeprivate.h,
so we don't rely on gtkstylecontext.h here.
2022-10-12 15:35:00 -04:00
Matthias Clasen
ac3177ce95 tests: Ignore deprecations
Some of our tests use deprecated style context api.
Most of them should be ported to use global style
providers eventually. For now, ignore deprecations.
2022-10-12 15:35:00 -04:00
Matthias Clasen
ccaaff406f testsuite: Ignore deprecations
Some of our tests use deprecated style context
apis. Ignore the deprecations for now.
2022-10-12 15:35:00 -04:00
Matthias Clasen
b1ec43ae33 demos: Ignore deprecations
Most of these demos should be ported to use
global style providers eventually. For now,
just ignore the deprecations.
2022-10-12 15:35:00 -04:00
Matthias Clasen
ee8c2a235f stylecontext: Deprecate most apis
The notable exception here are the global provider apis,
which are needed in some form and don't have a replacement
yet. Move them to gtkstyleprovider.[hc], so we can wholly
deprecated gtkstylecontext.[hc].
2022-10-12 15:35:00 -04:00
Matthias Clasen
299fbfd722 tests: Ignore deprecations for render api 2022-10-12 15:35:00 -04:00
Matthias Clasen
5f54ecdf2c aboutdialog: Stop using gtk_style_context_save 2022-10-12 15:35:00 -04:00
Matthias Clasen
e09138ce45 textview: Stop using gtk_style_context_save_to_node 2022-10-12 15:35:00 -04:00
Matthias Clasen
a71893f88b text: Stop using gtk_style_context_save_to_node 2022-10-12 15:35:00 -04:00
Matthias Clasen
01324ffaff label: Stop using gtk_style_context_save_to_node 2022-10-12 15:35:00 -04:00
Matthias Clasen
c354465ed8 scrolledwindow: Stop using gtk_style_context_save_to_node 2022-10-12 15:35:00 -04:00
Matthias Clasen
50ab2386ec printunixdialog: Stop using gtk_style_context_save_to_node 2022-10-12 15:35:00 -04:00
Matthias Clasen
bf9f362597 popover: Stop using gtk_style_context_save_to_node 2022-10-12 15:35:00 -04:00
Matthias Clasen
d03ee57cc5 flowbox: Stop using gtk_style_context_save_to_node 2022-10-12 15:35:00 -04:00
Matthias Clasen
6f24bd9ff4 demos: Ignore deprecations for render apis
Eventually, this demo should probably be removed.
2022-10-12 15:35:00 -04:00
Matthias Clasen
616e0a0d32 textview: Stop using gtk_snapshot_render api
The gtk_snapshot_render api is deprecated, so avoid using it.
2022-10-12 15:35:00 -04:00
Matthias Clasen
ee76105119 text: Stop using gtk_snapshot_render api
The gtk_snapshot_render api is deprecated, so avoid using it.
2022-10-12 15:35:00 -04:00
Matthias Clasen
381f863a18 label: Stop using gtk_snapshot_render api
The gtk_snapshot_render api is deprecated, so avoid using it.
2022-10-12 15:35:00 -04:00
Matthias Clasen
57c63d9ce7 Use the new caret rendering api
Implement the deprecated gtk_snapshot_render api
for carets with the new one.
2022-10-12 15:35:00 -04:00
Matthias Clasen
0522dade9f Add gtk_css_style_snapshot_caret 2022-10-12 15:35:00 -04:00
Matthias Clasen
484cff2182 glarea: Stop using gtk_snapshot_render api
The gtk_snapshot_render api is deprecated, stop using it.
2022-10-12 15:35:00 -04:00
Matthias Clasen
dd3c371c08 inscription: Stop using gtk_snapshot_render api
The gtk_snapshot_render api is deprecated, so avoid using it.
2022-10-12 15:35:00 -04:00
Matthias Clasen
3145bce6a1 render: Use the new layout render api 2022-10-12 15:35:00 -04:00
Matthias Clasen
73f991a7fd Add gtk_css_style_snapshot_layout
This function renders a PangoLayout at a given
position, using text shadows and color from css.
2022-10-12 15:35:00 -04:00
Matthias Clasen
0205caa371 scrolledwindow: Port to the gtk_css_style_snapshot api
The gtk_snapshot_render api is deprecated, so avoid using it.
2022-10-12 15:35:00 -04:00
Matthias Clasen
c2c46a7036 printunixdialog: Port to the gtk_css_style_snapshot api
The gtk_snapshot_render api is deprecated, so avoid using it.
2022-10-12 15:35:00 -04:00
Matthias Clasen
2b00b64e8c popover: Port to the gtk_css_style_snapshot api
The gtk_snapshot_render api is deprecated, so avoid using it.
2022-10-12 15:35:00 -04:00
Matthias Clasen
4e2522a080 iconview: Port to the gtk_css_style_snapshot api
The gtk_snapshot_render api is deprecated, so avoid using it.
2022-10-12 15:35:00 -04:00
Matthias Clasen
473065dfeb flowbox: Port to the gtk_css_style_snapshot api
The gtk_snapshot_render api is deprecated, so avoid using it.
2022-10-12 15:35:00 -04:00
Matthias Clasen
60dafebd91 Deprecate gtk_snapshot_render apis
Move the implementations from gtksnapshot.c to
gtk/deprecated/gtkrender.c and deprecated these
functions. We want to get rid of them.

These functions are still used in some of our widgetry,
so use G_GNUC_BEGIN/END_IGNORE_DEPRECATIONS around
them.
2022-10-12 15:35:00 -04:00
Matthias Clasen
35370752d5 Deprecate gtk_render apis
These take a GtkStyleContext as argument, and we
want to get rid of GtkStyleContext eventually.
The proper drawing api these days is gtk_snapshot.
2022-10-12 15:35:00 -04:00
Matthias Clasen
808d00906c printunixdialog: Stop using gtk_render_ apis
These are getting deprecated.
2022-10-12 15:35:00 -04:00
Matthias Clasen
da5d5bd71f popover: Stop using gtk_render_background
The gtk_render_ apis are getting deprecated.
2022-10-12 15:34:59 -04:00
Matthias Clasen
0c99e69423 flowbox: Stop using gtk_render_background
The gtk_render_ apis are getting deprecated.
2022-10-12 15:34:59 -04:00
Matthias Clasen
410813eb6b Merge branch 'deprecate-all-the-cells' into 'main'
Deprecate treeviews and cell renderers

See merge request GNOME/gtk!5098
2022-10-12 19:28:04 +00:00
Luca Bacci
6cc44eb0fe Merge branch 'for-master' into 'main'
For master

See merge request GNOME/gtk!5095
2022-10-12 13:56:51 +00:00
Matthias Clasen
11ee930b9d Merge branch 'inspector_a11y' into 'main'
GtkInspector: make the inspector at least a little bit more accessible

See merge request GNOME/gtk!5109
2022-10-12 11:06:35 +00:00
Matthias Clasen
69e4c9b01e tests: Ignore deprecations
Eventually, most of these tests should be dropped.
2022-10-11 17:18:21 -04:00
Matthias Clasen
c32fed9238 testsuite: Ignore deprecations
For now, just ignore deprecations. Eventually,
we will have to go through, drop demos that are
for wholly deprecated widgets, and update others.
2022-10-11 17:18:21 -04:00
Matthias Clasen
4941ef659f tools: Ignore deprecations
For now, just ignore deprecations. Eventually,
we will have to go through and drop code that is
dealing with widgets that are going away.
2022-10-11 17:18:21 -04:00
Matthias Clasen
6efb18330f demos and examples: Ignore deprecations
For now, just ignore deprecations. Eventually,
we will have to go through, drop demos that are
for wholly deprecated widgets, and update others.
2022-10-11 17:18:21 -04:00
Matthias Clasen
5e256590db Deprecate treeviews and cell renderers
This includes

GtkCellArea
GtkCellAreaBox
GtkCellAreaContext
GtkCellEditable
GtkCellRenderer
GtkCellRendererAccel
GtkCellRendererCombo
GtkCellRendererPixbuf
GtkCellRendererProgress
GtkCellRendererSpin
GtkCellRendererSpinner
GtkCellRendererText
GtkCellRendererToggle
GtkCellView
GtkComboBox
GtkComboBoxText
GtkIconView
GtkListStore
GtkTreeModel
GtkTreeModelFilter
GtkTreeModelSort
GtkTreeStore
GtkTreeView
GtkTreeViewColumn
GtkTreeSelection
2022-10-11 17:18:21 -04:00
Matthias Clasen
79303d7cd3 inspector: Drop an unused file 2022-10-11 17:18:21 -04:00
Matthias Clasen
681a818af2 flowbox: Stop using gtk_render_background
The gtk_render_ apis are getting deprecated.
2022-10-11 17:18:21 -04:00
Matthias Clasen
933b1eb4df Merge branch 'filename-sorter' into 'main'
stringsorter: Add a collate-mode property

See merge request GNOME/gtk!5111
2022-10-11 20:59:08 +00:00
Matthias Clasen
c419b57754 stringsorter: Fix up a doc typo
gi-docgen links can be tricky to get right.
2022-10-11 15:32:05 -04:00
Matthias Clasen
05323869d7 stringsorter: Add more detail to the docs
Mention when a collation value of NONE might
be useful.
2022-10-11 14:09:21 -04:00
Matthias Clasen
2520148ebb Apply 2 suggestion(s) to 2 file(s) 2022-10-11 17:53:26 +00:00
Matthias Clasen
a06a4ad59a ci: Allow macos builds to fail
The runner seems busted, so allow builds to fail
for now.
2022-10-11 13:43:36 -04:00
Matthias Clasen
141aac1a60 stringsorter: Add a collation property
The new property lets us choose between
Unicode collation, filename collation, and
plain strcmp.

This will be used in the filechooser.
2022-10-11 13:42:00 -04:00
Lukáš Tyrychtr
8a1578ede8 GtkInspector: make the inspector at least a little bit more accessible
Namely, it adds accessible name to the property value editors and to a few labels in the a11y panel.
2022-10-11 13:34:53 +02:00
Matthias Clasen
8ba7840528 Merge branch 'wip/corey/file-clipboard' into 'main'
gdkcontentserializer: Use newlines for file separators

Closes #5240

See merge request GNOME/gtk!5107
2022-10-10 21:13:28 +00:00
Corey Berla
3168a3e086 gdkcontentserializer: Use newlines for file separators
Use newlines rather than spaces to separate file paths (or uri's)
when serializing text/plain files.  There isn't a matching
deserializer, so we can do this in isolation.  Newlines
seem to make more sense when pasting into a text editor etc.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5240
2022-10-10 13:27:07 -07:00
Matthias Clasen
3cf9149129 Merge branch 'matthiasc/for-main' into 'main'
Matthiasc/for main

See merge request GNOME/gtk!5106
2022-10-10 03:29:41 +00:00
Matthias Clasen
7c8a098852 emojicompletion: Drop an unused include 2022-10-09 23:08:55 -04:00
Matthias Clasen
ecbdb3104a emojichooser: Drop an unused include 2022-10-09 23:03:43 -04:00
Matthias Clasen
c8a332b3af searchentry: Drop an unused include 2022-10-09 23:03:36 -04:00
Matthias Clasen
b5f7d57124 Merge branch 'matthiasc/for-main' into 'main'
gtk-demo: Modernize accordion demo

See merge request GNOME/gtk!5105
2022-10-09 14:26:58 +00:00
Benjamin Otte
0db5c7f421 testgtk: Use global css provider 2022-10-09 10:13:44 -04:00
Benjamin Otte
ed83272f35 tests: Use per-screen CSS providers 2022-10-09 10:13:10 -04:00
Benjamin Otte
20b49e7c34 gtk-demo: Modernize accordion demo 2022-10-09 10:09:59 -04:00
Matthias Clasen
6a6ef0f437 Merge branch 'matthiasc/for-main' into 'main'
inspector: Fix some criticals

See merge request GNOME/gtk!5104
2022-10-09 13:53:54 +00:00
Benjamin Otte
32ef462f1d fontbutton: Use attributes for custom font
Don't try to use CSS.
2022-10-09 09:10:39 -04:00
Matthias Clasen
b895360f49 inspector: Fix some criticals
This is fallout from the recent porting to GtkColumnView.
2022-10-09 09:10:39 -04:00
Matthias Clasen
c2c094e8a1 Merge branch 'matthiasc/for-main' into 'main'
widget: Changing the scale does no longer require a redraw

See merge request GNOME/gtk!5103
2022-10-09 13:10:24 +00:00
Benjamin Otte
d4d0192405 widget: Changing the scale does no longer require a redraw
It doesn't require one generally anyway, because only the root can
change scale and when that happens the root will queue a redraw.

But even if the root doesn't queue a redraw, render nodes (the only
thing discarded by queue_draw()) are scale-independant.
2022-10-09 08:50:32 -04:00
Matthias Clasen
15ea36e7fd Merge branch 'matthiasc/for-main' into 'main'
glarea: Drop an unused include

See merge request GNOME/gtk!5102
2022-10-09 12:49:42 +00:00
Matthias Clasen
692279586a Merge branch 'main' into 'main'
GtkPaned: Fix symbol names in code example

See merge request GNOME/gtk!5101
2022-10-09 12:22:08 +00:00
Matthias Clasen
9eec475dcc glarea: Drop an unused include
We are not using gtk_render apis here.
2022-10-09 08:10:12 -04:00
Tilo Villwock
661130d429 GtkPaned: Fix symbol names in code example 2022-10-08 13:49:10 +02:00
Matthias Clasen
68b73ebf91 Merge branch 'matthiasc/for-main' into 'main'
paperdialog: Drop an unused function

See merge request GNOME/gtk!5099
2022-10-08 03:01:24 +00:00
Matthias Clasen
08c0020ac3 placesview: Stop using GtkEntryCompletion
We want to get rid of tree models and cell renderers,
and that includes GtkEntryCompletion. The functionality
here is really not that essential.
2022-10-07 22:22:36 -04:00
Matthias Clasen
ac87c72797 paperdialog: Drop an unused function
This gets rid of a GtkListStore use.
2022-10-07 22:03:15 -04:00
Matthias Clasen
5be8710774 Merge branch 'inspector-trees' into 'main'
inspector: Stop using GtkTreeView for css nodes

See merge request GNOME/gtk!5097
2022-10-07 21:55:10 +00:00
Matthias Clasen
5fa027ab8a cssnode: Drop the node-added/-removed signals
These are no longer used, and the children-observer
listmodel is a better approach for monitoring the
children.
2022-10-07 17:21:04 -04:00
Matthias Clasen
dbe04adb1a inspector: Drop the css node tree model
This is not used anymore.
2022-10-07 17:17:41 -04:00
Matthias Clasen
6815f3af6d inspector: Stop using GtkTreeView for css nodes
Replace the css node tree with a GtkColumnView, using
the new gtk_css_node_observe_children api.
2022-10-07 15:54:02 -04:00
Matthias Clasen
f8357512d0 Add gtk_css_node_observe_children 2022-10-07 15:54:01 -04:00
Luca Bacci
8bfc19e7f7 GtkFileChooserNativeWin32: Add some option flags
Avoid changing the current directory.
Also avoid creating a sample file to test if the target file
can be created.

References:

* "Why does the common file dialog change the current directory?"
 -> https://devblogs.microsoft.com/oldnewthing/20101112-00/?p=12293

* "Why does the common file save dialog create a temporary file and then delete it?"
 -> https://devblogs.microsoft.com/oldnewthing/20140429-00/?p=1123
2022-10-07 19:06:09 +02:00
Luca Bacci
d6f7449636 GdkWin32: Return TRUE when processing WM_XBUTTONDOWN/UP messages
As documented on MSDN:

> Unlike the WM_LBUTTONUP, WM_MBUTTONUP, and WM_RBUTTONUP messages, an
> application should return TRUE from this message if it processes it.
2022-10-07 19:05:29 +02:00
Luca Bacci
f4286e8f1a GdkWin32: Use gdk_pixbuf_read_pixels () where applicable
This is an optimization in case of reading unmodifiable GdkPixbufs.
Also replace uses of GLib integral types with <stdlib.h> integral
types.
2022-10-07 19:05:29 +02:00
Matthias Clasen
14e6fd1f12 Merge branch 'wroy-main-patch-03767' into 'main'
Add subproject/libjpeg-turbo.wrap

Closes #5237

See merge request GNOME/gtk!5094
2022-10-07 16:00:36 +00:00
William Roy
2e57621fc5 Add subproject/libjpeg-turbo.wrap 2022-10-07 14:48:49 +00:00
Matthias Clasen
4a8ae3a20c Merge branch 'inspector-trees' into 'main'
inspector: Stop using GtkTreeView for statistics

See merge request GNOME/gtk!5093
2022-10-07 05:57:02 +00:00
Matthias Clasen
61393fdcce inspector: Stop using GtkTreeView for statistics
GtkTreeView is heading towards deprecation; use
a GtkColumnView instead.
2022-10-07 01:40:51 -04:00
Matthias Clasen
6ed6cebcf4 inspector: Fixup
We were overlooking a transfer full here.
2022-10-07 00:12:47 -04:00
Jürgen Benvenuti
2f764f6c18 Update German translation
(cherry picked from commit 52dd917c6a)
2022-10-06 20:48:36 +00:00
Matthias Clasen
a646e50019 Merge branch 'main' into 'main'
Treat XKB_MOD_NAME_LOGO as super key

Closes #4913

See merge request GNOME/gtk!5088
2022-10-06 10:41:56 +00:00
Po Lu
e967dfed2d Treat XKB_MOD_NAME_LOGO as super key 2022-10-06 11:19:31 +04:00
Matthias Clasen
2dc33a9de1 Merge branch 'matthiasc/for-main' into 'main'
gdk: Cosmetics

See merge request GNOME/gtk!5087
2022-10-06 03:48:36 +00:00
Matthias Clasen
7c5e1c6195 gtk: Rename some private headers
Improve the consistency of our private header
naming, by add 'private' to a bunch of them.
2022-10-05 23:01:28 -04:00
Matthias Clasen
8607312fef gdk: Cosmetics
Add a define for each renderer.
2022-10-05 23:01:28 -04:00
Matthias Clasen
abac891bd2 Merge branch 'inspector-trees' into 'main'
inspector: Stop using a treeview for css properties

See merge request GNOME/gtk!5086
2022-10-06 02:52:12 +00:00
Matthias Clasen
2e25a13fc0 Merge branch 'matthiasc/for-main' into 'main'
mountoperation: Add a mnemonic to a button

See merge request GNOME/gtk!5085
2022-10-06 02:15:16 +00:00
Matthias Clasen
7a2c4e8a38 inspector: Stop using a treeview for css properties
Treeviews are heading towards deprecation.
2022-10-05 22:12:57 -04:00
Matthias Clasen
90e0ace325 inspector: Cosmetics 2022-10-05 21:20:04 -04:00
Matthias Clasen
9a2a5d9c8b mountoperation: Add a mnemonic to a button
This is a good practice, even if this is a rarely
used dialog.
2022-10-05 20:14:09 -04:00
Matthias Clasen
d4dd0dcd79 Merge branch 'accessible_range_interface' into 'main'
Introduce GtkAccessibleRange

See merge request GNOME/gtk!5066
2022-10-05 11:33:56 +00:00
Matthias Clasen
d454586927 Review fixes 2022-10-05 11:13:21 +00:00
Matthias Clasen
1917b6a0a3 Merge branch 'matthiasc/for-main' into 'main'
inspector: Use more compact list styles

See merge request GNOME/gtk!5083
2022-10-05 10:14:04 +00:00
Matthias Clasen
a924b820c2 inspector: Use more compact list styles
Use the same style classes throughout for
data lists that benefit from smaller fonts.
2022-10-04 23:25:12 -04:00
Matthias Clasen
9e82d2b843 Merge branch 'inspector-menus' into 'main'
Drop unused includes

See merge request GNOME/gtk!5082
2022-10-05 03:11:41 +00:00
Matthias Clasen
ab7a04d89f inspector: Stop using a treeview for menus
Replace this with a GtkColumnView.
2022-10-04 22:49:05 -04:00
Matthias Clasen
a377f95aac Drop unused includes
This gets rid of treeview includes in a number of places.
2022-10-04 22:49:05 -04:00
Matthias Clasen
4356e0c3ce Merge branch 'mountoperation-trees' into 'main'
mountoperation: Survive on Wayland

See merge request GNOME/gtk!5081
2022-10-05 02:48:39 +00:00
Matthias Clasen
5d5de9f759 mountoperation: Don't use a treeview
Port the process list from GtkTreeView
to GtkListView, and fix a number of broken
things along the way.
2022-10-04 21:26:07 -04:00
Matthias Clasen
e1f69ea278 testmountoperation: Test process dialog
Without this, it is hard to trigger the
dialog. Event with this, we have to force
GtkMountOperation to use its own dialog.
2022-10-04 21:26:07 -04:00
Matthias Clasen
6a76fe41c6 mountoperation: Survive on Wayland
The code was assuming it is dealing with an
X11 display, and trigger assertions. Fix that
to make it work at least as well as it does
on Windows.
2022-10-04 21:26:07 -04:00
Matthias Clasen
aae82d7992 Merge branch 'inspector-trees' into 'main'
inspector: Don't use treeviews in the recorder

See merge request GNOME/gtk!5080
2022-10-04 20:54:10 +00:00
Matthias Clasen
ca576e877f inspector: Don't use treeviews in the recorder
Replace the event and render node details views with
columnviews.
2022-10-04 16:26:28 -04:00
Alexander Shopov
bc23038848 Update Bulgarian translation
(cherry picked from commit 2ca2a15637)
2022-10-04 18:07:24 +00:00
Matthias Clasen
43e8730acd Merge branch 'inspector-fixes' into 'main'
inspector: Fix some lifecycle issues

See merge request GNOME/gtk!5079
2022-10-04 15:34:53 +00:00
Piotr Drąg
c43def5fce Update POTFILES.in 2022-10-04 15:20:57 +02:00
Matthias Clasen
e68b365fa1 inspector: Fix some lifecycle issues
The template use in the inspector was not properly
disposing all widgets. gtk_widget_dispose_template
will only unparent widgets that have been named
as template children, so we need to make the toplevel
elements in the ui file named children, or manually
dispose them. This commit does the former.
2022-10-04 07:10:35 -04:00
Matthias Clasen
3867f9b8ea Merge branch 'deprecate-entry-completion' into 'main'
Deprecate GtkEntryCompletion

See merge request GNOME/gtk!5078
2022-10-04 03:35:26 +00:00
Matthias Clasen
0b20c57867 Merge branch 'deprecate-app-choosers' into 'main'
Deprecate app choosers

See merge request GNOME/gtk!5077
2022-10-04 03:28:09 +00:00
Matthias Clasen
7e9ca5b41d Deprecate GtkEntryCompletion
We want to drop cell renderers and tree models
in GTK 5. The functionality of GtkEntryCompletion
may be replaced by a new widget in GTK 5.
2022-10-03 23:23:56 -04:00
Matthias Clasen
a527a4d82e Deprecate the app chooser widgets
These are a family of pretty specialized widgets, and
are very rarely used. Instead of porting them away
from GtkTreeView and GtkComboBox, deprecate them.
2022-10-03 23:02:09 -04:00
Matthias Clasen
adfc29968a Revert "gtk: Use gnome.mkenums_simple"
This reverts commit 11829fe7d0.

The mkenums_simple function can't properly handle headers
in subdirectories currently, so go back to the template
version.
2022-10-03 22:20:07 -04:00
Benjamin Otte
e17e94d2da Merge branch 'oh-no-my-docs' into 'main'
Remove outdated docs

See merge request GNOME/gtk!5076
2022-10-03 22:21:48 +00:00
Benjamin Otte
9af3bb8dc1 Remove outdated docs
There are a lot of automatic conversions in the blame log.
2022-10-03 21:12:42 +00:00
Matthias Clasen
998dd11cbd Merge branch 'wip/jimmac/combobox-lists' into 'main'
stylesheet: sync combox with other popovers

Closes #5221

See merge request GNOME/gtk!5074
2022-10-03 21:02:25 +00:00
António Fernandes
9cb8d21cb5 columnview: Forward all focus to child
For the same reasoning as the preceding commit.

Also don't make GtkColumnView focusable. Its internal list view
is already focusable, which is enough to take care of the empty
view case.
2022-10-03 20:48:10 +01:00
António Fernandes
4fc4298920 listbase: Grab focus on items instead of container
The container view itself being focusable makes keyboard navigation
slower by adding a useless focus step.

It also means if an item gets removed, the focus jumps back to the view,
instead of jumping to the next item, as seen in nautilus bug report:
https://gitlab.gnome.org/GNOME/nautilus/-/issues/2489

Instead of making the GtkListBase container itself focusable, override
the .grab_focus() vfunc. This way, calling gtk_widget_grab_focus() on
the view container keeps working sucessfully, but focuses the focus
item directly instead.

This is particularly useful to have because applicaiton authors do
not have direct acess to this class's children, so they can't call
gtk_widget_grab_focus() on them directly.
2022-10-03 20:26:24 +01:00
Corey Berla
230188fb30 entrycompletion: Use GSignalGroup on the entry's buffer
We connect to the inserted-text signal for the entry's buffer.
During the lifetime of the entry, the buffer changes.  This is
literally the example used for GSignalGroup in the docs.
2022-10-03 10:40:27 -07:00
Jakub Steiner
a96c75ff02 stylesheet: sync combox with other popovers
- use the same lists style as everything else (menus, sidebars ...)

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5221
2022-10-03 15:43:07 +02:00
Carlos Garnacho
1b4ed00509 Merge branch 'evince_crash_popover_motion2' into 'main'
fix crash in gtk_synthesize_crossing_events()

Closes #5190

See merge request GNOME/gtk!5052
2022-10-03 12:19:35 +00:00
Fabio Tomat
a54284b629 Update Friulian translation
(cherry picked from commit 6387863256)
2022-10-03 08:35:56 +00:00
Goran Vidović
ee9e9bb3e1 Update Croatian translation 2022-10-02 14:05:29 +00:00
Aleksandr Melman
cae9689281 Update Russian translation 2022-10-01 15:40:59 +00:00
Emin Tufan Çetin
1f6e2cf291 Update Turkish translation 2022-10-01 14:57:10 +00:00
Zurab Kargareteli
69a76054e8 Update Georgian translation 2022-10-01 10:17:09 +00:00
Emmanuele Bassi
31fea11255 a11y: Drop GtkAccessibleRange.get_minimum_increment()
MinimumIncrement is an AT-SPI-ism that has no counterpart in the ARIA
specification, so it should not live inside public API. Additionally,
it's not really a useful method because it collapses two values on the
adjustment API.

The only method in the GtkAccessibleRange interface should be the
set_current_value(), which allows ATs to control the current position in
a ranged widget.

The AT-SPI implementation can now use all the accessible properties,
including the VALUE_TEXT one, mapped to the Text property on the
AtSpi.Value interface.
2022-09-30 18:36:02 +01:00
Emmanuele Bassi
5dd7e24806 Clean up GtkAccessibleRange
Coding style and documentation fixes.
2022-09-30 16:58:00 +01:00
Goran Vidović
848dc78112 Update Croatian translation 2022-09-30 12:05:09 +00:00
Matthias Clasen
e9d7cd3a48 Merge branch 'wip/handle-zero-bounds' into 'main'
Fix shrinking windows when suspending

See merge request GNOME/gtk!5069
2022-09-30 11:26:29 +00:00
Jonas Ådahl
b3a3a6ceb1 toplevel-size: Report zero bounds as infinite
Empty/zero bounds are sent by the Wayland compositor if there are no
valid bounds to report, e.g. if there are no connected monitors. Report
this to GTK, which uses this to clamp calculated sizes, as INT_MAX, so
that clamping isn't done until there are actual valid bounds to clamp
to.

This fixes clients sometimes shrinking to their minimum size during
hotplugs or after having suspended the session.
2022-09-30 09:31:40 +02:00
Jonas Ådahl
148c133674 surface/wayland: Handle no current monitor when calculating bounds
We shouldn't assume there is always a monitor to derive bounds from.
If there is no monitor, pass empty bounds, as this matches what
xdg_toplevel.configure_bounds do in this case.
2022-09-30 09:31:40 +02:00
Asier Sarasua Garmendia
d2c9cbba4f Update Basque translation 2022-09-29 16:55:20 +00:00
Balázs Úr
8b33900e1d Update Hungarian translation 2022-09-29 16:43:31 +00:00
Nart Tlisha
0c3572312a Update Abkhazian translation 2022-09-29 15:19:37 +00:00
Lukáš Tyrychtr
7e683ed89b Use proper version specifier 2022-09-29 09:55:10 +02:00
Lukáš Tyrychtr
7fb892460a Document that this will be available only in GTK 4.10 2022-09-29 09:36:09 +02:00
Lukáš Tyrychtr
d517804acd Actually use the AccessibleRange interface 2022-09-29 09:36:09 +02:00
Lukáš Tyrychtr
ce761122b2 Implement also for GtkPaned 2022-09-29 09:36:09 +02:00
Lukáš Tyrychtr
76a5354ad7 Implement GtkAccessibleRange for GtkScaleButton 2022-09-29 09:36:08 +02:00
Lukáš Tyrychtr
006b473c0c Improve documentation 2022-09-29 09:36:08 +02:00
Lukáš Tyrychtr
5e1af6d7d5 Implement GtkAccessibleRange for GtkProgressBar 2022-09-29 09:36:08 +02:00
Lukáš Tyrychtr
ec0cd4a994 Implement GtkAccessibleRange for GtkLevelBar 2022-09-29 09:36:08 +02:00
Lukáš Tyrychtr
86864d7bc0 Account for GtkAccessibleRange implementations which do not have a
minimum step and it makes no sense for them to set the current value
2022-09-29 09:36:08 +02:00
Lukáš Tyrychtr
485ffcde38 Implement GtkAccessibleRange for GtkSpinButton 2022-09-29 09:36:08 +02:00
Lukáš Tyrychtr
0304eaec94 Implement GtkAccessibleRange for GtkRange 2022-09-29 09:36:08 +02:00
Lukáš Tyrychtr
a7814a0963 Introduce GtkAccessibleRange
This introduces GtkAccessibleRange, an interface which allows the accessibility backend to work with a control which can adjust a value.
2022-09-29 09:36:08 +02:00
Zurab Kargareteli
160a83023a Update Georgian translation 2022-09-28 18:33:41 +00:00
Matthias Clasen
911abe2d2c Fix expected test output
The major.minor version number shows up in the expected
output of this test, so it needs to be adjusted at the
beginning of every cycle.
2022-09-28 13:32:40 -04:00
Matthias Clasen
0c02573c47 Add 4.10 version macros 2022-09-28 13:30:01 -04:00
Matthias Clasen
4257e1ce4f Post-release version bump
This is an experiment to see if I can keep up with
doing post-release version bumps, so git snapshots
will always have a different version from released
tarballs.

This commit also marks the beginning of the 4.10
development cycle, as 4.8 has been branched.
2022-09-28 13:19:49 -04:00
Matthias Clasen
39bc13c8a7 Merge branch 'matthiasc/for-main' into 'main'
Add more names to sources

See merge request GNOME/gtk!5064
2022-09-28 17:02:09 +00:00
Matthias Clasen
dd7cd6ffdd Add more names to sources
This helps with identifying things in sysprof logs,
and while debugging.
2022-09-28 12:37:21 -04:00
Matthias Clasen
349cda3d36 Merge branch 'post-install' into 'main'
meson: Remove post-install script

See merge request GNOME/gtk!5063
2022-09-28 16:21:49 +00:00
Xavier Claessens
48cc56081d meson: Remove post-install script
GTK depends on Meson >= 0.60 so it was never used.
2022-09-28 11:25:43 -04:00
Matthias Clasen
aa9a7a931d Merge branch 'wip/carlosg/shuffle-reset-take2' into 'main'
gtkimcontextwayland: Shuffle full resets after IM changes

Closes #5200

See merge request GNOME/gtk!5050
2022-09-28 01:39:49 +00:00
Matthias Clasen
3aee45de28 Merge branch 'wroy-main-patch-32519' into 'main'
Fix #5211: Preprocessor conformance with MSVC

Closes #5211

See merge request GNOME/gtk!5058
2022-09-28 01:39:15 +00:00
Matthias Clasen
5f469d8903 Merge branch 'broadway-device-query-state-fix' into 'main'
GTK4 gdk/broadway: correct gdk_broadway_device_query_state() to return pointer coordinates relative to the upper left corner of surface

See merge request GNOME/gtk!5053
2022-09-28 01:38:45 +00:00
Matthias Clasen
2ce2e90205 Merge branch 'fix-scale-crashes' into 'main'
scale: Fix a typo

See merge request GNOME/gtk!5061
2022-09-28 01:22:49 +00:00
Matthias Clasen
8b76cc841d scale: Fix a typo
We want to update the label size request when
the adjustment changes, not when anything else
changes.

This may be the reason for crash reports like
https://retrace.fedoraproject.org/faf/problems/bthash/?bth=1e5cc1318358d5db298e5d6c2ec47361922cce74
2022-09-27 21:03:56 -04:00
Aurimas Černius
75b1d75751 Updated Lithuanian translation 2022-09-27 22:40:49 +03:00
Hugo Carvalho
2d19a1f1ec Update Portuguese translation 2022-09-27 19:39:53 +00:00
Rafael Fontenelle
e57d005076 Update Brazilian Portuguese translation 2022-09-27 13:10:05 +00:00
Matthias Clasen
31d483dfbc Apply 1 suggestion(s) to 1 file(s) 2022-09-27 11:31:55 +00:00
Martin
fc2cb9d063 Update Slovenian translation 2022-09-27 08:03:24 +00:00
Fran Dieguez
91cc03a81a Update Galician translation 2022-09-27 06:22:18 +00:00
Benjamin Otte
67049c3261 Merge branch 'wip/otte/for-main' into 'main'
drop target: Warn about broken signal handler returns

See merge request GNOME/gtk!5060
2022-09-27 02:07:21 +00:00
Benjamin Otte
c98cea3dbb drop target: Warn about broken signal handler returns
Signal handlers ust return their preferred action and that one must be
unique.

Shout at them if they don't do that, before gdk_drop_status() does
tesame thing.

Related: gnome-build-meta#554
Related: gnome-builder#1799
2022-09-27 03:50:29 +02:00
Emmanuele Bassi
0a67ac6d47 Merge branch 'left-right-typo' into 'main'
Fix GtkSettings docs typo

See merge request GNOME/gtk!5059
2022-09-26 22:23:29 +00:00
Mitchell Hentges
f8c0d86d6c Fix GtkSettings docs typo
"left of right" should be "left or right".
There's a small (subjective?) English nit in there as well: I believe
that buttons are placed (for example) "on the right" rather than "at the
right".
2022-09-27 00:00:30 +02:00
Ian Douglas Scott
dac7a4f6e7 gdk/wayland/surface: Remove SURFACE_IS_TOPLEVEL
Always defined to `TRUE`.
2022-09-26 14:26:18 -07:00
Ian Douglas Scott
3679207e09 gdk/wayland/surface: Move more members to GdkWaylandToplevel 2022-09-26 14:26:18 -07:00
Ian Douglas Scott
46d1d54f5a gdk/wayland/surface: Make gtk_surface related functions take toplevel
These are only used with `GdkWaylandToplevel`, so it should be a function
taking that, and ultimately move to that struct.
2022-09-26 14:26:18 -07:00
Ian Douglas Scott
3131c50b82 gdk/wayland/surface: Make some toplevel functions take GdkWaylandToplevel 2022-09-26 14:26:18 -07:00
Ian Douglas Scott
c2063a623a gdk/wayland/surface: Move some variables to GdkWaylandPopup 2022-09-26 14:26:16 -07:00
Ian Douglas Scott
3e267c3285 gdk/wayland/surface: Make popup functions take GdkWaylandPopup
This will allow them to use member variables from that struct.
Ultimately, `GdkWaylandPopup` should be moved to its own file.
2022-09-26 14:22:37 -07:00
Ian Douglas Scott
887da8f931 gdk/wayland/surface: Don't wrap gdk_wayland_surface_* for toplevel vfuncs
As far as I'm aware, these only exist with `gdk_wayland_surface_` names
for historical reasons, before these types were split.

This way, those functions will be able to access members of the
`GdkWaylandToplevel` struct. And it just saves a few lines of code.
2022-09-26 14:22:37 -07:00
William Roy
872e04f94e Fix preprocessor conformance with MSVC 2022-09-26 19:52:57 +00:00
Goran Vidović
d5c60438d1 Update Croatian translation 2022-09-26 19:30:45 +00:00
Anders Jonsson
60788913da Update Swedish translation 2022-09-26 18:28:19 +00:00
Matthias Clasen
f01118f2fc Merge branch 'kjellahl/gtkprintbackendlpr' into 'main'
gtkprintbackendlpr.c: Add #include "gtkprivate.h"

See merge request GNOME/gtk!5057
2022-09-26 18:22:21 +00:00
Kjell Ahlstedt
9db812ea7f gtkprintbackendlpr.c: Add #include "gtkprivate.h"
Necessary after GTK_NOTE was replaced by GTK_DEBUG.
GTK_DEBUG is defined in gtk/gtkprivate.h. GTK_NOTE was defined
in gtk/gtkdebug.h.
2022-09-26 18:38:06 +02:00
Piotr Drąg
d538e78d8a Update Polish translation 2022-09-26 18:01:02 +02:00
Yuri Chornoivan
ba0499a803 Update Ukrainian translation 2022-09-26 14:54:56 +00:00
Matthias Clasen
1318fdc52c Merge branch 'fix_4577' into 'main'
Make the presentation of the stack sidebar listbox nicer for A11Y

Closes #4577

See merge request GNOME/gtk!4661
2022-09-26 14:41:29 +00:00
Luca Bacci
d3c50fad6c Merge branch 'gdk-win32-fix-subclassing-gdk-win32-clipdrop' into 'main'
GdkWin32: Fix subclassing for GdkWin32Clipdrop

Closes #5207

See merge request GNOME/gtk!5055
2022-09-26 12:59:17 +00:00
Luca Bacci
e2219858ae GdkWin32: Fix subclassing for GdkWin32Clipdrop
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5207
2022-09-26 14:34:24 +02:00
Matthias Clasen
85043a2d1b Merge branch 'bump-meson-req' into 'main'
Bump the meson requirement

See merge request GNOME/gtk!5051
2022-09-25 17:24:53 +00:00
Piotr Drąg
cac813bbc4 Update POTFILES.in 2022-09-25 14:10:28 +02:00
Nelson Benítez León
94a4c2cb40 fix crash in gtk_synthesize_crossing_events()
Update ancestor between GTK_CROSSING_OUT and
GTK_CROSSING_IN as it may have changed.

Fixes #5190
2022-09-24 21:25:05 -04:00
Matthias Clasen
11829fe7d0 gtk: Use gnome.mkenums_simple
This lets us avoid template files, and works just as well.
2022-09-24 21:23:00 -04:00
Matthias Clasen
455eefa854 gdk: Use gnome.mkenums_simple
This lets us avoid template files, and works just as well.
2022-09-24 21:22:53 -04:00
Matthias Clasen
0f4f90d722 Bump the meson requirement
GLib requires meson 0.60 nowadays, and it does not
make much sense for us to support an older meson.
2022-09-24 20:07:03 -04:00
Matthias Clasen
cefb0a3eb8 Merge branch 'header-cleanup' into 'main'
Header cleanup

See merge request GNOME/gtk!5049
2022-09-24 14:23:39 +00:00
Matthias Clasen
bc661a8ed5 gdk: Rename gdkpixbuf-drawable.c
There is nothing particularly specific to drawables
in there (and we don't have that concept anymore),
so just name the source file to match the header.
Easier for everybody.
2022-09-24 10:03:37 -04:00
Matthias Clasen
9ff549799d gdk: Tweaks to keyname handling
Rename the private header to follow our naming
conventions, and drop the extra gdkkeys.c file.
2022-09-24 10:03:37 -04:00
Matthias Clasen
e499a09759 Drop gtkintl.h
Include gtkprivate.h for I_() and glib-i18n.h for
gettext macros.
2022-09-24 10:03:37 -04:00
Carlos Garnacho
fb280e47d6 gtkimcontextwayland: Shuffle full resets after IM changes
Doing reset() on the text widgets after commit and delete_surrounding
is still too eager for some IMs (e.g. those that expect being able
to commit text while keeping a preedit buffer shown).

However, reset() is more of a "synchronize state" action on Wayland,
and it is still desirable to do that after changes that do come from
the IM (e.g. requesting the new surrounding text and cursor/anchor
positions). Notably here, the text_input protocol may still come up
with a preedit string after this state synchronization happens.

Shuffle the code so that the text widgets do not reset() the IM
context after text is deleted or committed, but the Wayland IM does
apply its practical effects after these actions happen. This keeps
the Wayland IM fully up-to-date wrt text widget state, while not
altering the ::commit and ::delete-surrounding-text behavior for
other IM context implementations.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5200
Fixes: 5b78fe2721 (gtktextview: Also reset IM context after IM...)
Fixes: 7c0a395ff9 (gtktext: Also reset IM context after IM...)
Fixes: 52ac71b972 (gtktextview: Shuffle the places doing IM reset)
Fixes: 9e29739e66 (gtktext: Shuffle the places doing IM reset)
2022-09-24 11:52:16 +02:00
Matthias Clasen
4aabc45685 Drop gdkintl.h
This header was merely including gi18n-lib.h.
Just do that directly.
2022-09-23 23:33:42 -04:00
Matthias Clasen
a8af7caae1 Rename gdk-private.h to gdkprivate.h
The extra - does not add any value.
2022-09-23 23:23:27 -04:00
Matthias Clasen
7d2c296357 Rename gdkconstructor.h to gdkconstructorprivate.h
This is the naming convention for private headers.
2022-09-23 23:14:08 -04:00
Matthias Clasen
c24a69549d Rename gdkdebug.h to gdkdebugprivate.h
This is the naming convention for private headers.
2022-09-23 23:12:01 -04:00
Matthias Clasen
f141da6b55 gtk: Dissolve gtk-autocleanup.h
Move the autocleanup declarations into their
respective headers.
2022-09-23 23:07:43 -04:00
Matthias Clasen
3688ece655 gsk: Dissolve gsk-autocleanup.h
Move the autocleanup declarations into their
respective headers.
2022-09-23 19:50:09 -04:00
Matthias Clasen
61a51dea7b gdk: Dissolve gdk-autocleanup.h
Move the autocleanup declarations into their
respective headers.

While we are at it, correct the autocleanup
declaration for GdkEvent to use gdk_event_unref,
not g_object_unref. Oops
2022-09-23 19:49:58 -04:00
Matthias Clasen
bccb4f87be Merge branch 'debug-envvars-cleanup' into 'main'
Clean up debug env vars

See merge request GNOME/gtk!5044
2022-09-23 23:06:47 +00:00
Matthias Clasen
52b6dbf2b4 gtk: Remove old debug macros
These are no longer used.
2022-09-23 18:51:46 -04:00
Matthias Clasen
f33f55bcbb gtk: Use the new debug macros 2022-09-23 18:12:39 -04:00
Matthias Clasen
f4d3f45c16 gtk: Introduce new debug macros
Introduce GTK_DISPLAY_DEBUG() and GTK_DEBUG(), which
mirror the new macros in gdk. They use the same helper
function gdk_debug_message().
2022-09-23 18:12:39 -04:00
Matthias Clasen
1e65d6640f tests: Rewrite the icontheme tests
The lookup order tests were relying on out
debug spew using g_log, so they can redirect
the output by setting a log writer function.

Rewrite this to use g_test_subprocess() and
parse stderr.
2022-09-23 18:12:39 -04:00
Matthias Clasen
8a4fd30797 gsk: drop old debug macros
These are no longer used.
2022-09-23 18:11:48 -04:00
Matthias Clasen
9818ec4ad9 gsk: Use the new debug macros 2022-09-23 18:11:48 -04:00
Matthias Clasen
4d08eb264d gsk: Introduce new debug macros
Introduce GSK_RENDERER_DEBUG() and GSK_DEBUG(), which
mirror the new macros in gdk. They use the same helper
function gdk_debug_message().
2022-09-23 18:11:48 -04:00
Matthias Clasen
bc159207bd gdk: Drop old debug macros
Drop the old GDK_NOTE() and GDK_DISPLAY_NOTE()
macros from gdkdebug.h. Reintroduce them in the
win32 backend, where they are still used.
2022-09-23 18:11:48 -04:00
Matthias Clasen
1f166ae071 macos: Use the new debug macros 2022-09-23 18:11:48 -04:00
Matthias Clasen
ce4c2154f4 x11: Use the new debug macros 2022-09-23 18:11:48 -04:00
Matthias Clasen
71fedee85d wayland: Use the new debug macros 2022-09-23 18:11:48 -04:00
Matthias Clasen
90c2b548e5 broadway: Use the new debug macros 2022-09-23 18:11:48 -04:00
Matthias Clasen
1d48f96fc5 gdk: Use the new debug macros 2022-09-23 18:11:48 -04:00
Matthias Clasen
10255eee72 Introduce new debug macros
Introduce GDK_DISPLAY_DEBUG() and GDK_DEBUG() and
the helper function gdk_debug_message(). This is
meant to clean up the mess of our current debug
statements which wildly mix g_message, g_print
and g_printerr.
2022-09-23 18:11:48 -04:00
Matthias Clasen
5b2568e9e4 Merge branch 'wip/jimmac/backdrop-titles' into 'main'
theme: tone down unfocused title labels

Closes #4468

See merge request GNOME/gtk!5047
2022-09-23 17:27:08 +00:00
Jakub Steiner
be6413b0e7 theme: tone down unfocused title labels
- mimic libadwaita in toning down unfocused titles. Cargo culting the
  filter instead of using normal opacity property.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/4468
2022-09-23 17:01:24 +02:00
Matthias Clasen
15d1c86b2c Merge branch 'wip/carlosg/touchpad-gestures-matching-fingers' into 'main'
gtkgesture: Do not update gestures with mismatching n-points on touchpad

See merge request GNOME/gtk!5046
2022-09-23 14:37:58 +00:00
Marek Černocký
dd47e3bcab Updated Czech translation 2022-09-23 16:22:41 +02:00
Carlos Garnacho
872534e763 gtkgesture: Do not update gestures with mismatching n-points on touchpad
Check that the touchpad gesture event has a matching number of fingers before
updating the GtkGesture point tracking, instead of afterwards. Avoids pointless
tracking of these touchpad events when we know beforehand that the gesture
will never be activated by the touchpad events.

Related: https://gitlab.gnome.org/GNOME/gtk/-/issues/5199
2022-09-23 16:04:32 +02:00
Marek Černocký
d351cbbcea Updated Czech translation 2022-09-23 15:57:50 +02:00
Matthias Clasen
6c95547c3f docs: Some updates
Make the section about environment variables match
current code.

Add a warning about env vars not being stable and
only for debugging.
2022-09-21 21:59:33 -04:00
Matthias Clasen
c7a7e550dc Only print supported debug flags
It is a bit disorienting to print a lot of unavailable
debug flags, with some working ones mixed in. Just show
the ones that work.
2022-09-21 21:51:58 -04:00
Matthias Clasen
ee1a634c25 Mark the invert-text-dir flag as always there
This flag works in non-debug builds too.
2022-09-21 21:47:06 -04:00
Matthias Clasen
55ab99cb98 Make GL flavor flags always available
No need to restrict this to debug builds.
2022-09-21 21:29:34 -04:00
Matthias Clasen
f50b0a0bcb Make the gl-debug debug flag always available
No need to restrict this to debug builds.
2022-09-21 21:17:16 -04:00
Matthias Clasen
01054c9c79 Make the gl-gles debug flag always available
No need to restrict this to debug builds.
2022-09-21 21:12:22 -04:00
Matthias Clasen
8bd3ec2ba1 Make the gl-legacy debug flag always available
No need to restrict this to debug builds.
2022-09-21 21:09:08 -04:00
Matthias Clasen
e08a9ea9ad Drop the gl-texture-rect debug flag
This was not doing anything.
2022-09-21 21:05:25 -04:00
Matthias Clasen
1987398ec5 Drop the software-gl debug flag
This was not doing anything.
2022-09-21 21:03:40 -04:00
Matthias Clasen
fa0fc9acb8 Make the gl-disable flag always available
No need to restrict this to debug builds.
2022-09-21 20:57:22 -04:00
Matthias Clasen
fa1c461c13 Make the portals debug flag always available
No need to restrict this to debug builds.
2022-09-21 20:55:46 -04:00
Matthias Clasen
a99b05525d Make the nograbs flag always available
No need to restrict this to debug builds.
2022-09-21 20:53:46 -04:00
Matthias Clasen
a337b21a4f Make vulkan-disable always available
There is no need to restrict this to debug builds.
2022-09-21 20:51:35 -04:00
Matthias Clasen
1b96828667 Make vulkan-validate always available
There is no need to restrict this debug builds.
2022-09-21 20:49:53 -04:00
Matthias Clasen
7785c18c56 Fix high-depth handling
We mark this flag as always available, but we
were only checking it in debug builds.
2022-09-21 20:47:26 -04:00
Matthias Clasen
183709c522 Fix default-settings handling
This is meant to be always available, but we
were checking for debug in one place.
2022-09-21 20:45:43 -04:00
Emmanuele Bassi
458bf674ad Merge branch 'windows-build-instructions-link' into 'main'
Update GTK on Windows link: use gtk.org, not wiki

See merge request GNOME/gtk!5043
2022-09-21 21:06:23 +00:00
Matthias Clasen
3016edbe72 Merge branch 'font-chooser-docs' into 'main'
fontchooser: Add some details to the docs

See merge request GNOME/gtk!5041
2022-09-21 18:57:58 +00:00
Mitchell Hentges
fa554a8e85 Update GTK on Windows link: use gtk.org, not wiki
The old wiki page has a couple issues:
* It's out-of-date, not having any notes for GTK4 specifically,
  and it doesn't link to `gvsbuild`, which (I believe) is
  the current official (and best) way to build GTK with MSVC.
* It's "locked", so it's harder for contributors to update. This
  is OK, except for one spicy detail:
* It's not clear how to contribute/report issues on the locked wiki
  pages, so out-of-date information falls off the radar.

Regardless :) the gtk.org GTK for Windows docs are a much better
springboard, in my opinion.
2022-09-21 20:12:21 +02:00
Matthias Clasen
5b03f5c531 fontchooser: Add some details to the docs 2022-09-21 09:39:06 -04:00
Maxim Zakharov
2acd10d7b0 gdk/broadway: correct gdk_broadway_device_query_state() to return pointer
coordinates relative to the upper left corner of surface
2022-09-21 15:42:40 +10:00
Matthias Clasen
a012f5bddb Merge branch 'cross-gi-docgen-detection' into 'main'
build: fix gi-docgen detection in cross builds

See merge request GNOME/gtk!5039
2022-09-20 10:58:45 +00:00
Michal Vasilek
98796d4513 build: fix gi-docgen detection in cross builds
gi-docgen is supposed to be ran natively on the build machine, without
native: true dependency() searches for gi-docgen on the host system.
When it doesn't find it, it falls back to a subproject even if gi-docgen
is available on the build machine.

also make gtk_doc require introspection
2022-09-20 01:27:26 +02:00
Matej Urbančič
2bbf7d267a Update Slovenian translation 2022-09-19 19:50:27 +00:00
Bruce Cowan
266d72a82f Update British English translation 2022-09-19 15:17:18 +00:00
Matthias Clasen
873c437235 Merge branch 'wip/smcv/shifted-shortcuts' into 'main'
gdkevents: Don't ignore modifiers that are not currently active

Closes #5095

See merge request GNOME/gtk!5037
2022-09-19 13:55:10 +00:00
Matthias Clasen
15e0f3e8c6 Merge branch 'wip/smcv/reliable-gresource' into 'main'
build: Use more conservative GResource embedding on non-x86_64

Closes #5107

See merge request GNOME/gtk!4956
2022-09-19 13:30:22 +00:00
Martin
af2a4d4a91 Update Slovenian translation 2022-09-19 08:38:02 +00:00
Sabri Ünal
d4e2f23287 Update Turkish translation 2022-09-18 08:21:42 +00:00
Baurzhan Muftakhidinov
332bd868f5 Update Kazakh translation 2022-09-18 04:56:54 +00:00
Simon McVittie
60a83a51c3 build: Use more conservative GResource embedding on non-x86_64
Doing clever things with objcopy is faster and seems to be reliable on
x86_64 Linux, but also doesn't work on all toolchains and architectures:
in particular, Debian has had trouble with this on arm and mips.
In a distro build environment where we are compiling all of GTK every
time, the cost of potentially unreliable builds is higher than the cost
of using slower but more conservative GResource embedding.

Resolves: https://gitlab.gnome.org/GNOME/gtk/-/issues/5107
Signed-off-by: Simon McVittie <smcv@debian.org>
2022-09-17 21:50:38 +01:00
Simon McVittie
79285bd63e gdkevents: Don't ignore modifiers that are not currently active
The X11 backend can mark modifiers like Shift as consumed even if they
aren't actually active, which seems to be something to do with making
shortcuts like `<Control><Shift>plus` and `<Control>plus` work as
intended regardless of whether the plus symbol is obtained by pressing
Shift and a key (like `+/=` on American, British or French keyboards)
or not (like `*/+` on German keyboards).

However, this can go badly wrong when the modifier is *not* pressed.
For example, terminals normally have separate bindings for `<Control>c`
(send SIGINT) and `<Control><Shift>c` (copy). If we disregard the
consumed modifiers completely, when the X11 backend marks Shift as
consumed, pressing Ctrl+c would send SIGINT *and* copy to the clipboard,
which is not what was intended.

By masking out the members of `consumed` that are not in `state`, we
get the same interpretation for X11 and Wayland, and ensure that
keyboard shortcuts that explicitly mention Shift can only be triggered
while holding Shift. It continues to be possible to trigger keyboard
shortcuts that do not explicitly mention Shift (such as `<Control>plus`)
while holding Shift, if the backend reports Shift as having been
consumed in order to generate the plus keysym.

Resolves: https://gitlab.gnome.org/GNOME/gtk/-/issues/5095
Bug-Debian: https://bugs.debian.org/1016927
Signed-off-by: Simon McVittie <smcv@debian.org>
2022-09-17 19:40:53 +01:00
Matthias Clasen
3a941eff4a 4.8.1 2022-09-16 12:29:33 -04:00
Matthias Clasen
65adcec82f Merge branch 'detect-stylus' into 'main'
Recognize "stylus" devices as GDK_SOURCE_PEN

Closes #4394

See merge request GNOME/gtk!4776
2022-09-16 12:12:37 +00:00
Matthias Clasen
ffb6f39715 Merge branch 'fix-filetransfer-mimetype' into 'main'
portal: Use the right mimetype for file transfers

Closes #5182

See merge request GNOME/gtk!5033
2022-09-16 00:35:13 +00:00
Matthias Clasen
9a16269747 Merge branch 'wip/abono/gtk-main-remove-condition' into 'main'
gtk/main: Remove condition that always evaluates TRUE

See merge request GNOME/gtk!5031
2022-09-15 19:24:04 +00:00
Matthias Clasen
32f55a74b0 portal: Use the right mimetype for file transfers
The filetransfer protocol says to use
application/vnd.portal.filetransfer, but I used
application/vnd.portal.files when I implemented the
protocol. Oops.

This commit dds the correct mimetype, but we still
support the old one to preserve interoperatibility
with existing flatpaks using GTK 4.6.

Fixes: #5182
2022-09-15 15:18:17 -04:00
Alessandro Bono
5320acf589 gtk/main: Remove condition that always evaluates TRUE 2022-09-15 16:44:44 +02:00
Benjamin Otte
b9b2ac2ce3 Merge branch 'wip/coreyberla/gridview-rubberband' into 'main'
gridview: Fix rubberbanding from negative x coordinates

Closes nautilus#2492

See merge request GNOME/gtk!5030
2022-09-14 18:48:11 +00:00
Corey Berla
ad041fc5d4 gridview: Fix rubberbanding from negative x coordinates
This is a follow-up to 1e9a36ffa8. For GridView
we also need to make sure that we aren't rubberbanding below x=0 which
causes unexpected rubberbanding behavior.

Fixes: https://gitlab.gnome.org/GNOME/nautilus/-/issues/2492
2022-09-14 11:27:52 -07:00
Matthias Clasen
952f85c12d Merge branch 'single-key-compose' into 'main'
input: Accept short compose sequences

Closes #5172

See merge request GNOME/gtk!5026
2022-09-13 10:24:49 +00:00
Matthias Clasen
72d6241c84 Add a test for short compose sequences
Add a table that has a short sequence
to verify that we can parse this.
2022-09-12 22:30:47 -04:00
Matthias Clasen
aac3f1860f Update test results
The table sizes change, even though none of our
test tables include short sequences.
2022-09-12 22:30:47 -04:00
Matthias Clasen
6be27682a8 Regenerate builtin sequences
The table format has changed.
2022-09-12 22:30:47 -04:00
Matthias Clasen
8931169e00 input: Accept short compose sequences
Some of the X keyboard layouts use compose
sequences of length one to make individual
keys generate multiple Unicode characters.

To support this use case, change the index
part of the table format to also include
an offset for length 1. Bump the table
version to indicate this change.

Fixes: #5172
2022-09-12 22:30:47 -04:00
Matthias Clasen
72785c68d6 Cosmetics: Fix a typo 2022-09-12 12:01:30 -04:00
Boyuan Yang
5c831d030a Update Chinese (China) translation 2022-09-11 19:24:40 +00:00
Jordi Mas
f17a924e7b Update Catalan translation 2022-09-11 14:32:27 +02:00
Matthias Clasen
2e542d8cae Merge branch 'misc-gl-fixes' into 'main'
gsk: Make glyph upload more similar to icons

See merge request GNOME/gtk!4074
2022-09-10 20:09:28 +00:00
Matthias Clasen
511a4ec475 gsk: Make glyph upload more similar to icons
When uploading glyphs to the atlas, clear
the padding bytes so that no dirt remains there.
2022-09-10 15:25:59 -04:00
Matthias Clasen
b76a2e44ba Merge branch 'matthiasc/for-main' into 'main'
clang-format: This did not work

See merge request GNOME/gtk!5021
2022-09-10 18:51:14 +00:00
Matthias Clasen
d28b94f0cb clang-format: This did not work
I thought AlignConsecutiveDeclarations would
align function parameters, but it doesn't.
So drop it again.
2022-09-10 14:35:40 -04:00
Cheng-Chia Tseng
c4766b2747 Update Chinese (Taiwan) translation 2022-09-10 09:09:29 +00:00
Matthias Clasen
98bdf67468 Merge branch 'game-sounds' into 'main'
gtk-demo: Make losing games hurt

See merge request GNOME/gtk!5017
2022-09-10 00:32:45 +00:00
Emmanuele Bassi
dca57bebb7 Merge branch 'a11y-state-changes' into 'main'
a11y: Be safe against state type changes

See merge request GNOME/gtk!5018
2022-09-10 00:04:03 +00:00
Matthias Clasen
de9a5f94c2 Merge branch 'less-fetching-in-ci' into 'main'
ci: Improve style check script

See merge request GNOME/gtk!5020
2022-09-10 00:02:41 +00:00
Matthias Clasen
659a129f81 Merge branch 'clang-format-improvement' into 'main'
ci: Improve clang-format style

See merge request GNOME/gtk!3770
2022-09-09 23:59:49 +00:00
Matthias Clasen
0c8bdf2ac2 ci: Improve clang-format style
Add

AlignConsecutiveDeclarations: true
PointerAlignment: Right

which will produce the style we want with llvm 13.
2022-09-09 19:43:27 -04:00
Matthias Clasen
3d2dcb437c ci: Improve style check script
Only fetch the two branches we are about to
compare, and use existing git merge-base to
find the common ancestor.
2022-09-09 19:41:42 -04:00
Emmanuele Bassi
22de54a9dc Merge branch 'ebassi/style-check' into 'main'
ci: Re-sync the style check with GLib

See merge request GNOME/gtk!5019
2022-09-09 23:30:38 +00:00
Matthias Clasen
4b5ed886ce ci: Fix the git usage in scripts
Thanks, git.
2022-09-10 00:16:12 +01:00
Emmanuele Bassi
821dd26934 ci: Move style check to its own stage
Drop the `.pre` phase.
2022-09-10 00:16:12 +01:00
Emmanuele Bassi
d6597098f1 ci: Re-sync the style check with GLib 2022-09-10 00:16:12 +01:00
Matthias Clasen
4c1bc93f6f a11y: Be safe against state type changes
For some of the a11y states, calling gtk_accessible_reset_state
can change the type of the state value from boolean or tristate
to undefined.

Handle that, instead of throwing criticals.

Related: !4910
2022-09-09 16:07:24 -04:00
Matthias Clasen
ef9b844c7f Merge branch 'filechooser-keybindings' into 'main'
filechooser: Restore ~ and . functionality

See merge request GNOME/gtk!5016
2022-09-09 19:38:39 +00:00
Matthias Clasen
681ec04b85 gtk-demo: Make losing games hurt
Use a more annoying sound for losses.
And use it for all games.
2022-09-09 15:36:31 -04:00
Matthias Clasen
7dd3289837 Merge branch 'widget-factory-filechooser' into 'main'
widget-factory: Add a file chooser

See merge request GNOME/gtk!5015
2022-09-09 18:44:31 +00:00
Matthias Clasen
7e54a7e5a5 filechooser: Restore ~ and . functionality
We'll have to keep patching up these things
until somebody rewrites the file chooser :(

Inspired by: !4970
2022-09-09 14:44:28 -04:00
Matthias Clasen
f050a9e889 widget-factory: Add a file chooser
We don't have a readily accessible file chooser
in our demo apps. Fix that by making the Open
menu item on page 2 bring up a file chooser.
2022-09-09 14:28:08 -04:00
Matthias Clasen
ae2964c7c6 Merge branch 'fix-fontrendering-demo' into 'main'
gtk-demo: Avoid a segfault

Closes #5166

See merge request GNOME/gtk!5014
2022-09-09 16:57:27 +00:00
Matthias Clasen
54daad3878 gtk-demo: Avoid a segfault
The code in the fontrendering demo is a bit sloppy
and assumes that we always get a single run when
appending a sequence of 4 chars and 4 spaces.

That is not in general true, such as for Emoji.

Instead of working harder to handle Emoji here,
just give up and fall back to 'a'.

Fixes: #5166
2022-09-09 12:34:54 -04:00
Matthias Clasen
d7817e6fc6 Merge branch 'gtkplaces' into 'main'
gtkplacesview: Right click popover fix crash and align menu with mouse

See merge request GNOME/gtk!4662
2022-09-09 14:59:03 +00:00
Matthias Clasen
de94f3d97f Merge branch 'gtktooltip.c-optimise' into 'main'
gtk/gtktooltip.c: check result of event position get operation

Closes #5134

See merge request GNOME/gtk!4996
2022-09-09 14:56:33 +00:00
Matthias Clasen
066884aed1 Merge branch 'wip/carlosg/im-reset' into 'main'
Avoid early IM reset on updates

Closes #5133

See merge request GNOME/gtk!5012
2022-09-09 12:36:43 +00:00
Rūdolfs Mazurs
e7501185cd Update Latvian translation 2022-09-07 20:56:57 +00:00
Matthias Clasen
a08277adcd Merge branch 'fix-file-transfer-portal' into 'main'
Stop recursion in registering serializers

See merge request GNOME/gtk!5013
2022-09-07 15:04:43 +00:00
Matthias Clasen
e8e69a1208 Make clipboard tests work with portals
This was not working right, since it hasn't been
tested with portals - there are no portals in ci.
2022-09-07 08:45:31 -04:00
Matthias Clasen
e16414b3ac Handle absence of portals
When the documents portal is not on the bus,
we still get an (unowned) proxy, and we need
to handle that situation.
2022-09-07 08:45:31 -04:00
Matthias Clasen
2e42786091 portals: Fix FileTransfer portal calls
We were not passing the right arguments to
the AddFiles call, causing the file transfer
to fail.
2022-09-07 06:47:02 -04:00
Matthias Clasen
b756aa0764 Make the file transfer portal setup sync again
We need to register the portal mime types before
the others to prefer them, doing this call async
messes up that ordering.

This is effectively reverting 69fb3648b2
2022-09-07 06:45:03 -04:00
Matthias Clasen
9654fd451f Stop recursion in registering serializers
This was probably unintentional, and messes up
the ordering of our registration.
2022-09-06 23:35:48 -04:00
Matthias Clasen
7d564ecdc9 Merge branch 'textbuffer-set-text-docs' into 'main'
Document irreversibility of gtk_text_buffer_set_text

See merge request GNOME/gtk!5005
2022-09-06 22:19:30 +00:00
Matthias Clasen
d850dfd245 Merge branch 'launch-uri-no-export' into 'main'
Make gtk_launch_uri more robust

Closes #5152

See merge request GNOME/gtk!5010
2022-09-06 20:50:06 +00:00
Matthias Clasen
a6d5757627 Merge branch 'gtk-scale-set-digits-update-label' into 'main'
GtkScale: Update the label size request from set_digits ()

Closes #5156

See merge request GNOME/gtk!5011
2022-09-06 20:34:39 +00:00
Matthias Clasen
ad8a3e5b45 Merge branch 'wip/antoniof/columnview-rtl' into 'main'
columnview: Invert columns on RTL

Closes nautilus#2302

See merge request GNOME/gtk!5002
2022-09-06 20:30:15 +00:00
Carlos Garnacho
5b78fe2721 gtktextview: Also reset IM context after IM surrounding text deletion
When the IM commands the GtkText to delete text, the cursor position
would change, and so would the surrounding text. Reset the IM context
so that these updates are properly picked up by the IM.

Fixes backspace	key behavior in	the GNOME Shell OSK, since that	relies
on the surrounding text	being properly updated for the next iteration.
2022-09-06 22:17:40 +02:00
Carlos Garnacho
7c0a395ff9 gtktext: Also reset IM context after IM surrounding text deletion
When the IM commands the GtkText to delete text, the cursor position
would change, and so would the surrounding text. Reset the IM context
so that these updates are properly picked up by the IM.

Fixes backspace key behavior in the GNOME Shell OSK, since that relies
on the surrounding text being properly updated for the next iteration.
2022-09-06 22:17:40 +02:00
Carlos Garnacho
41f26975a9 gtktext: Avoid early IM reset on updates
Resetting the IM on IM updates is too eager and indeed the simple
IM context doesn't like that this happens in the middle of dead
key handling.

We however want to reset the IM after actual text buffer changes
(say, a committed string) moved the cursor position, altered the
surrounding text, etc. So that the IM implementation does know to
update its state.

Since there is going to be an actual IM reset anyways, it does
no longer make sense to try to preserve the old priv->need_im_reset
status during commit handling.

Fixes: 52ac71b972 ("gtktextview: Shuffle the places doing IM reset")
Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5133
2022-09-06 22:17:40 +02:00
Carlos Garnacho
085374198f gtktext: Avoid early IM reset on updates
Resetting the IM on IM updates is too eager and indeed the simple
IM context doesn't like that this happens in the middle of dead
key handling.

We however want to reset the IM after actual text buffer changes
(say, a committed string) moved the cursor position, altered the
surrounding text, etc. So that the IM implementation does know to
update its state.

Fixes: 9e29739e66 ("gtktext: Shuffle the places doing IM reset")
Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5133
2022-09-06 22:17:40 +02:00
Matthias Clasen
586675c902 Merge branch 'treepopover-ellipsize' into 'main'
treepopover: Do not propagate natural width of content

See merge request GNOME/gtk!4895
2022-09-06 20:17:33 +00:00
Matthias Clasen
1679fc8675 Merge branch 'display-wayland-update-scale' into 'main'
wayland/display: Remove duplicate update_scale() call

See merge request GNOME/gtk!5003
2022-09-06 20:14:38 +00:00
Matthias Clasen
9cc1dcf2a4 4.8.0 2022-09-06 15:59:04 -04:00
Luca Bacci
cc57692345 GtkScale: Update the label's size request from set_digits ()
Update the label size request when setting the digits property
by calling the update_label_request () util function.

That util function works by measuring the size request of the
label with the lower and upper values of the adjustment, then
taking the max. That way the size requisition is constant
regardless of the actual displayed value.

Since the util function internally works by setting the text
of the label, let it also set the text at last by taking in
account the current adjustment's value. Most of its callers
do that anyway.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5156
2022-09-06 21:08:31 +02:00
Matthias Clasen
a0db8a24c2 Make gtk_launch_uri more robust
We were failing to launch the uri if we are on
Wayland, but have no xdg_foreign protocol support.

Fixes: #5152
2022-09-06 12:37:56 -04:00
Zurab Kargareteli
e4be073f0a Update Georgian translation 2022-09-06 16:28:59 +00:00
Zurab Kargareteli
4ffefec469 Update Georgian translation 2022-09-06 16:28:00 +00:00
Changwoo Ryu
db2432b5db Update Korean translation 2022-09-06 04:15:30 +00:00
Aurimas Černius
7d29b456b8 Updated Lithuanian translation 2022-09-05 22:38:20 +03:00
Daniel Mustieles
8fbb647daa Updated Spanish translation 2022-09-05 14:30:59 +02:00
Fran Dieguez
c28b8297ee Update Galician translation 2022-09-04 22:24:45 +00:00
Aleksandr Melman
4eb0dd7264 Update Russian translation 2022-09-04 20:45:34 +00:00
Rūdolfs Mazurs
b3d6972803 Update Latvian translation 2022-09-04 15:50:02 +00:00
Jürgen Benvenuti
0eab3c3940 Update German translation 2022-09-04 13:57:48 +00:00
Elliott Sales de Andrade
4cbfb69f74 Document irreversibility of gtk_text_buffer_set_text
If you've begun a user action and call `gtk_text_buffer_set_text`, you
get an unexpected warning:
```
Gtk-WARNING **: Cannot begin irreversible action while in user action
```
which can be fixed by doing the delete/insert yourself. But this is not
documented as occurring, so document it.
2022-09-04 02:47:57 -04:00
Boyuan Yang
4603e7bb18 Update Chinese (China) translation 2022-09-03 21:16:03 +00:00
Rūdolfs Mazurs
8d504cae44 Update Latvian translation 2022-09-03 13:04:54 +00:00
Piotr Drąg
0f35ece2af Update Polish translation 2022-09-03 15:00:46 +02:00
Marek Černocký
204cac7ebf Updated Czech translation 2022-09-03 09:50:27 +02:00
Robert Mader
06a51b6ca6 wayland/display: Remove duplicate update_scale() call
`apply_monitor_change()` already calls `update_scale()`.
Note that this only affects old compositor versions (see
`should_update_monitor()`) so it's just a minor cleanup.
2022-09-03 00:53:02 +02:00
Balázs Úr
853bfcb130 Update Hungarian translation 2022-09-02 21:29:08 +00:00
Jordi Mas
6a1f5c0af5 Update Catalan translation 2022-09-02 20:34:04 +02:00
António Fernandes
91e6f8e4b9 columnview: Invert columns on RTL
Respect text direction.

Fixes https://gitlab.gnome.org/GNOME/nautilus/-/issues/2302
2022-09-02 15:44:59 +01:00
Carlos Garnacho
bce90df49d Merge branch 'treeview-gesture-claim' into 'main'
treeview: Don't claim event sequence too early

Closes #3649, #3985, #4206, and #4669

See merge request GNOME/gtk!4883
2022-09-02 12:40:15 +00:00
Mat
58953671fe treeview: Don't claim event sequence too early
We want to claim the event sequence in the click gesture when appropriate,
such as activating a row or clicking an editable cell, but this is currently
done too early, preventing other gestures for drag-and-drop and rubberband
selection entirely.

Fixes #3649
Fixes #3985
Fixes #4669
2022-09-02 15:04:43 +03:00
Ask Hjorth Larsen
df527758b1 Updated Danish translation 2022-09-02 11:51:27 +02:00
Emin Tufan Çetin
3cd55fdf35 Update Turkish translation 2022-09-01 22:53:55 +00:00
Alexander Shopov
25783573c6 Update Bulgarian translation 2022-09-01 21:11:55 +00:00
Luca Bacci
041a186272 Merge branch 'implement-gtk-color-picker-for-windows' into 'main'
Implement GtkColorPicker for Windows

Closes #5136

See merge request GNOME/gtk!4983
2022-09-01 20:39:15 +00:00
Christian Hergert
f5488bb4b2 gdk: fix typo in frame clock docs 2022-09-01 12:16:10 -07:00
Luca Bacci
86a38918d7 Implement GtkColorPicker for Windows
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5136
2022-09-01 19:25:07 +02:00
Hugo Carvalho
88f38f598b Update Portuguese translation 2022-09-01 17:18:51 +00:00
Nathan Follens
4aee6edbbd Update Dutch translation 2022-09-01 16:21:14 +00:00
Matthias Clasen
adcec93b02 Merge branch 'gtkplacessidebar' into 'main'
gtkplacessidebar: Fix crash when remove or rename bookmark

See merge request GNOME/gtk!4625
2022-09-01 15:00:42 +00:00
Matthias Clasen
79ff151624 Merge branch 'inscription_a11y' into 'main'
GtkInscription: Set the a11y label when updating the text property

See merge request GNOME/gtk!5000
2022-09-01 14:38:49 +00:00
Lukáš Tyrychtr
27f32b7f9b GtkInscription: Set the a11y label when updating the text property 2022-09-01 16:19:59 +02:00
Anders Jonsson
1771f75c6c Update Swedish translation 2022-09-01 13:15:36 +00:00
Marek Černocký
979c418e46 Updated Czech translation 2022-09-01 14:41:37 +02:00
Marek Černocký
28f63259ab Updated Czech translation 2022-09-01 14:34:27 +02:00
Leônidas Araújo
105a2262dc Update Brazilian Portuguese translation 2022-08-31 14:53:19 +00:00
Danial Behzadi
3615619f41 Update Persian translation 2022-08-31 12:45:30 +00:00
Kukuh Syafaat
0782bfa52b Update Indonesian translation 2022-08-31 09:17:12 +00:00
Asier Sarasua Garmendia
ccd5565f75 Update Basque translation 2022-08-31 07:04:00 +00:00
Matthias Clasen
e502155dfa Merge branch 'gbsneto/cleanup-gsettings' into 'main'
gtk: Remove last-folder-uri from schema

See merge request GNOME/gtk!4998
2022-08-30 19:14:44 +00:00
Georges Basile Stavracas Neto
9261b0079d gtk: Remove last-folder-uri from schema
It's unused since 2013, apparently.
2022-08-30 15:58:47 -03:00
Goran Vidović
4638f942b8 Update Croatian translation 2022-08-30 11:56:21 +00:00
Maxim Zakharov
982b4ff3b2 gtk/gtktooltip.c: check result of event position get operation
Do not perform coordinates transformation when gdk_event_get_position()
returns FALSE as it returns NaNs in that case and these coordinates
are not used anyway in further processing (closes #5134).
2022-08-30 15:54:52 +10:00
Yuri Chornoivan
46483bebcd Update Ukrainian translation 2022-08-29 19:21:22 +00:00
Matthias Clasen
e077a6bffe Merge branch 'wip/jimmac/HC-italic-hints' into 'main'
HC: entry - make hints italic

Closes #5143

See merge request GNOME/gtk!4994
2022-08-29 18:55:34 +00:00
Matthias Clasen
66dc193aeb Merge branch 'font-feature-work' into 'main'
fontchooser: Rename default feature value

See merge request GNOME/gtk!4995
2022-08-29 18:48:00 +00:00
Matthias Clasen
39439aa838 fontchooser: Rename default feature value
"Default" is a better fit than "None" here.
2022-08-29 14:14:07 -04:00
Matthias Clasen
018bd0a927 fontchooser: Add a tooltip to the tweak button
Icon-only buttons are always better with a tooltip.
2022-08-29 12:13:32 -04:00
Matthias Clasen
975ab6e7cf fontchooser: Remove placeholder from preview entry
The way we explicitly set the font on the entry
conflicts with the placeholder text styling. But the
entry isn't normally empty, so placeholder text is
not that important here. Remove it and use a tooltip
instead.
2022-08-29 10:21:37 -04:00
Jordi Mas
53c8975739 Update Catalan translation 2022-08-29 12:28:26 +02:00
Jakub Steiner
09176fc1b3 HC: entry - make hints italic
- to keep contrast but indicated difference between a value and a hint

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5143
2022-08-29 11:58:29 +02:00
Matthias Clasen
0f2582ff02 Merge branch 'font-feature-work' into 'main'
fontchooser: Improve handling of features

See merge request GNOME/gtk!4992
2022-08-29 01:26:12 +00:00
Matthias Clasen
a217be14f9 Merge branch 'gtknotebook-arrow-press' into 'main'
gtknotebook: Claim event sequence after pressing notebook arrow buttons

See merge request GNOME/gtk!4990
2022-08-28 23:30:00 +00:00
Matthias Clasen
e7b332c532 Merge branch 'gtknotebook-arrow-state' into 'main'
gtknotebook: update arrow button state when reordering tabs

See merge request GNOME/gtk!4991
2022-08-28 23:29:25 +00:00
Piotr Drąg
13382937d1 Update Polish translation 2022-08-28 23:34:58 +02:00
Matthias Clasen
c364f1ee12 fontchooser: Improve handling of features
salt and swsh need to be treated like cvXX, with
a dropdown. Also add examples to the default cases
of radio groups.
2022-08-28 17:02:56 -04:00
Mat
dd8c899737 gtknotebook: update arrow button state when reordering tabs
When reordering notebook tabs, updating the sensitivity state of the
arrow buttons is necessary if the tab is moved to the beginning or
end of the tab list.
2022-08-29 00:00:10 +03:00
Mat
d69fdaa04d gtknotebook: Claim event sequence after pressing notebook arrow buttons
When notebook tabs are reorderable, pressing the notebook arrow buttons to
change the active tab results in tabs reordering unexpectedly.
Claim the event sequence after pressing an arrow button to avoid conflicts
with the motion/drag gesture used for reordering.
2022-08-28 23:42:59 +03:00
Aleksandr Melman
16eced7bf1 Update Russian translation 2022-08-28 18:51:12 +00:00
Matthias Clasen
1276e8868d Merge branch 'notebook-tab-accessibility' into 'main'
gtkatspiselection: Retrieve the correct GtkNotebook tab widget

See merge request GNOME/gtk!4989
2022-08-28 14:53:03 +00:00
Goran Vidović
7539fb4ced Update Croatian translation 2022-08-28 14:41:32 +00:00
Matthias Clasen
f24efd175e Merge branch 'strdup-avoidance' into 'main'
notebook: Use canonical signal names

See merge request GNOME/gtk!4988
2022-08-28 14:05:02 +00:00
Mat
df40efd50d gtkatspiselection: Retrieve the correct GtkNotebook tab widget
A typo resulted in the tab container widget being retrieved instead of
the tab widget. If an adjacent action widget was present, an infinite
loop occurred when switching tabs while a screen reader was enabled.
2022-08-28 17:02:01 +03:00
Hugo Carvalho
db5868d89b Update Portuguese translation 2022-08-28 13:14:19 +00:00
Matthias Clasen
32796cad10 Use gtk_event_controller_set_static_name
This avoids strdups.
2022-08-27 22:35:13 -04:00
Matthias Clasen
b6a965a67c eventcontroller: Allow static names
These names are a debug-only feature, and we
use string literals everywhere, so avoid the
overhead of copying them.
2022-08-27 22:35:13 -04:00
Matthias Clasen
6136f3ab95 shortcutaction: Intern signal names
Signal names are already interned anyway,
so we can avoid strdups here, and just use
the interned names.
2022-08-27 22:35:13 -04:00
Matthias Clasen
d3e79633e1 notebook: Use canonical signal names
No excuse for not doing that.
2022-08-27 22:34:31 -04:00
Goran Vidović
b362098f63 Update Croatian translation 2022-08-27 20:18:12 +00:00
Luca Bacci
35583c8d36 Merge branch 'gl-renderer-make-context-current-in-remove-program' into 'main'
GL Renderer: Make GdkGLContext current in gsk_gl_driver_shader_weak_cb

Closes #5140

See merge request GNOME/gtk!4985
2022-08-27 17:53:39 +00:00
Piotr Drąg
581bfd20e4 Update Polish translation 2022-08-27 16:16:35 +02:00
Piotr Drąg
c5bbdfb7b1 Update POTFILES.in and POTFILES.skip 2022-08-27 15:54:10 +02:00
Luca Bacci
bcccb46b7c GL Renderer: Ensure that GdkGLContext is current in gsk_gl_driver_shader_weak_cb
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5140
2022-08-27 13:58:17 +02:00
Yuri Chornoivan
916328da2b Update Ukrainian translation 2022-08-27 09:56:43 +00:00
Danial Behzadi
6ca0d616d4 Update Persian translation 2022-08-27 05:32:31 +00:00
Matthias Clasen
137af44f81 Merge branch 'font-chooser-feature-work' into 'main'
fontchooser: Handle font features better

See merge request GNOME/gtk!4984
2022-08-26 22:10:52 +00:00
Matthias Clasen
0441fd3678 fontchooser: Handle font features better
Properly show multiple-choice cvXX features as dropdowns,
include afrc, and fix bugs in feature enumeration that
made some features not show up.
2022-08-26 17:53:55 -04:00
Luca Bacci
3abc3425cb Merge branch 'win32-gir' into 'main'
gdk/win32: do not expose gdk_win32_*_libgtk_only in public headers

See merge request GNOME/gtk!4980
2022-08-26 13:14:30 +00:00
Matthias Clasen
2017f3debe Some strdup avoidance 2022-08-25 14:33:30 -04:00
Marc-André Lureau
4b08570727 gdk/win32: add missing Since tag for gdk_win32_display_get_egl_display
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-25 17:33:25 +04:00
Nart Tlisha
1042ca7e52 Update Abkhazian translation 2022-08-25 10:29:34 +00:00
Marc-André Lureau
52e3ed13e2 gdk/win32: deprecate gdk_win32_handle_table_lookup
This function is probably not generally useful for a Gtk+/win32 user,
and it's only used internally by gdk-win32. It's time to deprecate it, I
believe.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-24 21:02:57 +04:00
Benjamin Otte
fb7257a1f5 Merge branch 'treelistmodel-collapse-test' into 'main'
treelistmodel: Fix handling of collapsed nodes

Closes #4595

See merge request GNOME/gtk!4981
2022-08-24 13:42:51 +00:00
Matthias Clasen
83bf193218 Add a test for treelistmodel row collapse
Test that we can expand and collapse a row, and then
add another child below it, without crashing.

Adapted from the testcase in #4595.

This tests the fix in the previous commit.
2022-08-24 08:23:22 -04:00
Matthias Clasen
f1c1c979c2 treelistmodel: Fix handling of collapsed nodes
When we collapse a node, we clear out the children,
but we were not disconnecting the signal handler on
the child listmodel, leading to bad outcomes when
that model is persistent and changing.

Fixes: #4595
2022-08-24 08:23:20 -04:00
Marc-André Lureau
6cfb6e0c9c gdk/win32: do not expose gdk_win32_*_libgtk_only in public headers
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-24 15:44:32 +04:00
Luca Bacci
ef831235fe Merge branch 'win32-gir' into 'main'
win32: various GI annotations and fixes

See merge request GNOME/gtk!4977
2022-08-24 09:41:11 +00:00
Luca Bacci
5286e9405d Merge branch 'gdk-win32-scale-text-with-dpi-as-gtk3' into 'main'
GdkWin32: Scale text like in GTK3 with SYSTEM_DPI_AWARENESS

Closes #4187

See merge request GNOME/gtk!4979
2022-08-24 09:35:30 +00:00
Luca Bacci
c11ea42644 GdkWin32: Scale text with DPI like in GTK3 with SYSTEM_DPI_AWARENESS
Right now we only support system DPI awareness in GTK4. In that case
it makes sense to scale text with the DPI of the primary monitor, like
done in GTK3.

We plan to land support for proper fractional scaling in Gdk/Win32, so
in the future the "gtk-xft-dpi" setting will be gathered as intended,
i.e. for text magnification, as an a11y feature.
2022-08-23 19:53:44 +02:00
Luca Bacci
d7c04145ee Merge branch 'gdk-win32-fix-monitor-for-popup' into 'main'
GdkWin32: Use primary monitor as fallback if popup layout does not intersect any

See merge request GNOME/gtk!4978
2022-08-23 17:20:02 +00:00
Marc-André Lureau
0d7a0132bb gdk/win32: annotate gdk_win32_surface_lookup_for_display
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-23 17:20:39 +04:00
Marc-André Lureau
cad32636ce gdk/win32: annotate gdk_win32_surface_set_urgency_hint
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-23 17:06:48 +04:00
Luca Bacci
d125fcd35a GdkWin32: Position popups on the primary monitor if outside of the visible screen area
Fixes a crash caused by attempting to dereference a NULL GdkMonitor*
in GdkWin32.

See https://gitlab.gnome.org/GNOME/gtk/-/issues/5125
2022-08-23 14:54:01 +02:00
Marc-André Lureau
88503bcc3b gtk/win32: fix a switch-default warning
gtk/gtkimcontextime.c:714:3: warning: switch missing default case [-Wswitch-default]

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-23 16:42:17 +04:00
Matthias Clasen
e68925a932 Merge branch 'tweak-option-docs' into 'main'
Tweak the vulkan option description

See merge request GNOME/gtk!4976
2022-08-23 12:41:46 +00:00
Marc-André Lureau
a6418d5028 gdk/win32: deprecate gdk_win32_surface_get_impl_hwnd
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-23 16:35:07 +04:00
Marc-André Lureau
04ebec0fa7 gtk/win32: use gdk_win32_surface_get_handle
As I propose to deprecate gdk_win32_surface_get_impl_hwnd() next,
replace it with the alternative.

The main difference between the two functions is that
gdk_win32_surface_get_impl_hwnd() fails gracefully by returning NULL if
the surface is not of the win32 implementation.

All the surfaces should be native surfaces here, and the existing code
doesn't seem to deal with NULL case anyway.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-23 16:31:09 +04:00
Matthias Clasen
aa0f564aa1 Tweak the vulkan option description
The thing that is experimental is our renderer,
not the vulkan API.
2022-08-23 08:27:24 -04:00
Marc-André Lureau
3cbf6c9d6e gdk/win32: annotate gdk_win32_surface_get_handle
And adjust the argument precondition check.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-23 16:25:33 +04:00
Marc-André Lureau
a75de5fb90 gdk/win32: correct gdk_win32_surface_get_handle return type
The associated surface window handle is a HWND, not a HGDIOBJ.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-23 16:17:19 +04:00
Sveinn í Felli
1b66373a5d Update Icelandic translation
(cherry picked from commit a27ae5362c)
2022-08-23 11:49:42 +00:00
Sveinn í Felli
8786ac844c Update Icelandic translation
(cherry picked from commit e6d3c58ccf)
2022-08-23 11:38:46 +00:00
Marc-André Lureau
180dd5fb7f gdk/win32: deprecate gdk_win32_surface_is_win32
The function isn't used by Gtk itself anymore, and does not help much.
It creates extra issues for bindings, as it doesn't fit well with code
doing the same job for other objects.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-23 15:34:50 +04:00
Marc-André Lureau
a53650d9da gdk/win32: annotate filter callbacks
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-23 12:57:20 +04:00
Luca Bacci
0d4d52d322 Merge branch 'win32-gir' into 'main'
Generate gtk/GdkWin32-4.0.gir

Closes #5112

See merge request GNOME/gtk!4965
2022-08-22 22:26:09 +00:00
Aurimas Černius
896155fab7 Updated Lithuanian translation 2022-08-22 23:21:45 +03:00
Matthias Clasen
727ec4cf7d Merge branch 'fix-calc-value-free' into 'main'
css: Fix freeing of calc values

Closes #5130

See merge request GNOME/gtk!4974
2022-08-22 16:31:23 +00:00
Matthias Clasen
a52ee9ee22 css: Fix freeing of calc values
We were getting our memory allocations mixed
up here.

Fixes: #5130
2022-08-22 11:51:56 -04:00
Matthias Clasen
94a9859391 Merge branch 'jpeg-memory-limit' into 'main'
Bump the jpeg memory limit

See merge request GNOME/gtk!4973
2022-08-22 15:03:40 +00:00
Matthias Clasen
d1755337a2 Bump the jpeg memory limit
Commit 59f6c50df8 set the memory limit to 100M,
which turns out to exclude some large, valid jpegs.
So, bump things to 300M, matching what was done
in gdk-pixbuf.
2022-08-22 10:48:00 -04:00
Matthias Clasen
092c166f54 Merge branch 'no-emoji-insert' into 'main'
text: Respect no-emoji hint fully

See merge request GNOME/gtk!4972
2022-08-21 20:47:27 +00:00
Matthias Clasen
13f8eeb3ee text: Respect no-emoji hint fully
We were disabling the insert-emoji action when the
no-emoji input hint is set, but the Ctrl-. shortcut
was bypassing the action and kept working. Make
the shortcut activate the action instead.

Fixes: #5123
2022-08-21 16:31:14 -04:00
Matthias Clasen
36768471e5 Merge branch 'wip/smcv/log-writer' into 'main'
icontheme test: Assert that the subprocess passed

See merge request GNOME/gtk!4969
2022-08-21 11:55:00 +00:00
Simon McVittie
3cfe04aa74 icontheme test: Assert that the subprocess passed
Noticed while backporting GLogWriterFunc fixes to 3.24.x (#5119).

Signed-off-by: Simon McVittie <smcv@debian.org>
2022-08-20 19:38:29 +01:00
Марко Костић
4965a3ea4b Update Serbian translation 2022-08-20 13:06:02 +00:00
Fran Dieguez
adc8a27f7a Update Galician translation 2022-08-20 11:26:34 +00:00
Luca Bacci
37d4dfb6b5 Merge branch 'gdk-win32-fix-handling-of-input-region' into 'main'
GdkWin32: Fix handling of WM_NCHITTEST

Closes #5114

See merge request GNOME/gtk!4966
2022-08-20 10:08:32 +00:00
Zurab Kargareteli
d887af0748 Update Georgian translation 2022-08-20 07:37:42 +00:00
Matthias Clasen
803ba1da4f Merge branch 'fix-emojichooser-keynav' into 'main'
emojichooser: Fix arrow keynav

Closes #5076

See merge request GNOME/gtk!4967
2022-08-19 20:12:51 +00:00
Matthias Clasen
78eaad614a emojichooser: Fix arrow keynav
When some of the Emoji have been filtered out by
a search term, arrow keynav would behave oddly and
get stuck in invisible sections. Fix this by ignoring
any filtered out children when moving between
sections for arrow keynav.

Fixes: #5076
2022-08-19 15:55:10 -04:00
Luca Bacci
749425808d Fix typo
And reword comment
2022-08-19 19:29:17 +02:00
Luca Bacci
5e299cd3d2 GdkWin32: Fix handling of WM_NCHITTEST
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/5114
2022-08-19 19:21:17 +02:00
Marc-André Lureau
8ab57fc8ef build-sys: generate GdkWin32.gir
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-19 17:42:30 +04:00
Matthias Clasen
3a8e45963f Merge branch 'mingw' into 'main'
Cross-building with mingw & fixes

See merge request GNOME/gtk!4341
2022-08-19 11:06:10 +00:00
Marc-André Lureau
ff16446b0b build-sys: do not install gdkwin32keys.h
Fixes: commit 89ad7893ad ("gdk: Make GdkKeymap a private api")

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-19 11:58:12 +04:00
Marc-André Lureau
82bcebe3de gdk/win32: remove old declaration
The function is gone since commit ea65abc7e2 ("Rewrite
GdkWin32Keymap (load table directly from layout DLL)")

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-19 11:58:12 +04:00
Benjamin Otte
a790764a7a Merge branch 'wip/otte/for-main' into 'main'
gdk: Plug a memleak

Closes #5110

See merge request GNOME/gtk!4964
2022-08-19 01:08:59 +00:00
Benjamin Otte
248e33e3c9 gdk: Plug a memleak
Free GdkIOPipe struct when freeing it
Don't just free all its members.

Fixes #5110
2022-08-19 02:38:11 +02:00
Matthias Clasen
44931aa8f8 Merge branch 'treeview-search-focus' into 'main'
treeview: Always call grab_focus_without_selecting on search entry

Closes #4551

See merge request GNOME/gtk!4961
2022-08-18 23:51:02 +00:00
Luca Bacci
fb83adef25 Merge branch 'remove-msys2-ci-subproject-workaround' into 'main'
CI: remove workaround for some subproject builds failing on Windows

See merge request GNOME/gtk!4923
2022-08-18 18:40:05 +00:00
Matthias Clasen
08de13e9d2 Merge branch 'wip/carlosg/im-fixes' into 'main'
gtkimcontextwayland: Refactor handling of client updates

Closes #5106 and #5105

See merge request GNOME/gtk!4962
2022-08-18 17:58:26 +00:00
Carlos Garnacho
f66ffde68d gtkimcontextwayland: Refactor handling of client updates
Currently, the wayland IM context sends zwp_text_input_v3.commit from
a number of places, and some of them with partial data. In order to
make client state updates "atomic" and complete, make the communication
happen over an unified notify_im_change() function that happens on
a narrower set of circumstances:

  - The GtkIMContext is reset
  - The GtkIMContext is just focused
  - The gesture to invoke the OSK is triggered
  - The IM context is reacting to changes coming from the compositor

Notably, setting the cursor location or the surrounding text do not try
to commit state on their own, and now will be flushed with the corresponding
IM update or reset. But also, these requests won't be prevented from
happening individually on serial mismatch, instead it will be the whole
state commit which is held off.

With these changes in place, all client-side updates are notified
atomically to the compositor under a single .commit request.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5106
Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5105
2022-08-18 19:19:53 +02:00
Carlos Garnacho
52ac71b972 gtktextview: Shuffle the places doing IM reset
During text widget manipulation (inserting or deleting text via keyboard)
the IM context is reset somewhat early, before the actual change took place.
This makes IM lag behind in terms of surrounding text and cursor position.

Shuffle these IM reset calls so that they happen after the changes, and
ensure that the IM is actually reset, since that is currently toggled on
a pretty narrow set of circumstances.

Also, fix a bug during GtkEventControllerKey::im-update where the condition
on cursor position editability to reset the IM context was inverted.
2022-08-18 19:07:12 +02:00
Mat
27eaca8b79 treeview: Always call grab_focus_without_selecting on search entry
The search text entry is always a GtkText widget, not GtkEntry. If a
custom search entry is set, this part of the code is never reached.

Fixes #4551
2022-08-18 18:03:04 +03:00
Marc-André Lureau
63dce34396 ci: add fedora-mingw64 job
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-18 11:45:21 +04:00
Marc-André Lureau
3585da6b7f build-sys: fix linker warning on win32
[196/296] Linking target testsuite/gtk/builder.exe
/usr/lib/gcc/x86_64-w64-mingw32/11.2.1/../../../../x86_64-w64-mingw32/bin/ld: warning: --export-dynamic is not supported for PE+ targets, did you mean --export-all-symbols?

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2022-08-18 11:44:34 +04:00
Carlos Garnacho
9e29739e66 gtktext: Shuffle the places doing IM reset
During text widget manipulation (inserting or deleting text via keyboard)
the IM context is reset somewhat early, before the actual change took place.
This makes IM lag behind in terms of surrounding text and cursor position.

Shuffle these IM reset calls so that they happen after the changes, and
ensure that the IM is actually reset, since that is currently toggled on
a pretty narrow set of circumstances.
2022-08-18 00:55:30 +02:00
Matthias Clasen
82395e73ad Merge branch 'wip/smcv/rej' into 'main'
demos: Remove detritus from a patch not applying cleanly

See merge request GNOME/gtk!4957
2022-08-16 12:28:46 +00:00
Simon McVittie
0237713c3a demos: Remove detritus from a patch not applying cleanly
I assume this was committed by mistake. It isn't used, and some
packaging systems will automatically remove it during `clean`.

Signed-off-by: Simon McVittie <smcv@debian.org>
2022-08-16 08:32:45 +01:00
Jordi Mas
7e0e8365bd Update Catalan translation 2022-08-15 23:58:40 +02:00
Luca Bacci
fbd11fc595 Merge branch 'overshoot-win32-fix' into 'main'
GdkWin32: Support high resolution scroll wheel events

See merge request GNOME/gtk!4950
2022-08-15 21:33:19 +00:00
Matthias Clasen
bebaac64e1 Merge branch 'gtktreeview-adjustment' into 'main'
treeview: Do not set top row adjustment value while animating

Closes #4550

See merge request GNOME/gtk!4940
2022-08-14 22:40:32 +00:00
Matthias Clasen
1d232a725f Merge branch 'treeview-widget-coords' into 'main'
treeview: Use widget coordinates where required

See merge request GNOME/gtk!4939
2022-08-14 22:39:21 +00:00
Benjamin Otte
fb4312738d Merge branch 'wip/otte/for-main' into 'main'
listitemwidget: Actually unref the listitems

Closes #5102

See merge request GNOME/gtk!4955
2022-08-14 21:19:48 +00:00
Benjamin Otte
918dd66dca listitemwidget: Actually unref the listitems
Fixes #5102
2022-08-14 22:55:27 +02:00
Ricardo Maia Louro
6ceacee0f9 GdkWin32: Support high resolution scroll wheel events 2022-08-14 18:30:28 +01:00
Piotr Drąg
f1e81d176c Update Polish translation 2022-08-14 15:24:39 +02:00
Matthias Clasen
8d18b2b92d Merge branch 'fix-gears-leak' into 'main'
gtk4-demo: Fix a memory leak

See merge request GNOME/gtk!4954
2022-08-13 21:42:35 +00:00
Matthias Clasen
4a04e468fd gtk4-demo: Fix a memory leak
The gears demo was leaking its vertices.
2022-08-13 17:27:40 -04:00
Matthias Clasen
f8d1912098 Merge branch 'wayland-cursor-texture-leak' into 'main'
wayland: Avoid leaking cursor textures

See merge request GNOME/gtk!4953
2022-08-13 17:35:56 +00:00
Matthias Clasen
0bd15b44f2 wayland: Avoid leaking cursor textures
When we fall back to the default cursor and load it
from a resource, we need to free the texture.
2022-08-13 13:19:49 -04:00
Matthias Clasen
e4fb6933d2 Merge branch 'inscription-leak-fixes' into 'main'
inscription: Plug a memory leak

See merge request GNOME/gtk!4952
2022-08-13 00:49:33 +00:00
Matthias Clasen
33cf8f9404 inscription: Plug a memory leak
PangoFontMetrics also need to be freed.
2022-08-12 20:35:36 -04:00
Matthias Clasen
1640390839 inscription: Plug a memory leak
PangoLayoutIter needs to be freed.
2022-08-12 20:35:36 -04:00
Matthias Clasen
b01f28b9e2 Merge branch 'fix-cups-backend-leak' into 'main'
Add more valgrind suppressions

See merge request GNOME/gtk!4951
2022-08-12 23:00:44 +00:00
Matthias Clasen
62192cba6e cups printbackend: Plug memory leaks
This loop has many early exits, and all of them
need to free this info object that gets allocated
at the beginning.
2022-08-12 18:44:25 -04:00
Matthias Clasen
586826d34c Add more valgrind suppressions
This gets all GQuark functions out of the logs.
2022-08-12 12:44:02 -04:00
Matthias Clasen
c7a55faf37 Merge branch 'fix-a11y-leak' into 'main'
a11y: Fix a memory leak

See merge request GNOME/gtk!4949
2022-08-12 16:17:48 +00:00
Matthias Clasen
e81db46578 a11y: Fix a memory leak
We need to free the queued context list in dispose
if we didn't get to register the contexts, and we also
need to free the list properly when we do get to
register them.

This showed up in valgrind as leaked GList structs.
2022-08-12 12:01:42 -04:00
Goran Vidović
e036eebde8 Update Croatian translation 2022-08-12 14:33:14 +00:00
Goran Vidović
dfa45c0da2 Update Croatian translation 2022-08-12 14:25:29 +00:00
Goran Vidović
6692c7e9c4 Update Croatian translation 2022-08-12 14:22:10 +00:00
Zurab Kargareteli
671f33a7b8 Update Georgian translation 2022-08-12 03:32:05 +00:00
Matthias Clasen
0fee50d1a5 Merge branch 'fix-leak' into 'main'
gtk/css: data_url_path fix leak in error path

See merge request GNOME/gtk!4947
2022-08-12 00:09:15 +00:00
Pablo Correa Gómez
97d3363360 gtk/css: data_url_path fix leak in error path
Fixes 7900032f30
2022-08-12 01:34:18 +02:00
Matthias Clasen
6eb3548192 4.7.2 2022-08-11 14:26:50 -04:00
Matthias Clasen
e5a47b5592 Merge branch 'improve-css-test' into 'main'
css: Propagate charset conversion errors

See merge request GNOME/gtk!4943
2022-08-11 11:58:04 +00:00
Matthias Clasen
6c3119bc33 tests: Check the error first
The error contains useful information when
things fail, so check it first to get useful
output in case of failure.
2022-08-11 07:29:56 -04:00
Matthias Clasen
7900032f30 css: Propagate charset conversion errors
Lets not throw away informtation that
helps to figure out why things fail.
2022-08-11 07:29:56 -04:00
Matthias Clasen
a020cf7534 Merge branch 'matthiasc/for-main' into 'main'
jpeg loader: Limit memory consumption

See merge request GNOME/gtk!4942
2022-08-10 17:57:55 +00:00
Matthias Clasen
59f6c50df8 jpeg loader: Limit memory consumption
This will prevent stupid oom situations with pathological
jpeg files, without affecting our ability to load reasonable
images.
2022-08-10 13:25:17 -04:00
Matthias Clasen
bbd6fdaa04 Merge branch 'jx/hi-res-scrolling' into 'main'
High-resolution scroll wheel support

See merge request GNOME/gtk!3839
2022-08-10 16:51:55 +00:00
Carlos Garnacho
6a7136d5fb ci: Disable -Werror on wayland submodule
CI is mostly interested in GTK not introducing compiler warnings, other
submodules like Wayland might have their own and that shouldn't hinder
CI testing of GTK.

Disable -Werror for the wayland submodule, and let it be fixed independently
at some point.
2022-08-10 16:37:17 +02:00
José Expósito
95860d4989 gtkeventcontrollerscroll: Always accumulate discrete deltas
When GTK_EVENT_CONTROLLER_SCROLL_DISCRETE is set, accumulate deltas also
for mouse scroll so a high-resolution mouse wheel click behaves in the
in the same manner as a low-resolution mouse wheel click.
2022-08-10 14:23:58 +00:00
José Expósito
37a561eb53 gdk/x11: Handle high-resolution scroll events 2022-08-10 14:23:58 +00:00
José Expósito
ed0a2a203c gdk/wayland: Handle high-resolution scroll events
Starting with the Wayland protocol wl_pointer >= 8, discrete axis
events have been deprecated in favour of high-resolution scroll event.

Add a listener for high-resolution scroll events and, for backwards
compatibility, handle discrete events as discrete*120.
2022-08-10 14:23:58 +00:00
José Expósito
fc3aca8223 gdk/wayland: Calculate discrete scroll direction in its helper
Refactor, no functional changes.
2022-08-10 14:23:58 +00:00
José Expósito
6ebb38e12e gdk/events: Set discrete scroll deltas in its constructor
Instead of calculating the discrete scroll deltas in
GtkEventControllerScroll, move that code to the event constructor and
access the precalculated values using gdk_scroll_event_get_deltas.

Refactor, no functional changes.
2022-08-10 14:23:58 +00:00
José Expósito
51ca454eef gdk/events: Add constructor for high-resolution scroll events
Starting with Linux Kernel v5.0 two new axes are available for
mice that support high-resolution wheel scrolling: REL_WHEEL_HI_RES and
REL_HWHEEL_HI_RES.

Both axes send data in fractions of 120 where each multiple of 120
amounts to one logical scroll event. Fractions of 120 indicate a wheel
movement less than one detent.

The 120 magic number is a copy of the Windows API, so this new
constructor can be used both in Linux >= 5.0 and Windows >= Vista.
2022-08-10 14:23:58 +00:00
José Expósito
fb100d719f build: Update Wayland to >= 1.21.0 2022-08-10 14:23:58 +00:00
Jordi Mas
cf1974f6b1 Update Catalan translation 2022-08-10 14:27:44 +02:00
Emmanuele Bassi
3f4a0aa1f3 Merge branch 'rounded-clip-node-new-transfer-full' into 'main'
Mark gsk_rounded_clip_node_new() return value as (transfer full)

See merge request GNOME/gtk!4941
2022-08-10 09:23:02 +00:00
Sebastian Dröge
0cc2d5559b Mark gsk_rounded_clip_node_new() return value as (transfer full)
Like all the other constructors for nodes already do. Without this,
newly created rounded clip nodes are leaked in bindings.
2022-08-10 11:07:51 +03:00
Mat
b4ade026f1 treeview: Do not set top row adjustment value while animating
gtk_tree_view_top_row_to_dy, which is called from GtkTreeView's
size_allocate function, changes the adjustment value. Since this
conflicts with the animation when changing the active row, bail
out until the animation is finished.

Fixes #4550
2022-08-10 08:32:47 +03:00
Mat
102ca838b8 treeview: Use widget coordinates where required
When a GtkTreeView scrolled horizontally, it was not possible to
select rows outside the initial area due to an erroneous comparison
between widget and bin window coordinates.

Original change to widget coordinates occurred in commit
a0de570e47
2022-08-10 04:25:19 +03:00
Carlos Garnacho
378ae4fbc1 Merge branch 'gbsneto/paned-focus-infloop' into 'main'
paned: Protect against NULL variable

Closes #5094

See merge request GNOME/gtk!4938
2022-08-09 18:26:48 +00:00
Matthias Clasen
00f079d705 Merge branch 'wip/carlosg/fix-crossing-on-unmap' into 'main'
gtkwindow: Use pointer-oriented function to deal with crossing events

Closes #5094

See merge request GNOME/gtk!4937
2022-08-09 18:15:41 +00:00
Carlos Garnacho
54465adff2 gtkwindow: Use pointer-oriented function to deal with crossing events
Commit adba0b97 fixed missed pointer crossings by using a helper function that
was already present and looked like did everything that was needed. However
this function was oriented to keyboard focus and it also did update the related
widget state. Doing these changes on pointer-based crossing was misuse, and
could cause weird interactions with keyboard focus management.

Fix this by using gtkmain.c gtk_synthesize_crossing_event() that is in fact
oriented to pointers.

Fixes: adba0b97 (gtkwindow: Synthesize pointer crossing events on state changes)
Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5094
2022-08-09 19:48:15 +02:00
Georges Basile Stavracas Neto
29580d4252 paned: Warn if child is not actually a child
This will at least allow us to debug this in the future.
2022-08-09 14:20:25 -03:00
Carlos Garnacho
25c3616a79 gtkmain: Pass coordinates when synthesizing pointer events
Instead of passing an event and figuring out coordinates from it, pass
directly the toplevel coordinates so that we can use this outside event
handling.

All callers have been updated to pass the coordinates, in practical effects
they were already based on the GtkNative.
2022-08-09 19:13:28 +02:00
Georges Basile Stavracas Neto
120399cc92 paned: Protect against NULL variable
The inner loop in gtk_paned_set_focus_child() tries to find the
topmost GtkPaned, however, if the `w` variable ends up becoming
NULL after bubbling up the entire GtkWidget hierarchy, this loop
never breaks.

Check for NULL in this loop.

Closes https://gitlab.gnome.org/GNOME/gtk/-/issues/5094
2022-08-09 13:59:09 -03:00
Kukuh Syafaat
86e5ad85b7 Update Indonesian translation 2022-08-09 02:12:09 +00:00
Quentin PAGÈS
04ad5e8936 Update Occitan translation 2022-08-08 20:49:35 +00:00
Carlos Garnacho
9691a11076 Merge branch 'wip/exalm/multiplier' into 'main'
scrolledwindow: Lower the scroll multiplier

See merge request GNOME/gtk!4933
2022-08-08 12:00:15 +00:00
Daniel Mustieles
fef3ab0b62 Updated Spanish translation 2022-08-08 12:42:06 +02:00
Alexander Mikhaylenko
493660a296 scrolledwindow: Lower the scroll multiplier
c68247f63b introduced a scroll multiplier,
intended to be significantly lower than the GTK 4.6 behavior but higher
than 1. However, it was _higher_ than 4.6, since 4.6 also had a permanent
1/10 multiplier in GDK, so the cited multiplier values were really 6.4 and
9.7.
2022-08-08 00:07:36 +04:00
Matthias Clasen
73f634435a Merge branch 'build-fix-glib-2.66' into 'main'
build: fix for use with glib 2.66.0 (2nd try)

See merge request GNOME/gtk!4932
2022-08-07 19:09:04 +00:00
Matthias Clasen
b17bba4af2 Merge branch 'wip/carlosg/scroll-overshoot' into 'main'
gtk/scrolledwindow: Check for overshoot setting up kinetic scroll helpers

Closes #4784

See merge request GNOME/gtk!4909
2022-08-07 19:01:25 +00:00
Emmanuele Bassi
ba1a084899 Apply 1 suggestion(s) to 1 file(s) 2022-08-07 18:54:19 +00:00
Carlos Garnacho
0e5a97ae58 gtk/scrolledwindow: Check for overshoot setting up kinetic scroll helpers
We may have situations where velocity is 0/0, but are overshooting. Places where
this happens are mouse wheels, and continuous scroll that ended up still before
finish. In this situation we also want to run the animation for overshoot, so
check for the corresponding axes to also set up the kinetic scroll helper.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4784
2022-08-07 20:26:52 +02:00
Matthias Clasen
7a306fe32f Merge branch 'wip/carlosg/fixes' into 'main'
Some fixes

Closes #2877 and #5003

See merge request GNOME/gtk!4929
2022-08-07 18:06:28 +00:00
Emmanuele Bassi
ac7009d56c Merge branch 'clipboard-seg2' into 'main'
x11: Don't assume valid type

See merge request GNOME/gtk!4912
2022-08-07 16:21:40 +00:00
Carlos Garnacho
c68247f63b gtkscrolledwindow: Add fixed multiplier to scroll events in surface units
The expected configurability is not going to arrive yet from compositors, and
it is precipitate for GTK to gain any configurability. We do know a factor of 1
feels way too slow, and we do know a factor of page_size * pow (2 / 3) feels way
way too fast.

With the previous multiplier, gtk4-demo at its default size had a vertical textview
factor of 64.332901, and maximized on a 1920x1080 screen a factor of 97.585365.
Pick a magic multiplier that is both significantly below these values and above 1,
and stick to it.

Future work will add the configurability of smooth scroll events where it belongs.
At that point this commit may be reverted so we don't pile up on magic numbers again.

Related: https://gitlab.gnome.org/GNOME/gtk/-/issues/4793
2022-08-07 17:16:14 +02:00
Asier Sarasua Garmendia
668a2c0f3e Update Basque translation 2022-08-07 09:49:00 +00:00
Hugo Carvalho
c435c7e764 Update Portuguese translation 2022-08-06 23:01:57 +00:00
Danial Behzadi
4d36a4ebd7 Update Persian translation 2022-08-06 22:43:23 +00:00
Hannes Müller
703fc51d8e build: fix for use with glib 2.66.0
Add missing #define g_memdup2() for gdksurface-broadway.c in case of enabled
broadway-backend as used otherwise.

Copy static would_drop() replacement for g_log_writer_default_would_drop()
from gtk-builder-tool.c to gtk-reftest.c
2022-08-06 21:11:08 +02:00
Aleksandr Melman
fb008578b4 Update Russian translation 2022-08-06 14:44:53 +00:00
Carlos Garnacho
adba0b972e gtkwindow: Synthesize pointer crossing events on state changes
When widgets go mapped/unmapped, we repick but don't generate crossing
events. Since there could be stateful controllers that use those in
the previously picked widget (e.g. GtkEventControllerMotion), skipping
those breaks their state.

Ensure to send the relevant crossing events on every situation that
changes the pointer focus, so these controllers get a fair opportunity
to undo their state.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/2877
2022-08-05 19:25:13 +02:00
Carlos Garnacho
c77b98d716 gdk/wayland: Drop surface checks on wl_pointer.leave handling
Even though the argument is non-nullable, GTK sometimes incurs in that
by itself by destroying the surface while the event is in flight. This
is the case of popping down a GtkDropdown. When this happens we simply
ignore the crossing event, but we should let it through instead, the
compositor did not send it in vain and we possibly still have pointer
state to undo.

Drop the surface checks, so that the event is propagated along GTK.
2022-08-05 19:25:13 +02:00
Carlos Garnacho
8eda182f24 gtkeventcontroller: Fix internal enum documentation
Copy and paste typo.
2022-08-05 19:25:13 +02:00
Carlos Garnacho
15e0c175a3 gtkgesturerotate: Filter touchpad holds events
Since the pinch touchpad gestures already have begin/update/end phases,
this gesture has no actual use for these events.
2022-08-05 19:25:13 +02:00
Carlos Garnacho
bc953eebdd gtkgesturerotate: Filter touchpad holds events
Since the pinch touchpad gestures already have begin/update/end phases,
this gesture has no actual use for these events.
2022-08-05 19:25:13 +02:00
Carlos Garnacho
6238f97cb6 gdkevent: Give touchpad hold events a sequence
Following what was done for pinch/swipe events, give hold gestures their
own distinct sequence as well. Without this it was NULL, which was already
distinct to other touchpad gestures.
2022-08-05 19:25:13 +02:00
Carlos Garnacho
023924bca9 gtkgesture: Do not coalesce hold events with other touchpad gestures
This delaying of the cancel event was made to avoid intermediate cancellation
for >=2fg hold gestures followed by pinch/swipe gestures, and it worked as
long as everything was considered to have the same sequence.

Since each pinch/swipe pointer gesture now gets its own sequence, this no
longer applies, nor works. This results in zoom/rotate/swipe gestures being
stuck since the sequence for the touchpad events changes mid-gesture.

Sticking to this pattern of giving touchpad gestures their own sequence,
these hold events cannot be assumed to coalesce with other touchpad gestures,
it is better to let it propagate altogether so that both the hold gesture
and the incoming gesture trigger coherent begin and end/cancel phases.

In the worst case, this results in "::begin, ::cancel, ::begin , ..." before
triggering a touchpad gesture, but the extra begin/cancel ought to be a safe
no-op in widgets.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5003
2022-08-05 19:25:13 +02:00
Matthias Clasen
af6432aa67 Merge branch 'ebassi/textbuffer-private-api' into 'main'
Move private function out of the AT-SPI a11y backend

See merge request GNOME/gtk!4924
2022-08-05 12:01:27 +00:00
Emmanuele Bassi
6c37158bbc Re-enable the TextBuffer wrap-mode serialization test
The private serialization function is now available on all platforms.
2022-08-04 23:39:54 +01:00
Emmanuele Bassi
d030c92d63 Move private function out of the AT-SPI a11y backend
The textbuffer test is calling into a function defined by the AT-SPI
accessibility backend. As of commit 4ddf1b70 we only build and run the
test on Linux, but the function in question isn't really
accessibility-related: it's just a serialization function.
2022-08-04 23:34:41 +01:00
Christoph Reiter
efe100df9e CI: remove workaround for some subproject builds failing on Windows
In some cases subproject builds under MSYS2 failed, see
https://gitlab.gnome.org/GNOME/gtk/-/issues/2243
https://gitlab.gnome.org/GNOME/gtk/-/issues/3002
https://gitlab.gnome.org/GNOME/gtk/-/issues/5053

These manual pango/glib build instructions were added to work around
the problem by avoiding the subprojects.

https://gitlab.gnome.org/GNOME/gtk/-/issues/5053 uncovered the bug in
binutils, which is now fixed in master there and was also backported
into MSYS2 which we use in CI.

So we can just remove the workaround again now.
2022-08-04 22:26:04 +02:00
Yuri Chornoivan
a07ee709d2 Update Ukrainian translation 2022-08-04 14:33:50 +00:00
Matthias Clasen
60b77736b5 Merge branch 'cleanup-ffmpeg' into 'main'
ffmpeg: add audio playback through avdevice

See merge request GNOME/gtk!4852
2022-08-04 10:49:45 +00:00
Stephan Vedder
83ff85d227 ffmpeg: add audio playback through avdevice 2022-08-04 10:49:44 +00:00
Matthias Clasen
f7b3a214f3 Merge branch 'mount_operation' into 'main'
mountoperation: Fix authentication dialog

Closes #5059 and #5058

See merge request GNOME/gtk!4899
2022-08-03 11:56:25 +00:00
Matthias Clasen
c1053096bd Merge branch 'win32-nahimic-nv-notes' into 'main'
running.md: Mention about issue with Nahimic on Windows

Closes #4113

See merge request GNOME/gtk!4915
2022-08-02 11:10:25 +00:00
Chun-wei Fan
f2b85fa1c7 running.md: Mention about issue with Nahimic on Windows
Let people know that they will need to use GTK with the Nahimic service
disabled or OpenGL disabled or put their GTK application into the Nahimic
backlist, or try to use GLES, since there is a known issue in the Windows
nVidia graphics drivers and Nahimic that causes GL operations to fail,
causing crashes in operations such as window resizes.

This will close issue #4113--sadly, there is nothing we can do within
GTK to fix the issue.
2022-08-02 13:50:49 +08:00
Matthias Clasen
a48942bf39 Merge branch 'label-tabs' into 'main'
Label tabs

See merge request GNOME/gtk!4914
2022-08-02 00:18:44 +00:00
Benjamin Otte
c1d6160bd4 Merge branch 'otte-main-patch-86462' into 'main'
Fix g_object_new(GTK_TYPE_SNAPSHOT)

See merge request GNOME/gtk!4919
2022-08-01 20:47:12 +00:00
Benjamin Otte
dbab69c453 snapshot: Don't critical on dispose
When there's remaining state that draws nothing, it returns no
rendernode. So do a NULL-check before unreffing it.
2022-08-01 20:28:46 +00:00
Benjamin Otte
09f0c96b9b Fix g_object_new(GTK_TYPE_SNAPSHOT)
GJS apparent likes g_object_new() over actual constructors, so make that work.
2022-08-01 20:08:58 +00:00
Matthias Clasen
641a589734 Add GtkLabel:tabs
This adds more powerful formatting capabilities to GtkLabel
without costing us much, since Pango already supports tabs.
2022-08-01 08:20:05 -04:00
Christian Hergert
9bce70ed8d Merge branch 'wip/chergert/builder-expose-object-fix' into 'main'
builder: gracefully handle re-exposing builder object

See merge request GNOME/gtk!4913
2022-08-01 05:09:53 +00:00
Christian Hergert
d00d1334ce gtkbuilder: update gtk_builder_expose_object() docs 2022-07-31 21:37:20 -07:00
Christian Hergert
fbe124ca54 gtkbuilder: update gtk_builder_extend_with_templat() docs 2022-07-31 21:25:58 -07:00
Christian Hergert
f680b86130 gtkbuilder: check for existing object before extending template
If gtk_builder_expose_object() is called twice with the same name, it will
result in a g_critical(). This improves that situation by checking for the
object before exposing additional times.

This turns out to be handy in situations where templates are expanded
multiple times, such as application-side implementations of UI merging.
2022-07-31 21:25:58 -07:00
Dr. David Alan Gilbert
dbc4e18bf8 x11: Don't assume valid type
If we get an invalid TARGETS reply, we might not have a valid 'type',
which ends up as NULL and segs in the g_str_equal.

(This is probably fallout from my fix 506566b6a4, which I still
can't reproduce reliably, so the last one just moved the seg a bit
further along, and we still don't know who is sending a bad TARGETS).

This corresponds to:
https://bugzilla.redhat.com/show_bug.cgi?id=2062143
2022-07-30 22:11:59 +01:00
Luca Bacci
924da0e84b Merge branch 'fix-gdk-win32-dnd' into 'main'
Fix DnD on Windows

Closes #4498

See merge request GNOME/gtk!4900
2022-07-29 12:42:57 +00:00
Christian Kirbach
38f14303d8 Update German translation 2022-07-28 21:13:07 +00:00
Nart Tlisha
b896b73e5e Update Abkhazian translation 2022-07-28 19:19:12 +00:00
Matthias Clasen
81a65690f8 Merge branch 'alatiera/node-flatpak' into 'main'
flatpak: add a NodeEditor demo

See merge request GNOME/gtk!4898
2022-07-28 18:08:47 +00:00
Matthias Clasen
33f7d96e8f Merge branch 'ebassi/file-list-fixes' into 'main'
Add constructors for GdkFileList

See merge request GNOME/gtk!4907
2022-07-28 18:07:34 +00:00
Emmanuele Bassi
dcd549aebe Add constructors for GdkFileList
C API users can keep dealing with the implicit equivalence of
GdkFileList and GSList, but language bindings have no idea that one type
is another, and none of them exposes GSList as a type anyway, so they
will need a way to construct a GdkFileList.

Instead of making GdkFileList mutable, and re-implement GSList, we only
provide a constructors pair that lets you create a GdkFileList from a
linked list or from an array.
2022-07-28 14:41:35 +01:00
Emmanuele Bassi
8a4aee583c Merge branch 'barthalion/gnome-runtime-images-quay' into 'main'
Update (or drop) the Docker image used by Flatpak job

See merge request GNOME/gtk!4906
2022-07-27 11:39:55 +00:00
Bartłomiej Piotrowski
ea21923932 Update (or drop) the Docker image used by Flatpak job
The gnome-runtime-images have been recently migrated to Quay. This is already reflected in the template.

Please note this MR has been created semi-automatically. If it doesn't make sense, feel free to close it.
2022-07-27 12:47:50 +02:00
Daniel Mustieles
5ca266f137 Updated Spanish translation 2022-07-27 11:36:48 +02:00
Christian Hergert
b9f374c0c6 Merge branch 'wip/chergert/disable-sysprof-agent' into 'main'
build: configure subproject sysprof with -Dagent=false

See merge request GNOME/gtk!4896
2022-07-26 23:44:37 +00:00
Christian Hergert
a32b9d8b51 build: configure subproject sysprof with -Dagent=false
Sysprof has a new -Dagent=true build option which allows installing a
/usr/bin/sysprof-agent program (simimlar to sysprof-cli). It provides a
P2P D-Bus API to the process which can control subprocesses. It's used by
IDE tooling to have more control across container boundaries.

However, we do not need it for GTK CI.
2022-07-26 16:29:25 -07:00
Emmanuele Bassi
c92b27f41b Merge branch 'markand-main-patch-04776' into 'main'
gtk: Missing end of code block

See merge request GNOME/gtk!4902
2022-07-26 15:09:28 +00:00
David Demelier
06bec5fb45 gtk: Missing end of code block 2022-07-26 14:52:30 +00:00
Nart Tlisha
e0be85ccca Add Abkhazian translation 2022-07-26 11:17:20 +00:00
Benjamin Otte
0c052c9a37 Merge branch 'gridview' into 'main'
Gridview fix rubberbanding issues

Closes #3462 and #3445

See merge request GNOME/gtk!4688
2022-07-26 01:08:08 +00:00
Corey Berla
a7bbc25851 listview: Fix selection for last item in get_items_in_rect
Make the last item dependent on y + height
2022-07-25 17:55:26 -07:00
Corey Berla
d6fab1408a listview: Allow starting rubberband in empty space below last row
Rubberband does not work when initiated past the last row
(warning is printed "Could not start rubberbanding: No item).

Clamp y at the max height of the widgets in the listview
2022-07-25 17:55:15 -07:00
Corey Berla
e14b84ff67 listview: Return an empty bitset when selecting only empty space
Return an empty bitset if the user selects exclusively below the last
row.
2022-07-25 17:54:44 -07:00
Corey Berla
aba2d994e6 gridview: Fix typo in docstring for gtk_grid_view_get_cell_at_y() 2022-07-25 17:54:44 -07:00
Corey Berla
57c032e6cc listbase: Clear selection if rubberband selected an empty set
If rubberband returns an empty bitset the selection should be cleared
unless the shift or ctrl key is held
2022-07-25 17:54:44 -07:00
Corey Berla
f3fc8f5b35 gridview: Return an empty bitset when selecting only empty space
Return an empty bitset if the user selects exclusively below the last
row.  No need to calculate selection.
2022-07-25 17:54:44 -07:00
Corey Berla
ba909cf901 gridview: Fix get_items_in_rect() selection
last_row should be dependent on y + height, not y
2022-07-25 17:54:44 -07:00
Corey Berla
1e9a36ffa8 gridview: Allow starting rubberband in empty space below last row
Rubberband does not work when initiated past the last row
(warning is printed "Could not start rubberbanding: No item).

Clamp y at the max height of the widgets in the gridview

Fixes: #3462
2022-07-25 17:54:35 -07:00
Corey Berla
c6f357e447 gridview: Limit rectangle to gridview columns
The function gtk_grid_view_get_items_in_rect() erroneously calculates
columns less than 0 and greater than n_columns when the user attempts
to rubberband all the way to the left or right respectively.  This
causes the rubberband to persistent and creates unexpected behavior.
Limit the rows to a minimum of 0 and maximum of n_columns - 1.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3445
2022-07-25 17:27:24 -07:00
Corey Berla
2bcae546b3 gridview: Move gtk_grid_view_computer_total_height() up for reuse 2022-07-25 17:27:24 -07:00
Emmanuele Bassi
291696607a Merge branch 'widget-docs-fix' into 'main'
gtkwidget: Fix a small typo in a docs comment

See merge request GNOME/gtk!4901
2022-07-25 21:31:18 +00:00
Philip Withnall
87ba99f66b gtkwidget: Fix a small typo in a docs comment
Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2022-07-25 23:15:58 +02:00
Zurab Kargareteli
fc20268cb8 Update Georgian translation 2022-07-25 16:03:57 +00:00
darkcutler
64a959dad9 Fix DnD on Windows
DnD under Windows needed 3 fixes to work with Gtk.DropTarget.

1. The droptarget_w32format_contentformat_map list never gets
filled so the gdk_win32_drop_read_async throws
"No compatible transfer format found".
This is an easy fix and done the same way in the win32 clipboard code.

2. After a drop no gdk_drop_emit_leave_event gets emitted.
This causes a second drop to trigger a bunch of assertion
'self->drop == drop' failed because the first drop is still active.
This is also an easy fix and done the same way by the macos backend.

3. Handling gdk_drop_status/gdk_drop_get_actions interaction.
In gtk_drop_target_do_drop the code
```gdk_drop_finish (self->drop, gdk_drop_get_actions (self->drop));```
calls the finish operation with the actions of the drop which triggers
```g_return_if_fail (gdk_drag_action_is_unique (action));```
in gdk_drop_finish. The code assumes that GdkDrop::actions gets
narrowed down by calling gdk_drop_status. This is hard to assure
because at the same time gdk_drop_get_actions is used by
gtk_drop_target_accept to figure out if a drag is accepted.
GdkDrop::actions serves a double purpose here as the supported source
actions and the currently agreed on action. Both the x11 and the
wayland backend get this wrong somewhat too. Under wayland/x11 when
a drag coming from a source that supports both MOVE and COPY is
first hovering a drop target that only supports COPY it is afterwards
no longer accepted by other drop targets only accepting MOVE.
Under x11 this is permanent for this drag but with wayland the drag
recovers when hovering other widgets. The win32 backend now sets the
supported source actions before any enter/move/drop and narrows them
down in gdk_win32_drop_status.

The patch only touches the win32 backend and fixes all three issues,
for me restoring DnD under windows.

Closes #4498
2022-07-25 15:16:23 +00:00
Corey Berla
111929593a mountoperation: Free user_widgets list upon dialog destruction
There's a list user_widgets that contains all of the entries and
selections during authentication.  This is only freed  upon
finalizing the GtkMountOperation.  It's possible (and true for the
GVFS SMB implementation) that a MountOperation can have the
gtk_mount_operation_ask_password_do_gtk () function called multiple
times (i.e. bad password).  The user_widgets list grows with now
invalid pointers to old widgets (causing unexpected behavior and
seg faults).

Free the user_widgets list upon dialog destruction, we don't need it
anymore.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5059
Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5058
2022-07-25 06:54:14 -07:00
Jordan Petridis
23bd7c1c05 flatpak-build.sh: change the buildtype to debugoptimized
So that the flatpaks will include debuginfo and make debugging
easier.
2022-07-25 15:42:14 +03:00
Jordan Petridis
f99880a74a flatpak: add a NodeEditor demo 2022-07-25 15:38:55 +03:00
Emmanuele Bassi
61bf5ac009 Merge branch 'content-fit-since' into 'main'
picture: Fix Since and Deprecated annotations for content-fit

See merge request GNOME/gtk!4897
2022-07-25 11:45:43 +00:00
Maximiliano Sandoval R
ef07d1556b picture: Fix Since and Deprecated annotations
gi-docgen will parse four or more whitespaces of indentation as code blocks,
two whitespaces were used.

This was missing in https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/4873.
2022-07-25 12:59:47 +02:00
Corey Berla
dd5d1030b5 mountoperation: Select "Anonymous" check button by default
It is already explicitly assumed that anonymous authentication will
be used when available, but it is not clear to the user since neither
of the check buttons are selected.  Select the Anonymous check button
by default.
2022-07-24 20:53:41 -07:00
Jordi Mas
f480ff2e4d Update Catalan translation 2022-07-21 04:25:20 +02:00
Mat
9c919ffa46 treepopover: Do not propagate natural width of content
Propagating the natural width of the tree popover contents breaks ellipsizing of items
(see 'Unconstrained menu' in tests/testcombo).
2022-07-20 16:51:33 +03:00
Carlos Garnacho
2b131f09a8 Merge branch 'fix-controller-key-event-propagation-file-chooser-widget' into 'main'
GtkFileChooserWidget: Propagate captured key events when the location entry is focused

Closes #4880

See merge request GNOME/gtk!4674
2022-07-19 22:15:04 +00:00
Matthias Clasen
b165028e86 Merge branch 'drag-action' into 'main'
tree/iconview: Use a unique drag action in drag_enter/motion callbacks

Closes #3187

See merge request GNOME/gtk!4882
2022-07-18 14:35:11 +00:00
Matthias Clasen
6e379181d9 Merge branch 'treeview-drag-ancestor' into 'main'
treeview: Check for column header area in row click/drag gestures

Closes #4453

See merge request GNOME/gtk!4885
2022-07-18 14:33:26 +00:00
Matthias Clasen
edf8c9e501 Merge branch 'matthiasc/for-main' into 'main'
css: Fix handling of transform values

See merge request GNOME/gtk!4890
2022-07-18 14:24:49 +00:00
Matthias Clasen
f95f992d32 Merge branch 'wip/carlosg/use-press-serial' into 'main'
gdk/wayland: Use last implicit grab serial for DnD start requests

Closes #5048

See merge request GNOME/gtk!4889
2022-07-18 14:18:22 +00:00
Carlos Garnacho
95cf34ab4c gdk/wayland: Stop storing the last serial in GdkWaylandDisplay
This is not used anymore, so we can drop the serial being stored
here.
2022-07-18 15:21:40 +02:00
Matthias Clasen
0cebf6d9c5 Merge branch 'drop-target-unique' into 'main'
droptarget: Provide a unique action for gdk_drop_finish

Closes #5051

See merge request GNOME/gtk!4888
2022-07-18 12:38:52 +00:00
Matthias Clasen
de6b8da6c4 Merge branch 'tree-popover-scroll' into 'main'
treepopover: Add support for scrolling

Closes #3674 and #4877

See merge request GNOME/gtk!4887
2022-07-18 12:28:34 +00:00
Matthias Clasen
03f24bb5cf css: Improve test coverage
Among other things, this includes a test for the fix
in the previous commit.
2022-07-18 07:08:01 -05:00
Matthias Clasen
6ef3968227 css: Fix handling of transform values
When computing a transform value, there is nothing
to do, but we still need to copy the matrix from
src to dest, since it depends on the other transforms
in the array whether we are using the src or the
dest in the end.

This fixes cases like
-gtk-icon-transform: perspective(100px) matrix(1,2,...);
which would otherwise end up with a zero matrix.
2022-07-18 07:08:01 -05:00
Matthias Clasen
eb1a2268bb gtk: Improve test coverage 2022-07-18 07:08:01 -05:00
Matthias Clasen
64193ae706 sortlistmodel: Add more tests 2022-07-18 07:08:01 -05:00
Matthias Clasen
4682eb214a filterlistmodel: Add more tests 2022-07-18 07:08:01 -05:00
Carlos Garnacho
5a34b7ecc6 gdk/wayland: Use last press serial for clipboard/primary selections
This serial observes key and button presses, we can use that instead
of relying on the last serial which might come from other
events/devices.
2022-07-18 13:01:27 +02:00
Carlos Garnacho
eb0b98d5f2 gdk/wayland: Use last implicit grab serial for DnD start requests
This serial should be that from a button press/touch down/etc, use
the last implicit grab here, which will presumably be from the same
device that triggered the event.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5048
2022-07-18 13:00:32 +02:00
Mat
89db59a40d treepopover: Add support for scrolling
Add support for scrolling large tree popovers in a similar fashion to GtkPopoverMenu.

Fixes #3674
Fixes #4877
2022-07-18 00:44:28 +03:00
Mat
9209fd65a5 droptarget: Provide a unique action for gdk_drop_finish
gdk_drop_finish() requires a unique drop action. Reuse the existing
make_action_unique() function to get one.

Fixes #5051
2022-07-17 22:59:59 +03:00
Quentin PAGÈS
7dd874cec8 Update Occitan translation 2022-07-17 15:38:50 +00:00
Emmanuele Bassi
4a5d15535e Merge branch 'picture-suggest-content-fit' into 'main'
picture: Remove keep-aspect-ratio mention in the doc

See merge request GNOME/gtk!4886
2022-07-17 15:00:19 +00:00
Mat
c9a48736d6 treeview: Check for column header area in row click/drag gestures
Bail out if a row click/drag gesture is performed in the column header area,
since separate gestures handle column headers.

Fixes #4453
2022-07-17 17:36:38 +03:00
Marco Melorio
8376f5c9fa picture: Remove keep-aspect-ratio mention in the doc
We were still suggesting to use it in the main doc page. Suggest using
content-fit instead.
2022-07-17 16:21:53 +02:00
Matthias Clasen
1d94c75a78 Merge branch 'matthiasc/for-main' into 'main'
filterlistmodel: Add a test

See merge request GNOME/gtk!4884
2022-07-17 10:50:22 +00:00
Matthias Clasen
d840e082e6 slicelistmodel: Improve a test
Make sure that replacements in the underlying model
don't affect the slice list model if they are outside
the slice window.
2022-07-17 06:32:15 -04:00
Matthias Clasen
2ed954d307 sortlistmodel: Add a test
Add  a test to prove that additions and removals
in the underlying model show up as expected.
2022-07-17 06:22:55 -04:00
Matthias Clasen
7b815768e0 filterlistmodel: Add a test
Test that items added in the underlying model show
up in the filter model (if they pass the filter).

Test removals as well.

See #5050
2022-07-17 06:22:31 -04:00
Mat
d89297b152 tree/iconview: Use a unique drag action in drag_enter/motion callbacks
Functions already exist for providing a unique drag action for gdk_drop_finish().
Reuse these functions in the drag_enter/motion callbacks, since they require
a unique action as the return value.

Fixes #3187
2022-07-17 06:09:53 +03:00
Matthias Clasen
ff038428d8 Merge branch 'matthiasc/for-main' into 'main'
widget-factory: Make the icon work uninstalled

See merge request GNOME/gtk!4881
2022-07-17 01:33:09 +00:00
Matthias Clasen
7321eb881a widget-factory: Make the icon work uninstalled
Include the app logo as a resource, so we can show
it even when uninstalled.
2022-07-16 21:16:40 -04:00
Matthias Clasen
648e423cc5 Merge branch 'fix-wrong-label-wrap-in-popover' into 'main'
popover: Correctly substract arrow height when measuring popover widget

See merge request GNOME/gtk!4880
2022-07-16 23:19:10 +00:00
Benjamin Otte
09da4db81f Merge branch 'dnd' into 'main'
DnD Fix Preferred Action for X11

Closes #4259

See merge request GNOME/gtk!4785
2022-07-16 21:37:15 +00:00
Corey Berla
16fd2608fd gdkdrop-x11: Use the preferred action if possible
The XDND suggested action is a relic from when the source would control
the action for a drop.  With the new GtkDropTarget the target decides
the action (not the source).  That means the all of the returned
results from the ::enter and ::motion handlers will be unexpectely
ignored. Prefer to use the preferred action over the x11 suggested action.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/4259
2022-07-16 14:02:47 -07:00
Corey Berla
c9c48d78bf gdkdrop-x11: Fix preferred action
gdk_x11_drop_update_actions() sets actions to
drop_x11->suggested_action when !drop_x11->xdnd_have_actions
and then sets it again to drop_x11->suggested_action if it is.
If xdnd_have_actions is true use xdnd_actions.
2022-07-16 13:42:58 -07:00
Yubao Liu
50a8cbc0da popover: Correctly substract arrow height when measuring popover widget
For default popover arrow position and default height-for-width layout mode,
natural_width is calculated first with for_size=-1 and orientation=HORIZONTAL,
at the end of gtk_popover_measure() natural_width  won't be added with tail_height.

Then to measure with for_size=natural_width and orientation=VERTICAL, obviously
for_size shouldn't be substract with tail_height.

The wrong logic will force content in popover gets less width and then text labels
in popover may get wrapped unnecessarily.
2022-07-17 00:29:42 +08:00
Benjamin Otte
188cb49b44 Merge branch 'content-fit-reftests' into 'main'
reftests: Add content-fit picture tests

See merge request GNOME/gtk!4879
2022-07-16 16:06:57 +00:00
Marco Melorio
6da65b25b6 reftests: Add content-fit picture tests 2022-07-16 17:53:13 +02:00
Matthias Clasen
405cfc8f1f Merge branch 'test-coverage' into 'main'
gtk-demo: Fix icon theme breakage

See merge request GNOME/gtk!4878
2022-07-16 14:08:37 +00:00
Matthias Clasen
9daf83a1da gtk-demo: Make the icon work uninstalled
Include the app logo as a resource, so we can show
it even when uninstalled.
2022-07-16 09:43:46 -04:00
Matthias Clasen
f7811f5dc3 gtk-demo: Add a winning sound to the puzzle
We should celebrate every win.
2022-07-16 09:43:46 -04:00
Matthias Clasen
25ec58be3c gtk-demo: Fix icon theme breakage
The starred emblem silently went away :(
2022-07-16 09:43:46 -04:00
Matthias Clasen
61a843e824 gdk: Improve test coverage 2022-07-16 09:43:46 -04:00
Matthias Clasen
14cb208ec2 png loader: gray can have alpha 2022-07-16 09:43:46 -04:00
Matthias Clasen
c642649311 gdk: Drop an unused function 2022-07-16 09:43:46 -04:00
Matthias Clasen
882c805b53 gdk: Improve test coverage 2022-07-16 09:43:46 -04:00
Benjamin Otte
9cc7dbe9c9 Merge branch 'content-fit-followup' into 'main'
GtkContentFit followups

See merge request GNOME/gtk!4877
2022-07-16 00:24:31 +00:00
Marco Melorio
3eac4ef5c9 picture: Move variable definition at the top 2022-07-16 01:40:08 +02:00
Marco Melorio
f1faa71d6d picture: Set overflow to be hidden
The new content-fit property was wrongly suggesting to manually set
widgets' overflow property, but that property is not really intended to
be set by external code. This commit removes those suggestions and
directly set picture's overflow to be hidden.
2022-07-16 01:40:01 +02:00
Marco Melorio
a08bc46936 picture: Fix replacement for deprecated methods 2022-07-16 01:18:07 +02:00
Matthias Clasen
c6a56b52dc Merge branch 'text-placeholder-visibility' into 'main'
text: Update placeholder visibility more

See merge request GNOME/gtk!4875
2022-07-15 23:00:16 +00:00
Matthias Clasen
63c61340ac Merge branch 'test-coverage' into 'main'
node-editor: Make the help more helpful

See merge request GNOME/gtk!4874
2022-07-15 22:34:02 +00:00
Matthias Clasen
09f99ffb27 Merge branch 'gtk-content-fit' into 'main'
picture: Add content-fit property

Closes #5027

See merge request GNOME/gtk!4873
2022-07-15 22:28:42 +00:00
Matthias Clasen
3cc3a73d97 Merge branch 'nick.richards-main-patch-67353' into 'main'
Improve style in GtkInscription documentation

See merge request GNOME/gtk!4876
2022-07-15 22:21:23 +00:00
Marco Melorio
d8a73cbd03 picture: Add content-fit property
It allows to specify the resize mode of the paintable inside the
GtkPicture allocation. This also deprecates the keep-aspect-ratio
property.

Fixes #5027.
2022-07-15 23:01:23 +02:00
nick richards
624f5ba0ec Improve style in GtkInscription documentation 2022-07-15 20:55:37 +00:00
Matthias Clasen
ac81ed3adb text: Update placeholder visibility more
When the text in the buffer changes, we should
update the placeholder visibility, since we might
have gone from empty to non-empty.
2022-07-15 16:47:02 -04:00
Matthias Clasen
5064a8eac0 gsk: Improve test coverage 2022-07-15 16:41:05 -04:00
Matthias Clasen
a4c6517d06 glshader: Add preconditions
Add preconditions to many of the glshader
uniform apis.
2022-07-15 15:47:11 -04:00
Matthias Clasen
7ebc5454f4 Drop an unused function 2022-07-15 15:47:11 -04:00
Matthias Clasen
35e6a2fdb8 node-editor: Sort help better
Move the gshader section where it belongs.
2022-07-15 15:46:06 -04:00
Matthias Clasen
69336fa5f1 node-editor: Make the help more helpful
I struggled to remember how newlines vs strings work in
this format, so put it in the docs.
2022-07-15 15:46:06 -04:00
Matthias Clasen
2cbb955e49 rendernodeparser: Cosmetics 2022-07-15 15:46:06 -04:00
Matthias Clasen
42042e6811 Add some tests for GtkNoSelection 2022-07-15 15:46:06 -04:00
Matthias Clasen
f8f669b895 Add some tests for the listlistmodel 2022-07-15 15:46:06 -04:00
Matthias Clasen
7743f35972 maplistmodel: Fix an oversight
This was meant to go into 678eb8ab76.
2022-07-14 19:52:54 -04:00
Matthias Clasen
db01233520 Merge branch 'fix-maplistmodel' into 'main'
maplistmodel: Fix items-changed emission

See merge request GNOME/gtk!4872
2022-07-14 23:48:27 +00:00
Matthias Clasen
fa1daf50a7 Add more maplistmodel tests
Add some tests for adding and removing items.
2022-07-14 17:04:02 -04:00
Matthias Clasen
678eb8ab76 maplistmodel: Fix items-changed emission
We were modifying the removed value before passing
it to the items-changed signal, so we always ended
up with removed == 0 in our signal emission, instead
of passing the original value on, as we should.

Pointed out in !4870
2022-07-14 16:53:09 -04:00
Matthias Clasen
c46b5ed646 Merge branch 'matthiasc/for-main' into 'main'
pango_font_description_to_css: Handle numeric weight

See merge request GNOME/gtk!4871
2022-07-14 20:46:37 +00:00
Matthias Clasen
f8945b6325 pango_font_description_to_css: Handle numeric weight
The PangoWeight enum agrees with the numeric values
we use here, so we can do this without a switch and
support numeric weight values at the same time.
2022-07-14 15:50:06 -04:00
Matthias Clasen
3c67f6a457 Merge branch 'add-back-pango-css' into 'main'
pango_font_description_to_css: Add extra-expanded

See merge request GNOME/gtk!4869
2022-07-14 11:43:04 +00:00
Maximiliano Sandoval R
9868143696 pango_font_description_to_css: Add extra-expanded 2022-07-14 12:55:55 +02:00
Matthias Clasen
b51eb4bd72 Merge branch 'coreyberla-main-patch-84997' into 'main'
ci: Remove print-backends build option

See merge request GNOME/gtk!4866
2022-07-13 23:44:53 +00:00
Matthias Clasen
62619a9777 Merge branch 'ebassi/childless-stack-page' into 'main'
stack: Assert that StackPage:child is set

See merge request GNOME/gtk!4201
2022-07-13 21:11:58 +00:00
Corey Berla
d37ccbffa3 ci: Remove print-backends build option
Flatpak CI is failing because of unknown option "print-backends".
print-backends was renamed to print in c4d350c260
and subsequently was removed in a4aa6d79ad
(replaced by print-cups and print-cloudprint as auto options)
2022-07-13 14:21:12 +00:00
Matthias Clasen
b3ecc40cf1 testsuite: Fix up a few test for GtkStackPage changes
GtkStackPage objects can no longer be freely created.
Update our generic object tests to take that into
account.
2022-07-13 15:03:05 +01:00
Matthias Clasen
5b76d0c226 GtkStack: Create stack pages with child
We're requiring stack pages to have a child
at construction time now. Make it so!
2022-07-13 15:03:05 +01:00
Emmanuele Bassi
9eb6de403f stack: Assert that StackPage:child is set
Childless GtkStackPage instances are not allowed, otherwise everything
falls apart in random places.
2022-07-13 15:03:05 +01:00
Kukuh Syafaat
d104357d40 Update Indonesian translation 2022-07-13 12:58:18 +00:00
Matthias Clasen
775435c025 Merge branch 'check-button-s-ancestry' into 'main'
print: Check button is not descendant of toggle button

See merge request GNOME/gtk!4864
2022-07-13 11:20:57 +00:00
Marek Kasik
e204910730 print: Check button is not descendant of toggle button
GtkCheckButton is not derived from GtkToggleButton anymore.
This caused some issues in GtkPrinterOptionWidget which
did not port handling of the button.
2022-07-12 16:22:59 +02:00
Nate Eldredge
5faa300c5e Recognize "stylus" devices as GDK_SOURCE_PEN
Add "stylus" to the list of substrings in a device name that cause it to be recognized
as a GDK_SOURCE_PEN device (previously "wacom", "pen" and "eraser").  Some devices
just use "stylus" in their name, and are otherwise recognized as
GDK_SOURCE_TOUCHSCREEN instead.

Fixes #4394.
2022-05-29 15:30:19 -06:00
Corey Berla
7df347d9a5 places: Align popover menu with mouse position
The popover menu previously always pops up in the center of each
row regardless of where the mouse cursor is currently positioned.

Make the popover popup at the current mouse position. If the popover
is triggered by the keyboard (i.e. SHIFT+F10), then align it with the
start of the row.
2022-05-07 18:50:59 +01:00
Corey Berla
7ed8a6ae3c places: Fix crash when right clicking row
After right clicking multiple rows, or after adding / removing rows
(i.e. new network locations), right clicking the row will crash
nautilus.

This happens because the popover may become orphan but still expect
a parent.

Reposition the popover menu instead of reparenting it.
2022-05-07 18:45:17 +01:00
Corey Berla
ff84b96480 places: Fix crash when disconnecting
After disconnecting a network mount in places (when there's 2 or more
mounts), right clicking another mount crashes the application.
Set row_for_action to NULL when successfully unmounted.
2022-05-07 18:22:15 +01:00
António Fernandes
64347f2c79 placessidebar: Point to row instead or reparenting popovers
In GTK 3 we used to move the popovers around using set_relative_to();
this is gone in GTK 4 and the apparent direct replacement is setting
the target widget as the new parent.

But this requires a lot of careful handling least the popover become
orphan, which gets us ready to crash at any moment.

Since we only care about positioning the popovers relative to a row,
let's use the set_pointing_to() instead of reparenting. Now, the
sidebar is always the parent.
2022-05-07 18:10:44 +01:00
Luca Bacci
1af7cde1a8 Propagate key events when the location entry is focused
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/4880
2022-04-29 16:53:02 +02:00
Lukáš Tyrychtr
4ab9592924 Use the correct macro 2022-04-25 14:21:40 +02:00
Lukáš Tyrychtr
6f01d458d5 Localize the a11y label 2022-04-22 11:42:32 +02:00
Lukáš Tyrychtr
6f9013297a Make the presentation of the stack sidebar listbox nicer for A11Y
This fixes #4577.
2022-04-21 17:55:39 +02:00
1239 changed files with 90536 additions and 65648 deletions

View File

@@ -4,6 +4,7 @@ AlwaysBreakAfterDefinitionReturnType: All
BreakBeforeBinaryOperators: None
BinPackParameters: false
SpaceAfterCStyleCast: true
PointerAlignment: Right
# Our column limit is actually 80, but setting that results in clang-format
# making a lot of dubious hanging-indent choices; disable it and assume the
# developer will line wrap appropriately. clang-format will still check

View File

@@ -3,6 +3,7 @@ include:
file: 'flatpak/flatpak_ci_initiative.yml'
stages:
- check
- build
- analysis
- docs
@@ -21,12 +22,12 @@ stages:
# Common variables
variables:
COMMON_MESON_FLAGS: "-Dwerror=true -Dglib:werror=false -Dpango:werror=false -Dgtk-doc:werror=false -Dwayland-protocols:werror=false -Dsysprof:werror=false"
COMMON_MESON_FLAGS: "-Dwerror=true -Dglib:werror=false -Dpango:werror=false -Dgtk-doc:werror=false -Dwayland-protocols:werror=false -Dsysprof:werror=false -Dwayland:werror=false"
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:v38"
FLATPAK_IMAGE: "registry.gitlab.gnome.org/gnome/gnome-runtime-images/gnome:master"
FLATPAK_IMAGE: "quay.io/gnome_infrastructure/gnome-runtime-images:gnome-master"
.only-default:
only:
@@ -37,7 +38,7 @@ variables:
style-check-diff:
extends: .only-default
image: $FEDORA_IMAGE
stage: .pre
stage: check
allow_failure: true
script:
- .gitlab-ci/run-style-check-diff.sh
@@ -50,8 +51,11 @@ style-check-diff:
reports:
junit:
- "${CI_PROJECT_DIR}/_build/report-x11.xml"
- "${CI_PROJECT_DIR}/_build/report-x11_unstable.xml"
- "${CI_PROJECT_DIR}/_build/report-wayland.xml"
- "${CI_PROJECT_DIR}/_build/report-wayland_unstable.xml"
- "${CI_PROJECT_DIR}/_build/report-broadway.xml"
- "${CI_PROJECT_DIR}/_build/report-broadway_unstable.xml"
name: "gtk-${CI_COMMIT_REF_NAME}"
paths:
- "${CI_PROJECT_DIR}/_build/meson-logs"
@@ -109,6 +113,29 @@ release-build:
- ninja -C _build
- .gitlab-ci/run-tests.sh _build x11
fedora-mingw64:
extends: .build-fedora-default
stage: build
needs: []
before_script:
- sudo dnf install -y
mingw64-filesystem
mingw64-gcc
mingw64-binutils
mingw64-cairo
mingw64-gdk-pixbuf
mingw64-gstreamer1-plugins-bad-free
mingw64-glib2
mingw64-libepoxy
mingw64-pango
# mingw64-graphene (rawhide)
script:
- .gitlab-ci/show-info-linux.sh
- meson subprojects update
- mkdir _build && cd _build
- mingw64-meson -Dintrospection=disabled -Dgraphene:introspection=disabled
- ninja
installed-tests:
extends: .build-fedora-default
stage: build
@@ -185,6 +212,7 @@ macos:
-Dintrospection=disabled
-Dcpp_std=c++11
-Dpixman:tests=disabled
-Dlibjpeg-turbo:simd=disabled
_build
- ninja -C _build
artifacts:
@@ -269,6 +297,18 @@ flatpak-main:icon-browser:
variables:
APPID: org.gtk.IconBrowser4
flatpak-manual:node-editor:
extends: .flatpak-manual
needs: []
variables:
APPID: org.gtk.gtk4.NodeEditor
flatpak-main:node-editor:
extends: .flatpak-main
needs: []
variables:
APPID: org.gtk.gtk4.NodeEditor
# Publish the demo apps to the GNOME Nightly repo
# https://wiki.gnome.org/Apps/Nightly
# https://gitlab.gnome.org/GNOME/Initiatives/-/wikis/DevOps-with-Flatpak
@@ -287,6 +327,11 @@ nightly icon-browser:
dependencies: ['flatpak-main:icon-browser']
needs: ['flatpak-main:icon-browser']
nightly node-editor:
extends: '.publish_nightly'
dependencies: ['flatpak-main:node-editor']
needs: ['flatpak-main:node-editor']
static-scan:
image: $FEDORA_IMAGE
stage: analysis

View File

@@ -16,10 +16,9 @@ flatpak-builder \
flatpak build ${builddir} meson \
--prefix=/app \
--libdir=/app/lib \
--buildtype=release \
--buildtype=debugoptimized \
-Dx11-backend=true \
-Dwayland-backend=true \
-Dprint-backends=file \
-Dbuild-tests=false \
-Dbuild-examples=false \
-Dintrospection=disabled \

View File

@@ -2,25 +2,43 @@
set -e
# 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}..."
ancestor_horizon=31 # days (one month)
# Recently, git is picky about directory ownership. Tell it not to worry.
git config --global --add safe.directory "$PWD"
# We need to add a new remote for the upstream target branch, since this script
# could be running in a personal fork of the repository which has out of date
# branches.
#
# Limit the fetch to a certain date horizon to limit the amount of data we get.
# If the branch was forked from origin/main before this horizon, it should
# probably be rebased.
if ! git ls-remote --exit-code upstream >/dev/null 2>&1 ; then
git remote add upstream https://gitlab.gnome.org/GNOME/gtk.git
git fetch upstream
ORIGIN="upstream"
else
echo "Reusing the existing repository on ${CI_PROJECT_NAMESPACE}/${CI_PROJECT_NAME}"
ORIGIN="origin"
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/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.
newest_common_ancestor_sha=$(diff --old-line-format='' --new-line-format='' <(git rev-list --first-parent "${ORIGIN}/${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-${CI_DEFAULT_BRANCH}}") <(git rev-list --first-parent HEAD) | head -1)
# `upstream/main` or `upstream/glib-2-62`).
# `${CI_MERGE_REQUEST_TARGET_BRANCH_NAME}` or `${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME}`
# are only defined if were running in a merge request pipeline,
# fall back to `${CI_DEFAULT_BRANCH}` or `${CI_COMMIT_BRANCH}` respectively
# otherwise.
source_branch="${CI_MERGE_REQUEST_SOURCE_BRANCH_NAME:-${CI_COMMIT_BRANCH}}"
target_branch="${CI_MERGE_REQUEST_TARGET_BRANCH_NAME:-${CI_DEFAULT_BRANCH}}"
git fetch --shallow-since="$(date --date="${ancestor_horizon} days ago" +%Y-%m-%d)" origin "${source_branch}"
git fetch --shallow-since="$(date --date="${ancestor_horizon} days ago" +%Y-%m-%d)" upstream "${target_branch}"
newest_common_ancestor_sha=$(git merge-base upstream/${target_branch} origin/${source_branch})
if [ -z "${newest_common_ancestor_sha}" ]; then
echo "Couldnt find common ancestor with upstream main branch. This typically"
echo "happens if you branched from main a long time ago. Please update"
echo "your clone, rebase, and re-push your branch."
exit 1
fi
git diff -U0 --no-color "${newest_common_ancestor_sha}" | .gitlab-ci/clang-format-diff.py -binary "clang-format" -p1
exit_status=$?
@@ -36,7 +54,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/main/docs/CODING-STYLE"
echo " https://gitlab.gnome.org/GNOME/gtk/blob/main/docs/CODING-STYLE.md"
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

@@ -19,11 +19,21 @@ case "${backend}" in
--print-errorlogs \
--setup=${backend} \
--suite=gtk \
--no-suite=failing \
--no-suite=flaky \
--no-suite=gsk-compare-broadway
# Store the exit code for the CI run, but always
# generate the reports
exit_code=$?
xvfb-run -a -s "-screen 0 1024x768x24 -noreset" \
meson test -C ${builddir} \
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
--print-errorlogs \
--setup=${backend}_unstable \
--suite=flaky \
--suite=failing || true
;;
wayland)
@@ -38,9 +48,18 @@ case "${backend}" in
--print-errorlogs \
--setup=${backend} \
--suite=gtk \
--no-suite=failing \
--no-suite=flaky \
--no-suite=gsk-compare-broadway
exit_code=$?
meson test -C ${builddir} \
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
--print-errorlogs \
--setup=${backend}_unstable \
--suite=flaky \
--suite=failing || true
kill ${compositor}
;;
@@ -56,9 +75,18 @@ case "${backend}" in
--print-errorlogs \
--setup=${backend} \
--suite=gtk \
--no-suite=failing \
--no-suite=flaky \
--no-suite=gsk-compare-broadway
exit_code=$?
meson test -C ${builddir} \
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
--print-errorlogs \
--setup=${backend}_unstable \
--suite=flaky \
--suite=failing || true
kill ${compositor}
;;
@@ -74,10 +102,20 @@ case "${backend}" in
--print-errorlogs \
--setup=${backend} \
--suite=gtk \
--no-suite=failing \
--no-suite=flaky \
--no-suite=gsk-compare-opengl
# don't let Broadway failures fail the run, for now
exit_code=0
meson test -C ${builddir} \
--timeout-multiplier "${MESON_TEST_TIMEOUT_MULTIPLIER}" \
--print-errorlogs \
--setup=${backend}_unstable \
--suite=flaky \
--suite=failing || true
kill ${server}
;;
@@ -90,18 +128,20 @@ esac
cd ${builddir}
$srcdir/.gitlab-ci/meson-junit-report.py \
--project-name=gtk \
--backend=${backend} \
--job-id="${CI_JOB_NAME}" \
--output=report-${backend}.xml \
meson-logs/testlog-${backend}.json
$srcdir/.gitlab-ci/meson-html-report.py \
--project-name=gtk \
--backend=${backend} \
--job-id="${CI_JOB_NAME}" \
--reftest-output-dir="testsuite/reftests/output/${backend}" \
--output=report-${backend}.html \
meson-logs/testlog-${backend}.json
for suffix in "" "_unstable"; do
$srcdir/.gitlab-ci/meson-junit-report.py \
--project-name=gtk \
--backend="${backend}${suffix}" \
--job-id="${CI_JOB_NAME}" \
--output="report-${backend}${suffix}.xml" \
"meson-logs/testlog-${backend}${suffix}.json"
$srcdir/.gitlab-ci/meson-html-report.py \
--project-name=gtk \
--backend="${backend}${suffix}" \
--job-id="${CI_JOB_NAME}" \
--reftest-output-dir="testsuite/reftests/output/${backend}${suffix}" \
--output="report-${backend}${suffix}.html" \
"meson-logs/testlog-${backend}${suffix}.json"
done
exit $exit_code

View File

@@ -38,25 +38,6 @@ mkdir -p _ccache
export CCACHE_BASEDIR="$(pwd)"
export CCACHE_DIR="${CCACHE_BASEDIR}/_ccache"
# https://gitlab.gnome.org/GNOME/gtk/-/issues/2243
# https://gitlab.gnome.org/GNOME/gtk/-/issues/3002
if ! pkg-config --atleast-version=2.66.0 glib-2.0; then
git clone https://gitlab.gnome.org/GNOME/glib.git _glib
meson setup _glib_build _glib
meson compile -C _glib_build
meson install -C _glib_build
fi
pkg-config --modversion glib-2.0
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
meson install -C _pango_build
fi
pkg-config --modversion pango
# Build
ccache --zero-stats
ccache --show-stats

248
NEWS
View File

@@ -1,3 +1,251 @@
Overview of Changes in 4.9.2, xx-xx-xxxx
========================================
Overview of Changes in 4.9.1, 31-10-2022
========================================
Note that deprecations are an early outlook at changes
that will appear in an eventual GTK 5 release, which is
still far away. We are introducing deprecations in 4.10
as a way to give users time to adapt, and to provide
feedback on our plans.
* GtkTreeView, GtkIconView, GtkComboBox and
auxiliary classes have been deprecated
* GtkEntryCompletion has been deprecated
* GtkStyleContext has been deprecated
* gtk_render_ and gtk_snapshot_render_ APIs
have been deprecated
* GtkAppChooser widgets have been deprecated
* GtkMessageDialog has been deprecated and
replaced by a new async dialog API
* GtkDialog has been deprecated
* GtkColorChooser, GtkFontChooser, GtkFileChooser
interfaces and their implementations have been
deprecated. A new family of async dialog APIs
has been introduced to replace them
* GtkColorDialog, GtkFontDialog, GtkFileDialog
and GtkAlertDialog are new dialog classes with
a consistent and well-bindable API
* GtkMountOperation:
- Fix the dialog to look reasonable
- Make it work under non-X11
* GtkStringSorter:
- Support different collation methods
* Accessibility:
- Introduce GtkAccessibleRange and implement it
* Debugging:
- Unify formatting for debug output
- Make make debug options available in
non-debug builds
* Increase the memory limit for the jpeg loader to 1G
* Translation updates:
Abkhazian
Basque
Bulgarian
Croatian
Friulian
Georgian
German
Hungarian
Russian
Turkish
Overview of Changes in 4.8.1, 16-09-2022
========================================
* Input:
- Fix problems with input method interactions that caused
dead keys not to work
- Accept single-key compose sequences (these are used with
some keyboard layouts)
* GtkColumnView:
- Flip column order in right-to-left context
* GtkGridView:
- Fix problems with rubberbanding
* GtkFileChooser:
- Fix positioning of popovers in the places view
- Make ~ and . keyboard shortcuts work again
* gsk:
- Make glyph upload more similar to icons
* Make file transfer via portals work, this fixes file
copy/paste and dnd in flatpaks
* Translation updates:
Catalan
Chinese (China)
Chinese (Taiwan)
Latvian
Overview of Changes in 4.8.0, 06-09-2022
========================================
* GtkTreeView:
- Fix a problem with scrolling animations
- Fix some event handling problems
- Drop unreachable code
* GtkText:
- Respect the no-emoji input hint fully
* GtkEmojiChooser:
- Fix arrow key navigation
* GtkFontChooser:
- Improve the handling of OpenType font features
* GtkTreeListModel:
- Fix handling of collapsed child nodes
* GtkInscription:
- Fix accessible name
* Theme:
- Fix placeholder text in HighContrast
* Increase the memory limit for the jpeg loader to 300M
* Miscellaneous memory leak fixes
* Wayland:
- Refator handling of text protocol client updates
* Windows:
- Support high-resolution scroll wheel events
- Generate GdkWin32.gir
- Implement color picking
* Translation updates
Abkhazian
Basque
Brazilian Portuguese
Bulgarian
Catalan
Chinese (China)
Croatian
Czech
Danish
Dutch
Galician
Georgian
German
Hungarian
Icelandic
Indonesian
Korean
Latvian
Lithuanian
Persian
Polish
Portuguese
Russian
Serbian
Spanish
Swedish
Turkish
Ukrainian
Overview of Changes in 4.7.2, 10-08-2022
========================================
* GtkTextView:
- Fix child positioning with gutters
* GtkText:
- Update placeholder visibility when necessary
* GtkPicture:
- Add a content-fit property
* GtkPopover:
- Fix a size allocation problem with the arrow
* GtkTreeView:
- Fix a problem with DND
* GtkTreePopover:
- Support scrolling
* GtkGridView:
- Fix issues with rubberband selection
* GtkLabel:
- Add a tabs property
* GtkSnapshot:
- Make GtkSnapshot work from bindings
* GtkScrolledWindow:
- Scroll at a reasonable speed
* GtkPaned:
- Avoid an infinite loop
* GtkWindow:
- Improve generation and handling of crossing events
* CSS:
- Fix handling of certain transform values
* Media support:
- Add audio support to the ffmpeg backend
- Avoid oom with pathological jpeg images
* GDK:
- Fix handling of touchpad hold events
- Add support for hi-resolution scroll events
* X11:
- Fix preferred action for DND
* Windows:
- Fix DND
* List models:
- Fix items-changed emission
- Add more list model tests
* Demos:
- Add a winning sound to game demos
- Make app icons work uninstalled
* Translation updates:
Abkhazian
Basque
Catalan
Georgian
German
Indonesian
Occitan
Persian
Portuguese
Russian
Spanish
Ukrainian
Overview of Changes in 4.7.1, 12-07-2022
========================================

View File

@@ -0,0 +1,138 @@
{
"app-id" : "org.gtk.gtk4.NodeEditor",
"runtime" : "org.gnome.Platform",
"runtime-version" : "master",
"sdk" : "org.gnome.Sdk",
"command" : "gtk4-node-editor",
"tags" : [
"devel",
"development",
"nightly"
],
"desktop-file-name-prefix" : "(Development) ",
"finish-args" : [
"--device=dri",
"--share=ipc",
"--socket=fallback-x11",
"--socket=wayland",
"--talk-name=org.gtk.vfs",
"--talk-name=org.gtk.vfs.*"
],
"cleanup" : [
"/include",
"/lib/pkgconfig",
"/share/pkgconfig",
"/share/aclocal",
"/man",
"/share/man",
"/share/gtk-doc",
"*.la",
".a",
"/lib/girepository-1.0",
"/share/gir-1.0",
"/share/doc"
],
"modules" : [
{
"name" : "wayland",
"buildsystem" : "meson",
"builddir" : true,
"config-opts" : [
"-Ddocumentation=false"
],
"sources" : [
{
"type" : "git",
"url" : "https://gitlab.freedesktop.org/wayland/wayland.git",
"branch" : "main"
}
]
},
{
"name" : "graphene",
"buildsystem" : "meson",
"builddir" : true,
"config-opts" : [
"--libdir=/app/lib",
"-Dtests=false"
],
"sources" : [
{
"type" : "git",
"url" : "https://github.com/ebassi/graphene.git"
}
]
},
{
"name" : "libsass",
"buildsystem" : "meson",
"builddir" : true,
"config-opts" : [
"--libdir=/app/lib"
],
"sources" : [
{
"type" : "git",
"url" : "https://github.com/lazka/libsass.git",
"branch" : "meson"
}
]
},
{
"name" : "sassc",
"buildsystem" : "meson",
"builddir" : true,
"config-opts" : [
"--libdir=/app/lib"
],
"sources" : [
{
"type" : "git",
"url" : "https://github.com/lazka/sassc.git",
"branch" : "meson"
}
]
},
{
"name" : "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",
"builddir" : true,
"config-opts" : [
"--libdir=/app/lib",
"-Dvulkan=disabled",
"-Dbuildtype=debugoptimized",
"-Dprofile=devel"
],
"sources" : [
{
"type" : "git",
"url" : "https://gitlab.gnome.org/GNOME/gtk.git",
"branch" : "main"
}
]
}
],
"build-options" : {
"env" : {
"DBUS_SESSION_BUS_ADDRESS" : "''",
"GSK_RENDERER" : "opengl",
"GDK_DEBUG" : "vulkan-disable",
"G_ENABLE_DEBUG" : "true"
}
}
}

View File

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

View File

@@ -202,43 +202,36 @@ constraint_editor_window_load (ConstraintEditorWindow *self,
}
static void
open_response_cb (GtkNativeDialog *dialog,
int response,
ConstraintEditorWindow *self)
open_response_cb (GObject *source,
GAsyncResult *result,
void *user_data)
{
gtk_native_dialog_hide (dialog);
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
ConstraintEditorWindow *self = user_data;
GFile *file;
if (response == GTK_RESPONSE_ACCEPT)
file = gtk_file_dialog_open_finish (dialog, result, NULL);
if (file)
{
GFile *file;
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
constraint_editor_window_load (self, file);
g_object_unref (file);
}
gtk_native_dialog_destroy (dialog);
}
static void
open_cb (GtkWidget *button,
ConstraintEditorWindow *self)
{
GtkFileChooserNative *dialog;
GtkFileDialog *dialog;
GFile *cwd;
dialog = gtk_file_chooser_native_new ("Open file",
GTK_WINDOW (self),
GTK_FILE_CHOOSER_ACTION_OPEN,
"_Load",
"_Cancel");
gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (dialog), TRUE);
GFile *cwd = g_file_new_for_path (".");
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), cwd, NULL);
dialog = gtk_file_dialog_new ();
gtk_file_dialog_set_title (dialog, "Open file");
cwd = g_file_new_for_path (".");
gtk_file_dialog_set_current_folder (dialog, cwd);
g_object_unref (cwd);
g_signal_connect (dialog, "response", G_CALLBACK (open_response_cb), self);
gtk_native_dialog_show (GTK_NATIVE_DIALOG (dialog));
gtk_file_dialog_open (dialog, GTK_WINDOW (self), NULL, NULL, open_response_cb, self);
g_object_unref (dialog);
}
static void
@@ -294,22 +287,23 @@ serialize_model (GListModel *list)
static void
save_response_cb (GtkNativeDialog *dialog,
int response,
ConstraintEditorWindow *self)
save_response_cb (GObject *source,
GAsyncResult *result,
void *user_data)
{
gtk_native_dialog_hide (dialog);
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
ConstraintEditorWindow *self = user_data;
GFile *file;
if (response == GTK_RESPONSE_ACCEPT)
file = gtk_file_dialog_save_finish (dialog, result, NULL);
if (file)
{
GListModel *model;
GFile *file;
char *text;
GError *error = NULL;
model = constraint_view_get_model (CONSTRAINT_VIEW (self->view));
text = serialize_model (model);
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
g_file_replace_contents (file, text, strlen (text),
NULL, FALSE,
G_FILE_CREATE_NONE,
@@ -318,46 +312,39 @@ save_response_cb (GtkNativeDialog *dialog,
&error);
if (error != NULL)
{
GtkWidget *message_dialog;
GtkAlertDialog *alert;
message_dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (self))),
GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_OK,
"Saving failed");
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (message_dialog),
"%s", error->message);
g_signal_connect (message_dialog, "response", G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (message_dialog);
alert = gtk_alert_dialog_new ("Saving failed");
gtk_alert_dialog_set_detail (alert, error->message);
gtk_alert_dialog_show (alert,
GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (self))));
g_object_unref (alert);
g_error_free (error);
}
g_free (text);
g_object_unref (file);
}
gtk_native_dialog_destroy (dialog);
}
static void
save_cb (GtkWidget *button,
ConstraintEditorWindow *self)
{
GtkFileChooserNative *dialog;
GtkFileDialog *dialog;
GFile *cwd;
dialog = gtk_file_chooser_native_new ("Save constraints",
GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (button))),
GTK_FILE_CHOOSER_ACTION_SAVE,
"_Save",
"_Cancel");
gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (dialog), TRUE);
GFile *cwd = g_file_new_for_path (".");
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog), cwd, NULL);
dialog = gtk_file_dialog_new ();
gtk_file_dialog_set_title (dialog, "Save constraints");
cwd = g_file_new_for_path (".");
gtk_file_dialog_set_current_folder (dialog, cwd);
g_object_unref (cwd);
g_signal_connect (dialog, "response", G_CALLBACK (save_response_cb), self);
gtk_native_dialog_show (GTK_NATIVE_DIALOG (dialog));
gtk_file_dialog_save (dialog,
GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (button))),
NULL, NULL,
NULL,
save_response_cb, self);
g_object_unref (dialog);
}
static void
@@ -440,7 +427,7 @@ edit_constraint (ConstraintEditorWindow *win,
g_signal_connect (editor, "done", G_CALLBACK (constraint_editor_done), win);
gtk_widget_show (window);
gtk_window_present (GTK_WINDOW (window));
}
static void
@@ -473,7 +460,7 @@ edit_guide (ConstraintEditorWindow *win,
gtk_window_set_child (GTK_WINDOW (window), GTK_WIDGET (editor));
g_signal_connect (editor, "done", G_CALLBACK (guide_editor_done), win);
gtk_widget_show (window);
gtk_window_present (GTK_WINDOW (window));
}
static void

View File

@@ -21,6 +21,8 @@
#include "constraint-editor.h"
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
struct _ConstraintEditor
{
GtkWidget parent_instance;

View File

@@ -21,6 +21,8 @@
#include "guide-editor.h"
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
struct _GuideEditor
{
GtkWidget parent_instance;

View File

@@ -33,22 +33,12 @@ static void create_window (GApplication *app, const char *contents);
static void
show_action_dialog (GSimpleAction *action)
{
const char *name;
GtkWidget *dialog;
GtkAlertDialog *dialog;
name = g_action_get_name (G_ACTION (action));
dialog = gtk_message_dialog_new (NULL,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_CLOSE,
"You activated action: \"%s\"",
name);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (dialog);
dialog = gtk_alert_dialog_new ("You activated action: \"%s\n",
g_action_get_name (G_ACTION (action)));
gtk_alert_dialog_show (dialog, NULL);
g_object_unref (dialog);
}
static void
@@ -67,7 +57,7 @@ show_action_infobar (GSimpleAction *action,
text = g_strdup_printf ("You activated radio action: \"%s\".\n"
"Current value: %s", name, value);
gtk_label_set_text (GTK_LABEL (window->message), text);
gtk_widget_show (window->infobar);
gtk_widget_set_visible (window->infobar, TRUE);
g_free (text);
}
@@ -90,43 +80,38 @@ activate_new (GSimpleAction *action,
}
static void
open_response_cb (GtkNativeDialog *dialog,
int response_id,
gpointer user_data)
open_response_cb (GObject *source,
GAsyncResult *result,
gpointer user_data)
{
GtkFileChooserNative *native = user_data;
GApplication *app = g_object_get_data (G_OBJECT (native), "app");
GtkWidget *message_dialog;
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
GApplication *app = G_APPLICATION (user_data);
GFile *file;
char *contents;
GError *error = NULL;
if (response_id == GTK_RESPONSE_ACCEPT)
file = gtk_file_dialog_open_finish (dialog, result, &error);
if (file)
{
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (native));
char *contents;
if (g_file_load_contents (file, NULL, &contents, NULL, NULL, &error))
{
create_window (app, contents);
g_free (contents);
}
else
{
message_dialog = gtk_message_dialog_new (NULL,
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Error loading file: \"%s\"",
error->message);
g_signal_connect (message_dialog, "response",
G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (message_dialog);
g_error_free (error);
}
}
gtk_native_dialog_destroy (GTK_NATIVE_DIALOG (native));
g_object_unref (native);
if (error)
{
GtkAlertDialog *alert;
alert = gtk_alert_dialog_new ("Error loading file: \"%s\"", error->message);
gtk_alert_dialog_show (alert, NULL);
g_object_unref (alert);
g_error_free (error);
}
g_object_unref (app);
}
@@ -136,21 +121,11 @@ activate_open (GSimpleAction *action,
gpointer user_data)
{
GApplication *app = user_data;
GtkFileChooserNative *native;
GtkFileDialog *dialog;
native = gtk_file_chooser_native_new ("Open File",
NULL,
GTK_FILE_CHOOSER_ACTION_OPEN,
"_Open",
"_Cancel");
g_object_set_data_full (G_OBJECT (native), "app", g_object_ref (app), g_object_unref);
g_signal_connect (native,
"response",
G_CALLBACK (open_response_cb),
native);
gtk_native_dialog_show (GTK_NATIVE_DIALOG (native));
dialog = gtk_file_dialog_new ();
gtk_file_dialog_open (dialog, NULL, NULL, NULL, open_response_cb, g_object_ref (app));
g_object_unref (dialog);
}
static void
@@ -320,7 +295,7 @@ static GActionEntry win_entries[] = {
static void
clicked_cb (GtkWidget *widget, DemoApplicationWindow *window)
{
gtk_widget_hide (window->infobar);
gtk_widget_set_visible (window->infobar, FALSE);
}
static void

View File

@@ -140,7 +140,6 @@ create_page3 (GtkWidget *assistant)
label = gtk_label_new ("This is a confirmation page, press 'Apply' to apply changes");
gtk_widget_show (label);
gtk_assistant_append_page (GTK_ASSISTANT (assistant), label);
gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), label, GTK_ASSISTANT_PAGE_CONFIRM);
gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), label, TRUE);
@@ -157,7 +156,6 @@ create_page4 (GtkWidget *assistant)
gtk_widget_set_margin_start (progress_bar, 40);
gtk_widget_set_margin_end (progress_bar, 40);
gtk_widget_show (progress_bar);
gtk_assistant_append_page (GTK_ASSISTANT (assistant), progress_bar);
gtk_assistant_set_page_type (GTK_ASSISTANT (assistant), progress_bar, GTK_ASSISTANT_PAGE_PROGRESS);
gtk_assistant_set_page_title (GTK_ASSISTANT (assistant), progress_bar, "Applying changes");
@@ -199,7 +197,7 @@ do_assistant (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (assistant))
gtk_widget_show (assistant);
gtk_widget_set_visible (assistant, TRUE);
else
gtk_window_destroy (GTK_WINDOW (assistant));

View File

@@ -168,7 +168,7 @@ do_builder (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -1,4 +1,5 @@
/* Clipboard
* #Keywords: drag-and-drop, dnd
*
* GdkClipboard is used for clipboard handling. This demo shows how to
* copy and paste text, images, colors or files to and from the clipboard.
@@ -50,10 +51,10 @@ copy_button_clicked (GtkStack *source_stack,
}
else if (strcmp (visible_child_name, "Color") == 0)
{
GdkRGBA color;
const GdkRGBA *color;
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (visible_child), &color);
gdk_clipboard_set (clipboard, GDK_TYPE_RGBA, &color);
color = gtk_color_dialog_button_get_rgba (GTK_COLOR_DIALOG_BUTTON (visible_child));
gdk_clipboard_set (clipboard, GDK_TYPE_RGBA, color);
}
else if (strcmp (visible_child_name, "File") == 0)
{
@@ -215,39 +216,70 @@ file_button_set_file (GtkButton *button,
}
static void
file_chooser_response (GtkNativeDialog *dialog,
int response,
GtkButton *button)
file_chooser_response (GObject *source,
GAsyncResult *result,
gpointer user_data)
{
gtk_native_dialog_hide (dialog);
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
GtkButton *button = GTK_BUTTON (user_data);
GFile *file;
if (response == GTK_RESPONSE_ACCEPT)
file = gtk_file_dialog_open_finish (dialog, result, NULL);
if (file)
{
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;
GtkFileDialog *dialog;
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");
dialog = gtk_file_dialog_new ();
g_signal_connect (chooser, "response", G_CALLBACK (file_chooser_response), button);
gtk_native_dialog_show (GTK_NATIVE_DIALOG (chooser));
gtk_file_dialog_open (dialog,
GTK_WINDOW (gtk_widget_get_ancestor (button, GTK_TYPE_WINDOW)),
NULL,
NULL,
file_chooser_response, button);
}
static void
folder_chooser_response (GObject *source,
GAsyncResult *result,
gpointer user_data)
{
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
GtkButton *button = GTK_BUTTON (user_data);
GFile *file;
file = gtk_file_dialog_select_folder_finish (dialog, result, NULL);
if (file)
{
file_button_set_file (button, file);
g_object_unref (file);
update_copy_button_sensitivity (gtk_widget_get_ancestor (GTK_WIDGET (button), GTK_TYPE_STACK));
}
}
static void
open_folder_cb (GtkWidget *button)
{
GtkFileDialog *dialog;
dialog = gtk_file_dialog_new ();
gtk_file_dialog_select_folder (dialog,
GTK_WINDOW (gtk_widget_get_ancestor (button, GTK_TYPE_WINDOW)),
NULL,
NULL,
folder_chooser_response, button);
}
static void
update_paste_button_sensitivity (GdkClipboard *clipboard,
GtkWidget *paste_button)
@@ -346,6 +378,7 @@ do_clipboard (GtkWidget *do_widget)
gtk_builder_cscope_add_callback (scope, source_changed_cb);
gtk_builder_cscope_add_callback (scope, text_changed_cb);
gtk_builder_cscope_add_callback (scope, open_file_cb);
gtk_builder_cscope_add_callback (scope, open_folder_cb);
gtk_builder_cscope_add_callback (scope, on_drop);
gtk_builder_cscope_add_callback (scope, drag_prepare);
builder = gtk_builder_new ();
@@ -369,7 +402,7 @@ do_clipboard (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -32,6 +32,7 @@
<item>Color</item>
<item>Image</item>
<item>File</item>
<item>Folder</item>
</items>
</object>
</property>
@@ -64,7 +65,11 @@
<object class="GtkStackPage">
<property name="name">Color</property>
<property name="child">
<object class="GtkColorButton" id="source_color">
<object class="GtkColorDialogButton" id="source_color">
<property name="dialog">
<object class="GtkColorDialog">
</object>
</property>
<property name="valign">center</property>
<property name="rgba">purple</property>
</object>
@@ -162,6 +167,30 @@
</property>
</object>
</child>
<child>
<object class="GtkStackPage">
<property name="name">Folder</property>
<property name="child">
<object class="GtkButton" id="source_folder">
<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_folder_cb"/>
</object>
</property>
</object>
</child>
</object>
</child>
<child>

View File

@@ -11,6 +11,8 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
enum
{
ICON_NAME_COL,
@@ -447,7 +449,7 @@ do_combobox (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -277,7 +277,7 @@ do_constraints (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -66,7 +66,7 @@ do_constraints_builder (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -229,7 +229,7 @@ do_constraints_interactive (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -152,7 +152,7 @@ do_constraints_vfl (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -1,20 +1,16 @@
/* Theming/CSS Accordion
*
* A simple accordion demo written using CSS transitions and multiple backgrounds
*
*/
#include <gtk/gtk.h>
static void
apply_css (GtkWidget *widget, GtkStyleProvider *provider)
destroy_provider (GtkWidget *window,
GtkStyleProvider *provider)
{
GtkWidget *child;
gtk_style_context_add_provider (gtk_widget_get_style_context (widget), provider, G_MAXUINT);
for (child = gtk_widget_get_first_child (widget);
child != NULL;
child = gtk_widget_get_next_sibling (child))
apply_css (child, provider);
gtk_style_context_remove_provider_for_display (gtk_widget_get_display (window), provider);
}
GtkWidget *
@@ -24,8 +20,8 @@ do_css_accordion (GtkWidget *do_widget)
if (!window)
{
GtkWidget *container, *child;
GtkStyleProvider *provider;
GtkWidget *container, *styled_box, *child;
GtkCssProvider *provider;
window = gtk_window_new ();
gtk_window_set_title (GTK_WINDOW (window), "CSS Accordion");
@@ -33,10 +29,13 @@ do_css_accordion (GtkWidget *do_widget)
gtk_window_set_default_size (GTK_WINDOW (window), 600, 300);
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
styled_box = gtk_frame_new (NULL);
gtk_window_set_child (GTK_WINDOW (window), styled_box);
gtk_widget_add_css_class (styled_box, "accordion");
container = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_set_halign (container, GTK_ALIGN_CENTER);
gtk_widget_set_valign (container, GTK_ALIGN_CENTER);
gtk_window_set_child (GTK_WINDOW (window), container);
gtk_frame_set_child (GTK_FRAME (styled_box), container);
child = gtk_button_new_with_label ("This");
gtk_box_append (GTK_BOX (container), child);
@@ -56,14 +55,20 @@ do_css_accordion (GtkWidget *do_widget)
child = gtk_button_new_with_label (":-)");
gtk_box_append (GTK_BOX (container), child);
provider = GTK_STYLE_PROVIDER (gtk_css_provider_new ());
gtk_css_provider_load_from_resource (GTK_CSS_PROVIDER (provider), "/css_accordion/css_accordion.css");
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_resource (provider, "/css_accordion/css_accordion.css");
apply_css (window, provider);
gtk_style_context_add_provider_for_display (gtk_widget_get_display (window),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
g_signal_connect (window, "destroy",
G_CALLBACK (destroy_provider), provider);
g_object_unref (provider);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -1,13 +1,13 @@
@import url("resource://css_accordion/reset.css");
.accordion, .accordion * {
all: unset;
* {
transition-property: color, background-color, border-color, background-image, padding, border-width;
transition-duration: 1s;
font: 20px Cantarell;
}
window {
.accordion {
background: linear-gradient(153deg, #151515, #151515 5px, transparent 5px) 0 0,
linear-gradient(333deg, #151515, #151515 5px, transparent 5px) 10px 5px,
linear-gradient(153deg, #222, #222 5px, transparent 5px) 0 5px,
@@ -18,7 +18,7 @@ window {
background-size: 20px 20px;
}
button {
.accordion button {
color: black;
background-color: #bbb;
border-style: solid;
@@ -28,25 +28,25 @@ button {
padding: 12px 4px;
}
button:first-child {
.accordion button:first-child {
border-radius: 5px 0 0 5px;
}
button:last-child {
.accordion button:last-child {
border-radius: 0 5px 5px 0;
border-width: 2px;
}
button:hover {
.accordion button:hover {
padding: 12px 48px;
background-color: #4870bc;
}
button *:hover {
.accordion button *:hover {
color: white;
}
button:hover:active,
button:active {
.accordion button:hover:active,
.accordion button:active {
background-color: #993401;
}

View File

@@ -6,6 +6,8 @@
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static void
show_parsing_error (GtkCssProvider *provider,
GtkCssSection *section,
@@ -113,7 +115,7 @@ do_css_basics (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -139,7 +139,7 @@ do_css_blendmodes (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -6,6 +6,8 @@
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static void
show_parsing_error (GtkCssProvider *provider,
GtkCssSection *section,
@@ -153,7 +155,7 @@ do_css_multiplebgs (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -7,6 +7,8 @@
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static void
show_parsing_error (GtkCssProvider *provider,
GtkCssSection *section,
@@ -122,7 +124,7 @@ do_css_pixbufs (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -5,6 +5,8 @@
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static void
show_parsing_error (GtkCssProvider *provider,
GtkCssSection *section,
@@ -140,7 +142,7 @@ do_css_shadows (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -33,7 +33,7 @@ do_cursors (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -24,7 +24,6 @@
</gresource>
<gresource prefix="/css_accordion">
<file>css_accordion.css</file>
<file>reset.css</file>
</gresource>
<gresource prefix="/css_basics">
<file>css_basics.css</file>
@@ -428,6 +427,8 @@
<file>icons/16x16/emotes/face-laugh-symbolic.symbolic.png</file>
<file>icons/16x16/status/battery-caution-charging-symbolic.symbolic.png</file>
<file>icons/16x16/categories/applications-other.png</file>
<file>icons/48x48/status/starred.png</file>
<file alias="icons/scalable/apps/org.gtk.Demo4.svg">data/scalable/apps/org.gtk.Demo4.svg</file>
</gresource>
<gresource prefix="/org/gtk/Demo4/gtk">
<file preprocess="xml-stripblanks">help-overlay.ui</file>

View File

@@ -8,6 +8,8 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static GtkWidget *window = NULL;
static GtkWidget *entry1 = NULL;
static GtkWidget *entry2 = NULL;
@@ -27,7 +29,7 @@ message_dialog_clicked (GtkButton *button,
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
ngettext ("Has been shown once", "Has been shown %d times", i), i);
g_signal_connect (dialog, "response", G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (dialog);
gtk_window_present (GTK_WINDOW (dialog));
i++;
}
@@ -114,7 +116,7 @@ interactive_dialog_clicked (GtkButton *button,
data, (GClosureNotify) g_free,
0);
gtk_widget_show (dialog);
gtk_window_present (GTK_WINDOW (dialog));
}
GtkWidget *
@@ -184,7 +186,7 @@ do_dialog (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -11,6 +11,7 @@
#include <gtk/gtk.h>
G_DECLARE_FINAL_TYPE (CanvasItem, canvas_item, CANVAS, ITEM, GtkWidget)
struct _CanvasItem {
@@ -24,6 +25,9 @@ struct _CanvasItem {
double delta;
GtkWidget *editor;
GtkStyleProvider *provider;
char *css_class;
};
struct _CanvasItemClass {
@@ -34,32 +38,41 @@ G_DEFINE_TYPE (CanvasItem, canvas_item, GTK_TYPE_WIDGET)
static int n_items = 0;
static void
unstyle_item (CanvasItem *item)
{
if (item->provider)
{
gtk_style_context_remove_provider_for_display (gtk_widget_get_display (item->label), item->provider);
g_clear_object (&item->provider);
}
if (item->css_class)
{
gtk_widget_remove_css_class (item->label, item->css_class);
g_clear_pointer (&item->css_class, g_free);
}
}
static void
set_color (CanvasItem *item,
GdkRGBA *color)
{
char *css;
char *str;
GtkStyleContext *context;
GtkCssProvider *provider;
const char *old_class;
const char *name;
unstyle_item (item);
str = gdk_rgba_to_string (color);
css = g_strdup_printf ("* { background: %s; }", str);
context = gtk_widget_get_style_context (item->label);
provider = g_object_get_data (G_OBJECT (context), "style-provider");
if (provider)
gtk_style_context_remove_provider (context, GTK_STYLE_PROVIDER (provider));
old_class = (const char *)g_object_get_data (G_OBJECT (item->label), "css-class");
if (old_class)
gtk_widget_remove_css_class (item->label, old_class);
name = gtk_widget_get_name (item->label);
css = g_strdup_printf ("#%s { background: %s; }", name, str);
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider, css, -1);
gtk_style_context_add_provider (gtk_widget_get_style_context (item->label), GTK_STYLE_PROVIDER (provider), 800);
g_object_set_data_full (G_OBJECT (context), "style-provider", provider, g_object_unref);
gtk_style_context_add_provider_for_display (gtk_widget_get_display (item->label), GTK_STYLE_PROVIDER (provider), 700);
item->provider = GTK_STYLE_PROVIDER (provider);
g_free (str);
g_free (css);
@@ -69,21 +82,10 @@ static void
set_css (CanvasItem *item,
const char *class)
{
GtkStyleContext *context;
GtkCssProvider *provider;
const char *old_class;
unstyle_item (item);
context = gtk_widget_get_style_context (item->label);
provider = g_object_get_data (G_OBJECT (context), "style-provider");
if (provider)
gtk_style_context_remove_provider (context, GTK_STYLE_PROVIDER (provider));
old_class = (const char *)g_object_get_data (G_OBJECT (item->label), "css-class");
if (old_class)
gtk_widget_remove_css_class (item->label, old_class);
g_object_set_data_full (G_OBJECT (item->label), "css-class", g_strdup (class), g_free);
gtk_widget_add_css_class (item->label, class);
item->css_class = g_strdup (class);
}
static gboolean
@@ -722,8 +724,11 @@ do_dnd (GtkWidget *do_widget)
int i;
int x, y;
GtkCssProvider *provider;
GString *css;
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
button = gtk_color_button_new ();
G_GNUC_END_IGNORE_DEPRECATIONS
g_object_unref (g_object_ref_sink (button));
provider = gtk_css_provider_new ();
@@ -733,6 +738,18 @@ do_dnd (GtkWidget *do_widget)
800);
g_object_unref (provider);
css = g_string_new ("");
for (i = 0; colors[i]; i++)
g_string_append_printf (css, ".canvasitem.%s { background: %s; }\n", colors[i], colors[i]);
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider, css->str, css->len);
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (provider),
800);
g_object_unref (provider);
g_string_free (css, TRUE);
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window),
gtk_widget_get_display (do_widget));
@@ -785,7 +802,7 @@ do_dnd (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -372,7 +372,7 @@ do_drawingarea (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -164,14 +164,14 @@ strings_bind_item (GtkSignalListItemFactory *factory,
popup = gtk_widget_get_ancestor (title, GTK_TYPE_POPOVER);
if (popup && gtk_widget_is_ancestor (popup, GTK_WIDGET (dropdown)))
{
gtk_widget_show (checkmark);
gtk_widget_set_visible (checkmark, TRUE);
g_signal_connect (dropdown, "notify::selected-item",
G_CALLBACK (selected_item_changed), item);
selected_item_changed (dropdown, NULL, item);
}
else
{
gtk_widget_hide (checkmark);
gtk_widget_set_visible (checkmark, FALSE);
}
}
@@ -563,7 +563,7 @@ do_dropdown (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -14,6 +14,8 @@
#include <string.h>
#include <stdlib.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
typedef struct
{
int number;
@@ -407,7 +409,7 @@ do_editable_cells (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -8,6 +8,8 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
/* Creates a tree model containing the completions */
static GtkTreeModel *
create_completion_model (void)
@@ -113,7 +115,7 @@ do_entry_completion (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -46,7 +46,7 @@ do_entry_undo (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -42,12 +42,12 @@ mode_switch_state_set (GtkSwitch *sw,
if (!state ||
(gtk_range_get_value (GTK_RANGE (scale)) > 50))
{
gtk_widget_hide (label);
gtk_widget_set_visible (label, FALSE);
gtk_switch_set_state (sw, state);
}
else
{
gtk_widget_show (label);
gtk_widget_set_visible (label, TRUE);
}
return TRUE;
@@ -65,7 +65,7 @@ level_scale_value_changed (GtkRange *range,
!gtk_switch_get_state (GTK_SWITCH (sw)) &&
(gtk_range_get_value (range) > 50))
{
gtk_widget_hide (label);
gtk_widget_set_visible (label, FALSE);
gtk_switch_set_state (GTK_SWITCH (sw), TRUE);
}
else if (gtk_switch_get_state (GTK_SWITCH (sw)) &&
@@ -113,7 +113,7 @@ do_errorstates (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -10,6 +10,8 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static GtkWidget *window = NULL;
static void
@@ -120,7 +122,7 @@ do_expander (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -9,6 +9,8 @@
#include <gtk/gtk.h>
#include <stdlib.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
enum {
WIDTH_COLUMN,
HEIGHT_COLUMN,
@@ -197,7 +199,7 @@ do_filtermodel (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -68,11 +68,13 @@ create_blurred_button (void)
return w;
}
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static GtkWidget *
create_font_button (void)
{
return gtk_font_button_new ();
}
G_GNUC_END_IGNORE_DEPRECATIONS
static GtkWidget *
create_level_bar (void)
@@ -327,7 +329,7 @@ do_fishbowl (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -160,7 +160,7 @@ do_fixed (GtkWidget *do_widget)
demo_window = create_demo_window (do_widget);
if (!gtk_widget_get_visible (demo_window))
gtk_widget_show (demo_window);
gtk_widget_set_visible (demo_window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (demo_window));

View File

@@ -742,7 +742,7 @@ do_flowbox (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -21,6 +21,77 @@
#include "script-names.h"
#include "language-names.h"
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
/* {{{ ScriptLang object */
G_DECLARE_FINAL_TYPE (ScriptLang, script_lang, SCRIPT, LANG, GObject)
struct _ScriptLang
{
GObject parent;
char *langname;
unsigned int script_index;
unsigned int lang_index;
hb_tag_t lang_tag;
};
struct _ScriptLangClass
{
GObjectClass parent_class;
};
G_DEFINE_TYPE (ScriptLang, script_lang, G_TYPE_OBJECT)
static void
script_lang_init (ScriptLang *self)
{
}
static void
script_lang_finalize (GObject *object)
{
ScriptLang *self = SCRIPT_LANG (object);
g_free (self->langname);
G_OBJECT_CLASS (script_lang_parent_class)->finalize (object);
}
static void
script_lang_class_init (ScriptLangClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
object_class->finalize = script_lang_finalize;
}
static ScriptLang *
script_lang_new (const char *langname,
unsigned int script_index,
unsigned int lang_index,
hb_tag_t lang_tag)
{
ScriptLang *self;
self = g_object_new (script_lang_get_type (), NULL);
self->langname = g_strdup (langname);
self->script_index = script_index;
self->lang_index = lang_index;
self->lang_tag = lang_tag;
return self;
}
static char *
script_lang_get_langname (ScriptLang *self)
{
return g_strdup (self->langname);
}
/* }}} */
#define MAKE_TAG(a,b,c,d) (unsigned int)(((a) << 24) | ((b) << 16) | ((c) << 8) | (d))
@@ -94,6 +165,10 @@ demo_free (gpointer data)
g_clear_pointer (&demo->axes, g_hash_table_unref);
g_clear_pointer (&demo->text, g_free);
gtk_style_context_remove_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (demo->provider));
g_object_unref (demo->provider);
g_free (demo);
}
@@ -183,10 +258,10 @@ swap_colors (void)
GdkRGBA fg;
GdkRGBA bg;
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (demo->foreground), &fg);
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (demo->background), &bg);
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (demo->foreground), &bg);
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (demo->background), &fg);
fg = *gtk_color_dialog_button_get_rgba (GTK_COLOR_DIALOG_BUTTON (demo->foreground));
bg = *gtk_color_dialog_button_get_rgba (GTK_COLOR_DIALOG_BUTTON (demo->background));
gtk_color_dialog_button_set_rgba (GTK_COLOR_DIALOG_BUTTON (demo->foreground), &bg);
gtk_color_dialog_button_set_rgba (GTK_COLOR_DIALOG_BUTTON (demo->background), &fg);
}
static void
@@ -195,8 +270,8 @@ font_features_reset_basic (void)
gtk_adjustment_set_value (demo->size_adjustment, 20);
gtk_adjustment_set_value (demo->letterspacing_adjustment, 0);
gtk_adjustment_set_value (demo->line_height_adjustment, 1);
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (demo->foreground), &(GdkRGBA){0.,0.,0.,1.});
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (demo->background), &(GdkRGBA){1.,1.,1.,1.});
gtk_color_dialog_button_set_rgba (GTK_COLOR_DIALOG_BUTTON (demo->foreground), &(GdkRGBA){0.,0.,0.,1.});
gtk_color_dialog_button_set_rgba (GTK_COLOR_DIALOG_BUTTON (demo->background), &(GdkRGBA){1.,1.,1.,1.});
}
static void
@@ -204,7 +279,7 @@ update_basic (void)
{
PangoFontDescription *desc;
desc = gtk_font_chooser_get_font_desc (GTK_FONT_CHOOSER (demo->font));
desc = gtk_font_dialog_button_get_font_desc (GTK_FONT_DIALOG_BUTTON (demo->font));
gtk_adjustment_set_value (demo->size_adjustment,
pango_font_description_get_size (desc) / (double) PANGO_SCALE);
@@ -471,8 +546,6 @@ update_display (void)
GString *s;
char *text;
gboolean has_feature;
GtkTreeIter iter;
GtkTreeModel *model;
PangoFontDescription *desc;
GList *l;
PangoAttrList *attrs;
@@ -517,7 +590,7 @@ update_display (void)
end = PANGO_ATTR_INDEX_TO_TEXT_END;
}
desc = gtk_font_chooser_get_font_desc (GTK_FONT_CHOOSER (demo->font));
desc = gtk_font_dialog_button_get_font_desc (GTK_FONT_DIALOG_BUTTON (demo->font));
value = gtk_adjustment_get_value (demo->size_adjustment);
pango_font_description_set_size (desc, value * PANGO_SCALE);
@@ -575,14 +648,13 @@ update_display (void)
features = g_string_free (s, FALSE);
if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (demo->script_lang), &iter))
if (gtk_drop_down_get_selected (GTK_DROP_DOWN (demo->script_lang)) != 0)
{
hb_tag_t lang_tag;
ScriptLang *selected;
model = gtk_combo_box_get_model (GTK_COMBO_BOX (demo->script_lang));
gtk_tree_model_get (model, &iter, 3, &lang_tag, -1);
selected = gtk_drop_down_get_selected_item (GTK_DROP_DOWN (demo->script_lang));
lang = pango_language_from_string (hb_language_to_string (hb_ot_tag_to_language (lang_tag)));
lang = pango_language_from_string (hb_language_to_string (hb_ot_tag_to_language (selected->lang_tag)));
}
else
lang = NULL;
@@ -609,7 +681,7 @@ update_display (void)
GdkRGBA rgba;
char *fg, *bg, *css;
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (demo->foreground), &rgba);
rgba = *gtk_color_dialog_button_get_rgba (GTK_COLOR_DIALOG_BUTTON (demo->foreground));
attr = pango_attr_foreground_new (65535 * rgba.red,
65535 * rgba.green,
65535 * rgba.blue);
@@ -622,7 +694,7 @@ update_display (void)
pango_attr_list_insert (attrs, attr);
fg = gdk_rgba_to_string (&rgba);
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (demo->background), &rgba);
rgba = *gtk_color_dialog_button_get_rgba (GTK_COLOR_DIALOG_BUTTON (demo->background));
bg = gdk_rgba_to_string (&rgba);
css = g_strdup_printf (".font_features_background { caret-color: %s; background-color: %s; }", fg, bg);
gtk_css_provider_load_from_data (demo->provider, css, strlen (css));
@@ -697,7 +769,6 @@ update_display (void)
gtk_label_set_attributes (GTK_LABEL (demo->the_label), attrs);
g_free (font_desc);
pango_font_description_free (desc);
g_free (features);
pango_attr_list_unref (attrs);
g_free (text);
@@ -709,7 +780,7 @@ get_pango_font (void)
PangoFontDescription *desc;
PangoContext *context;
desc = gtk_font_chooser_get_font_desc (GTK_FONT_CHOOSER (demo->font));
desc = gtk_font_dialog_button_get_font_desc (GTK_FONT_DIALOG_BUTTON (demo->font));
context = gtk_widget_get_pango_context (demo->font);
return pango_context_load_font (context, desc);
@@ -739,50 +810,40 @@ tag_pair_equal (gconstpointer a, gconstpointer b)
return pair_a->script_tag == pair_b->script_tag && pair_a->lang_tag == pair_b->lang_tag;
}
static int
script_sort_func (GtkTreeModel *model,
GtkTreeIter *a,
GtkTreeIter *b,
gpointer user_data)
static GtkOrdering
script_sort (const void *item1,
const void *item2,
void *data)
{
char *sa, *sb;
int ret;
ScriptLang *a = (ScriptLang *)item1;
ScriptLang *b = (ScriptLang *)item2;
gtk_tree_model_get (model, a, 0, &sa, -1);
gtk_tree_model_get (model, b, 0, &sb, -1);
ret = strcmp (sa, sb);
g_free (sa);
g_free (sb);
return ret;
return strcmp (a->langname, b->langname);
}
static void
update_script_combo (void)
{
GtkListStore *store;
GListStore *store;
GtkSortListModel *sortmodel;
hb_font_t *hb_font;
int i, j, k;
PangoFont *pango_font;
GHashTable *tags;
GHashTableIter iter;
TagPair *pair;
char *lang;
PangoLanguage *language;
const char *lang;
hb_tag_t active;
GtkTreeIter active_iter;
gboolean have_active = FALSE;
lang = gtk_font_chooser_get_language (GTK_FONT_CHOOSER (demo->font));
language = gtk_font_dialog_button_get_language (GTK_FONT_DIALOG_BUTTON (demo->font));
lang = pango_language_to_string (language);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
active = hb_ot_tag_from_language (hb_language_from_string (lang, -1));
G_GNUC_END_IGNORE_DEPRECATIONS
g_free (lang);
store = gtk_list_store_new (4, G_TYPE_STRING, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT);
store = g_list_store_new (script_lang_get_type ());
pango_font = get_pango_font ();
hb_font = pango_font_get_hb_font (pango_font);
@@ -794,11 +855,6 @@ update_script_combo (void)
pair->lang_tag = 0;
g_hash_table_add (tags, pair);
pair = g_new (TagPair, 1);
pair->script_tag = HB_OT_TAG_DEFAULT_SCRIPT;
pair->lang_tag = HB_OT_TAG_DEFAULT_LANGUAGE;
g_hash_table_add (tags, pair);
if (hb_font)
{
hb_tag_t tables[2] = { HB_OT_TAG_GSUB, HB_OT_TAG_GPOS };
@@ -806,19 +862,19 @@ update_script_combo (void)
hb_face = hb_font_get_face (hb_font);
for (i= 0; i < 2; i++)
for (guint i = 0; i < 2; i++)
{
hb_tag_t scripts[80];
unsigned int script_count = G_N_ELEMENTS (scripts);
hb_ot_layout_table_get_script_tags (hb_face, tables[i], 0, &script_count, scripts);
for (j = 0; j < script_count; j++)
for (guint j = 0; j < script_count; j++)
{
hb_tag_t languages[80];
unsigned int language_count = G_N_ELEMENTS (languages);
hb_ot_layout_script_get_language_tags (hb_face, tables[i], j, 0, &language_count, languages);
for (k = 0; k < language_count; k++)
for (guint k = 0; k < language_count; k++)
{
pair = g_new (TagPair, 1);
pair->script_tag = scripts[j];
@@ -838,7 +894,6 @@ update_script_combo (void)
{
const char *langname;
char langbuf[5];
GtkTreeIter tree_iter;
if (pair->lang_tag == 0 && pair->script_tag == 0)
langname = NC_("Language", "None");
@@ -855,31 +910,31 @@ update_script_combo (void)
}
}
gtk_list_store_insert_with_values (store, &tree_iter, -1,
0, langname,
1, pair->script_index,
2, pair->lang_index,
3, pair->lang_tag,
-1);
if (pair->lang_tag == active)
{
have_active = TRUE;
active_iter = tree_iter;
}
g_list_store_append (store, script_lang_new (langname,
pair->script_index,
pair->lang_index,
pair->lang_tag));
}
g_hash_table_destroy (tags);
gtk_tree_sortable_set_default_sort_func (GTK_TREE_SORTABLE (store),
script_sort_func, NULL, NULL);
gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store),
GTK_TREE_SORTABLE_DEFAULT_SORT_COLUMN_ID,
GTK_SORT_ASCENDING);
gtk_combo_box_set_model (GTK_COMBO_BOX (demo->script_lang), GTK_TREE_MODEL (store));
if (have_active)
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (demo->script_lang), &active_iter);
else
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (demo->script_lang), 0);
sortmodel = gtk_sort_list_model_new (G_LIST_MODEL (store),
GTK_SORTER (gtk_custom_sorter_new (script_sort, NULL, NULL)));
gtk_drop_down_set_model (GTK_DROP_DOWN (demo->script_lang), G_LIST_MODEL (sortmodel));
for (guint i = 0; i < g_list_model_get_n_items (G_LIST_MODEL (sortmodel)); i++)
{
ScriptLang *item = g_list_model_get_item (G_LIST_MODEL (sortmodel), i);
g_object_unref (item);
if (item->lang_tag == active)
{
gtk_drop_down_set_selected (GTK_DROP_DOWN (demo->script_lang), i);
break;
}
}
g_object_unref (sortmodel);
}
static char *
@@ -904,33 +959,22 @@ static void
update_features (void)
{
int i, j;
GtkTreeModel *model;
GtkTreeIter iter;
guint script_index, lang_index;
hb_tag_t lang_tag;
PangoFont *pango_font;
hb_font_t *hb_font;
GList *l;
ScriptLang *selected;
/* set feature presence checks from the font features */
if (!gtk_combo_box_get_active_iter (GTK_COMBO_BOX (demo->script_lang), &iter))
return;
selected = gtk_drop_down_get_selected_item (GTK_DROP_DOWN (demo->script_lang));
model = gtk_combo_box_get_model (GTK_COMBO_BOX (demo->script_lang));
gtk_tree_model_get (model, &iter,
1, &script_index,
2, &lang_index,
3, &lang_tag,
-1);
if (lang_tag == 0) /* None is selected */
if (selected->lang_tag == 0) /* None is selected */
{
for (l = demo->feature_items; l; l = l->next)
{
FeatureItem *item = l->data;
gtk_widget_show (item->feat);
gtk_widget_show (gtk_widget_get_parent (item->feat));
gtk_widget_set_visible (item->feat, TRUE);
gtk_widget_set_visible (gtk_widget_get_parent (item->feat), TRUE);
if (strcmp (item->name, "xxxx") == 0)
gtk_check_button_set_active (GTK_CHECK_BUTTON (item->feat), TRUE);
}
@@ -941,8 +985,8 @@ update_features (void)
for (l = demo->feature_items; l; l = l->next)
{
FeatureItem *item = l->data;
gtk_widget_hide (item->feat);
gtk_widget_hide (gtk_widget_get_parent (item->feat));
gtk_widget_set_visible (item->feat, FALSE);
gtk_widget_set_visible (gtk_widget_get_parent (item->feat), FALSE);
if (strcmp (item->name, "xxxx") == 0)
gtk_check_button_set_active (GTK_CHECK_BUTTON (item->feat), TRUE);
}
@@ -950,11 +994,13 @@ update_features (void)
pango_font = get_pango_font ();
hb_font = pango_font_get_hb_font (pango_font);
g_print ("language %s\n", selected->langname);
if (hb_font)
{
hb_tag_t tables[2] = { HB_OT_TAG_GSUB, HB_OT_TAG_GPOS };
hb_face_t *hb_face;
char *feat;
const char *feat;
hb_face = hb_font_get_face (hb_font);
@@ -965,8 +1011,8 @@ update_features (void)
hb_ot_layout_language_get_feature_tags (hb_face,
tables[i],
script_index,
lang_index,
selected->script_index,
selected->lang_index,
0,
&count,
features);
@@ -976,9 +1022,6 @@ update_features (void)
char buf[5];
hb_tag_to_string (features[j], buf);
buf[4] = 0;
#if 0
g_print ("%s present in %s\n", buf, i == 0 ? "GSUB" : "GPOS");
#endif
if (g_str_has_prefix (buf, "ss") || g_str_has_prefix (buf, "cv"))
{
@@ -988,8 +1031,8 @@ update_features (void)
hb_ot_layout_language_find_feature (hb_face,
tables[i],
script_index,
lang_index,
selected->script_index,
selected->lang_index,
features[j],
&feature_index);
@@ -1028,15 +1071,15 @@ update_features (void)
if (item->tag == features[j])
{
gtk_widget_show (item->feat);
gtk_widget_show (gtk_widget_get_parent (item->feat));
gtk_widget_set_visible (item->feat, TRUE);
gtk_widget_set_visible (gtk_widget_get_parent (item->feat), TRUE);
if (GTK_IS_CHECK_BUTTON (item->feat))
{
GtkWidget *def = GTK_WIDGET (g_object_get_data (G_OBJECT (item->feat), "default"));
if (def)
{
gtk_widget_show (def);
gtk_widget_show (gtk_widget_get_parent (def));
gtk_widget_set_visible (def, TRUE);
gtk_widget_set_visible (gtk_widget_get_parent (def), TRUE);
gtk_check_button_set_active (GTK_CHECK_BUTTON (def), TRUE);
}
else
@@ -1047,7 +1090,7 @@ update_features (void)
}
}
feat = gtk_font_chooser_get_font_features (GTK_FONT_CHOOSER (demo->font));
feat = gtk_font_dialog_button_get_font_features (GTK_FONT_DIALOG_BUTTON (demo->font));
if (feat)
{
for (l = demo->feature_items; l; l = l->next)
@@ -1073,8 +1116,6 @@ update_features (void)
}
}
}
g_free (feat);
}
}
@@ -1321,10 +1362,9 @@ free_instance (gpointer data)
}
static void
add_instance (hb_face_t *face,
unsigned int index,
GtkWidget *combo,
int pos)
add_instance (hb_face_t *face,
unsigned int index,
GtkStringList *strings)
{
Instance *instance;
hb_ot_name_id_t name_id;
@@ -1340,20 +1380,20 @@ add_instance (hb_face_t *face,
instance->index = index;
g_hash_table_add (demo->instances, instance);
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), instance->name);
gtk_string_list_append (GTK_STRING_LIST (strings), instance->name);
}
static void
unset_instance (GtkAdjustment *adjustment)
{
if (demo->instance_combo)
gtk_combo_box_set_active (GTK_COMBO_BOX (demo->instance_combo), 0);
gtk_drop_down_set_selected (GTK_DROP_DOWN (demo->instance_combo), 0);
}
static void
instance_changed (GtkComboBox *combo)
instance_changed (GtkDropDown *combo)
{
char *text;
const char *text;
Instance *instance;
Instance ikey;
int i;
@@ -1365,17 +1405,15 @@ instance_changed (GtkComboBox *combo)
hb_font_t *hb_font;
hb_face_t *hb_face;
text = gtk_combo_box_text_get_active_text (GTK_COMBO_BOX_TEXT (combo));
text = gtk_string_list_get_string (GTK_STRING_LIST (gtk_drop_down_get_model (combo)),
gtk_drop_down_get_selected (combo));
if (text[0] == '\0')
goto out;
ikey.name = text;
ikey.name = (char *) text;
instance = g_hash_table_lookup (demo->instances, &ikey);
if (!instance)
{
g_print ("did not find instance %s\n", text);
goto out;
}
goto out;
pango_font = get_pango_font ();
hb_font = pango_font_get_hb_font (pango_font);
@@ -1410,7 +1448,6 @@ instance_changed (GtkComboBox *combo)
}
out:
g_free (text);
g_clear_object (&pango_font);
g_free (ai);
g_free (coords);
@@ -1520,6 +1557,7 @@ update_font_variations (void)
{
GtkWidget *label;
GtkWidget *combo;
GtkStringList *strings;
label = gtk_label_new ("Instance");
gtk_label_set_xalign (GTK_LABEL (label), 0);
@@ -1527,26 +1565,28 @@ update_font_variations (void)
gtk_widget_set_valign (label, GTK_ALIGN_BASELINE);
gtk_grid_attach (GTK_GRID (demo->variations_grid), label, 0, -1, 1, 1);
combo = gtk_combo_box_text_new ();
strings = gtk_string_list_new (NULL);
combo = gtk_drop_down_new (G_LIST_MODEL (strings), NULL);
gtk_widget_set_halign (combo, GTK_ALIGN_START);
gtk_widget_set_valign (combo, GTK_ALIGN_BASELINE);
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "");
gtk_string_list_append (strings, "");
for (i = 0; i < hb_ot_var_get_named_instance_count (hb_face); i++)
add_instance (hb_face, i, combo, i);
add_instance (hb_face, i, strings);
for (i = 0; i < hb_ot_var_get_named_instance_count (hb_face); i++)
{
if (matches_instance (hb_face, i, n_axes, design_coords))
{
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), i + 1);
gtk_drop_down_set_selected (GTK_DROP_DOWN (combo), i + 1);
break;
}
}
gtk_grid_attach (GTK_GRID (demo->variations_grid), combo, 1, -1, 3, 1);
g_signal_connect (combo, "changed", G_CALLBACK (instance_changed), NULL);
g_signal_connect (combo, "notify::selecte", G_CALLBACK (instance_changed), NULL);
demo->instance_combo = combo;
}
@@ -1693,6 +1733,7 @@ do_font_features (GtkWidget *do_widget)
GtkBuilder *builder;
GtkBuilderScope *scope;
GtkEventController *controller;
GtkExpression *expression;
builder = gtk_builder_new ();
@@ -1726,6 +1767,10 @@ do_font_features (GtkWidget *do_widget)
demo->description = GTK_WIDGET (gtk_builder_get_object (builder, "description"));
demo->font = GTK_WIDGET (gtk_builder_get_object (builder, "font"));
demo->script_lang = GTK_WIDGET (gtk_builder_get_object (builder, "script_lang"));
g_assert (GTK_IS_DROP_DOWN (demo->script_lang));
expression = gtk_cclosure_expression_new (G_TYPE_STRING, NULL, 0, NULL, G_CALLBACK (script_lang_get_langname), NULL, NULL);
gtk_drop_down_set_expression (GTK_DROP_DOWN (demo->script_lang), expression);
gtk_expression_unref (expression);
demo->feature_list = GTK_WIDGET (gtk_builder_get_object (builder, "feature_list"));
demo->stack = GTK_WIDGET (gtk_builder_get_object (builder, "stack"));
demo->entry = GTK_WIDGET (gtk_builder_get_object (builder, "entry"));
@@ -1744,8 +1789,8 @@ do_font_features (GtkWidget *do_widget)
demo->swin = GTK_WIDGET (gtk_builder_get_object (builder, "swin"));
demo->provider = gtk_css_provider_new ();
gtk_style_context_add_provider (gtk_widget_get_style_context (demo->swin),
GTK_STYLE_PROVIDER (demo->provider), 800);
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (demo->provider), 800);
basic_value_changed (demo->size_adjustment, demo->size_entry);
basic_value_changed (demo->letterspacing_adjustment, demo->letterspacing_entry);
@@ -1823,3 +1868,5 @@ do_font_features (GtkWidget *do_widget)
return window;
}
/* vim:set foldmethod=marker expandtab: */

View File

@@ -1,65 +0,0 @@
--- demos/gtk-demo/font_features.c
+++ demos/gtk-demo/font_features.c
@@ -434,7 +434,7 @@ static void
update_display (void)
{
GString *s;
- const char *text;
+ char *text;
gboolean has_feature;
GtkTreeIter iter;
GtkTreeModel *model;
@@ -452,8 +452,12 @@ update_display (void)
gboolean do_waterfall;
GString *waterfall;
char *palette;
+ GtkTextBuffer *buffer;
+ GtkTextIter start_iter, end_iter;
- text = gtk_editable_get_text (GTK_EDITABLE (demo->the_entry));
+ buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (demo->the_entry));
+ gtk_text_buffer_get_bounds (buffer, &start_iter, &end_iter);
+ text = gtk_text_buffer_get_text (buffer, &start_iter, &end_iter, FALSE);
text_len = strlen (text);
do_waterfall = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (demo->waterfall_toggle));
@@ -631,6 +635,8 @@ update_display (void)
pango2_font_description_free (desc);
g_free (features);
pango2_attr_list_unref (attrs);
+
+ g_free (text);
}
static Pango2Font *
@@ -1603,8 +1609,12 @@ font_features_toggle_edit (void)
{
if (strcmp (gtk_stack_get_visible_child_name (GTK_STACK (demo->stack)), "entry") != 0)
{
+ GtkTextBuffer *buffer;
+ GtkTextIter start, end;
g_free (demo->text);
- demo->text = g_strdup (gtk_editable_get_text (GTK_EDITABLE (demo->the_entry)));
+ buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (demo->the_entry));
+ gtk_text_buffer_get_bounds (buffer, &start, &end);
+ demo->text = gtk_text_buffer_get_text (buffer, &start, &end, FALSE);
gtk_stack_set_visible_child_name (GTK_STACK (demo->stack), "entry");
gtk_widget_grab_focus (demo->the_entry);
gtk_adjustment_set_value (gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (demo->swin)), 0);
@@ -1632,7 +1642,7 @@ entry_key_press (GtkEventController *controller,
{
if (keyval == GDK_KEY_Escape)
{
- gtk_editable_set_text (GTK_EDITABLE (entry), demo->text);
+ gtk_text_buffer_set_text (gtk_text_view_get_buffer (GTK_TEXT_VIEW (demo->the_entry)), demo->text, -1);
return GDK_EVENT_STOP;
}
@@ -1701,7 +1711,6 @@ do_font_features (GtkWidget *do_widget)
basic_value_changed (demo->line_height_adjustment, demo->line_height_entry);
controller = gtk_event_controller_key_new ();
- g_object_set_data_full (G_OBJECT (demo->the_entry), "controller", g_object_ref (controller), g_object_unref);
g_signal_connect (controller, "key-pressed", G_CALLBACK (entry_key_press), demo->the_entry);
gtk_widget_add_controller (demo->the_entry, controller);

View File

@@ -58,11 +58,14 @@
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkFontButton" id="font">
<object class="GtkFontDialogButton" id="font">
<property name="dialog">
<object class="GtkFontDialog">
</object>
</property>
<property name="receives-default">1</property>
<property name="font">Sans 12</property>
<property name="level">family|style</property>
<signal name="font-set" handler="font_features_font_changed" swapped="no"/>
<property name="level">face</property>
<signal name="notify::font-desc" handler="font_features_font_changed" swapped="no"/>
</object>
</child>
<child>
@@ -192,7 +195,11 @@
</object>
</child>
<child>
<object class="GtkColorButton" id="foreground">
<object class="GtkColorDialogButton" id="foreground">
<property name="dialog">
<object class="GtkColorDialog">
</object>
</property>
<property name="valign">baseline</property>
<property name="rgba">black</property>
<signal name="notify::rgba" handler="color_set_cb"/>
@@ -214,7 +221,11 @@
</object>
</child>
<child>
<object class="GtkColorButton" id="background">
<object class="GtkColorDialogButton" id="background">
<property name="dialog">
<object class="GtkColorDialog">
</object>
</property>
<property name="valign">baseline</property>
<property name="rgba">white</property>
<signal name="notify::rgba" handler="color_set_cb"/>
@@ -259,16 +270,10 @@
<object class="GtkBox" id="feature_list">
<property name="orientation">vertical</property>
<child>
<object class="GtkComboBox" id="script_lang">
<object class="GtkDropDown" id="script_lang">
<property name="tooltip-text" translatable="yes">Language System</property>
<property name="margin-top">10</property>
<signal name="changed" handler="font_features_script_changed" swapped="no"/>
<child>
<object class="GtkCellRendererText"/>
<attributes>
<attribute name="text">0</attribute>
</attributes>
</child>
<signal name="notify::selected" handler="font_features_script_changed" swapped="no"/>
</object>
</child>
</object>

View File

@@ -43,7 +43,6 @@ update_image (void)
cairo_t *cr;
GdkPixbuf *pixbuf;
GdkPixbuf *pixbuf2;
const char *hint;
cairo_font_options_t *fopt;
cairo_hint_style_t hintstyle;
cairo_hint_metrics_t hintmetrics;
@@ -54,22 +53,27 @@ update_image (void)
context = gtk_widget_create_pango_context (image);
text = gtk_editable_get_text (GTK_EDITABLE (entry));
desc = gtk_font_chooser_get_font_desc (GTK_FONT_CHOOSER (font_button));
desc = gtk_font_dialog_button_get_font_desc (GTK_FONT_DIALOG_BUTTON (font_button));
fopt = cairo_font_options_copy (pango_cairo_context_get_font_options (context));
hint = gtk_combo_box_get_active_id (GTK_COMBO_BOX (hinting));
hintstyle = CAIRO_HINT_STYLE_DEFAULT;
if (hint)
switch (gtk_drop_down_get_selected (GTK_DROP_DOWN (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;
case 0:
hintstyle = CAIRO_HINT_STYLE_NONE;
break;
case 1:
hintstyle = CAIRO_HINT_STYLE_SLIGHT;
break;
case 2:
hintstyle = CAIRO_HINT_STYLE_MEDIUM;
break;
case 3:
hintstyle = CAIRO_HINT_STYLE_FULL;
break;
default:
hintstyle = CAIRO_HINT_STYLE_DEFAULT;
break;
}
cairo_font_options_set_hint_style (fopt, hintstyle);
@@ -217,30 +221,39 @@ update_image (void)
text = " ";
ch = g_utf8_get_char (text);
str = g_string_new ("");
layout = pango_layout_new (context);
retry:
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, str->str, -1);
g_string_free (str, TRUE);
pango_layout_get_extents (layout, &ink, &logical);
pango_extents_to_pixels (&logical, NULL);
iter = pango_layout_get_iter (layout);
run = pango_layout_iter_get_run (iter);
if (run->glyphs->num_glyphs < 8)
{
/* not a good char to use */
g_string_truncate (str, 0);
ch = 'a';
goto retry;
}
g_string_free (str, TRUE);
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, logical.width * 3 / 2, 4*logical.height);
cr = cairo_create (surface);
cairo_set_source_rgb (cr, 1, 1, 1);
cairo_paint (cr);
iter = pango_layout_get_iter (layout);
run = pango_layout_iter_get_run (iter);
cairo_set_source_rgb (cr, 0, 0, 0);
for (i = 0; i < 4; i++)
{
@@ -274,8 +287,6 @@ update_image (void)
gtk_picture_set_pixbuf (GTK_PICTURE (image), pixbuf2);
g_object_unref (pixbuf2);
pango_font_description_free (desc);
}
static gboolean fading = FALSE;
@@ -409,7 +420,7 @@ do_fontrendering (GtkWidget *do_widget)
g_signal_connect (down_button, "clicked", G_CALLBACK (scale_down), NULL);
g_signal_connect (entry, "notify::text", G_CALLBACK (update_image), NULL);
g_signal_connect (font_button, "notify::font-desc", G_CALLBACK (update_image), NULL);
g_signal_connect (hinting, "notify::active", G_CALLBACK (update_image), NULL);
g_signal_connect (hinting, "notify::selected", G_CALLBACK (update_image), NULL);
g_signal_connect (anti_alias, "notify::active", G_CALLBACK (update_image), NULL);
g_signal_connect (hint_metrics, "notify::active", G_CALLBACK (update_image), NULL);
g_signal_connect (text_radio, "notify::active", G_CALLBACK (update_image), NULL);
@@ -424,7 +435,7 @@ do_fontrendering (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -74,7 +74,11 @@
</object>
</child>
<child>
<object class="GtkFontButton" id="font_button">
<object class="GtkFontDialogButton" id="font_button">
<property name="dialog">
<object class="GtkFontDialog">
</object>
</property>
<layout>
<property name="column">2</property>
<property name="row">1</property>
@@ -116,15 +120,18 @@
</object>
</child>
<child>
<object class="GtkComboBoxText" id="hinting">
<property name="active">0</property>
<object class="GtkDropDown" id="hinting">
<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>
<property name="model">
<object class="GtkStringList">
<items>
<item translatable="yes">None</item>
<item translatable="yes">Slight</item>
<item translatable="yes">Medium</item>
<item translatable="yes">Full</item>
</items>
</object>
</property>
</object>
</child>
<layout>

View File

@@ -157,7 +157,7 @@ do_frames (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -54,7 +54,6 @@ create_axis_slider (GtkGears *gears,
label = gtk_label_new (text);
gtk_box_append (GTK_BOX (box), label);
gtk_widget_show (label);
adj = gtk_adjustment_new (gtk_gears_get_axis (gears, axis), 0.0, 360.0, 1.0, 12.0, 0.0);
g_object_set_data (G_OBJECT (adj), "axis", GINT_TO_POINTER (axis));
@@ -65,9 +64,6 @@ create_axis_slider (GtkGears *gears,
gtk_scale_set_draw_value (GTK_SCALE (slider), FALSE);
gtk_box_append (GTK_BOX (box), slider);
gtk_widget_set_vexpand (slider, TRUE);
gtk_widget_show (slider);
gtk_widget_show (box);
return box;
}
@@ -129,7 +125,7 @@ do_gears (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -208,7 +208,7 @@ do_gestures (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -355,7 +355,6 @@ create_axis_slider (int axis)
label = gtk_label_new (text);
gtk_box_append (GTK_BOX (box), label);
gtk_widget_show (label);
adj = gtk_adjustment_new (0.0, 0.0, 360.0, 1.0, 12.0, 0.0);
g_signal_connect (adj, "value-changed",
@@ -364,9 +363,6 @@ create_axis_slider (int axis)
slider = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, adj);
gtk_box_append (GTK_BOX (box), slider);
gtk_widget_set_hexpand (slider, TRUE);
gtk_widget_show (slider);
gtk_widget_show (box);
return box;
}
@@ -440,7 +436,7 @@ do_glarea (GtkWidget *do_widget)
demo_window = create_glarea_window (do_widget);
if (!gtk_widget_get_visible (demo_window))
gtk_widget_show (demo_window);
gtk_widget_set_visible (demo_window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (demo_window));

View File

@@ -33,7 +33,7 @@ static void
text_changed (GtkTextBuffer *buffer,
GtkWidget *button)
{
gtk_widget_show (button);
gtk_widget_set_visible (button, TRUE);
}
static void
@@ -58,7 +58,7 @@ apply_text (GtkWidget *button,
g_object_unref (shader);
g_bytes_unref (bytes);
gtk_widget_hide (button);
gtk_widget_set_visible (button, FALSE);
}
static void
@@ -144,7 +144,6 @@ make_shader_stack (const char *name,
GtkTextBuffer *buffer;
GBytes *bytes;
GtkEventController *controller;
GtkCssProvider *provider;
GdkPaintable *paintable;
stack = gtk_shader_stack_new ();
@@ -235,16 +234,10 @@ make_shader_stack (const char *name,
g_signal_connect (buffer, "changed", G_CALLBACK (text_changed), button);
g_object_set_data (G_OBJECT (button), "the-stack", stack);
g_signal_connect (button, "clicked", G_CALLBACK (apply_text), buffer);
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider, "button.small { padding: 0; }", -1);
gtk_style_context_add_provider (gtk_widget_get_style_context (button),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
g_object_unref (provider);
gtk_widget_set_halign (button, GTK_ALIGN_CENTER);
gtk_widget_set_valign (button, GTK_ALIGN_CENTER);
gtk_widget_add_css_class (button, "small");
gtk_widget_hide (button);
gtk_widget_set_visible (button, FALSE);
gtk_center_box_set_end_widget (GTK_CENTER_BOX (widget), button);
gtk_box_append (GTK_BOX (vbox), widget);
@@ -274,11 +267,21 @@ make_shader_stack (const char *name,
return vbox;
}
static void
remove_provider (gpointer data)
{
GtkStyleProvider *provider = GTK_STYLE_PROVIDER (data);
gtk_style_context_remove_provider_for_display (gdk_display_get_default (), provider);
g_object_unref (provider);
}
static GtkWidget *
create_gltransition_window (GtkWidget *do_widget)
{
GtkWidget *window, *headerbar, *scale, *outer_grid, *grid, *background;
GdkPaintable *paintable;
GtkCssProvider *provider;
window = gtk_window_new ();
gtk_window_set_display (GTK_WINDOW (window), gtk_widget_get_display (do_widget));
@@ -333,6 +336,14 @@ create_gltransition_window (GtkWidget *do_widget)
make_shader_stack ("Kaleidoscope", "/gltransition/kaleidoscope.glsl", 3, scale),
1, 1, 1, 1);
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider, "button.small { padding: 0; }", -1);
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (provider),
GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
g_object_set_data_full (G_OBJECT (window), "provider", provider, remove_provider);
return window;
}
@@ -343,7 +354,7 @@ do_gltransition (GtkWidget *do_widget)
demo_window = create_gltransition_window (do_widget);
if (!gtk_widget_get_visible (demo_window))
gtk_widget_show (demo_window);
gtk_widget_set_visible (demo_window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (demo_window));

View File

@@ -223,6 +223,7 @@ static void
destroy_gear (struct gear *g)
{
g_free (g->strips);
g_free (g->vertices);
g_free (g);
}

View File

@@ -50,7 +50,7 @@ do_headerbar (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -399,7 +399,7 @@ do_hypertext (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@@ -378,7 +378,7 @@ do_iconscroll (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -9,6 +9,8 @@
#include <gtk/gtk.h>
#include <string.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static GtkWidget *window = NULL;
#define FOLDER_NAME "/iconview/gnome-fs-directory.png"
@@ -318,7 +320,7 @@ do_iconview (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -1,4 +1,5 @@
/* Icon View/Editing and Drag-and-Drop
* #Keywords: dnd
*
* The GtkIconView widget supports Editing and Drag-and-Drop.
* This example also demonstrates using the generic GtkCellLayout
@@ -8,6 +9,8 @@
#include <gtk/gtk.h>
#include <string.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
enum
{
COL_TEXT,
@@ -148,7 +151,7 @@ do_iconview_edit (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -83,24 +83,17 @@ progressive_timeout (gpointer data)
if (bytes_read < 0)
{
GtkWidget *dialog;
GtkAlertDialog *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Failure reading image file 'alphatest.png': %s",
error->message);
dialog = gtk_alert_dialog_new ("Failure reading image file 'alphatest.png': %s",
error->message);
gtk_alert_dialog_show (dialog, NULL);
g_object_unref (dialog);
g_error_free (error);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_window_destroy), NULL);
g_object_unref (image_stream);
image_stream = NULL;
gtk_widget_show (dialog);
load_timeout = 0;
return FALSE; /* uninstall the timeout */
@@ -110,25 +103,17 @@ progressive_timeout (gpointer data)
buf, bytes_read,
&error))
{
GtkWidget *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Failed to load image: %s",
error->message);
GtkAlertDialog *dialog;
dialog = gtk_alert_dialog_new ("Failed to load image: %s",
error->message);
gtk_alert_dialog_show (dialog, NULL);
g_object_unref (dialog);
g_error_free (error);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_window_destroy), NULL);
g_object_unref (image_stream);
image_stream = NULL;
gtk_widget_show (dialog);
load_timeout = 0;
return FALSE; /* uninstall the timeout */
@@ -143,22 +128,14 @@ progressive_timeout (gpointer data)
error = NULL;
if (!g_input_stream_close (image_stream, NULL, &error))
{
GtkWidget *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Failed to load image: %s",
error->message);
GtkAlertDialog *dialog;
dialog = gtk_alert_dialog_new ("Failed to load image: %s",
error->message);
gtk_alert_dialog_show (dialog, NULL);
g_object_unref (dialog);
g_error_free (error);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (dialog);
g_object_unref (image_stream);
image_stream = NULL;
g_object_unref (pixbuf_loader);
@@ -177,25 +154,16 @@ progressive_timeout (gpointer data)
* it was incomplete.
*/
error = NULL;
if (!gdk_pixbuf_loader_close (pixbuf_loader,
&error))
if (!gdk_pixbuf_loader_close (pixbuf_loader, &error))
{
GtkWidget *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Failed to load image: %s",
error->message);
GtkAlertDialog *dialog;
dialog = gtk_alert_dialog_new ("Failed to load image: %s",
error->message);
gtk_alert_dialog_show (dialog, NULL);
g_object_unref (dialog);
g_error_free (error);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (dialog);
g_object_unref (pixbuf_loader);
pixbuf_loader = NULL;
@@ -216,20 +184,14 @@ progressive_timeout (gpointer data)
if (image_stream == NULL)
{
GtkWidget *dialog;
GtkAlertDialog *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"%s", error->message);
dialog = gtk_alert_dialog_new ("%s",
error->message);
gtk_alert_dialog_show (dialog, NULL);
g_object_unref (dialog);
g_error_free (error);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (dialog);
load_timeout = 0;
return FALSE; /* uninstall the timeout */
@@ -460,7 +422,7 @@ do_images (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -7,13 +7,15 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static void
on_bar_response (GtkInfoBar *info_bar,
int response_id,
gpointer user_data)
{
GtkWidget *dialog;
GtkWidget *window;
GtkAlertDialog *dialog;
char *detail;
if (response_id == GTK_RESPONSE_CLOSE)
{
@@ -21,19 +23,12 @@ on_bar_response (GtkInfoBar *info_bar,
return;
}
window = GTK_WIDGET (gtk_widget_get_root (GTK_WIDGET (info_bar)));
dialog = gtk_message_dialog_new (GTK_WINDOW (window),
GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_OK,
"You clicked a button on an info bar");
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
"Your response has id %d", response_id);
g_signal_connect_swapped (dialog, "response",
G_CALLBACK (gtk_window_destroy), dialog);
gtk_widget_show (dialog);
dialog = gtk_alert_dialog_new ("You clicked a button on an info bar");
detail = g_strdup_printf ("Your response has been %d", response_id);
gtk_alert_dialog_set_detail (dialog, detail);
g_free (detail);
gtk_alert_dialog_show (dialog, GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (info_bar))));
g_object_unref (dialog);
}
GtkWidget *
@@ -145,7 +140,7 @@ do_infobar (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -311,5 +311,12 @@ get_language_name_for_tag (guint32 tag)
lang = hb_ot_tag_to_language (tag);
s = hb_language_to_string (lang);
if (strcmp (s, "und-fonipa") == 0)
return "International Phonetic Alphabet";
else if (strcmp (s, "und-fonnapa") == 0)
return "North-American Phonetic Alphabet";
else if (strcmp (s, "ro-md") == 0)
return "Moldavian";
return get_language_name (pango_language_from_string (s));
}

View File

@@ -54,7 +54,7 @@ do_layoutmanager (GtkWidget *parent)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -190,7 +190,7 @@ do_layoutmanager2 (GtkWidget *parent)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -7,38 +7,22 @@
#include <gtk/gtk.h>
static void
response_cb (GtkWidget *dialog,
int response_id,
gpointer data)
{
gtk_window_destroy (GTK_WINDOW (dialog));
}
static gboolean
activate_link (GtkWidget *label,
activate_link (GtkWidget *label,
const char *uri,
gpointer data)
gpointer data)
{
if (g_strcmp0 (uri, "keynav") == 0)
{
GtkWidget *dialog;
GtkWidget *parent;
GtkAlertDialog *dialog;
parent = GTK_WIDGET (gtk_widget_get_root (label));
dialog = gtk_message_dialog_new_with_markup (GTK_WINDOW (parent),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_INFO,
GTK_BUTTONS_OK,
"Keyboard navigation");
gtk_message_dialog_format_secondary_markup (GTK_MESSAGE_DIALOG (dialog),
"The term <i>keynav</i> is a shorthand for "
"keyboard navigation and refers to the process of using "
"a program (exclusively) via keyboard input.");
gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
gtk_window_present (GTK_WINDOW (dialog));
g_signal_connect (dialog, "response", G_CALLBACK (response_cb), NULL);
dialog = gtk_alert_dialog_new ("Keyboard navigation");
gtk_alert_dialog_set_detail (dialog,
"The term keynav is a shorthand for "
"keyboard navigation and refers to the process of using "
"a program (exclusively) via keyboard input.");
gtk_alert_dialog_show (dialog, GTK_WINDOW (gtk_widget_get_root (label)));
g_object_unref (dialog);
return TRUE;
}
@@ -79,11 +63,10 @@ do_links (GtkWidget *do_widget)
gtk_widget_set_margin_top (label, 20);
gtk_widget_set_margin_bottom (label, 20);
gtk_window_set_child (GTK_WINDOW (window), label);
gtk_widget_show (label);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -7,6 +7,8 @@
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
static GtkWidget *window = NULL;
static GtkTreeModel *model = NULL;
static guint timeout = 0;
@@ -298,7 +300,7 @@ do_list_store (GtkWidget *do_widget)
if (!gtk_widget_get_visible (window))
{
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
if (timeout == 0) {
/* FIXME this should use the animation-duration instead */
timeout = g_timeout_add (80, spinner_timeout, NULL);

View File

@@ -380,7 +380,6 @@ do_listbox (GtkWidget *do_widget)
{
message = gtk_message_new (lines[i]);
row = gtk_message_row_new (message);
gtk_widget_show (GTK_WIDGET (row));
gtk_list_box_insert (GTK_LIST_BOX (listbox), GTK_WIDGET (row), -1);
}
@@ -389,7 +388,7 @@ do_listbox (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -62,7 +62,7 @@ do_listbox_controls (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -117,19 +117,16 @@ activate_cb (GtkListView *list,
G_APP_LAUNCH_CONTEXT (context),
&error))
{
GtkWidget *dialog;
GtkAlertDialog *dialog;
/* And because error handling is important, even a simple demo has it:
* We display an error dialog that something went wrong.
*/
dialog = gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (list))),
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"Could not launch %s", g_app_info_get_display_name (app_info));
gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), "%s", error->message);
dialog = gtk_alert_dialog_new ("Could not launch %s", g_app_info_get_display_name (app_info));
gtk_alert_dialog_set_detail (dialog, error->message);
gtk_alert_dialog_show (dialog, GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (list))));
g_object_unref (dialog);
g_clear_error (&error);
gtk_widget_show (dialog);
}
g_object_unref (context);
@@ -194,7 +191,7 @@ do_listview_applauncher (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -494,7 +494,7 @@ do_listview_clocks (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -1124,7 +1124,7 @@ do_listview_colors (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -275,7 +275,7 @@ do_listview_filebrowser (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -8,6 +8,7 @@
* to implement rather different interaction behavior to a typical list.
*/
#include "config.h"
#include <glib/gi18n.h>
#include <gtk/gtk.h>
@@ -375,6 +376,23 @@ sweeper_game_init (SweeperGame *self)
sweeper_game_new_game (self, 8, 8, 10);
}
static void
celebrate (gboolean win)
{
char *path;
GtkMediaStream *stream;
if (win)
path = g_build_filename (GTK_DATADIR, "sounds", "freedesktop", "stereo", "complete.oga", NULL);
else
path = g_build_filename (GTK_DATADIR, "sounds", "freedesktop", "stereo", "suspend-error.oga", NULL);
stream = gtk_media_file_new_for_filename (path);
gtk_media_stream_set_volume (stream, 1.0);
gtk_media_stream_play (stream);
g_signal_connect (stream, "notify::ended", G_CALLBACK (g_object_unref), NULL);
g_free (path);
}
static void
sweeper_game_end (SweeperGame *self,
gboolean win)
@@ -383,7 +401,9 @@ sweeper_game_end (SweeperGame *self,
{
self->playing = FALSE;
g_object_notify_by_pspec (G_OBJECT (self), game_properties[GAME_PROP_PLAYING]);
celebrate (win);
}
if (self->win != win)
{
self->win = win;
@@ -465,7 +485,7 @@ do_listview_minesweeper (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -422,11 +422,15 @@ do_listview_settings (GtkWidget *do_widget)
gtk_column_view_column_set_sorter (name_column, sorter);
g_object_unref (sorter);
sorter = GTK_SORTER (gtk_string_sorter_new (gtk_property_expression_new (SETTINGS_TYPE_KEY, NULL, "type")));
gtk_column_view_column_set_sorter (type_column, sorter);
g_object_unref (sorter);
g_object_unref (builder);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -10,7 +10,6 @@
#include "script-names.h"
#include "unicode-names.h"
#define UCD_TYPE_ITEM (ucd_item_get_type ())
G_DECLARE_FINAL_TYPE (UcdItem, ucd_item, UCD, ITEM, GObject)
@@ -338,6 +337,15 @@ create_ucd_view (GtkWidget *label)
static GtkWidget *window;
static void
remove_provider (gpointer data)
{
GtkStyleProvider *provider = GTK_STYLE_PROVIDER (data);
gtk_style_context_remove_provider_for_display (gdk_display_get_default (), provider);
g_object_unref (provider);
}
GtkWidget *
do_listview_ucd (GtkWidget *do_widget)
{
@@ -360,7 +368,7 @@ do_listview_ucd (GtkWidget *do_widget)
gtk_widget_add_css_class (label, "enormous");
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider, "label.enormous { font-size: 80px; }", -1);
gtk_style_context_add_provider (gtk_widget_get_style_context (label), GTK_STYLE_PROVIDER (provider), 800);
gtk_style_context_add_provider_for_display (gdk_display_get_default (), GTK_STYLE_PROVIDER (provider), 800);
gtk_widget_set_hexpand (label, TRUE);
gtk_box_append (GTK_BOX (box), label);
@@ -370,10 +378,12 @@ do_listview_ucd (GtkWidget *do_widget)
gtk_scrolled_window_set_child (GTK_SCROLLED_WINDOW (sw), listview);
gtk_box_prepend (GTK_BOX (box), sw);
gtk_window_set_child (GTK_WINDOW (window), box);
g_object_set_data_full (G_OBJECT (window), "provider", provider, remove_provider);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -317,7 +317,7 @@ do_listview_weather (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -42,7 +42,7 @@ update_title_cb (GtkFilterListModel *model)
title = g_strdup_printf ("%u lines", g_list_model_get_n_items (G_LIST_MODEL (model)));
gtk_widget_set_visible (progress, pending != 0);
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress), (total - pending) / (double) total);
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress), total > 0 ? (total - pending) / (double) total : 0.);
gtk_window_set_title (GTK_WINDOW (window), title);
g_free (title);
}
@@ -141,39 +141,35 @@ load_file (GtkStringList *list,
}
static void
open_response_cb (GtkNativeDialog *dialog,
int response,
GtkStringList *stringlist)
open_response_cb (GObject *source,
GAsyncResult *result,
void *user_data)
{
gtk_native_dialog_hide (dialog);
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
GtkStringList *stringlist = GTK_STRING_LIST (user_data);
GFile *file;
if (response == GTK_RESPONSE_ACCEPT)
file = gtk_file_dialog_open_finish (dialog, result, NULL);
if (file)
{
GFile *file;
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
load_file (stringlist, file);
g_object_unref (file);
}
gtk_native_dialog_destroy (dialog);
}
static void
file_open_cb (GtkWidget *button,
GtkStringList *stringlist)
{
GtkFileChooserNative *dialog;
GtkFileDialog *dialog;
dialog = gtk_file_chooser_native_new ("Open file",
GTK_WINDOW (gtk_widget_get_root (button)),
GTK_FILE_CHOOSER_ACTION_OPEN,
"_Load",
"_Cancel");
gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (dialog), TRUE);
g_signal_connect (dialog, "response", G_CALLBACK (open_response_cb), stringlist);
gtk_native_dialog_show (GTK_NATIVE_DIALOG (dialog));
dialog = gtk_file_dialog_new ();
gtk_file_dialog_open (dialog,
GTK_WINDOW (gtk_widget_get_root (button)),
NULL,
NULL,
open_response_cb, stringlist);
g_object_unref (dialog);
}
GtkWidget *
@@ -253,7 +249,7 @@ do_listview_words (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -463,7 +463,6 @@ add_data_tab (const char *demoname)
widget = display_nothing (resource_name);
label = gtk_label_new (label_string ? label_string : resources[i]);
gtk_widget_show (label);
gtk_notebook_append_page (GTK_NOTEBOOK (notebook), widget, label);
g_object_set (gtk_notebook_get_page (GTK_NOTEBOOK (notebook), widget),
"tab-expand", FALSE,

View File

@@ -62,7 +62,6 @@ do_markup (GtkWidget *do_widget)
g_object_add_weak_pointer (G_OBJECT (window), (gpointer *)&window);
stack = gtk_stack_new ();
gtk_widget_show (stack);
gtk_window_set_child (GTK_WINDOW (window), stack);
show_source = gtk_check_button_new_with_label ("Source");
@@ -118,12 +117,10 @@ do_markup (GtkWidget *do_widget)
gtk_text_buffer_end_irreversible_action (buffer);
g_bytes_unref (bytes);
gtk_widget_show (stack);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -53,7 +53,7 @@ do_menu (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -84,7 +84,7 @@ do_overlay (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -94,7 +94,7 @@ do_overlay_decorative (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -28,7 +28,7 @@ do_pagesetup (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -7,6 +7,8 @@
#include <glib/gi18n.h>
#include <gtk/gtk.h>
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
enum {
COLOR_SET,
N_SIGNALS
@@ -51,8 +53,8 @@ static const char *pad_colors[] = {
static GType drawing_area_get_type (void);
G_DEFINE_TYPE (DrawingArea, drawing_area, GTK_TYPE_WIDGET)
static void drawing_area_set_color (DrawingArea *area,
GdkRGBA *color);
static void drawing_area_set_color (DrawingArea *area,
const GdkRGBA *color);
static void
drawing_area_ensure_surface (DrawingArea *area,
@@ -350,8 +352,8 @@ drawing_area_new (void)
}
static void
drawing_area_set_color (DrawingArea *area,
GdkRGBA *color)
drawing_area_set_color (DrawingArea *area,
const GdkRGBA *color)
{
if (gdk_rgba_equal (&area->draw_color, color))
return;
@@ -361,21 +363,22 @@ drawing_area_set_color (DrawingArea *area,
}
static void
color_button_color_set (GtkColorButton *button,
DrawingArea *draw_area)
color_button_color_set (GtkColorDialogButton *button,
GParamSpec *pspec,
DrawingArea *draw_area)
{
GdkRGBA color;
const GdkRGBA *color;
gtk_color_chooser_get_rgba (GTK_COLOR_CHOOSER (button), &color);
drawing_area_set_color (draw_area, &color);
color = gtk_color_dialog_button_get_rgba (button);
drawing_area_set_color (draw_area, color);
}
static void
drawing_area_color_set (DrawingArea *area,
GdkRGBA *color,
GtkColorButton *button)
drawing_area_color_set (DrawingArea *area,
GdkRGBA *color,
GtkColorDialogButton *button)
{
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (button), color);
gtk_color_dialog_button_set_rgba (button, color);
}
GtkWidget *
@@ -394,13 +397,13 @@ do_paint (GtkWidget *toplevel)
headerbar = gtk_header_bar_new ();
colorbutton = gtk_color_button_new ();
g_signal_connect (colorbutton, "color-set",
colorbutton = gtk_color_dialog_button_new (gtk_color_dialog_new ());
g_signal_connect (colorbutton, "notify::rgba",
G_CALLBACK (color_button_color_set), draw_area);
g_signal_connect (draw_area, "color-set",
G_CALLBACK (drawing_area_color_set), colorbutton);
gtk_color_chooser_set_rgba (GTK_COLOR_CHOOSER (colorbutton),
&(GdkRGBA) { 0, 0, 0, 1 });
gtk_color_dialog_button_set_rgba (GTK_COLOR_DIALOG_BUTTON (colorbutton),
&(GdkRGBA) { 0, 0, 0, 1 });
gtk_header_bar_pack_end (GTK_HEADER_BAR (headerbar), colorbutton);
gtk_window_set_titlebar (GTK_WINDOW (window), headerbar);
@@ -409,7 +412,7 @@ do_paint (GtkWidget *toplevel)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -175,7 +175,7 @@ do_paintable (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -214,7 +214,7 @@ do_paintable_animated (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -177,7 +177,7 @@ do_paintable_emblem (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -307,7 +307,7 @@ do_paintable_mediastream (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -13,25 +13,24 @@
static void
open_response_cb (GtkNativeDialog *dialog,
int response,
GtkPicture *picture)
open_response_cb (GObject *source,
GAsyncResult *result,
void *data)
{
gtk_native_dialog_hide (dialog);
GtkFileDialog *dialog = GTK_FILE_DIALOG (source);
GtkPicture *picture = data;
GFile *file;
if (response == GTK_RESPONSE_ACCEPT)
file = gtk_file_dialog_open_finish (dialog, result, NULL);
if (file)
{
GFile *file;
GdkPaintable *paintable;
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
paintable = svg_paintable_new (file);
gtk_picture_set_paintable (GTK_PICTURE (picture), paintable);
g_object_unref (paintable);
g_object_unref (file);
}
gtk_native_dialog_destroy (dialog);
}
static void
@@ -39,20 +38,25 @@ show_file_open (GtkWidget *button,
GtkPicture *picture)
{
GtkFileFilter *filter;
GtkFileChooserNative *dialog;
GtkFileDialog *dialog;
GListStore *filters;
dialog = gtk_file_chooser_native_new ("Open node file",
GTK_WINDOW (gtk_widget_get_root (button)),
GTK_FILE_CHOOSER_ACTION_OPEN,
"_Load",
"_Cancel");
dialog = gtk_file_dialog_new ();
gtk_file_dialog_set_title (dialog, "Open node file");
filter = gtk_file_filter_new ();
gtk_file_filter_add_mime_type (filter, "image/svg+xml");
gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (dialog), filter);
gtk_native_dialog_set_modal (GTK_NATIVE_DIALOG (dialog), TRUE);
g_signal_connect (dialog, "response", G_CALLBACK (open_response_cb), picture);
gtk_native_dialog_show (GTK_NATIVE_DIALOG (dialog));
filters = g_list_store_new (GTK_TYPE_FILE_FILTER);
g_list_store_append (filters, filter);
g_object_unref (filter);
gtk_file_dialog_set_filters (dialog, G_LIST_MODEL (filters));
g_object_unref (filters);
gtk_file_dialog_open (dialog,
GTK_WINDOW (gtk_widget_get_root (button)),
NULL,
NULL,
open_response_cb, picture);
}
static GtkWidget *window;

View File

@@ -200,7 +200,7 @@ do_paintable_symbolic (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -82,7 +82,7 @@ do_panes (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -90,7 +90,7 @@ do_password_entry (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -1,5 +1,5 @@
/* Peg Solitaire
* #Keywords: GtkGridView, game
* #Keywords: GtkGridView, game, drag-and-drop, dnd
*
* This demo demonstrates how to use drag-and-drop to implement peg solitaire.
*
@@ -8,6 +8,7 @@
#include "config.h"
#include <gtk/gtk.h>
/* Create an object for the pegs that get moved around in the game.
*
* We implement the GdkPaintable interface for them, so we can use GtkPicture
@@ -119,12 +120,6 @@ solitaire_peg_new (void)
/*** Helper for finding a win ***/
static void
ended (GObject *object)
{
g_object_unref (object);
}
static void
celebrate (gboolean win)
{
@@ -134,12 +129,12 @@ celebrate (gboolean win)
if (win)
path = g_build_filename (GTK_DATADIR, "sounds", "freedesktop", "stereo", "complete.oga", NULL);
else
path = g_build_filename (GTK_DATADIR, "sounds", "freedesktop", "stereo", "dialog-error.oga", NULL);
path = g_build_filename (GTK_DATADIR, "sounds", "freedesktop", "stereo", "suspend-error.oga", NULL);
stream = gtk_media_file_new_for_filename (path);
gtk_media_stream_set_volume (stream, 1.0);
gtk_media_stream_play (stream);
g_signal_connect (stream, "notify::ended", G_CALLBACK (ended), NULL);
g_signal_connect (stream, "notify::ended", G_CALLBACK (g_object_unref), NULL);
g_free (path);
}
@@ -365,6 +360,15 @@ drop_drop (GtkDropTarget *target,
return TRUE;
}
static void
remove_provider (gpointer data)
{
GtkStyleProvider *provider = GTK_STYLE_PROVIDER (data);
gtk_style_context_remove_provider_for_display (gdk_display_get_default (), provider);
g_object_unref (provider);
}
static void
create_board (GtkWidget *window)
{
@@ -381,6 +385,9 @@ create_board (GtkWidget *window)
provider = gtk_css_provider_new ();
gtk_css_provider_load_from_data (provider, css, -1);
gtk_style_context_add_provider_for_display (gdk_display_get_default (),
GTK_STYLE_PROVIDER (provider),
800);
grid = gtk_grid_new ();
gtk_widget_set_halign (grid, GTK_ALIGN_CENTER);
@@ -399,9 +406,6 @@ create_board (GtkWidget *window)
continue;
image = gtk_image_new ();
gtk_style_context_add_provider (gtk_widget_get_style_context (image),
GTK_STYLE_PROVIDER (provider),
800);
gtk_widget_add_css_class (image, "solitaire-field");
gtk_image_set_icon_size (GTK_IMAGE (image), GTK_ICON_SIZE_LARGE);
if (x != 3 || y != 3)
@@ -445,7 +449,7 @@ create_board (GtkWidget *window)
}
}
g_object_unref (provider);
g_object_set_data_full (G_OBJECT (window), "provider", provider, remove_provider);
}
static void
@@ -483,7 +487,7 @@ do_peg_solitaire (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -1,5 +1,5 @@
/* Pickers
* #Keywords: GtkColorChooser, GtkFontChooser, GtkApplicationChooser
* #Keywords: GtkColorDialog, GtkFontDialog, GtkFileDialog
*
* These widgets are mainly intended for use in preference dialogs.
* They allow to select colors, fonts and applications.
@@ -10,55 +10,66 @@
#include <gtk/gtk.h>
static gboolean
filter_font_cb (const PangoFontFamily *family,
const PangoFontFace *face,
gpointer data)
static void
file_opened (GObject *source,
GAsyncResult *result,
void *data)
{
const char *alias_families[] = {
"Cursive",
"Fantasy",
"Monospace",
"Sans",
"Serif",
"System-ui",
NULL
};
const char *family_name;
GFile *file;
GError *error = NULL;
char *name;
family_name = pango_font_family_get_name (PANGO_FONT_FAMILY (family));
file = gtk_file_dialog_open_finish (GTK_FILE_DIALOG (source), result, &error);
return g_strv_contains (alias_families, family_name);
if (!file)
{
g_print ("%s\n", error->message);
g_error_free (error);
return;
}
name = g_file_get_basename (file);
gtk_label_set_label (GTK_LABEL (data), name);
g_free (name);
}
#define COLOR(r,g,b) { r/255., g/255., b/255., 1.0 }
static gboolean
abort_mission (gpointer data)
{
GCancellable *cancellable = data;
g_cancellable_cancel (cancellable);
return G_SOURCE_REMOVE;
}
static void
open_file (GtkButton *picker,
GtkLabel *label)
{
GtkWindow *parent = GTK_WINDOW (gtk_widget_get_root (GTK_WIDGET (picker)));
GtkFileDialog *dialog;
GCancellable *cancellable;
dialog = gtk_file_dialog_new ();
cancellable = g_cancellable_new ();
g_timeout_add_seconds_full (G_PRIORITY_DEFAULT,
20,
abort_mission, g_object_ref (cancellable), g_object_unref);
gtk_file_dialog_open (dialog, parent, NULL, cancellable, file_opened, label);
g_object_unref (cancellable);
g_object_unref (dialog);
}
GtkWidget *
do_pickers (GtkWidget *do_widget)
{
static GtkWidget *window = NULL;
GtkWidget *table, *label, *picker;
GdkRGBA solarized[] = {
COLOR (0xff, 0xff, 0xff),
COLOR (0x07, 0x36, 0x42),
COLOR (0xdc, 0x32, 0x2f),
COLOR (0x85, 0x99, 0x00),
COLOR (0xb5, 0x89, 0x00),
COLOR (0x26, 0x8b, 0xd2),
COLOR (0xd3, 0x36, 0x82),
COLOR (0x2a, 0xa1, 0x98),
COLOR (0xee, 0xe8, 0xd5),
COLOR (0x00, 0x00, 0x00),
COLOR (0x00, 0x2b, 0x36),
COLOR (0xcb, 0x4b, 0x16),
COLOR (0x58, 0x6e, 0x75),
COLOR (0x65, 0x7b, 0x83),
COLOR (0x83, 0x94, 0x96),
COLOR (0x6c, 0x71, 0xc4),
COLOR (0x93, 0xa1, 0xa1),
COLOR (0xfd, 0xf6, 0xe3),
};
GtkWidget *table, *label, *picker, *button;
if (!window)
{
@@ -77,60 +88,59 @@ do_pickers (GtkWidget *do_widget)
gtk_grid_set_column_spacing (GTK_GRID (table), 10);
gtk_window_set_child (GTK_WINDOW (window), table);
label = gtk_label_new ("Standard");
gtk_widget_add_css_class (label, "title-4");
gtk_grid_attach (GTK_GRID (table), label, 1, -1, 1, 1);
label = gtk_label_new ("Custom");
gtk_widget_add_css_class (label, "title-4");
gtk_grid_attach (GTK_GRID (table), label, 2, -1, 1, 1);
label = gtk_label_new ("Color:");
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_widget_set_hexpand (label, TRUE);
gtk_grid_attach (GTK_GRID (table), label, 0, 0, 1, 1);
picker = gtk_color_button_new ();
picker = gtk_color_dialog_button_new (gtk_color_dialog_new ());
gtk_grid_attach (GTK_GRID (table), picker, 1, 0, 1, 1);
picker = gtk_color_button_new ();
gtk_color_button_set_title (GTK_COLOR_BUTTON (picker), "Solarized colors");
gtk_color_chooser_add_palette (GTK_COLOR_CHOOSER (picker),
GTK_ORIENTATION_HORIZONTAL,
9,
18,
solarized);
gtk_grid_attach (GTK_GRID (table), picker, 2, 0, 1, 1);
label = gtk_label_new ("Font:");
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_widget_set_hexpand (label, TRUE);
gtk_grid_attach (GTK_GRID (table), label, 0, 1, 1, 1);
picker = gtk_font_button_new ();
picker = gtk_font_dialog_button_new (gtk_font_dialog_new ());
gtk_grid_attach (GTK_GRID (table), picker, 1, 1, 1, 1);
picker = gtk_font_button_new ();
gtk_font_chooser_set_level (GTK_FONT_CHOOSER (picker),
GTK_FONT_CHOOSER_LEVEL_FAMILY |
GTK_FONT_CHOOSER_LEVEL_SIZE);
gtk_font_chooser_set_filter_func (GTK_FONT_CHOOSER (picker), filter_font_cb, NULL, NULL);
label = gtk_label_new ("File:");
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_widget_set_hexpand (label, TRUE);
gtk_grid_attach (GTK_GRID (table), label, 0, 2, 1, 1);
gtk_grid_attach (GTK_GRID (table), picker, 2, 1, 1, 1);
picker = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 10);
button = gtk_button_new_from_icon_name ("document-open-symbolic");
label = gtk_label_new ("None");
gtk_label_set_xalign (GTK_LABEL (label), 0.);
gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_MIDDLE);
gtk_widget_set_hexpand (label, TRUE);
g_signal_connect (button, "clicked", G_CALLBACK (open_file), label);
gtk_box_append (GTK_BOX (picker), label);
gtk_box_append (GTK_BOX (picker), button);
gtk_grid_attach (GTK_GRID (table), picker, 1, 2, 1, 1);
G_GNUC_BEGIN_IGNORE_DEPRECATIONS
label = gtk_label_new ("Mail:");
gtk_widget_set_halign (label, GTK_ALIGN_START);
gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
gtk_widget_set_hexpand (label, TRUE);
picker = gtk_app_chooser_button_new ("x-scheme-handler/mailto");
gtk_app_chooser_button_set_show_dialog_item (GTK_APP_CHOOSER_BUTTON (picker), TRUE);
G_GNUC_END_IGNORE_DEPRECATIONS
gtk_grid_attach (GTK_GRID (table), label, 0, 3, 1, 1);
gtk_grid_attach (GTK_GRID (table), picker, 1, 3, 1, 1);
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -16,7 +16,6 @@ enum {
NUM_PROPERTIES
};
G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
static void
pixbuf_paintable_snapshot (GdkPaintable *paintable,
GdkSnapshot *snapshot,
@@ -37,7 +36,6 @@ pixbuf_paintable_snapshot (GdkPaintable *paintable,
g_object_unref (texture);
}
G_GNUC_END_IGNORE_DEPRECATIONS;
static int
pixbuf_paintable_get_intrinsic_width (GdkPaintable *paintable)

View File

@@ -177,19 +177,12 @@ do_printing (GtkWidget *do_widget)
if (error)
{
GtkWidget *dialog;
GtkAlertDialog *dialog;
dialog = gtk_message_dialog_new (GTK_WINDOW (do_widget),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_CLOSE,
"%s", error->message);
dialog = gtk_alert_dialog_new ("%s", error->message);
gtk_alert_dialog_show (dialog, GTK_WINDOW (do_widget));
g_object_unref (dialog);
g_error_free (error);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_window_destroy), NULL);
gtk_widget_show (dialog);
}

View File

@@ -231,7 +231,7 @@ do_read_more (GtkWidget *do_widget)
}
if (!gtk_widget_get_visible (window))
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
else
gtk_window_destroy (GTK_WINDOW (window));

View File

@@ -90,7 +90,7 @@ do_revealer (GtkWidget *do_widget)
{
count = 0;
timeout = g_timeout_add (690, reveal_one, window);
gtk_widget_show (window);
gtk_widget_set_visible (window, TRUE);
}
else
{

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