Commit Graph

37811 Commits

Author SHA1 Message Date
Timm Bäder
ebdf2989f8 widget: Move a few vfunc implementations above class_init
And save us the prototypes at the top of the file this way.
2021-01-03 11:01:29 +01:00
Timm Bäder
bc35c5d494 nevertrigger: Remove unused instance members 2021-01-03 11:01:29 +01:00
Timm Bäder
70a3e5e8ce shortcutmanager: Use g_list_store_find()
We require glib 2.66 these days, so we can unconditionally use
g_list_store_find().
2021-01-03 11:01:29 +01:00
Timm Bäder
74ff61a937 gesturelongpress: Remove a useless cast
We already get a GtkGestureLongPress here.
2021-01-03 11:01:29 +01:00
Timm Bäder
280d7e57bd gesturelongpress: Keep the pspec around
So we can use it to notify(), like we do everywhere else.
2021-01-03 11:01:29 +01:00
Timm Bäder
03f5a368ec label: Remove unused private functions 2021-01-03 11:01:29 +01:00
Timm Bäder
0b15aba82a label: Remove mnemonics_visible_apply_recursively from private header
This is only used in gtklabel.c
2021-01-03 11:01:28 +01:00
Timm Bäder
d8fa9de93a label: Modernize source file
Try to sort toplevel functions to minimize unnecessary function
prototypes at the beginning of the file, get rid of all tabs and
trailing whitespace.
2021-01-03 11:01:28 +01:00
Timm Bäder
71efa96ef2 gesturestylus: Only add histroy element if translation succeeded
Instead of always doing it and then undoing it if the translation does
not succeed.
2021-01-03 11:01:28 +01:00
Timm Bäder
e336fe2bf8 gesturestylus: Retrieve event and controller widget only once
Make it clear that these are not gonna chance while iterating the loop.
2021-01-03 11:01:28 +01:00
Matthias Clasen
c804645382 video: Tweak the docs
Point out the limitations and use cases of GtkVideo
and mention that GtkPicture can display video just fine.
2021-01-02 12:21:03 -05:00
Matthias Clasen
0ba5631100 video: Pause on unset too
When new media stream is set on the GtkVideo
widget and we're autoplaying, pause the old one.

Otherwise, the music keeps playing unexpectedly.
2021-01-02 01:33:48 -05:00
Matthias Clasen
f2e5775380 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

Closes #3506 and #3530

See merge request GNOME/gtk!3024
2021-01-01 22:48:11 +00:00
Matthias Clasen
20f3d1608d video: Be consistent about play/pause
Always check that the stream is prepared, and the
widget is mapped, before calling gtk_media_stream_play().
2021-01-01 16:25:54 -05:00
Matthias Clasen
29afe5a688 video: Stop playing when appropriate
When the widget gets unrealized or hidden, pause
the mediastream. Otherwise, audio might keep playing
unexpectedly.
2021-01-01 15:17:59 -05:00
Matthias Clasen
2d3885a44a center layout: Fix handling of expanding center child
We were not taking spacing into account when adjusting
the size of an expanding center child, causing it to slip
under the end child at times.

Fixes: #3506
2021-01-01 11:02:57 -05:00
Matthias Clasen
a4baac7193 docs: Complete a sentence
Fixes: #3530
2021-01-01 09:40:40 -05:00
David Lechner
4fb70c5e4d gtk/window: remove GtkWindowGeometryInfo from public header file
GtkWindowGeometryInfo is only used by static methods in gtkwindow.c
so it doesn't need to be in the public header file.
2020-12-30 01:32:27 -06:00
Matthias Clasen
878b34fae3 gtk4-encode-symbolic: Add debug output
Add a --debug option that makes this tool produce
some debug output that can be helpful in tracking
down why symbolic svgs are broken.
2020-12-29 21:30:52 -05:00
Matthias Clasen
5fe433418d Merge branch 'mcatanzaro/#3509' into 'master'
message dialog: use title style only if there is secondary text

Closes #3509

See merge request GNOME/gtk!3015
2020-12-29 17:47:01 +00:00
Michael Catanzaro
2336120010 message dialog: use title style only if there is secondary text
If there is no secondary text, then the primary text is just a message,
not a title, and should not use title style.

This partially reverts 1e3ec7c1f9. The
message dialog nown looks like it used to in GTK 3. However, it's still
styled only using a style class rather than using pango markup, as in
GTK 3.

Fixes #3509
2020-12-29 11:15:14 -06:00
Matthias Clasen
0d54d73a51 Fix menu item alignment with submenus
We were not aligning model button labels with nesting
submenus with indicators in their containing menu.

This was visible in the application demo of gtk4-demo.
2020-12-29 12:10:35 -05:00
Timm Bäder
108933b655 Merge branch 'wip/chergert/volatile-fixes' into 'master'
types: fix various use of volatile in type registration

See merge request GNOME/gtk!2865
2020-12-29 07:49:12 +00:00
Matthias Clasen
daded2bc86 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!3004
2020-12-27 05:21:26 +00:00
Matthias Clasen
bc7619abaf Merge branch 'gtkclip' into 'master'
gtk: remove GtkClipboard leftovers

See merge request GNOME/gtk!2991
2020-12-27 04:32:26 +00:00
Matthias Clasen
459d6e1349 Merge branch 'wip/carlosg/for-master' into 'master'
gtk/gesturestylus: Convert motion history from surface coordinates

Closes #3491

See merge request GNOME/gtk!2999
2020-12-27 04:30:38 +00:00
Emmanuel Gil Peyrot
84c6708366 Remove unused static inline function
This was causing a warning on AArch64 since __LITTLE_ENDIAN__ and
__BIG_ENDIAN__ weren’t set, but the functions were actually completely
unused.
2020-12-25 16:16:43 +01:00
Carlos Garnacho
cf20cfd31e gtk/gesturestylus: Convert motion history from surface coordinates
Motion history coordinates are based on GdkSurface coordinates. Transform
the coordinates from the GtkNative they are received on, accounting for the
possible transforms (e.g. due to window borders and shadows).

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3491
2020-12-24 19:59:51 +01:00
Matthias Clasen
7e579bb59a Merge branch 'wip/otte/for-master' into 'master'
Wip/otte/for master

See merge request GNOME/gtk!2997
2020-12-24 07:13:22 +00:00
Benjamin Otte
96e1b85c2c gdkarray: Add a "stolen" boolean to splice()
If set to TRUE, does not call the free func for the removed items.

This can be used to move items between arrays without having to do the
refcounting dance.
2020-12-24 06:38:45 +01:00
Benjamin Otte
71e616d17e listview: Use the correct scroll policy
Use the horizontal policy for horizontal decisions, not the vertical
one.

This broke in 0011ce949c.
2020-12-24 06:38:45 +01:00
Benjamin Otte
8d014d6cb0 roundedbox: Remove unused API 2020-12-24 06:38:45 +01:00
Benjamin Otte
f7f8990f7a picture: Fix copy/paste error in docs 2020-12-24 06:38:45 +01:00
Benjamin Otte
d6f288427a video: When autoplaying, start playing once the video is prepared
This fixe video sources with longer loading times not automatically
playing.
2020-12-24 06:38:45 +01:00
Matthias Clasen
6bd0dc3e78 colorbutton: Correct the css docs
Mention the wrapper colorbutton node.
2020-12-23 09:03:07 -05:00
Matthias Clasen
4f0c920a8e fontbutton: Correct the css docs
Mention the wrapper fontbutton node.
2020-12-23 08:59:58 -05:00
Matthias Clasen
b0b793dd94 menubutton: Correct the css docs
We are using menubutton instead of button.popup now.
2020-12-23 08:56:18 -05:00
Matthias Clasen
efbb649eee modelbutton: Center titles
The centering of titles was broken in b5b81dea7f.
Make it mostly work again by adding an empty end indicator.

Related: #3405
2020-12-23 00:51:51 -05:00
Matthias Clasen
5cd2ee927a window: Release application in destroy
We used to do this; it was lost in some life-cycle
reshuffling.
2020-12-22 20:34:13 -05:00
Marc-André Lureau
90dfb5e138 gtk: remove GtkClipboard leftovers
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2020-12-22 16:39:54 +04:00
Matthias Clasen
e854b90293 Merge branch 'wip/baedert/for-master' into 'master'
Wip/baedert/for master

See merge request GNOME/gtk!2990
2020-12-22 04:53:31 +00:00
Matthias Clasen
6d042d9e61 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

See merge request GNOME/gtk!2988
2020-12-22 02:29:03 +00:00
Matthias Clasen
fcd449f0d4 modelbutton: Remove an unused field
We're not using the centered field anymore.
2020-12-21 17:45:01 -05:00
Michael Catanzaro
ab1b117d91 Fix buffer overruns in 'gtk-builder-tool simplify'
Oops, here we allocate only one byte for each pointer we want to store.
We need to multiply by the size of a pointer.
2020-12-21 15:39:34 -06:00
Matthias Clasen
466484176f Merge branch 'ebassi/docs-for-master' into 'master'
Ebassi/docs for master

See merge request GNOME/gtk!2983
2020-12-21 19:22:38 +00:00
Matthias Clasen
147386189f inspector: Show glyphs as in node files
Reuse the glyph serialization code from gsk to
show glyphs in the same way here.
2020-12-21 13:11:46 -05:00
Emmanuele Bassi
b1d952b8a2 docs: Add examples for GtkDropTarget
Like we did for GtkDragSource.
2020-12-21 17:11:42 +00:00
Emmanuele Bassi
b9bcdbbfdc docs: Add examples of GtkDragSource use
The description is a bit terse; we should help out application
developers some more.
2020-12-21 17:03:59 +00:00
Yetizone
c4a8c0893b box: improve documentation
Rephrase a function parameter description and remove "." from all function parameters descriptions

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3499
2020-12-21 17:26:23 +02:00
Timm Bäder
e90f5e8a20 gskpango: Don't copy fg color
No need to do that here, we copy it in to the individual render nodes
anyway.
2020-12-21 15:23:25 +01:00
Timm Bäder
cf352374ae gskpango: Correct a comment
Not all other draw calls will use cairo.
2020-12-21 13:23:28 +01:00
Timm Bäder
98b99201b0 gskpango: Remove bounds rect
We only need this to render shapes and trapezoids, i.e. only when
falling back to cairo. Remove code to measure the layout and convert the
ink_rect to a graphene_rect_t from gtk_snapshot_append_layout() and do
it when drawing shapes and trapezoids instead.
2020-12-21 12:56:38 +01:00
Timm Bäder
bce4d669ee gskpango: Fix a potential cairo_t leak
The previous early return did not cairo_destroy() it.
2020-12-21 12:49:06 +01:00
Timm Bäder
e7a326e230 label: Refactor get_layout_location()
Rename a few local variables to be clearer about whether they belong to
the widget or to the layout.

Remove a workaround for an old bug that is no longer valid. We don't
underallocate the layout anymore. Aways center vertically, with respect
to the yalign.
2020-12-21 12:44:01 +01:00
Timm Bäder
9eaeaa8452 label: Refactor snapshot()
Use two early-out style if statements to reduce indentation in this
entire function.
2020-12-21 12:32:32 +01:00
Timm Bäder
2031c5bf90 textlayout: Remove dead offset_y code 2020-12-21 10:26:03 +01:00
Timm Bäder
0b4ed8d791 renderborder: Avoid 0 width outline color nodes 2020-12-21 10:26:03 +01:00
Timm Bäder
c34f98931e layoutoverlay: Avoid adding transparent color nodes
We have a region for the border here, but the color is defined as
transparent black because we don't want to render anything for it.

This way, the generated .node file for the listbox demo in gtk4-demo
with enabled layout borders is 3.5MB instead of 3.8MB.
2020-12-21 10:26:03 +01:00
Timm Bäder
2feac2772f layoutoverlay: Avoid adding 0 sized color nodes
This way, the output node file of the listbox demo in gtk4-demo with
enabled layout borders is only 3.8MB instead of 12MB.
2020-12-21 10:26:03 +01:00
Timm Bäder
21299cc7e4 icontheme: Make some constant values const 2020-12-21 10:26:02 +01:00
Timm Bäder
e747ea7dfd pixbufutils: Only convert icon size to string once 2020-12-21 10:26:02 +01:00
Timm Bäder
810cd7881e icontheme: Make icon_paintable_ensure_texture() return an unowned value
It's private, has only one caller and that one doesn't need the extra
ref.
2020-12-21 10:26:02 +01:00
Timm Bäder
e6f6d1e478 main: Add & use gdk_event_dup_axes()
The way this code is written trips up scan-build. Add
gdk_event_dup_axes() and use it in gtkmain.c.
2020-12-21 10:26:02 +01:00
Emmanuele Bassi
14bf45a0d5 3to4: Remove GtkCheckButton:draw-indicator
The property was removed from the widget, so we need to remove it from
UI files too.

Fixes: #3492
2020-12-18 23:14:24 +00:00
Matthias Clasen
f31765d5dd Merge branch 'ebassi/mnemonic-label-remove' into 'master'
a11y: Fix removing mnemonic widgets

See merge request GNOME/gtk!2970
2020-12-18 00:00:48 +00:00
Emmanuele Bassi
af0973c847 a11y: Fix removing mnemonic widgets
We must not use the variadic arguments version with GList, as it expects
a pointer to a GtkAccessible.
2020-12-17 15:49:00 +00:00
Emmanuele Bassi
e71f6b0bc0 docs: Note the caveat on GtkEditable signals with delegates
We cannot bubble up ::insert-text and ::delete-text signals from the
delegate to the wrapper editable without causing an infinite recursion,
due to how the signals are designed; ideally, we would have decoupled
signal emission from virtual functions *before* releasing GTK4, but now
that we have, we can't break the contract.
2020-12-17 15:13:43 +00:00
Emmanuele Bassi
1738724e4a Notify properties on deletion in PasswordEntryBuffer
The GtkEntryBufferClass.deleted_text() behaviour changed between GTK3
and GTK4, which means any subclass of GtkEntryBuffer is now responsible
for emitting the "notify" signal for the "text" and "length" properties.

Without this, the GtkText delegate widget used by GtkPasswordEntry would
not be able to communicate changes in the contents of its buffer.

Fixes: #3484
2020-12-17 15:01:35 +00:00
Jakub Steiner
addcf57b4d Adwaita: flat button adjustments
- normally lighter (on bg_color)
- darker for headerbar
- undecorated checked buttons were never style properly (even gtk3)
  see page2 volume buttons

Finetunes https://gitlab.gnome.org/GNOME/gtk/-/issues/3427
2020-12-17 12:20:29 +01:00
Sebastian Keller
02f0681344 settings: Change gtk-cursor-aspect-ratio from float to double
Float properties can not be read from keyfiles. This was causing changes
to this property in settings.ini to be ignored. Fix this by changing it
to a double.

Technically this change could be considered an API break, but there are
no users of this property as float yet and it is early enough to expect
there to never be any.

Also document this change in the 3 to 4 migration guide since in gtk 3
this setting will be kept a float.

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3441
2020-12-16 22:35:36 +01:00
Emmanuele Bassi
e3de92f1ea docs: Fix annotation for GtkSearchEntry::activate 2020-12-16 16:29:01 +00:00
Emmanuele Bassi
2ffa2be64e doc: Document missing GtkNotebook types 2020-12-16 16:29:01 +00:00
Emmanuele Bassi
387078b40c docs: Document GtkNativeDialogClass 2020-12-16 16:29:01 +00:00
Emmanuele Bassi
5203bf0b83 docs: Document GtkTreeViewColumn::clicked 2020-12-16 16:29:01 +00:00
Emmanuele Bassi
fb93baeae4 docs: Add missing description for GtkWidget::move-focus 2020-12-16 16:29:01 +00:00
Emmanuele Bassi
cc9528eaec docs: Add missing documentation to GtkStatusbar 2020-12-16 16:29:01 +00:00
Emmanuele Bassi
73dda96711 docs: Add missing stanzas for gtk_test_accessible API 2020-12-16 16:29:01 +00:00
Emmanuele Bassi
ab59c47880 docs: Add missing documentation to GtkPopover 2020-12-16 16:29:01 +00:00
Emmanuele Bassi
e4b7847904 docs: Fix documentation of GtkGestureStylus
Document all the signals, and fix the syntax for boolean values.
2020-12-16 16:29:01 +00:00
Emmanuele Bassi
308115ebae docs: Add gtk-doc stanza for GtkExpander::activate 2020-12-16 16:29:00 +00:00
Emmanuele Bassi
1cb72536ea docs: Fix syntax of GtkEntry::activate signal 2020-12-16 16:29:00 +00:00
Emmanuele Bassi
fc4402b456 docs: Ignore gtkpasswordentryprivate.h 2020-12-16 16:29:00 +00:00
Emmanuele Bassi
077aec5d32 docs: Add missing documentation for GtkTextCharPredicate 2020-12-16 16:29:00 +00:00
Emmanuele Bassi
548949214c docs: Add missing documentation GtkNative 2020-12-16 16:29:00 +00:00
Emmanuele Bassi
2aec47f56f docs: Add missing documentation for GtkCellRenderer 2020-12-16 16:29:00 +00:00
Jonas Ådahl
142f7862ed gdk/toplevellayout: Change API to be about intent, not full state
When being fullscreen, and wanting to unfullscreen but not caring about
whether to go unmaximized or maximized (as this information is lost), if
the GdkToplevelLayout represents the full intended state, we won't be
able to do the right thing.

To avoid this issue, make the GdkToplevelLayout API intend based, where
if one e.g. doesn't call gdk_toplevel_set_maximized() with anything, the
backend will not attempt to change the maximized state.

This means we can also remove the old 'initially_maximized' and
'initially_fullscreen' fields from the private GtkWindow struct, as we
only deal with intents now.
2020-12-16 14:16:08 +01:00
Jonas Ådahl
b6412adc32 gtk/window: Check widget mappdness and not surface mappedness
When deciding whether to call gdk_toplevel_present(), check the
mappedness of GtkWidget instead of the mapped-ness of GdkSurface, as the
latter is mapped asynchronously, while the former is direct state of the
GtkWindow itself.

This fixes an issue where calling e.g. gtk_window_maximize() shortly
after showing it didn't take effect, as hadn't been mapped yet. While
maximizing after showing is racy, and will likely glitch from time to
time, the correct thing to do is still to maximize and handle whatever
state the compositor configured the window to be in.

Closes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3466
2020-12-16 11:56:41 +01:00
Emmanuele Bassi
ea5e186bb8 Hide GtkTextAttributes functions
The type is private, so making functions operating on it public is
pointless.
2020-12-15 16:20:21 +00:00
Emmanuele Bassi
69b181f263 Remove boxed type for GtkCrossingData
The GtkCrossingData type is completely private, so there's no point in
having a boxed type for it.
2020-12-15 15:55:15 +00:00
Emmanuele Bassi
474b4ac1af build: Use Meson support for dylib versions
Do not hand-code it inside GTK's meson.build.
2020-12-15 12:47:05 +00:00
Emmanuele Bassi
99e0929d6c build: Use a consistent style for Meson files 2020-12-15 12:46:59 +00:00
Emmanuele Bassi
e75e44bdcc build: Remove duplicate definition
The `GTK_COMPILATION` symbol is defined in gir_args.
2020-12-15 11:47:32 +00:00
Emmanuele Bassi
7975bbfcaa build: Remove linker flags from static libraries
We only need hardening linker flags on the libgtk shared library;
internal static libraries don't really need them.
2020-12-15 11:36:20 +00:00
Matthias Clasen
e2afb59a0b Merge branch 'matthiasc/for-master' into 'master'
Avoid adding // to resource paths

Closes #3469

See merge request GNOME/gtk!2947
2020-12-14 13:14:32 +00:00
Jakub Steiner
daa5d5aead Merge branch 'dropdown-searchbar' into 'master'
dropdown: Improve search bar styling

See merge request GNOME/gtk!2948
2020-12-14 09:39:38 +00:00
nana-4
34d99ea1d0 Adwaita: Improve emoji picker styling
- Add borders around the main scrollable content, like most other
  places.
- Set padding and spacing on .emoji-searchbar and .emoji-toolbar in a
  more proper way.
- Remove unused button.emoji-section label styles.
2020-12-14 05:26:39 +09:00
nana-4
90355c0b27 emojichooser: Add .emoji-searchbar style class
Similar to .emoji-toolbar, it would be nice to have this for styling.
2020-12-14 05:26:13 +09:00
nana-4
538cf9e294 dropdown: Improve search bar styling
As per the mockup. See:

https://gitlab.gnome.org/Teams/Design/os-mockups/-/blob/master/dropdown-lists/dropdown-lists.png
2020-12-14 05:08:59 +09:00
Matthias Clasen
96a300b2de Merge branch 'wip/jimmac/button-shed' into 'master'
headerbar window controls & clean up flat button extend

Closes #3427

See merge request GNOME/gtk!2942
2020-12-12 02:51:05 +00:00
Matthias Clasen
aeca9cb7ba Avoid adding // to resource paths
The GResource machinery is not forgiving about this
sort of thing.

Fixes: #3469
2020-12-11 21:47:54 -05:00
Carlos Garnacho
612d3bca7d gtk/window: Bring back L-shaped resize corners
These ended up square in the various refactors. Make them again L-shaped
by extending these along the edge being checked. This means we have to
check for corner positions in all edges, though.
2020-12-12 01:42:42 +01:00
Carlos Garnacho
e9fe270e94 gtk/scrolledwindow: Handle full scroll sequences only
In order to do this, leverage smooth scroll handling into the capture
phase scroll controller, controlled by ::scroll-begin in the propagation
phase controller.

There's 2 cases here:
- A child widget handles scroll. The scrolled window does not get
  ::scroll-begin, the child widget handles the full scroll sequence.
- No child handles scroll, the scrolled window gets ::scroll-begin,
  and transfers control of scrolling to the capture phase controller.
  As scrolling is performed, the pointer may fall into scrollable children,
  but the scrolled window will be capturing the scroll events, so these
  won't be seen by the child widgets.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/593
2020-12-12 01:42:42 +01:00
Carlos Garnacho
8402665c55 gtk/eventscrollerscroll: Handle smooth events in discrete controllers
We let smooth scroll events that don't trigger a ::scroll signal through.
This is unintended, these are handled, even if just accumulated.

This fixes cases like GtkSpinButton inside GtkScrolledWindow, where both
would handle events, until the GtkSpinButton eventually shifts away from
underneath the pointer.

Brought up at https://gitlab.gnome.org/GNOME/gtk/-/issues/593
2020-12-12 01:42:42 +01:00
Carlos Garnacho
79090f1755 gtk/entrycompletion: Ensure to show first row when shown, not allocated
This code was here in gtk3 to cater for the completion window being
positioned. That was only to meant once as long as the completion window
was shown.

This doesn't work as well for gtk4, ::size-allocate gets propagated from
the toplevel, so happens much more often for the completion window, this
ends up with the completion position being reset to the first row
frequently.

Do this simply once when popping up the completion, instead.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3083
2020-12-12 01:42:42 +01:00
Carlos Garnacho
3d84a38867 gtk/treeview: Position editable widgets correctly wrt left border
The coordinates are already widget-local here, not transformed by the
adjustment positions. Using the adjustment value here ends up pushing
the entry far from the left border.

The correct minimum value here is 0, which matches the treeview left
border.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3009
2020-12-12 01:42:42 +01:00
Carlos Garnacho
5155fac94f gtk/modelbutton: Handle unpaired releases
Let model buttons handle unpaired releases, these may happen indirectly
e.g. due to other child menus being opened at the time. Clicking would
dismiss the menu, but the menu item beneath the pointer would not get
activated.

We can handle that button release though via ::unpaired-release, so
there's no second click required.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3463
2020-12-12 01:42:42 +01:00
Carlos Garnacho
7a4d15dc67 gtk/range: Move button release handling to GtkGestureDrag
Tracking it through the GtkGestureClick becomes a bit cumbersome for
handling of simultaneously pressed buttons. We can track ::stopped,
but that also emits for a number of situations where we want drag to
continue.

However, the GtkGestureDrag is grouped with the click gesture, and
knows better when to finish the drag gesture (not just because of a
button release), so hook drag and zoom mode finalization there.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3426
2020-12-12 01:42:42 +01:00
Emmanuele Bassi
2c97d44281 docs: Fix the Widget as Buildable example
The layout properties use an old name.
2020-12-11 23:41:51 +00:00
Matthias Clasen
324683993e docs: Update references to GtkWindow:fullscreened
The property got renamed from fullscreen to fullscreened.
Update all references.
2020-12-10 09:10:21 -05:00
Jakub Steiner
f6f6241627 Adwaita: special case flat headerbar buttons
- make sure the hovers and pushed states are legible on a tintend headerbar

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3427
2020-12-10 14:24:29 +01:00
Jakub Steiner
6a33bed353 Adwaita: flat button :hover and :active
- special case undecorated button hovers
2020-12-10 14:16:25 +01:00
Jakub Steiner
f83ee0be23 Adwaita: headerbar_color > headerbar_bg_color
- semantic correction
2020-12-10 13:58:42 +01:00
Jakub Steiner
7442bdc383 Adwaita: duplicate selector
- awkward duplicate selector that should have no effect
  (resulting in the same css)
2020-12-10 13:51:10 +01:00
Emmanuele Bassi
b8a651df47 Share the popcount() fallback for MSVC
We use __builtin_popcount() in a couple of places, so it makes sense to
have it in one header.
2020-12-09 16:06:52 +00:00
Matthias Clasen
c5dd34344f Merge branch 'wip/carlosg/for-master' into 'master'
Wip/carlosg/for master

Closes #3426 and #3264

See merge request GNOME/gtk!2933
2020-12-09 15:04:01 +00:00
Matthias Clasen
c90cc976a5 Merge branch 'wip/jimmac/row-transitions-and-spacing' into 'master'
Adwaita: row transitions and spacing

Closes #3434

See merge request GNOME/gtk!2937
2020-12-09 13:35:54 +00:00
Jakub Steiner
a76ee61e97 Adwaita: row transitions and spacing
- no fading out of row hovers. Many feel like it's a slow
  refresh rather than intentional effect.
- give some margin to navigation lists

Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3434
2020-12-09 12:16:15 +01:00
Emmanuele Bassi
c4b768a4ec Rename GtkWindow:fullscreen to :fullscreened
Having a property with the same name of a method makes some languages
which put properties and method names in the same flat namespace not
really happy about our choices. To avoid collisions, let's put the the
"fullscreen" property into the past, alongside the "maximized" property.
2020-12-09 00:11:49 +00:00
Emmanuele Bassi
6d1be832d9 Fix the documentation for GtkWindow state properties
Drop the "don't write code that crashes" folksy bit; don't start
sentences with conjunctions; remove copy-pasted references to
"iconified" states; point to the corresponding property notification in
a consistent manner.
2020-12-08 23:49:45 +00:00
Carlos Garnacho
43e4848872 gtk/main: Keep implicit grab until all buttons are released
Currently, the implicit grab is broken on the first button release,
in the case of pressing multiple buttons simultaneously. This means
that we emit crossing events early, and the next button releases
are sent to the pointer focus widget instead.

Consider the implicit grab effective until all buttons are released,
and only unset the pointer implicit grab (and emit crossing events)
after there are no further buttons pressed. We do this by checking
event modifiers, given button release events do contain the modifiers
in effect at the time the event was generated, we have to look for
exactly one active button modifier.

Fixes weird pointer states after pressing multiple buttons on a
widget.

Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/3426
2020-12-08 23:27:03 +01:00
Carlos Garnacho
47d0b5ad0c gkt/textview: Set an iter position for event-less menu activation
This went missing. Use the current insertion position as a reference.
Fixes invoking the menu via keyboard.
2020-12-08 23:27:03 +01:00
Matthias Clasen
08ca8a361e docs: Remove a mention of gtk_window_get_size
That function has been removed.
2020-12-08 10:44:33 -05:00
Matthias Clasen
1f141c1953 Merge branch 'wip/surface-state-rework' into 'master'
Rework surface state and geometry computation

See merge request GNOME/gtk!2885
2020-12-08 15:38:36 +00:00
Jakub Steiner
1e14a91cb9 Merge branch 'wip/jimmac/no-inner-shadow-sidebars' into 'master'
Adwaita: no 3d shadow for pressed sidebar

Closes #3413

See merge request GNOME/gtk!2928
2020-12-08 14:18:44 +00:00
Jonas Ådahl
d2c95a1b13 gdk: Replace 'WITHDRAWN' state with async 'is-mapped' boolean
It was used by all surfaces to track 'is-mapped', but still part of the
GdkToplevelState, and is now replaced with a separate boolean in the
GdkSurface structure.

It also caused issues when a widget was unmapped, and due to that
unmapped a popover which hid its corresponding surface. When this
surface was hidden, it emitted a state change event, which would then go
back into GTK and queue a resize on popover widget, which would travel
back down to the widget that was originally unmapped, causing confusino
when doing future allocations.

To summarize, one should not hide widgets during allocation, and to
avoid this, make this new is-mapped boolean asynchronous when hiding a
surface, meaning the notification event for the changed mapped state
will be emitted in an idle callback. This avoids the above described
reentry issue.
2020-12-07 20:37:30 +01:00
Jonas Ådahl
8f8c5040db gtk/headerbar: Remove unused 'state' field 2020-12-07 20:37:30 +01:00
Matthias Clasen
3db0d06901 Properly remove gtk_window_get_size
It was still in the headers and the docs, but did
not have an implementation anymore.
2020-12-07 20:37:30 +01:00
Jonas Ådahl
2e5eeb6b92 gtk/window: Add 'fullscreen' prop and gtk_window_is_fullscreen()
This makes it possible to set 'fullscreen' to 'true' in a .ui file to
start an application in fullscreen mode.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
eb0eac0f03 gtk/window: Make R/O is-maximized R/W maximized prop
This makes it possible to set 'maximized' to true in .ui files, and the
window will show up maximized.

gtk_window_is_maximized() will return the intended maximized state until
actually mapped, it will then show the actual maximized state. The same
applies to reading the property.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
27077d5be8 gtk/window: Make 'default-size' adapt to configured size
This commit changes the behavior of window size computation and the
default size properties to:

 * The default-width and default-height properties are updated to the
   current window size unless the size is fixed by e.g. being maxmized,
   tiled etc.
 * The compute-size semantics are to just pick the default size, or if
   not adequate, use the measured size, and consequently update the
   default size, unless unresizable.
 * gtk_window_get_size() is removed, what's more likely relevant is the
   gtk_window_get_default_size() which will now contain more sensible
   values.

Various places that used gtk_window_get_size() were updated to use
gtk_window_get_default_size() to remember and restore previous sizes.

This also changes the default value of 'default-width' and
'default-height' from -1 to 0. The gtk builder simplify tool is taught
how to omit when the default size is set to both -1 and 0.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
40a9baa2db gtk/native: Remove gtk_native_check_resize()
This is now handle by the corresponding implemenatations using per
non-gobject-type API.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
4b2aae9950 gtk/dragicon: Use private gtk_drag_icon_present() instead of GtkNative
It didn't even use GtkNative, just the vfunc it set to the interface
sturct.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
9d3f497a21 gtk/tooltipwindow: Use gtk_tooltip_window_present() instead of GtkNative 2020-12-07 20:37:29 +01:00
Jonas Ådahl
517bc0db84 gtk/texthandle: Use gtk_text_handle_present() instead of GtkNative 2020-12-07 20:37:29 +01:00
Jonas Ådahl
369b03a3d8 gtk/window: Don't go via GtkNative when presenting
It'll only call directly back into GtkWindow's toplevel present handling
code.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
2cddec7798 gtk/popover: Use gtk_popover_present() instead of going via GtkNative
This makes it more explicit that managers of popovers make it "present".
2020-12-07 20:37:29 +01:00
Jonas Ådahl
f7fceab40b gtk/entry: Remove emoji chooser field
It wasn't ever set.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
3b66f63523 gtk/popover: Request fake motion events for popovers too
As with GtkWindow, we need to request fake motion events if allocation
changes, to emulate motion events given the new layout.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
5eee1dfcd1 gdk/popup: Remove the popup-layout-changed signal
It was replaced with GdkSurface::layout.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
19d2a4ab94 gtk/window: Only fake motion events on windows with pending allocations
This fixes an issue where the focus of the window continuously received
fake motion events even when a popover was open, making input events end
up behind the popover.

It also adds a comment describing why motion events are requested. Note
that popovers won't work with this, and it's possible both in the past
and now that sporadic missplaced motion events will appear, e.g. when a
window changes allocation but a popover is open.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
6ee7535af0 gdk/toplevelsize: Rename 'margin' to 'shadow' and 'shadow_width'
This makes it more consistent with everywhere else.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
b738054344 gdk: Remove GdkSurface::size-changed
It's not emitted, and everyone should use the GdkSurface::layout signal
from now on.
2020-12-07 20:37:29 +01:00
Jonas Ådahl
b8fa892b70 gtk/window: Minor cleanup 2020-12-07 20:37:29 +01:00
Jonas Ådahl
ca65ee8d50 gtk/window: Remove out-dated comment 2020-12-07 20:37:29 +01:00
Jonas Ådahl
5eca548acc gtk/window: Use default size if non-resizable if set 2020-12-07 20:37:29 +01:00
Emmanuele Bassi
606cb51293 Merge branch 'ebassi/activate-signal' into 'master'
Add accessors for GtkWidgetClass.activate_signal

See merge request GNOME/gtk!2925
2020-12-07 15:23:55 +00:00
Jakub Steiner
62e0c0de59 Adwaita: no 3d shadow for pressed sidebar
Fixes https://gitlab.gnome.org/GNOME/gtk/-/issues/3413
2020-12-07 14:19:24 +01:00
Jakub Steiner
30f789650f Revert "Adwaita: avoid clipping menu shadows"
While the workaround hides majority of the issue there are still two big downsides:

  - shadow does eat from the widget dimensions so alignment is broken
  - situations like popover going upwards on screen edge break completely

The appropriate action is to revert these theme duct tape solutions to make room
for a proper fix.

This reverts commit b3dba1dca6.

Issue https://gitlab.gnome.org/GNOME/gtk/-/issues/1987
2020-12-07 10:58:12 +01:00
Jonas Ådahl
3f96d4b6da gdk: Always get shadow width via GdkToplevelSize
This removes the gdk_surface_set_shadow_width() function and related
vfuncs. The point here is that the shadow width and surface size can now
be communicated to GDK atomically, meaning it's possible to avoid
intermediate stages where the surface size includes the shadow, but
without the shadow width set, or the other way around.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
8a599b2582 gtk: Allocate everything from GtkNativeClass::layout
This changes allocation of the widget trees to happen as a side effect
to the GdkSurface::layout signal, which first passes the GtkNative
instance where it is then forwarded to the implementations of the
GtkNative interface.

The implementations of GtkNative are the ones doing the actual
gtk_widget_allocate(), and they do so in their GtkNativeClass::layout
function.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
a798edc360 gtk/window: Only deal with shadow when (ex|in)cluding csd size
The size should correspond what gtk_widget_measure() does, and it
measures what's within the window excluding the shadow; so make this
helper function correspond to this.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
14b5a5a4c7 gtk/window: Remove gtk_window_resize()
Use gtk_window_set_default_size() or change the size of the widget
inside the window to get the same effect.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
deb58339b9 gtk/expander: Remove manual call to gtk_window_resize()
It happens implicitly for a non-resizeable window.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
ecd40fa265 wayland: Layout drag icon from GdkSurface::layout 2020-12-07 09:46:39 +01:00
Jonas Ådahl
3b140a05a4 gtk/dragicon: Don't show until child is set
Showing before the child would result in bogus
gdk_drag_surface_present() with an "empty" (1x1) size. This can easily
be avoided by postponing showing until there is anything to show.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
d38f81999e wayland: Communicate popup layout changes via GdkSurface::layout
By moving popup layout emission to the layout phase, the current
GdkPopup::poup-layout-changed signal has no value on its own as it'd be
ignored by GtkPopover.

Make the Wayland backend communicate the popup layout changes via the
common signal; but leave the rest intact until other backends catch up.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
ecc861bf06 Pass the layout signal via GdkSurface to GtkRoot
Don't have GtkRoot listen directly to the layout signal on the frame
clock, but let it pass through GdkSurface. This will allow GdkSurface to
be more involved in the layout phase.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
0c8d97e3f7 gtk/root: Validate css node after update
It should happen before layout, but after the animation tick, thus after
the update.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
13b4a4b24c gdk/toplevelsize: Add way to set margin
Will be used to communicate the shadow margin, instead of using
gdk_surface_set_shadow_width().

Also set these values in gtkwindow.c.
2020-12-07 09:46:39 +01:00
Jonas Ådahl
8f27b3fcf6 gtk/window: Let the backend handle toplevel freezing 2020-12-07 09:46:39 +01:00
Jonas Ådahl
996eeec16c gtk/window: Don't gdk_toplevel_present() if not mapped
That would map the window too early.
2020-12-07 09:46:39 +01:00
Michael Terry
c8d991e4de wayland: avoid referencing unallocated memory when uninhibiting 2020-12-06 18:37:40 -05:00
Emmanuele Bassi
d8c9a67d20 docs: Clarify gtk_widget_activate()
We need to tell people what signal will be emitted when calling
gtk_widget_activate(), and that the shortcuts API might be more
appropriate to what they are looking for.
2020-12-06 15:13:57 +00:00
Emmanuele Bassi
c352fe9ab0 Move activate_signal to the widget private class data
Instead of having it as a field in the class structure.
2020-12-06 15:06:18 +00:00
Emmanuele Bassi
f6c53ced0d a11y: Plug a leak in the AT-SPI context
Fixes: #3450
2020-12-05 20:25:30 +00:00
Matthias Clasen
894f893223 Merge branch 'revert-round-windows' into 'master'
Revert "theme: Round all window corners"

See merge request GNOME/gtk!2921
2020-12-05 15:10:16 +00:00
Emmanuele Bassi
3a9cca74fc Use WidgetClass.activate_signal getter function 2020-12-05 01:04:18 +00:00
Emmanuele Bassi
fe9c0db603 Add getter for WidgetClass.activate_signal
Just like we have a setter.
2020-12-05 01:04:18 +00:00
Emmanuele Bassi
fde32c5219 Use private can_activate() method
Instead of checking the activate_signal field directly.
2020-12-05 01:04:18 +00:00
Emmanuele Bassi
213024a560 Use function setter for WidgetClass.activate_signal 2020-12-05 01:04:18 +00:00
Emmanuele Bassi
e5e18ddffb Add private method to check activatability
We should have an actual method, instead of checking the
WidgetClass.activate_signal directly.
2020-12-05 01:04:18 +00:00
Emmanuele Bassi
b3e03fa6f0 Add wrappers for setting the WidgetClass.activate_signal field
Setting a field on a class structure is not always an easy task from
languages other than C. While bindings can provide access to the class
pointer, twiddling the fields in the class structure can be awkward.
Additionally, signal ids are not always readily available.

We can paper over the direct access to the class structure, as well as
the "signal name to id" mapping with a simple couple of setter
functions.
2020-12-05 01:04:18 +00:00
Jean Felder
4430314514 customsorter: Add missing nullable annotation 2020-12-05 00:04:36 +01:00
Matthias Clasen
24124452d5 docs: Fix up GtkPicture docs
These were missing proper linking.
2020-12-04 11:47:43 -05:00
Matthias Clasen
0dff89d9fb Revert "theme: Round all window corners"
This reverts commit e46522e4b5.
2020-12-04 11:13:26 -05:00
Matthias Clasen
f0f64f42ee emoji chooser: Fix incremental loading
This broke when we started using GDK_PROFILER_CURRENT_TIME for
timekeeping - that gets defined to 0 when we're building without
sysprof, so we can use it to make such determinations. Go back
to using g_get_monotonic_time().

Fixes: #3438
2020-12-04 11:09:43 -05:00
Benjamin Otte
66c3a43e96 Add docs about sizing pictures
Suggested by Christopher Davis.
2020-12-04 02:04:19 +00:00
Matthias Clasen
6ecae6c5f8 Merge branch 'wip/chergert/gdk-macos-for-master' into 'master'
macos: fix motion event delivery after closing transient window

Closes #3419

See merge request GNOME/gtk!2910
2020-12-03 20:07:16 +00:00
Corentin Noël
585ba777c2 build: Use the correct path to the header of the wayland and x11 backends 2020-12-03 10:02:03 +01:00
Matthias Clasen
35d2cbefe6 Merge branch 'wip/otte/conic' into 'master'
Add support for conic gradients

See merge request GNOME/gtk!2911
2020-12-03 03:54:24 +00:00
Christian Hergert
004f0a6596 macos: plug leak of application windows
This ensures that we don't leak window references inside the action muxer.
Otherwise, we risk not disposing the windows upon gtk_window_destroy()
and blocking the main loop from quitting.

Fixes #3419
2020-12-02 19:44:02 -08:00
Christian Hergert
b68e0bb3fb muxer: add helper to get group by name
This is useful when you need to read a group back out of the muxer.
2020-12-02 19:44:02 -08:00
Matthias Clasen
6e67d44aa3 Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master

Closes #3429

See merge request GNOME/gtk!2912
2020-12-03 03:43:19 +00:00
Benjamin Otte
e622013f7e css: Add support for conic-gradient()
This comes complete with animation support. For a good time, try:

@keyframes conic {
  100% { background-image: conic-gradient(from 1turn, red, lime, blue, yellow, red); }
}

window {
  background-image: conic-gradient(red, lime, blue, yellow, red);
  animation: conic infinite linear 5s;
}
2020-12-03 04:13:33 +01:00
Benjamin Otte
3886f0c530 Merge branch 'wip/otte/diediedie' into 'master'
Remove GtkFileChooserButton

See merge request GNOME/gtk!2909
2020-12-03 01:31:39 +00:00
Benjamin Otte
eb9c204535 gtk: Remove GtkFileChooserButton
... as discussed in the meeting.
2020-12-03 02:02:27 +01:00
Matthias Clasen
ab9e99218f docs: Remove mentions of <accelerator>
That is no longer supported, keyboard shortcuts
are done with GtkShortcut now.

Fixes: #3429
2020-12-02 19:59:44 -05:00
Benjamin Otte
8706d69e60 snapshot: Add gsk_snapshot_append_conic_gradient() 2020-12-03 01:15:53 +01:00
Benjamin Otte
55a242bd81 gsk: Add GskConicGradientNode 2020-12-03 00:47:54 +01:00
Emmanuele Bassi
0c8de4e561 Fix transfer of GtkTreeExpander.get_item()
We return a full reference to the item.

Fixes: #3428
2020-12-02 19:10:13 +00:00
Emmanuele Bassi
13f9993007 docs: Add missing fields to GtkTextBufferClass 2020-12-02 19:05:41 +00:00
Emmanuele Bassi
2e146a56f7 docs: Mark GtkModelButton's section as private
The widget is not public any more.
2020-12-02 19:05:41 +00:00
Bilal Elmoussaoui
475352fbc0 StringList: add missing nullability annotations 2020-12-02 10:36:29 -05:00
Bilal Elmoussaoui
ad30ac3932 Shortcut: add missing nullability annotations 2020-12-02 10:29:16 -05:00
Bilal Elmoussaoui
9d52ca1887 StringFilter: get_search fix nullable annotation 2020-12-02 10:28:07 -05:00
Bilal Elmoussaoui
ec537d75e4 Text: add missing nullability annotations 2020-12-02 10:28:07 -05:00
Bilal Elmoussaoui
b47ea9421f TextView: add missing nullability annotations 2020-12-02 10:28:07 -05:00
Bilal Elmoussaoui
845d2e5433 TreeModel: add missing nullability annotations 2020-12-02 10:28:07 -05:00
Bilal Elmoussaoui
50310f7b14 TreeView: add missing nullability annotations 2020-12-02 10:28:07 -05:00
Matthias Clasen
af944aa74c widget: Add a missing nullability annotation 2020-12-02 10:08:58 -05:00