Commit Graph

36667 Commits

Author SHA1 Message Date
Matthias Clasen
d47d036663 search entry: Don't propagate handled events
When the text says it has handled the event,
trust it. We don't want to emit ::search-started
if the content hasn't changed, but we still
should not propagate e.g. an Insert key press
if it has already toggled overwrite mode in
the text.

Fixes: #2874
2020-09-09 22:26:27 -04:00
Benjamin Otte
cb5b375f43 revealer: Remove arbitrary 100x scale limit
This is no longer necessary because the bug it was rying to solve is now
solved via the preference for min and nat size.
2020-09-09 17:38:37 +02:00
Benjamin Otte
dfccaa8831 revealer: Prefer min and nat size
Assume that the fully expanded revealer will likely get an allocation
that matches the child's minimum or natural allocation, so we
special-case these two values.

So when - due to the precision loss - multiple sizes would match the
current allocation, we don't pick one at random, we prefer the min and
nat size.

The preference of nat size over min sie was decided after an IRC vote,
we don't actually have an idea what's more likely to happen in the real
world.
Should we ever get better data, we might want to switch.
2020-09-09 17:38:37 +02:00
Benjamin Otte
cc58956dbb revealer: Use floor(), not ceil()
We use ceil() in measure(), so using it again will increase the
child's size whenever there is even a tiny rounding error.

This should also not make the size too small, because:
min = ceil(child_min * scale)
min / scale >= child_min
floor (min / scale) >= floor (child_min) = child_min
The last equality is because child_min is an integer.

Fixes #3137
2020-09-09 17:38:37 +02:00
Benjamin Otte
0ad10ccf39 revealer: Refactor code
Assign the values in the same place.
2020-09-09 17:38:37 +02:00
Benjamin Otte
8cb03a8cc0 widget: Add a critical when allocation is too small. 2020-09-09 17:38:37 +02:00
Emmanuele Bassi
f4b410daa7 Make sure we don't call back into GtkEntryBuffer
After commit 7e77afe94c moved the deletion
of text into the signal handler, in order to make undo work, we need to
override the GtkEntryBuffer::deleted-text class closure when subclassing
GtkEntryBuffer, as well as overriding GtkEntryBufferClass.delete_text,
otherwise the default class closure will be invoked, and will try to
delete an empty buffer.

Fixes: #3140
2020-09-09 11:29:16 +01:00
Chun-wei Fan
3095bccd2e gtksecurememory.c: Port secure memory allocation to Windows
Use the Windows API CryptProtectMemory() to encrypt the data that we want to
secure, and use CryptUnprotectMemory() to de-crypt the secured data that we
want to access, since mmap() and mlock() are not available on Windows.
2020-09-09 13:50:15 +08:00
Chun-wei Fan
c72b2f6167 gtksecurememory.c: Don't include unistd.h unconditionally
It is not universally available on non-POSIX systems.
2020-09-09 13:48:33 +08:00
Emmanuele Bassi
ae97284409 docs: Add a note on GtkPasswordEntry's secure storage 2020-09-08 23:50:12 +01:00
Emmanuele Bassi
7cda32d49e Use GtkPasswordEntryBuffer in GtkPasswordEntry
Now that we have a secure buffer, we should start using it.

Fixed: #3119
2020-09-08 23:50:12 +01:00
Emmanuele Bassi
fb99bde840 Add a secure GtkEntryBuffer
We have a widget for password and passphrase entries, but we have no way
to handle the data securely. This is usually performed by a separate
GtkEntryBuffer—for instance, the one in GCR. While we have API for
setting a new entry buffer on GtkText, we don't have API for
GtkPasswordEntry, though, so the options are:

 - expose additional API for GtkPasswordEntry to allow setting a secure
   text buffer on the internal GtkText widget
 - provide a secure text buffer out of the box

Given that an insecure-by-default GtkPasswordEntry is basically
pointless, might as well have a secure buffer built in.

We don't really need to make the password entry buffer public out of the
box, but we can re-evaluate at a later date.

Fixes: #2403
2020-09-08 23:50:12 +01:00
Emmanuele Bassi
9dc5c6a0f3 Move g_autoptr macro for GtkEntryBuffer
We need it into its own header, so we can derive from GtkEntryBuffer
with G_DECLARE_* macros without including gtk.h.
2020-09-08 23:50:12 +01:00
Emmanuele Bassi
31a7574544 Import egg-secure-memory allocator from gcr
We can re-use the code inside gcr, as we know that it's working, tested,
and license compatible.
2020-09-08 23:50:12 +01:00
Matthias Clasen
cb2b0688ca Merge branch 'filter-constructors' into 'master'
Filter constructors

See merge request GNOME/gtk!2360
2020-09-08 12:58:27 +00:00
Matthias Clasen
5a8267dfae text: Set the hotspot for the drag icon
This makes the drag icon align properly with the
dragged text at the beginning of the drag.
2020-09-07 11:18:45 -04:00
Matthias Clasen
bc80ed4240 aboutdialog: Disable text undo
The text buffers here are not editable, so it
does not make sense to have text undo enabled
for them.

Fixes: #3123
2020-09-06 17:02:00 -04:00
Matthias Clasen
4d45c2669c text history: Update state when enabled changes
This makes can-undo go FALSE when we disable the
text history, as it should.
2020-09-06 17:02:00 -04:00
Matthias Clasen
06c866f45e Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2538
2020-09-06 19:38:56 +00:00
Matthias Clasen
adc9d91e0e text: Stop drag updates when a dnd starts
This prevents the selection from changing underneath
us, messing up move dnd operations.
2020-09-06 12:19:44 -04:00
Matthias Clasen
1150c23b0f Merge branch 'listwidgets-doc-fix' into 'master'
docs: Update list widgets docs

See merge request GNOME/gtk!2537
2020-09-06 15:53:59 +00:00
Matthias Clasen
9b8c175f23 textview: Fix dnd
When we start a dnd of the selection in the drag-update handler,
set the gesture state to denied. Otherwise, we get more drag-update
signals, and things get really confused, leading to no dnd and
sadness.
2020-09-06 11:48:10 -04:00
Andreas Persson
e0134aaf15 docs: Update list widgets docs
Removed sentence that claimed the view will wrap the model in a
GtkSingleSelection, as it's no longer true. Fixed the code example in
GtkListView for the same reason. Fixed a small typo in GtkDropDown docs.
2020-09-06 17:19:24 +02:00
Matthias Clasen
a4ba25f0f8 inspector: Fix teardown of the general tab
We were connecting signal handlers to the display
and seats here, and never cleaning them up, leading
to crashes after the inspector is closed. This is
fairly easy to reproduce under Wayland, where the
scroll device is only created the first time we
create a scroll event.
2020-09-05 22:35:30 -04:00
Matthias Clasen
24389a0ef5 Make sorter constructors return exact types
Make functions like gtk_custom_sorter_new() return
the actual type they construct.

Update all callers.
2020-09-05 21:50:15 -04:00
Matthias Clasen
dfabe74c59 Make filter constructors return exact types
Make functions like gtk_custom_filter_new() return
the actual type they construct.

Update all callers.
2020-09-05 21:43:42 -04:00
Matthias Clasen
727f25f6da Merge branch 'revert-43ca43a22f' into 'master'
Revert "Adwaita: rich-list styling"

See merge request GNOME/gtk!2533
2020-09-05 16:00:33 +00:00
nana-4
12afc10ec3 Revert "Adwaita: rich-list styling"
This reverts commit 2f0a4c7128.

It seems the commit was accidentally added when
768e24afc1 was manually merged and pushed.
2020-09-05 23:13:24 +09:00
Matthias Clasen
ffc77ca926 css: Use an array when parsing selectors
There's no need for us to have a hard size-limit here;
with GdkArray we don't have to give up on stack-preallocation
either.
2020-09-05 09:51:59 -04:00
Matthias Clasen
635492b016 text: Don't replace unselected text with Emoji
We must be careful to not select everything on focus-in
before we have the Emoji inserted. This was accidentally
broken in d5121af876.

Fixes: #3122
2020-09-05 08:40:02 -04:00
Matthias Clasen
81f84fbe8f modelbutton: Claim the gesture
This aligns the model button behavior with what
GtkButton does.
2020-09-04 13:20:33 -04:00
Matthias Clasen
275302a9d5 Merge branch 'fix-gtk-application-menu-example' into 'master'
GtkApplicationWindow: Fix menubar example

See merge request GNOME/gtk!2528
2020-09-04 12:32:40 +00:00
Emmanuel Gil Peyrot
62f7395c77 GtkApplicationWindow: Fix menubar example
This example was using invalid attribute syntax.
2020-09-04 13:49:28 +02:00
Emmanuele Bassi
f7f0bc0369 Use consistent argument name
Declarations, definitions, and gtk-doc stanzas should use the same name
for arguments. Otherwise both g-ir-scanner and gtk-doc will complain
that they can't find the argument.
2020-09-04 12:05:01 +01:00
Matthias Clasen
887539e4ff gridview: Make constructor arguments nullable
I forgot to adjust the precondition when copying things
around.
2020-09-03 14:20:06 -04:00
Matthias Clasen
eee6d28c67 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

Closes #3109 and #3112

See merge request GNOME/gtk!2522
2020-09-02 19:47:40 +00:00
Matthias Clasen
30ab8b3eca Fix picking
My previous change here was too hasty - this code is not
actually transforming points - it is just a convoluted
way to transform the z axis from child coordinates to
the parent.
2020-09-02 15:20:58 -04:00
Matthias Clasen
d5121af876 text widgets: Don't lose focus after Emoji
Make sure to grab focus back when the Emoji chooser
disappears. This prevents focus going nowhere when
the Emoji chooser is canceled.

Fixes: #3112
2020-09-02 15:20:58 -04:00
Matthias Clasen
9512e461d5 textview: Fix placement of Emoji chooser
If the selection extends beyond the visible range,
place the Emoji chooser over the center of the window.

Fixes: #3109
2020-09-02 15:20:58 -04:00
Sebastian Dröge
ae5d1cd161 Annotate sequence argument of GtkGesture signals as nullable 2020-09-02 13:32:20 +03:00
Matthias Clasen
062822ab06 Merge branch 'checkbutton-fixes' into 'master'
Checkbutton fixes

See merge request GNOME/gtk!2518
2020-09-01 22:15:33 +00:00
Matthias Clasen
746bdd3d47 checkbutton: Don't notify write-only properties
Nobody is listening...
2020-09-01 16:31:07 -04:00
Matthias Clasen
c5c67cbb8c action helper: Drop G_GNUC_INTERNAL from headers
We haven't needed this for a long time now.
2020-09-01 16:29:21 -04:00
Matthias Clasen
639c839ba4 Add docs about grouping via action
Mention this in the docs for gtk_check_button_set_group
and gtk_toggle_button_set_group.
2020-09-01 16:29:21 -04:00
Matthias Clasen
5f8769e1a8 checkbutton: Support GtkActionable properly
Support grouping buttons via a radio action, as well
as via explicit gtk_check_button_set_group() calls.
2020-09-01 16:29:21 -04:00
Matthias Clasen
3569360949 actionhelper: Add a getter
Add a getter for the GtkActionHelper:role property.
2020-09-01 16:29:20 -04:00
Matthias Clasen
1c0bf2604c checkbutton: Don't leak the action helper 2020-09-01 15:24:34 -04:00
Matthias Clasen
1bbab5664d Merge branch 'license-clarification' into 'master'
License clarification

See merge request GNOME/gtk!2517
2020-09-01 18:58:52 +00:00
Matthias Clasen
87855dd375 Move timsort sources to a subdirectory
This makes it easier to identify the files that
belong together, and are under the same license.
2020-09-01 14:25:56 -04:00
Matthias Clasen
0e6eba3968 inspector: Plug another memory leak
Fixes: #3107
2020-09-01 13:06:20 -04:00