Commit Graph

36762 Commits

Author SHA1 Message Date
Matthias Clasen
6f56d8df28 Merge branch 'wip/jimmac/dnd-green' into 'master'
Adwaita: update tango color for DND

Closes #3158

See merge request GNOME/gtk!2581
2020-09-15 11:04:59 +00:00
Matthias Clasen
9eb4eef48b Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2582
2020-09-15 11:04:54 +00:00
Jakub Steiner
d1a68ac7ba Adwaita: update tango color for DND
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3158
2020-09-15 12:18:55 +02:00
Timm Bäder
a545fa15e4 inspector: Remove unsued function 2020-09-15 05:28:31 +02:00
Timm Bäder
e669433cde listbox: Activate single-click rows if n_press >= 1
Quickly clicking rows should always activate the row if
single-click-activation is enabled. Before, only the first click
(n_press == 1) would activate the row.
2020-09-15 05:21:54 +02:00
Timm Bäder
a6f86d9c26 popover: Only destroy arrow render node if position changed 2020-09-15 05:21:54 +02:00
Timm Bäder
c8f4c8c4f0 filechooserwidget: Plug a memory leak
g_list_store_append refs the file
2020-09-15 05:21:54 +02:00
Timm Bäder
87f589f738 emojichooser: Fix typo in css class 2020-09-15 05:21:54 +02:00
Timm Bäder
27f3600419 listbox: Add preconditions to remove() 2020-09-15 05:21:53 +02:00
Timm Bäder
a0422bfe25 inspector: Fix huge listbox rows
This is handled by .rich-list
2020-09-15 05:21:53 +02:00
Matthias Clasen
67c1600ac2 Document some API as widget-implementation only
Using gtk_widget_insert_before on a complex container
is a *bad* idea; it will mess up the containers bookkeeping
of its children and can easily lead to failure and crashes.
2020-09-14 20:28:44 -04:00
Emmanuele Bassi
595cc929e6 Annotate the expression array as "nullable"
While it's a bit dubious whether array+length annotations should be
marked as "nullable", we do this elsewhere in the API, so might as well
be consistent.

In practice, the array argument is only ever allowed to be NULL iff the
length argument is 0; annotations are static, so if somebody decides to
pass a NULL argument with a non-zero value, they will get a run time
critical error, instead of a compile time one, which is somewhat counter
to the point of annotating the API in the first place.

Fixes: #2923
2020-09-14 17:00:23 +01:00
Matthias Clasen
a201bfd9a5 Merge branch 'wip/jimmac/navlist-expander-whitespace' into 'master'
Adwaita: navigation list expander whitespace

See merge request GNOME/gtk!2575
2020-09-14 12:59:05 +00:00
Matthias Clasen
53dddf163d gestures: Make claiming button release work
When claiming a sequence in a gesture signal handler,
the expected result is that GtkGesture::handle-event
returns TRUE, causing the event to not be propagated
further.

This doesn't work for button release events, since
gtk_gesture_handle_event does the following:
  add point
  emit ::update
  remove point
  check claimed status
The ::update signal is where the application code
claims the sequence. But removing the point purges
the sequence from the gestures memory, so checking
the claimed status returns FALSE.

This patch fixes things to behave as expected, by
checking the claimed status before removing the point.
2020-09-14 08:35:44 -04:00
Jakub Steiner
e7c75f04dd Adwaita: navigation list expander whitespace
- Address https://gitlab.gnome.org/GNOME/gtk/-/issues/3138#note_910476
2020-09-14 14:31:23 +02:00
Jakub Steiner
8eab10dabf Adwaita: whitespace for the grid
- separate labels
- 12px margins around cells

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3164
2020-09-14 14:18:52 +02:00
Matthias Clasen
6a676d527c Merge branch 'wip/jimmac/natigation-sidebar-whitespace' into 'master'
Wip/jimmac/natigation sidebar whitespace

Closes #3138

See merge request GNOME/gtk!2572
2020-09-14 11:13:52 +00:00
Jakub Steiner
bcb2861447 assets: adjust gesture graphic
- quick, somebody on the internet is offended!

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3074
2020-09-14 12:14:40 +02:00
Jakub Steiner
962f76ddc9 Adwaita: navigation-sidebar spacing
- split from placessidebar as it's more generic

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3138
2020-09-14 11:51:54 +02:00
Matthias Clasen
c462f35a5e inspector: Use gdk_frame_clock_get_fps 2020-09-13 23:35:01 -04:00
Matthias Clasen
4b589b6afb main: Reshuffle debug code
Mode all the debug flags related code together,
to make gtkmain.c a bit less messy.
2020-09-13 22:48:29 -04:00
Matthias Clasen
fedeb51f31 Drop support for GTK_TEST_TOUCHSCREEN
This environment variable is undocumented, and you can
just use GTK_DEBUG=touchscreen insead.
2020-09-13 22:44:32 -04:00
Matthias Clasen
d2faa38eed Move version-related functions to gtkversion.c
This is just an internal cleanup, to make gtkmain.c
a bit less messy.
2020-09-13 22:23:06 -04:00
Matthias Clasen
ff9ca2b68d Clean up debug flags code a bit
Use the GtkDebugFlags enum, since we have it.
2020-09-13 22:10:25 -04:00
Matthias Clasen
aa5207b349 iconview: Small doc additions 2020-09-13 21:51:42 -04:00
Matthias Clasen
2b5b6e0885 Drop gtk_render_slider from headers
The function does not exist.
2020-09-13 21:51:42 -04:00
Matthias Clasen
93d9a2ceda colorchooser: Bring back gtk_color_chooser_widget_new
This was removed by accident in commit f392fbfb6d6f1116728b.
2020-09-13 21:51:42 -04:00
nana-4
f6e4486338 colorchooserwidget: Update default palette
This makes it completely in line with the new GNOME HIG color palette.

See https://gitlab.gnome.org/GNOME/gtk/-/issues/3146
2020-09-14 07:05:04 +09:00
Matthias Clasen
30c3a533f4 video: Make autoplay work
We were setting things up in the wrong order, so
autoplay had no effect when you using gtk_video_set_file().
2020-09-13 01:56:56 -04:00
Matthias Clasen
22257b124a placessidebar: Remove a pointless restriction
The sidebar was refusing to show shortcuts for
things that don't have a local path, for no
good reason.
2020-09-13 01:14:00 -04:00
Matthias Clasen
4629182246 filechooser: Fix setting unlisted filters
This is documented to work, but it was broken
when we ported things to list models.
2020-09-13 01:12:51 -04:00
Matthias Clasen
c8a9e7fa82 Fix a compiler warning 2020-09-13 01:12:39 -04:00
Matthias Clasen
b534752d5c Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

Closes #3110 and #2994

See merge request GNOME/gtk!2565
2020-09-12 16:25:17 +00:00
Matthias Clasen
929a56e53c Clean up lots of GTK+ -> GTK
Replace most remaining uses of GTK+ in the docs and
user-visible strings by GTK. Also remove some leftover
"Was added in 3.x" sentences from the docs.
2020-09-12 12:01:04 -04:00
Matthias Clasen
0011a1032d text: Claim the sequence when we start selecting
Without this, drag-select will only work sporadically
in entries in headerbars.

Fixes: #2994
2020-09-12 11:18:36 -04:00
Matthias Clasen
38b71ba292 Cosmetics
Add a missing comma.
2020-09-12 11:11:28 -04:00
Matthias Clasen
756c52ef08 filechooser: Prevent a crash
With csd, we are handling external widgets when
there is an entry in the headerbar. Use a weak ref
to prevent that pointer from going stale. This fixes
a crash when cancelling a save dialog.

Fixes: #3110
2020-09-12 10:40:13 -04:00
Emmanuele Bassi
25bcec5cbb Properly annotate GtkLayoutManagerClass.create_layout_child()
We're missing the ownership transfer rule for the created GtkLayoutChild
instance; this makes the virtual function not introspectable.

Fixes: #3156
2020-09-12 14:33:24 +01:00
Matthias Clasen
e55bdf87b5 Merge branch 'text-layout-speedup' into 'master'
textlayout: Avoid some iter comparisons

See merge request GNOME/gtk!2561
2020-09-11 21:20:38 +00:00
Matthias Clasen
c09575d9cb textlayout: Avoid some iter comparisons
We were doing more iter comparisons than necessary in the
inner loop of gtk_text_layout_snapshot(), in the presence
of a selection. Rewrite the code to compare line numbers
instead, which is faster than full iter comparisons.
2020-09-11 16:41:42 -04:00
Matthias Clasen
ff392fbfb6 colorchooser: Don't parse color names needlessly
We have a fancy macro to initialize GdkRGBAs without
any runtime work, lets use them.
2020-09-11 09:31:17 -04:00
Matthias Clasen
498cbae95c colorchooser: Drop color names
These were not used anymore, after a11y stopped using them.
2020-09-11 09:12:34 -04:00
Matthias Clasen
fa9608fd02 color chooser: Don't show too many custom colors
The code was hardcoding a fixed number of custom
colors, but we really want to match the number
of columns in the palette(s). Make it so.
2020-09-11 08:42:03 -04:00
Jakub Steiner
8700e136da colorChooser: updte color palette
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3146
2020-09-11 10:47:24 +02:00
Matthias Clasen
93078e52c0 gdk: Rename GdkSurfaceState to GdkToplevelState
That is what it is.

Fixes: #2790
2020-09-10 00:39:03 -04:00
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
Matthias Clasen
aaef9bec7f treelistrowsorter: Plug a memory leak 2020-09-01 13:01:34 -04:00
Matthias Clasen
391c05ef70 inspector: Plug a small memory leak 2020-09-01 12:57:08 -04:00
Matthias Clasen
b628338db3 list widgets: Simplify the constructors
Now that both arguments to the _new_with_factory() constructors
are nullable, there's no good reason to keep a separate _new()
around. Just make gtk_list_view_new() and gtk_grid_view_new()
take both a model and a factory.
2020-09-01 12:24:06 -04:00
Matthias Clasen
7051fdee5d Merge branch 'projective-transform' into 'master'
Replace uses of graphene_matrix_transform_

See merge request GNOME/gtk!2514
2020-09-01 13:44:38 +00:00
Matthias Clasen
e36b594867 Replace uses of graphene_matrix_transform_
Replace our uses of graphene_matrix_transform_point,
_point3d and _bounds by our own versions that handle
projective transforms correctly.

This fixes render node bounds being incorrect for widgets
involving projective transforms (e.g. testrevealer swing
transformations), and also fixes picking on such widgets.
2020-09-01 09:18:38 -04:00