Commit Graph

39251 Commits

Author SHA1 Message Date
Jakub Steiner
d74e62886c selections: have unfocused state
- text selections for unfocused elements - textview, label, entry,
  spinbutton

fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/4393
2021-12-10 12:00:12 +01:00
Jakub Steiner
d8505f09eb Revert "styling: Have unfocused selections"
This reverts commit 96f63a6bf3.
2021-12-10 11:36:10 +01:00
Christian Hergert
99a8202015 macos: fix crash in imcontextquartz 2021-12-09 12:26:33 -08:00
Benjamin Otte
17c903e246 Merge branch 'fix-picture-natural-size-0' into 'main'
picture: Return natural size 0 for size 0

See merge request GNOME/gtk!4177
2021-12-08 19:33:28 +00:00
Ivan Molodetskikh
7ef54e9c53 picture: Return natural size 0 for size 0
It was returning the full natural size (same as -1) due to default value
handling in the code below.

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

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

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

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

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

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

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

Related #4422
2021-12-07 22:42:04 -08:00
Benjamin Otte
ce7b0656c0 viewport: Allocate properly
Instead of allocation width for height for width for height or whatever
that code was doing, actually allocate the size we were given or the
requested size, whatever is larger.
2021-12-08 00:12:35 +01:00
Benjamin Otte
fd0d360f9b Revert "viewport: Actually report the size we're gonna allocate"
This reverts commit b8468af411.
2021-12-07 23:52:21 +01:00
Benjamin Otte
b8468af411 viewport: Actually report the size we're gonna allocate
Don't just pass on measure() calls, but actually behave in the way we
behave during size allocate.

This should improve cases where GtkScrolledWindow is used with GTK_POLICY_NEVER.
2021-12-07 21:58:42 +01:00
Benjamin Otte
9fd7e319f3 viewport: Use array for member variables
That way we can index them by orientation in future commits.
2021-12-07 21:58:42 +01:00
Benjamin Otte
b9d4da9cfe gtktypes: GTK_INVALID_LIST_POSITION should be an int
GListModel uses guint, so the macros we define for it should match that.

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

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

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

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

Closes #4512

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

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

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

Closes #4325

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

Update the affected input method tests.
2021-12-03 14:44:05 -05:00
Georg Vienna
c517e945de textchildanchor: allow to specify replacement character 2021-12-03 16:02:48 +00:00
Matthias Clasen
be949496ac Merge branch 'issue-4376' into 'main'
Update placeholder visibility when setting a buffer

Closes #4376

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

Fixes: #4376
2021-12-02 17:17:12 +00:00
Carlos Garnacho
c8d83b7a63 gesturestylus: Use GtkEventControllerEvent events to track changes
We use gtk_gesture_get_last_event() underneath at places that need to
work during ::proximity emission. Since GtkGesture only tracks events
while there are button/touch presses involved, this is not going to
bring the right result there.

Use gtk_event_controller_get_current_event() consistently inside,
which always pokes at the event being handled (which is the correct
intent here).
2021-12-02 17:06:35 +01:00
Matthias Clasen
67ad566188 textview: Improve scroll-to-mark behavior
The idea of within-margin is to scroll as little
as possible to bring the mark within the margins
defined by the factor. The code was achieving
that when scrolling down, but not when scrolling
up. This change makes things symmetrical.

Fixes: #4325
2021-12-01 19:35:11 -05:00
Matthias Clasen
2611a996ff Merge branch 'matthiasc/for-main' into 'main'
textbuffer: Fix pasting text

Closes #4357

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

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

See merge request GNOME/gtk!4124
2021-12-01 01:21:32 +00:00
Matthias Clasen
b3b0321620 textview: Avoid misplacing the Emoji chooser
When the iter is at the end of the buffer,
gtk_text_view_get_iter_location returns a
rectangle with width 0, which in turn makes
gdk_rectangle_intersect return FALSE.

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

Fixes: #4503
2021-11-30 19:44:26 -05:00
Matthias Clasen
e0deacd236 inspector: Make dropdowns bigger
If there's enough values to warrant scrolling,
the dropdown was much too small for comfort.
2021-11-30 18:38:33 -05:00
Matthias Clasen
f66172451d textview: Respect editability for Emoji
Switch the Emoji chooser keybinding to use the
action, so that disabling the action has the
desired effect.
2021-11-30 18:37:33 -05:00
Benjamin Otte
07cfdd8ca0 label: Don't set ellipsized size as natural size
Natural size should never ellipsize.

Tests added.
2021-11-30 15:10:02 +01:00
Matthias Clasen
ddd5704c92 Update references to master in the repository 2021-11-29 17:37:49 -05:00
Benjamin Otte
3ba6d2bd27 Merge branch 'wip/otte/hfw-min-size' into 'master'
window: Implement height-for-width for min size

See merge request GNOME/gtk!4183
2021-11-29 10:31:42 +00:00
Matthias Clasen
e9d8bf96e0 fontchooser: Avoid setting variations needlessly
Setting variations to their default value causes
them to show up in the serialization of the font
description - a font description has no idea about
the default values, so can't filter them out.

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

See merge request GNOME/gtk!4191
2021-11-24 19:56:42 +00:00
Alexandros Theodotou
cd60ec1576
gesture: fix typo in docs 2021-11-24 19:34:49 +00:00
Benjamin Otte
0709dc7a6a window: Add a new fancy way to compute min size
Try to compute a min size that matches the current aspect ratio.

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

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

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

Closes #4421

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

Otherwise future calls to sizing fucntions will reuse an outdated cache
and compute wrong values.
2021-11-21 06:08:06 +01:00
Benjamin Otte
358893aa84 window: Always clamp to max size
When computing the window size, always try to clamp to the max size.
This will shrink a window down into a sane size if it was too big
before.
2021-11-21 05:33:28 +01:00
Benjamin Otte
c025bc5098 paned: Compute the right handle size
Testcase included

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

Reftest included.
2021-11-21 01:31:06 +01:00
Benjamin Otte
eefb6a0dd4 sizerequest: Change critical message
Printing the affected widget leads people to assume that it is to blame
for the error. However, the widget is the object the function is being
called on, not the caller. And the caller is doing it wrong.

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

So don't put anything there instead.
2021-11-20 17:05:36 +01:00
Benjamin Otte
1eb86d6394 widget: Remove a check
That consistency check is entirely outdated and just prints confusing
stuff.
2021-11-20 06:04:10 +01:00