Commit Graph

38949 Commits

Author SHA1 Message Date
Matthias Clasen
4759afcc3e textview: Set line height from css
Set the line height in the default attributes from
the CSS style. This makes line height work in
GtkTextView.
2021-08-22 15:15:50 -04:00
Matthias Clasen
66b297e408 textview: Add line height plumbing
This adds a line-height property to GtkTexttag and a
line_height field to GtkTextAttributes, and translates
it to a pango attribute.
2021-08-22 15:15:50 -04:00
Matthias Clasen
ae767dc5bf css: Translate line-height to a Pango
Pango 1.50 introduces a line-height attribute. Use it.
This is enough to make line-height work for labels
and entries.
2021-08-22 15:15:50 -04:00
Matthias Clasen
d923402934 css: Add line-height property
This adds the plumbing to parse the line-height
property from CSS. Widgets are not picking it
up yet.
2021-08-22 15:15:50 -04:00
Matthias Clasen
7be3c2974a windowhandle: Quiet a compiler warning
gesture was left uninitialized in the default case.
2021-08-22 14:19:14 -04:00
Matthias Clasen
fd885e42b0 Merge branch 'drop-gl' into 'master'
gsk: Drop the gl renderer

See merge request GNOME/gtk!3863
2021-08-22 17:04:25 +00:00
Matthias Clasen
1bf5aab18c testutils: Don't include gsk/gl/gskglrenderer.h 2021-08-22 12:29:13 -04:00
Matthias Clasen
5feba67a3d Handle new pango attribute type
Update all the places where we switch over
PangoAttrType to handle PANGO_ATTR_TEXT_TRANSFORM,
and do nothing for now - text-transform support
will land in 4.6.
2021-08-22 11:04:28 -04:00
Matthias Clasen
92817b0603 Merge branch 'cut-shortcut-activation-short' into 'master'
shortcutcontroller: Only do round-robin for mnemonics

Closes #4130

See merge request GNOME/gtk!3824
2021-08-20 13:50:51 +00:00
Matthias Clasen
f8a1726ffa shortcutcontroller: Only do round-robin for mnemonics
Don't do round-robin activation unless we are looking
for mnemonics, where this is an expected feature.

Fixes: #4130
2021-08-20 09:26:37 -04:00
Emmanuele Bassi
12c5518e2b Merge branch 'master' into 'master'
a11y: Send correct object reference for the root accessible

See merge request GNOME/gtk!3800
2021-08-20 13:18:37 +00:00
Matthias Clasen
da1232caaf textview: Don't eat block cursors
We need to render even an empty paragraph when
it has a block cursor at the end. This fixes block
cursors not showing up in empty lines.
2021-08-20 01:57:31 -04:00
Matthias Clasen
f5b6488eb2 window: Make resizeability changes work
We were forgetting to update the toplevel
properties here.
2021-08-19 16:03:58 -04:00
Matthias Clasen
8aa25046dc textview: Improve word selection
Avoid selecting a whole extra paragraph when a select-by-words
selection is extended beyond the end of the previous paragraph.

Fixes: #4177
2021-08-19 00:33:03 -04:00
Matthias Clasen
071a6bcc06 Cosmetics 2021-08-18 22:33:23 -04:00
Matthias Clasen
1599b659cf infobar: Update buildable docs
Document the current state of GtkBuilder support in
GtkInfoBar, not what we had in GTK3.

Fixes: #4164
2021-08-18 17:42:54 -04:00
Matthias Clasen
81e5d4c327 Merge branch 'master' into 'master'
gtkbuilderparser: Fix duplicate object id detection

See merge request GNOME/gtk!3848
2021-08-18 12:00:41 +00:00
Ye Moran
f8111125ef gtkbuilderparser: Fix duplicate object id detection 2021-08-18 12:00:40 +00:00
Matthias Clasen
f6659fea8d imcontext: Improve docs
Add some more docs around GtkIMContext.
2021-08-17 22:33:26 -04:00
Alexander Mikhaylenko
342f02711b widget: Fix gtk_widget_class_query_action() annotations
Add transfer none on all out values as they aren't being copied.
2021-08-11 14:33:38 +05:00
Matthias Clasen
528ebfabf0 Handle the new line height pango attribute
Update all the places where we switch over PangoAttributeType
to handle (and ignore, for now) the new line height attribute.
2021-08-10 08:22:52 -04:00
Matthias Clasen
04f3c8054b Merge branch 'callback-annotation-again' into 'master'
widget: Change callback scope

See merge request GNOME/gtk!3796
2021-08-10 01:16:56 +00:00
Matthias Clasen
4e1ea58503 Cosmetics: Tweak css parser error messages
These show up in tooltips, so they should a) be capitalized
and b) not end with a period.
2021-08-07 18:18:10 -04:00
Matthias Clasen
f328ab9d83 Merge branch 'wip/chergert/revert-top-margin' into 'master'
Revert "textview: fix yoffset position when top_margin is set"

See merge request GNOME/gtk!3828
2021-08-06 13:13:21 +00:00
Matthias Clasen
bdbe0acd1f Merge branch 'matthiasc/for-master' into 'master'
settings: Default gtk-split-cursor to FALSE

See merge request GNOME/gtk!3827
2021-08-05 19:17:54 +00:00
Christian Hergert
fc701baef8 Revert "textview: fix yoffset position when top_margin is set"
This reverts commit 908b1e5e12.

This commit broke top-margin altogether.
2021-08-05 11:52:45 -07:00
Matthias Clasen
a457a81fd9 Merge branch 'matthiasc/for-master' into 'master'
text: Move setup code out of a loop

See merge request GNOME/gtk!3826
2021-08-05 18:45:39 +00:00
Matthias Clasen
4cc7977d36 settings: Default gtk-split-cursor to FALSE
According to Owen, this was the intention when the setting
was added in 2001. It only took us 20 years to fix the
default value.
2021-08-05 14:05:28 -04:00
Matthias Clasen
916886312a Merge branch 'wip/exalm/shadow-extents' into 'master'
Shrink shadow extents

See merge request GNOME/gtk!3825
2021-08-05 16:39:52 +00:00
Matthias Clasen
8ff94ea1f2 text: Move setup code out of a loop
Just a cleanup, no functional change.
2021-08-05 12:31:18 -04:00
vanadiae
a3ce574193 popover: Cycle around focus with (Shift+)Tab
Same thing as the previous popovermenu commit, except for the base popover
because the popovermenu needs special behaviour with e.g. sides arrow so
we need to have the "cycle around" for regular popovers here too.
2021-08-04 12:11:44 +02:00
vanadiae
ef92adc87d popovermenu: Cycle around focus also with (Shift+)Tab
Currently when moving the focus with (Shift+)Tab, it also traverses the window's
widgets, although it would be expected that the focus stays within the popover,
as it's (almost) like it's a separate window. This would be consistent with
the behaviour of the Up/down arrows, which do cycle around the focus once it
reaches the end.

So this commit makes the popovermenu cycle around focus in any direction, apart
from left/right because they are used to open and close submenus and it wouldn't
make sense anyway to cycle horizontally as there's usually only one widget per
line.
2021-08-04 12:11:44 +02:00
Alexander Mikhaylenko
46a9538b6a Shrink shadow extents
Long time ago, Cairo shadows in both GTK3 and 4 were drawn at a size about
twice their radius. Eventually this was fixed but the shadow extents are
still calculated for the previous size and appear unreasonably large: for
example, 141px for a 50px radius shadow. This can get very noticeable in
places such as invisible window frame which gets included into screenshots.

https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/3419 just divides the
radius by 2 when drawing a shadow with Cairo, do the same when calculating
extents.

See https://gitlab.gnome.org/GNOME/gtk/-/issues/3841
2021-08-04 14:47:17 +05:00
Matthias Clasen
04ea51e843 treepopover: Start adding keynav
Arrange for the items to be focusable, and add keyboard
activation. Still missing: cycling focus inside the
popover.
2021-08-02 23:49:05 -04:00
Matthias Clasen
f7dc0dda4e Merge branch 'big-keysyms' into 'master'
imcontext: Treat keysyms as 32bit values

Closes #4149

See merge request GNOME/gtk!3819
2021-08-03 01:05:16 +00:00
Matthias Clasen
d119c55b72 textview: Fix the get_surrounding implementation
This was, sadly, returning garbage.
2021-08-02 20:44:40 -04:00
Matthias Clasen
253e25a73c Add a private getter for the textview key controller
This will be used in tests.
2021-08-02 20:44:40 -04:00
Matthias Clasen
c63774967f Remove an unimplemented function
_gtk_entry_get_im_context does not exist.
2021-08-02 20:44:40 -04:00
Matthias Clasen
bbc36448fb imcontext: Treat keysyms as 32bit values
Our compose table format is still limited to 16bit
values for keysyms, but what we see in key events
can be 32bit values, and we treat them as such now.

Fixes: #4149
2021-08-02 19:16:18 -04:00
Matthias Clasen
5df323fb64 Merge branch 'fix-custom-widget-menu-focus' into 'master'
menusectionbox: Passthrough the focus function of custom widgets' gizmo

Closes gnome-text-editor#93

See merge request GNOME/gtk!3817
2021-08-02 22:21:08 +00:00
Matthias Clasen
0f2c5f13be Merge branch 'wip/otte/for-master' into 'master'
video: Use cross-fade transition to avoid resizes

See merge request GNOME/gtk!3815
2021-08-02 22:19:39 +00:00
James Westman
fb0229890b
gtkgesturerotate: Fix assertion
Fixes #4144. An assertion would be printed when GtkGestureRotate was
used with a touchscreen.
2021-08-02 16:38:35 -05:00
vanadiae
9099888398 menusectionbox: Passthrough the focus function of custom widgets' gizmo
It broke keyboard focusing any widget added through the custom widget
menu feature. So for example if you put e.g. a custom check box widget
in a menu, you won't be able to focus it.

This is because the gizmo is mostly used to custom drawing with e.g.
CSS for small visual elements like scale markers. That's probably why
gizmo's default focus overrides block the focus from going through
the children. So this commit fixes it by overriding those and passing
the focus through the children.
2021-08-02 21:20:32 +02:00
Benjamin Otte
882855f865 video: Use cross-fade transition to avoid resizes
Slide animations cause changes in the size requests due to the
behavior of GtkRevealer. We can avoid those by using cross-fades, which
don't have that problem.

Besides, cross-fades look better anyway.
2021-08-02 20:11:32 +02:00
Matthias Clasen
f59d2ae89d Merge branch 'input-tweaks' into 'master'
imcontext: Tweak Compose sequence preedit

Closes #10, #4127, and #4124

See merge request GNOME/gtk!3799
2021-08-02 18:07:46 +00:00
Matthias Clasen
1e22572716 Avoid pango deprecations
This function has been deprecated on the main
branch of pango. Since we don't want to bump our
pango dependency to 1.49 yet, ignore the deprecation.
2021-08-01 23:20:01 -04:00
Matthias Clasen
c51f2fc0ec label: Ignore __ for mnemonics
We were not ignoring double underscores for mnemonics
in one place, as we should.

Fixes: #4129
2021-08-01 22:14:12 -04:00
Matthias Clasen
2a528df977 Merge branch 'titlebar-gesture' into 'master'
Delegate titlebar action to the compositor if possible

See merge request GNOME/gtk!3797
2021-08-02 01:14:08 +00:00
Matthias Clasen
47072e0441 Merge branch 'fix-iconhelper' into 'master'
iconhelper: Fix the paintable implementation

Closes #4140

See merge request GNOME/gtk!3809
2021-07-31 20:35:08 +00:00
Emmanuele Bassi
95f2634ea9 Merge branch 'iter-is-valid-docs' into 'master'
docs: Fix iter_is_valid() description

See merge request GNOME/gtk!3810
2021-07-31 13:07:07 +00:00
Emmanuele Bassi
95c032f531 docs: Fix iter_is_valid() description
Drop the "WARNING" and the block quote, and follow the existing
documentation style guidelines.
2021-07-31 13:41:13 +01:00
Matthias Clasen
744955753f iconhelper: Fix the paintable implementation
get_current_image was recursing due to an obvious typo.

Fixes: #4140
2021-07-31 08:27:17 -04:00
Florian Müllner
1728aa581c checkbutton: Activate when moving focus
Currently we update the :active property on both the previous and
new focus button. That "visually activate" the button and will
emit ::toggled, but if the button is associated with an action,
the action state won't change.

Fix that by activating the new focus instead of explicitly fiddling
with the :active property.
2021-07-30 20:34:24 +02:00
Florian Müllner
c50475de34 checkbutton: Delegate ::activate to the helper if appropriate
If the button is associated with an action, the action is currently
only activated when the button is clicked, not when it is activated.
2021-07-30 20:34:24 +02:00
Mike Gorse
5d7ecb7a6e a11y: Remove unneeded check 2021-07-30 08:58:27 -05:00
Matthias Clasen
c4dbb8f01e imcontext: Code cleanup 2021-07-29 20:37:58 -04:00
Matthias Clasen
e67b2cb54b composetable: Allow multiple dead keys
Remove the limitation on the number of dead keys
that we match, and allow the result be be multiple
characters.

Regenerate the builtin sequences, since this changes
what dead key sequences we can reproduce algorithmically.

Update tests to match.

Fixes: #10
2021-07-29 20:37:30 -04:00
Christian Hergert
908b1e5e12 textview: fix yoffset position when top_margin is set
This doesn't need to be included in the calculation or it will cause the
yoffset to continually shift while the window is resized.

Fixes #4134
2021-07-29 16:45:04 -07:00
Matthias Clasen
539391ce6c composetable: Change an API
Make gtk_check_algorithmically take a GString
for the result. This is in preparation for allowing
multi-character results here, in the future.

Update all callers.
2021-07-29 17:29:25 -04:00
Mike Gorse
7fc90aed26 a11y: Send correct object reference for the root accessible 2021-07-29 15:55:58 -05:00
Florian Müllner
23e79d2eb2 gtk/windowhandle: Delegate titlebar action to the compositor if possible
Delegating the action to the compositor not only improves consistency
with server-side decorations, but also allows for actions that aren't
available client-side (like lower-in-middle-click).

https://gitlab.gnome.org/GNOME/mutter/-/issues/602
2021-07-29 21:39:32 +02:00
Matthias Clasen
b6c0155836 imcontext: Handle Escape in Compose sequence
Treat Escape the same in hex sequences and in
Compose sequence: reset the state.
2021-07-29 08:39:17 -04:00
Matthias Clasen
76d67b586c imcontext: Tweak Compose sequence handling
When we don't have any matches for a Compose sequence
anymore, beep, and keep the preedit as it was for the
last match.

Fixes: #4127
2021-07-29 08:24:14 -04:00
Matthias Clasen
914edb1472 composetable: Add a prefix api
Add a function that computes the longest prefix
of a buffer for which a compose table has matches.
2021-07-29 08:23:40 -04:00
Matthias Clasen
dbf5033f94 composetable: Reduce the scope of a variable
'prefix' is not a good name for a file-scope variable,
move it into the sole function using it.
2021-07-29 08:22:52 -04:00
Matthias Clasen
cc6ecc8b62 Merge branch 'source-static-name' into 'master'
Avoid copying static debug strings

See merge request GNOME/gtk!3789
2021-07-29 11:59:02 +00:00
Matthias Clasen
b7e6922605 imcontext: Tweak Compose sequence preedit
When sequences contain multiple Compose keys,
don't hide the first one. This is a very fringe
case, but it matches the behavior of IBus.

Fixes: #4124
2021-07-29 07:36:48 -04:00
Matthias Clasen
19b534f7de Avoid copying static debug strings
The g_source_set_name calls were showing up as a
major source of strdups in our profiles. Avoid that
by using new GLib api when available.
2021-07-28 22:42:46 -04:00
Florian Müllner
bc386c9a60 widget: Change callback scope
Look who changed his mind since commit 8e2ffb3b46 :-)

The "call" scope means that the callback is only used during the
function call itself (here: gtk_widget_class_install_action()).

That's clearly wrong here, as the callback is invoked every time
the action is activated.

Arguably the "notified" scope is a better match here, where the
lack of a GDestroyNotify parameter suggests that the callback may
be used forever (which is the case here).

Related: #3498
2021-07-28 21:48:01 +02:00
Chun-wei Fan
108c423d70 compose-parse.c: Include stdlib.h
That is needed for exit(), and it may not have been included by the
other headers.
2021-07-28 15:18:36 +08:00
Matthias Clasen
910f23ea19 Merge branch 'wip/otte/widgetfactory-dnd' into 'master'
Improve DND

See merge request GNOME/gtk!3785
2021-07-27 04:12:58 +00:00
Benjamin Otte
192bfa10cb droptarget: Make formats construct-only writable
This way, it can be set in GtkBuilder.

Also make sure to only ever look at the GTypes set in the formats, as
GtkDropTarget cannot deal with mime types.
2021-07-27 04:28:04 +02:00
Benjamin Otte
0781429dc5 builder: Add support for GdkContentFormats 2021-07-27 04:28:04 +02:00
Matthias Clasen
5c4aba4b9c Merge branch 'wip/compose-parser' into 'master'
Clean up the GtkComposeTable api

See merge request GNOME/gtk!3746
2021-07-26 11:51:14 +00:00
Matthias Clasen
d76460343a sizerequest: Simplify some code
Avoid some repeated MAX().
2021-07-24 18:49:41 -04:00
Matthias Clasen
0d8dd0c664 sizerequest: Keep branches in sync
There are some unintentional differences between
the path that uses a layout manager, and the path
that uses widget vfuncs. Sync them up.
2021-07-24 18:49:41 -04:00
Matthias Clasen
ee6491f717 widget: Avoid some unnecessary back-and-forth casting
Avoid some unnecessary casting and a redundant early exit.
2021-07-24 18:49:27 -04:00
Matthias Clasen
7044951dab widget: Avoid GObject data for action muxer
Most widget have an action muxer now, so just
store it in GtkWidgetPrivate.
2021-07-24 18:48:10 -04:00
Matthias Clasen
98986a25f9 layoutmanager: Avoid some overhead
Use inline getters for some things.
2021-07-24 18:48:10 -04:00
Matthias Clasen
ae3e586714 gridlayout: Avoid some unnecessary overhead
Use inline functions for some things.
2021-07-24 18:48:10 -04:00
Matthias Clasen
6f04ec9dae Merge branch 'wip/exalm/gtktext-selection-fix' into 'master'
text: Use the widget y coordinate for gestures

See merge request GNOME/gtk!3780
2021-07-23 20:29:07 +00:00
Alexander Mikhaylenko
00cc99818d text: Use the widget y coordinate for gestures
Currently we use layout coordinates and widget height when determining
where a click or drag has happened. If the widget has top padding (which it
does inside a GtkEntry, for example), the area where it's possible to select
text is shifted down, so the part of GtkText above the layout is not counted
as the draggable area and instead the equal area below the widget is counted.

Since GtkText is always single-line, there's no need to do any of that and
we can use widget coordinates. Then the draggable area matches the widget
and the problems goes away.
2021-07-23 23:37:36 +05:00
Matthias Clasen
4c41ef8de3 stack: GtkStackPage:name is not construct-only
We have a setter for this property, so we clearly
weren't serious when we marked it as construct-only.

Fixes: #4109
2021-07-22 16:55:15 -04:00
Matthias Clasen
a10b1b7341 Add more sysprof marks
Add a few more marks during gtk_init to figure out where
our startup time goes, and avoid the sysprof initialization
from distorting the first mark.
2021-07-22 12:51:32 -04:00
Benjamin Otte
72e2a46c05 inspector: Add support for displaying GL errors
Also, no need to show a GL version if GL isn't available.
2021-07-22 16:27:32 +02:00
Matthias Clasen
bdee75cd0f Sync included icons from adwaita-icon-theme
Make sure we stay in sync with the Adwaita.
2021-07-20 17:26:59 -04:00
Benjamin Otte
af0c95c11a build: Remove sassc option
Instead, ensure that sassc is made madatory on git builds (because
it is, we don't ship CSS files anymore) and not even looked for in
release builds (because do ship CSS files there).
2021-07-20 14:00:25 -04:00
Matthias Clasen
3883a98771 Merge branch 'fix-dialog-docs' into 'master'
gtk/builder: Port example to GTK 4

See merge request GNOME/gtk!3772
2021-07-20 12:54:55 +00:00
Maximiliano Sandoval R
aa6a9de6ba
gtk/builder: Port example to GTK 4 2021-07-20 13:22:08 +02:00
Maximiliano Sandoval R
ead31db096
password_entry: Header Capitalization on tooltip
See https://teams.pages.gitlab.gnome.org/Design/hig-www/feedback/tooltips.html
2021-07-20 13:00:05 +02:00
Benjamin Otte
a76f515569 cssimagecrossfade: Don't abort() when failing to parse image
The code wasn't checking if parsing an image failed and just returning
success.

Testcase from bug is attached.

Fixes #4101
2021-07-16 17:50:09 +02:00
Matthias Clasen
6ff85d287a Merge branch 'wip/chergert/fix-texthistory-insert' into 'master'
texthistory: fix calculation of n_chars

See merge request GNOME/gtk!3756
2021-07-16 11:04:21 +00:00
Christian Hergert
5d02a8f5db texthistory: fix calculation of n_chars
This should be the number of characters, not the end position. This fixes
an issue where we wouldn't coalesce insert actions together.
2021-07-15 21:26:30 -07:00
Matthias Clasen
b70b058b66 Merge branch 'transparent-optimizations' into 'master'
snapshot: Handle transparent opacity nodes correctly

See merge request GNOME/gtk!3754
2021-07-15 18:39:48 +00:00
Matthias Clasen
aaa68954c3 snapshot: Handle transparent opacity nodes correctly
Eliding totally transparent content from the node tree is
not 100% correct, since filters can make things visible, so
we need to at least preserve the bounds. We can do that by
creating a transparent color node.
2021-07-15 13:18:23 -04:00
Timm Bäder
433233258b snapshot: Only compute start and end point if we have to
If the linear gradient results in a color node, we don't need the start
and end point. Only declare and compute it if we need to.
2021-07-15 16:52:38 +02:00
Timm Bäder
3eed61deba snapshot: Replace trivial gradients with color nodes
Extend this to all existing gradient types
2021-07-15 16:51:17 +02:00
Matthias Clasen
87e2a02e0c composetable: Rewrite Compose files if necessary
Apply heuristics to avoid breaking users existing configurations
with the change to not always add the default sequences.

If we find a cache that was generated before 4.4, and the Compose
file does not have an include, and doesn't contain so many sequences
that it is probably a copy of the system one, we take steps to keep
things working, and thell the user about it.
2021-07-15 09:30:09 -04:00
Matthias Clasen
264d592012 composetable: Keep the number of sequences
And print it out in tests.

Update all tests for this.
2021-07-15 09:30:01 -04:00
Matthias Clasen
4390f8102b imcontext: Improve the docs
Add more details about supported input methods.
2021-07-13 22:03:23 -04:00