Commit Graph

37579 Commits

Author SHA1 Message Date
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
Matthias Clasen
b5077d02ed Clarify the docs for gtk_widget_class_set_css_name
Reword, and mention the default css name.
2020-12-02 10:06:01 -05:00
Bilal Elmoussaoui
6a3bd1c4d1 window: default_icon_name can be null 2020-12-02 10:00:18 -05:00
Emmanuele Bassi
69b1b19315 docs: Annotate missing symbols 2020-12-01 17:28:16 +00:00
Emmanuele Bassi
516f71bbdc Use the appropriate prefix for GtkBuilderClosureFlags
Facilitate the job of glib-mkenums, and ensure that the enumeration
nicknames are computed reliably.
2020-12-01 17:26:34 +00:00
Emmanuele Bassi
d820fea7a4 docs: Annotate GtkBuildableParser 2020-12-01 17:21:45 +00:00
Emmanuele Bassi
3e8d157118 docs: Hide GtkBitsetIter fields 2020-12-01 17:18:38 +00:00
Emmanuele Bassi
67f45940ce docs: Annotate GtkAssistant::escape action signal 2020-12-01 17:18:23 +00:00
Emmanuele Bassi
95400e6451 docs: Annotate GtkAppChooserButton::changed 2020-12-01 17:16:05 +00:00
Emmanuele Bassi
4f67be1c8e docs: Add missing annotations for GtkTextTagTable 2020-12-01 15:51:52 +00:00
Emmanuele Bassi
c13e164f25 Make GtkCenterLayout accessors more idiomatic
Add argument validation, and emit a layout-changed signal whenever the
start, center, and end widgets change.
2020-12-01 15:51:52 +00:00
Emmanuele Bassi
eba8f36d4f docs: Fix annotations in GtkCenterLayout
Missing ':' separator.
2020-12-01 15:51:52 +00:00
Matthias Clasen
617d12fd77 Merge branch 'sophie-h/gtk-nullables-2'
Merge Sophie's nullable annotations, with some documentation
fixups on top.
2020-11-30 23:43:44 -05:00
Matthias Clasen
837f398a9b columnviewcolumn: Improve docs
Mention what setting sorter to NULL means.
2020-11-30 23:40:03 -05:00
Matthias Clasen
e18211deca centerlayout: Improve docs
Explain what passing NULL does.
2020-11-30 23:36:23 -05:00
Matthias Clasen
365afa381a Merge branch 'arnaudb/annotate-set-title' into 'master'
Add "nullable" annotation.

See merge request GNOME/gtk!2895
2020-11-30 21:14:28 +00:00
Matthias Clasen
39f0c48eb2 Apply 1 suggestion(s) to 1 file(s) 2020-11-30 17:44:30 +00:00
Matthias Clasen
7d24e1405e Apply 1 suggestion(s) to 1 file(s) 2020-11-30 17:42:39 +00:00
Matthias Clasen
f309fa21c9 build: Use link_whole for linking our convenience libs
Without this, we lose exported symbols from e.g. libgsk
that are not used elsewhere in the code.
2020-11-30 09:56:55 -05:00
Timm Bäder
dc13ff97e2 modelbutton: Reset active menu item on pointer leave
We don't want to leave an active menu item behind if the pointer doesn't
enter another menu item.
This matches the old GtkMenu behavior
2020-11-30 09:23:03 -05:00
Timm Bäder
af28237569 popovermenu: Connect to right controller signal
leave is emitted before the new contains-pointer value is set, so the
signal handler wasn't working right.
2020-11-30 09:22:57 -05:00
Timm Bäder
ff8de0a93f eventcontrollermotion: Notify by pspec 2020-11-30 09:22:49 -05:00
Timm Bäder
aefabcc056 popovermenu: Pull variable declaration in closest scope 2020-11-30 09:22:41 -05:00
Timm Bäder
1d6c6fc3b8 shortcutcontroller: Separate trigger/action early returns
We take this early return in update_accel over 36k times when starting
the widget factory and always because the action is not a named action.
2020-11-30 09:22:34 -05:00
Timm Bäder
8645773fc6 shortcutcontroller: Pass the muxer to update_accel()
We only needed the widget to get its action muxer. And this way we don't
have to call gtk_widget_get_action_muxer() dozens of times, just once in
set_widget().
2020-11-30 09:22:29 -05:00
Timm Bäder
d663909159 shortcutcontroller: Use priv->shortcuts directly in set_widget()
Instead of treating the shortcut controller itself as a GListModel,
which just passes everything along from priv->shortcuts.
2020-11-30 09:22:21 -05:00
Timm Bäder
e3ff92bc87 shortcutcontroller: Save signal handler ID
gtk_shortcut_controller_finalize() used to take ~13.8% when closing the
complex listbox demo in gtk4-demo. Now it takes nothing.
2020-11-30 09:21:57 -05:00
Timm Bäder
2d43ecf8ca widget: root child before emitting child observer signals
Try to avoid the childen_observer signal handlers screwing up internal
state.

Fixes #3364
2020-11-30 09:21:52 -05:00
Timm Bäder
5f4beb711f widgetprivate: Remove unused function 2020-11-30 09:21:42 -05:00
Matthias Clasen
8cf4ce5d9e Merge branch 'ebassi/cell-renderer-get-size' into 'master'
Remove GtkCellRendererClass.get_size()

See merge request GNOME/gtk!2896
2020-11-30 14:09:03 +00:00
Emmanuele Bassi
09b6c37e1d Merge branch 'ebassi/for-master' into 'master'
Blend nodes might have NULL top/bottom nodes

See merge request GNOME/gtk!2891
2020-11-30 13:10:25 +00:00
Emmanuele Bassi
60a7830ba5 Remove GtkCellRendererClass.get_size()
The get_size() vfuncs is deprecated in GTK3, and only used as a
fallback path for cell renderers that do not implement preferred
size virtual functions.
2020-11-28 19:21:24 +00:00