Commit Graph

62127 Commits

Author SHA1 Message Date
Matthias Clasen
632524f679 Reinstate expected focus behavior
After the :can-focus change in the previous commit, widgets
need to set suitable focus and grab_focus implementations
to implement the desired focus behavior.

This commit does that for all widgets.
2020-04-09 17:50:29 -04:00
Matthias Clasen
22e1827f84 Change the default value of GtkWidget:can-focus
Make widgets can-focus by default, and change the semantics
of can-focus to be recursive . If it is set to FALSE, focus
can not enter the widget or its descendents at all anymore.

This commit temporarily breaks focus behavior of widgets
that did not expect to receive focus.
2020-04-09 17:50:29 -04:00
Matthias Clasen
3c39613d9c widget: Add common focus vfunc implementations
Privately export a number of implementations for the focus
and grab_focus vfuncs that cover many common cases.
2020-04-09 17:50:29 -04:00
Matthias Clasen
46ff9f891a gizmo: Allow passing changing focus behavior
We need this in popovers. Maybe it could be done better
by defining one-off custom widgets.
2020-04-09 17:50:29 -04:00
Matthias Clasen
97ff1b83dc widget: Make the :has-focus property readonly
The only place where this should be set is when making
a widget the focus-widget of a window. We still keep
the property around in readonly form, since there are
a few places where we rely on property notification
for it.
2020-04-09 17:50:29 -04:00
Matthias Clasen
9416856420 testsuite: Stop setting :has-focus
This is not necessary, whenever we want to set the initial
focus in a ui file, we can set GtkWindow:focus-widget.
2020-04-09 17:50:29 -04:00
Matthias Clasen
c1459cc45b widget: Drop the :is-focus property
This property doesn't carry any new information compared
to GtkWindow:focus-widget. We still keep the gtk_widget_is_focus
getter, as a convenient shortcut.
2020-04-09 17:50:29 -04:00
Matthias Clasen
4fe8c037c7 reftests: Stop using can-focus 2020-04-09 17:50:29 -04:00
Matthias Clasen
b1afe5ff23 a11y tests: Stop using can-focus 2020-04-09 17:50:29 -04:00
Matthias Clasen
bbd4fb8798 testsuite: Stop using can-focus 2020-04-09 17:50:29 -04:00
Matthias Clasen
b3b29e37fd inspector: Drop more uses of can-focus 2020-04-09 17:50:29 -04:00
Matthias Clasen
f996ba6585 inspector: Remove can-focus from ui files 2020-04-09 17:50:29 -04:00
Matthias Clasen
7ca36cd2d4 Stop setting can-focus in ui files
None of these settings are necessary.
2020-04-09 17:50:29 -04:00
Matthias Clasen
2a18f2150d window: Make set_focus equal to grab_focus
Make gtk_window_set_focus call gtk_widget_grab_focus internally.
This means that set_focus can now end up putting the focus on
a child of the passed-in widget, and makes the focus-widget
property work for setting initial focus to (the child of) an
entry in a ui file.
2020-04-09 17:50:28 -04:00
Matthias Clasen
a65fd81106 root: Reorganize focus handling
Make :focus-widget a GtkWindow property and add vfuncs
to the GtkRoot interface instead of the property.
2020-04-09 17:50:28 -04:00
Matthias Clasen
ff8217db40 Add more focus chain tests
Test page 2 and 3 of widget-factory as well, and try other directions.
2020-04-09 17:50:28 -04:00
Matthias Clasen
a3861bf9a0 Fix running focus-chain tests in ci
The widget-factory ui files require geettings
(for the color chooser), so set GSETTINGS_SCHEMA_DIR.
2020-04-09 17:50:28 -04:00
Matthias Clasen
b86c1446a4 notbook: Fix a bug in focus handling
After the header widget was introduced, focus would get
stuck in a loop between actions and tabs.

This could be seen in the notebook on page 3 of
widget-factory.
2020-04-09 17:50:28 -04:00
Matthias Clasen
9ce58bdb0c coloreditor: Draw a focus around the color plane
Not doing it was just an oversight.
2020-04-09 14:11:18 -04:00
Matthias Clasen
9f252f0ceb colorplane: Set a css name
Every widget should have one.
2020-04-09 14:10:23 -04:00
Matthias Clasen
7008a531bb Merge branch 'wip/xdg-popup-move' into 'master'
Wayland popup moving

See merge request GNOME/gtk!1017
2020-04-08 23:59:02 +00:00
Jonas Ådahl
458b8a6554 wayland: Move transient-for field to GdkWaylandToplevel
A toplevel will only ever be transient-for to another toplevel, and only
a toplevel will ever be transient-for, so move the field into the
GdkWaylandToplevel, and make it a pointer to another GdkWaylandToplevel.
2020-04-08 23:32:47 +02:00
Jonas Ådahl
307cc69adb wayland: Add surface to toplevel list only if toplevel
It was using another check (has parent) to do this, but now we have a
much more obvious way of creating surfaces, so we can use the type
directly.
2020-04-08 23:32:47 +02:00
Jonas Ådahl
ab6b5ae568 wayland: Remove own pointer to the popup parent
It's there already as the GdkSurface::parent, no need to duplicate.
2020-04-08 23:32:47 +02:00
Jonas Ådahl
0e601c0a70 wayland: Move toplevel/popup/drag surface definitions higher up
We them up there, so that code higher up compared to where they are
defined now can make use of them. Also add a few macros for type
checking and casting.
2020-04-08 23:32:47 +02:00
Jonas Ådahl
5425edff82 wayland: Move popups with xdg_popup.reposition
The third version of xdg-shell introduces support for explicit popup
repositioning. If available, make use of this to implement popup
repositioning.

Note that this does *NOT* include atomic parent-child state
synchronization. For that,
https://gitlab.freedesktop.org/wayland/wayland-protocols/issues/13 will
be needed.

This currently uses my own fork of wayland-protocols which adds meson
support, so that we can use it as a subproject. Eventually when
wayland-protocols' meson support lands upstream, we should change it to
point there.

Silence some meson warnings while at it to make CI happy.

This also bumps the glib requirement, since g_warning_once() is used.
2020-04-08 23:32:47 +02:00
Jonas Ådahl
213c471bb7 build: Change wrap revisions to use master instead of origin/master
Using origin/master crashes meson.
2020-04-08 23:32:47 +02:00
Jakub Steiner
9ae0fe7f3a Merge branch 'Gtk4_blue_focus_rings' into 'master'
Blue outlines / focus rings

See merge request GNOME/gtk!1629
2020-04-08 21:12:57 +00:00
Frederik F
abe6876f7c Blue outlines / focus rings
- introduce two new colors: $focus_border_color for focused / outlined elements and $_coloured_focus_border_color for focused / outlined elements with a colored background color, like suggested/destructive buttons or selected elements
- set outline / focus color, offset and style accordingly for all widgets
- adapt entry focus color
2020-04-08 21:12:57 +00:00
Matthias Clasen
53d74fd2dc Merge branch 'render-node-types' into 'master'
Turn GskRenderNode into a fundamental type

See merge request GNOME/gtk!1649
2020-04-08 20:55:14 +00:00
Emmanuele Bassi
3f0a830f3c Properly annotate the render node constructors
Now that the GskRenderNode subclasses are recognised as proper
sub-types, we can annotate the constructors with their type. The C API
remains the same.
2020-04-08 16:17:08 +01:00
Emmanuele Bassi
e0323fcdc2 Add get_type() functions for GskRenderNode subclasses
The introspection scanner tries to match a type name with a get_type()
function, in order to correctly identify a type as a class.

If the function is not available, we have two choices:

 - add some special case inside the introspection scanner, similar to
   how GParamSpec subclasses are handled in GObject
 - add a simple get_type() function

The latter is the simplest approach, and we don't need to change that
much, since we still register all render nodes at once.
2020-04-08 16:07:04 +01:00
Emmanuele Bassi
cd5cded430 Do not install GSK headers for missing backends
Broadway and Vulkan renderers are optional; if GTK hasn't been built
with their GSK renderers, we should not install their headers.
2020-04-08 15:41:21 +01:00
Emmanuele Bassi
54e4e6cd23 Improve the gtktypefuncs.inc generator
Remove the plug/socket exception, and add exceptions for non-X11
windowing systems.

Additionally, speed up the file generation by avoiding string
concatenation in Python.
2020-04-08 15:41:19 +01:00
Emmanuele Bassi
59852d3425 Add missing transfer annotation 2020-04-08 15:40:15 +01:00
Emmanuele Bassi
d701a89281 Turn GskRenderNode into a derivable type
Language bindings—especially ones based on introspection—cannot deal
with custom type hiearchies. Luckily for us, GType has a derivable type
with low overhead: GTypeInstance.

By turning GskRenderNode into a GTypeInstance, and creating derived
types for each class of node, we can provide an introspectable API to
our non-C API consumers, with no functional change to the C API itself.
2020-04-08 15:40:15 +01:00
Emmanuele Bassi
5e095cd208 Add macro for exported variables
The logic is based on the similar macro in GLib, but with the
appropriate GDK symbols.
2020-04-08 15:40:15 +01:00
Emmanuele Bassi
d2bdf3d5a1 Merge branch 'ci-meson-bump' into 'master'
ci: Update the version of Meson in our Docker image

See merge request GNOME/gtk!1651
2020-04-08 12:17:50 +00:00
Emmanuele Bassi
e692385baa ci: Update the version of Meson in our Docker image
Needed for !1017.
2020-04-08 12:26:58 +01:00
Matthias Clasen
1e8df851e9 Merge branch 'matthiasc/for-master' into 'master'
Remove an unused backend includes

See merge request GNOME/gtk!1648
2020-04-07 20:30:43 +00:00
Matthias Clasen
904db0a8f7 Merge branch 'imcontextsimple-drop-ifdefs' into 'master'
impcontextsimple: Drop ifdef'ed platform dependencies

See merge request GNOME/gtk!1647
2020-04-07 19:27:51 +00:00
Matthias Clasen
6b7cc8baa6 Remove an unused backend includes
These includes are just leftovers.

Every time where we do an #ifdef GDK_WINDOWING... in gtk/,
something went wrong. Don't do it needlessly.
2020-04-07 15:13:18 -04:00
Matthias Clasen
71fe843d99 impcontextsimple: Drop ifdef'ed platform dependencies
The proper way to do this would be to adapt the tables
to have the right data for the platform. Since 4.0 is
a new start in many ways, lets clean this up.
2020-04-07 14:54:04 -04:00
Matthias Clasen
552a681816 Merge branch 'private-x11-types' into 'master'
Do not parse all GDK-X11 source files

See merge request GNOME/gtk!1646
2020-04-07 18:18:55 +00:00
Emmanuele Bassi
2f0016eb08 Rename gdkx11keys.h
The header is now private, so it should follow the same naming scheme
for private GDK-X11 headers.
2020-04-07 18:12:58 +01:00
Emmanuele Bassi
f87291cac2 Hide GdkX11Keymap's GType function
It's not a public object.
2020-04-07 18:10:01 +01:00
Emmanuele Bassi
37c3ba2645 Do not parse all GDK-X11 source files
We don't need all of them, only the ones that contain public API. This
allows us to reduce the chance of a stray symbol getting incorrectly
added to the introspection data.
2020-04-07 18:06:08 +01:00
Matthias Clasen
ba05787a06 Merge branch 'attribute-docs' into 'master'
entry: Document buildable support

See merge request GNOME/gtk!1643
2020-04-07 04:15:33 +00:00
Matthias Clasen
12b97ffd24 entry: Document buildable support 2020-04-06 23:33:22 -04:00
Matthias Clasen
1ae60cb713 entry: Add <attributes> support
Make entries support the same <attributes> syntax
as labels.

Closes: #1335
2020-04-06 22:59:54 -04:00