Commit Graph

62309 Commits

Author SHA1 Message Date
Timm Bäder
5d61abd748 label: Redraw when text attrs are affected by css change
GtkWidget doesn't do it automatically and probably shouldn't
2020-04-17 15:21:00 +02:00
Timm Bäder
9f6ec5b7d4 label: Don't create an unnecessary attribute list 2020-04-17 15:21:00 +02:00
Timm Bäder
78e6475f9f label: Only parse mnemonic attributes if we need to 2020-04-17 15:21:00 +02:00
Timm Bäder
6289f7eecd label: Ignore AFFECTS_ATTRS css changes if we can
It's only interesting if we either already have attributes, or the new
style adds some.
2020-04-17 15:21:00 +02:00
Timm Bäder
9ad0dbb145 label: Inline function into only caller 2020-04-17 15:21:00 +02:00
Timm Bäder
db9fbb3918 label: Remove some unused quarks 2020-04-17 15:21:00 +02:00
Timm Bäder
afaa352142 label: Remove priv pointer 2020-04-17 15:21:00 +02:00
Timm Bäder
3b7cb31157 label: Stop connecting to notify::gtk-enable-accels
Leftover from when GtkAccelLabel was a GtkLabel subclass. GtkAccelLabel
connects to this itself these days though.
2020-04-17 15:21:00 +02:00
Timm Bäder
f0b33cdc53 label: Set underline text and markup in one step
Try to unify the way we parse the mnemonic character
2020-04-17 15:21:00 +02:00
Timm Bäder
203b0c9c9d label: Fold set_pattern_internal into only caller 2020-04-17 15:21:00 +02:00
Timm Bäder
1ea24e98c1 adwaita: don't extent %link in linkbuttons
We already do that for the label inside the button.
2020-04-17 15:21:00 +02:00
Timm Bäder
36248c609d label: Remove GtkLabel:track-visited-links
Always track visited state of links. This way all visited links in all
labels look the same. Whether the theme wants to style :visited is the
theme's business.
2020-04-17 15:21:00 +02:00
Timm Bäder
f6bedd0d5e label: Remove a11y-only properties
Update them manually instead.
2020-04-17 15:21:00 +02:00
Timm Bäder
8f96b38539 label: Fold function into only caller
This makes it more obvious that gtk_label_setup_mnemonic() depends on
the root of the widget and it therefore makes sense to call it in
::root/::unroot.
2020-04-17 15:21:00 +02:00
Timm Bäder
813be8a921 label: Don't normalize booleans in internal setters
We almost always pass a literal TRUE/FALSE to them.
2020-04-17 15:21:00 +02:00
Timm Bäder
21ac2330af stylecontext: Remove get_pango_attributes
Make the only caller use GtkCssNode API.
2020-04-17 15:21:00 +02:00
Timm Bäder
584a71ae96 cssstyle: Only create PangoAttrList if there are attribtues
Don't allocate a new GString if we never need it and therefore don't
create the PangoAttrList if we have no attributes anyway. Update callers
to handle the possible NULL return value.
2020-04-17 15:21:00 +02:00
Timm Bäder
2e14ea84f3 label: Pull all pango attributes from the theme
Dont' force an underline attribute here. Just ask the theme for the
text-decoration.
2020-04-17 15:21:00 +02:00
Timm Bäder
4737495e3c label: Fix an old TODO comment 2020-04-17 15:21:00 +02:00
Timm Bäder
57f913b753 modelbutton: Emit ::clicked() before closing the popover
The clicked handler might still need the popover.
2020-04-17 15:21:00 +02:00
Timm Bäder
4851081a77 label: Remove public pattern API 2020-04-17 15:21:00 +02:00
Timm Bäder
13fde6f4cd label: Shorten set_markup_internal a bit 2020-04-17 15:21:00 +02:00
Timm Bäder
1db53e6676 label: Avoid duplicating a string
We only use str_for_accel if with_uline is TRUE.
2020-04-17 15:21:00 +02:00
Timm Bäder
74b5eaa700 label: Pass <markup> length directly when parsing markup 2020-04-17 15:21:00 +02:00
Timm Bäder
b16157bc0d label: Remove a double if (needs_root) check
The code is clearer and shorter this way.
2020-04-17 15:21:00 +02:00
Timm Bäder
7a98e79d90 label: Use widget API to add style class 2020-04-17 15:21:00 +02:00
Timm Bäder
c588d8f858 label: Clear select info before creating a new one
E.g. set_markup_internal will create a new select_info, but then we were
destroying it again, just to recreate it later.
2020-04-17 15:21:00 +02:00
Timm Bäder
23cffdfe42 label: Save a few LOC 2020-04-17 15:21:00 +02:00
Timm Bäder
99998d25f8 label: Save links in an array
Stop using GList for this.
2020-04-17 15:21:00 +02:00
Timm Bäder
ca47e96d35 widget: Return an array from list_devices
To forther reduce the GList usage in the code base.
2020-04-17 15:21:00 +02:00
Timm Bäder
e583349956 accelgroup: Restructure gtk_accelerator_name
To fix invalid reads and make the function a bit shorter while we're at
it.

Fixes #2602
2020-04-17 15:21:00 +02:00
Timm Bäder
7bc4daae2f main: Stop using GList when propagating events
There are still some cases missing.
2020-04-17 15:21:00 +02:00
Matthias Clasen
726a7ac705 inspector: Fix a crash
Don't crash while picking. The event signal broke
when GdkEvent was turned into a type instance,
since the automatic marshallers don't know how to
deal with that. Manually set the right marshaller.
2020-04-17 08:37:45 -04:00
Matthias Clasen
60329c3cda Merge branch 'event-types' into 'master'
Rework event types

Closes #2585

See merge request GNOME/gtk!1702
2020-04-16 20:36:24 +00:00
Emmanuele Bassi
f28aa1ba02 Restructure the GdkEvent type hierarchy
GdkEvent has been a "I-can't-believe-this-is-not-OOP" type for ages,
using a union of sub-types. This has always been problematic when it
comes to implementing accessor functions: either you get generic API
that takes a GdkEvent and uses a massive switch() to determine which
event types have the data you're looking for; or you create namespaced
accessors, but break language bindings horribly, as boxed types cannot
have derived types.

The recent conversion of GskRenderNode (which had similar issues) to
GTypeInstance, and the fact that GdkEvent is now a completely opaque
type, provide us with the chance of moving GdkEvent to GTypeInstance,
and have sub-types for GdkEvent.

The change from boxed type to GTypeInstance is pretty small, all things
considered, but ends up cascading to a larger commit, as we still have
backends and code in GTK trying to access GdkEvent structures directly.
Additionally, the naming of the public getter functions requires
renaming all the data structures to conform to the namespace/type-name
pattern.
2020-04-16 19:54:02 +01:00
Emmanuele Bassi
96cfb12946 Fix annotations for GtkEventController 2020-04-16 19:40:00 +01:00
Emmanuele Bassi
5abb6f2a61 Fix annotation for gtk_show_uri_full()
The callback is now an asynchronous closure.
2020-04-16 19:40:00 +01:00
Emmanuele Bassi
0d065bca6d Fix compiler warning
Newer versions of GCC are fairly aggressive with NULL checks.
2020-04-16 19:40:00 +01:00
Matthias Clasen
b3b194532d Merge branch 'matthiasc/for-master' into 'master'
themes: Fix HighContrast dependencies

See merge request GNOME/gtk!1701
2020-04-16 18:05:19 +00:00
Matthias Clasen
1d1e1c5e83 Merge branch 'css-focus-changes' into 'master'
Add a focus-within state

See merge request GNOME/gtk!1700
2020-04-16 18:01:29 +00:00
Matthias Clasen
d36e41c6b8 themes: Fix HighContrast dependencies
HighContrast themes now depend on sass files from Adwaita.
2020-04-16 12:40:37 -04:00
Matthias Clasen
4516bfbc88 Adwaita: Some adjustments for :focus-within
Use :focus-within for focus in entries, since the
actual focus is on the text within, and :focus for
notebooks, since we don't want to draw an outline
around the notebook when the focus is in content.
2020-04-16 12:31:17 -04:00
Matthias Clasen
5095e87bb7 testsuite: Add some checks for focus states
This is some opportunistic checking in a test that
is really about focus chains, but better than nothing.
2020-04-16 12:31:17 -04:00
Matthias Clasen
54b99d281b Add a focus-within state
This is used for widgets that contain the focus widget,
reserving the focused state for the focus location itself.

This aligns our focus state handling with
https://www.w3.org/TR/selectors-4/
2020-04-16 12:31:01 -04:00
Matthias Clasen
3cb023d0df Merge branch 'monitor-signals-x11' into 'master'
x11: emit ::enter/leave-monitor

See merge request GNOME/gtk!1699
2020-04-16 15:43:47 +00:00
Olivier Fourdan
86f295f929 x11: emit ::enter/leave-monitor
For the X11 backend, keep a list of monitors for which the surface
intersects the monitor area.

Whenever the X11 surface is configured, check against the list of
monitors to determine whether it enters a new monitor or if it left a
monitor, to emit the corresponding ::enter/leave-monitor signals just
like a Wayland compositor would.

As monitors can be added, removed or reconfigured at any time, redo
those checks whenever any of these events occur.
2020-04-16 16:23:57 +02:00
Matthias Clasen
e83d87c20a Add :focus-visible to css docs 2020-04-15 23:14:34 -04:00
Matthias Clasen
03080f29b9 css: use :focus-visible instead of :focus(visible)
This is aligning our language with
https://www.w3.org/TR/selectors-4/
2020-04-15 23:09:36 -04:00
Matthias Clasen
3d988d5fe9 Merge branch 'matthiasc/for-master' into 'master'
window: Don't set is-active twice

See merge request GNOME/gtk!1698
2020-04-15 22:26:25 +00:00
Matthias Clasen
dbd578eaef window: Don't set is-active twice
We are listening to focus change events for this
no need to duplicate the work in ::state-changed.
2020-04-15 17:08:15 -04:00