Commit Graph

56798 Commits

Author SHA1 Message Date
Matthias Clasen
ecd6446d08 motion controller: Add focus properties
Add boolean properties, is-pointer-focus and
contains-pointer-focus, that track whether the pointer
is in the widget itself or in one of its descendants.
2019-03-16 23:32:31 -04:00
Matthias Clasen
1540797237 motion controller: add details to signals
The ::enter and ::leave signals get emitted up and down the
connecting path between the old an the new pointer location.

The signals are less useful if you can't find out where along
the path you are. That is what crossing mode and detail are
about, so add those to the signals.
2019-03-16 23:03:41 -04:00
Matthias Clasen
898728fb2d a11y tests: Clean up the placeholder-text test
This was relying on setting has-focus for initial focus.
2019-03-16 22:46:34 -04:00
Matthias Clasen
fc2b412c0c Merge branch 'wip/matthiasc/focus3' into 'master'
Move focus to GtkRoot

See merge request GNOME/gtk!640
2019-03-17 02:42:46 +00:00
Matthias Clasen
1ce5327058 xim: Stop using GtkWidget::event
It does not exist anymore. I'm removing this code now
because our CI tests are using xim and fail due to this.

Eventually, this code should be ported to use a popover.
2019-03-16 22:16:10 -04:00
Matthias Clasen
ad3773b2e1 a11y tests: Update expected results
The changes here are all related to initial focus.
2019-03-16 21:49:24 -04:00
Matthias Clasen
8619b109cc Update the focus test
Check that we get the expected sequences of focus
change events for the nonlinear, inferior and ancestor
cases.

It would be nice to do the same checks for crossing
events, but we have no gtk_window_set_hover().
2019-03-16 21:31:56 -04:00
Matthias Clasen
6ddb61119a Use root in gdk_synthesize_crossing_events 2019-03-16 21:30:48 -04:00
Matthias Clasen
492a38c229 Make gtk_widget_get_focus_child public
It doesn't really make sense to have only
the setter, but not the getter public.
2019-03-16 21:24:45 -04:00
Matthias Clasen
181a4bce25 Add key controller API to the docs
A bunch of API was missing here.
2019-03-16 21:24:45 -04:00
Matthias Clasen
93905a8513 key controller: Enforce limitations of key forwarding
We now set current_event for focus-change as well,
so make sure to check the event type.
2019-03-16 21:24:45 -04:00
Matthias Clasen
4f06b669c5 key controller: Improve the docs
Mention the limitations of the key forwarding api.
2019-03-16 21:24:45 -04:00
Matthias Clasen
f3ed3e99c3 key controller: Add getters for focus event targets
This information can be needed in signal handlers,
so make it available.
2019-03-16 21:24:45 -04:00
Matthias Clasen
4f5a8207bc key controller: Add focus properties
Add boolean properties, is-focus and contains-focus, that
track whether the focus is in the widget itself or in
one of its descendants.
2019-03-16 21:24:45 -04:00
Matthias Clasen
2f1194c0c1 key controller: Fix a copy/paste error
Prefix the finalize function properly.
2019-03-16 21:24:45 -04:00
Matthias Clasen
921eccb459 Pass mode and detail to focus-in/out signals
This information is useful when maintaining a
'last focus' field.

Update all users.
2019-03-16 21:24:45 -04:00
Matthias Clasen
888b92674f Move maintaining the focus chain
Put this code in the same place where we generate
the crossing events.
2019-03-16 21:24:45 -04:00
Matthias Clasen
7d354b5084 Some fixes to crossing event generation
In the inferior and ancestor cases, we were missing
the initial/final event.
2019-03-16 21:24:45 -04:00
Matthias Clasen
4238a04c7b window: Use gtk_synthesize_crossing_events
Emit focus change events in the same way as crossing events.
Also change the code to only emit focus change events for
the master keyboard - we only maintain a single focus location,
so sending multiple focus change events for different devices
seems confusing.
2019-03-16 21:24:45 -04:00
Matthias Clasen
adb547a147 Export gtk_synthesize_crossing_events internally
We want to use this for focus changes, now that
it can emit focus change events.
2019-03-16 21:24:45 -04:00
Matthias Clasen
cdcd2bb073 Share crossing and focus change event code
Make a single function that can emit both
enter/leave and focus change events.
2019-03-16 21:24:45 -04:00
Matthias Clasen
06f790d663 gdk: Add a related_target field to some events
Crossing and focus change events are emitted between
two widgets, and want to associate both with the
events.
2019-03-16 21:24:45 -04:00
Matthias Clasen
c73972f7df gdk: Rename gdk_event_set_user_data
Lets call it what it is, the target.
All of this is private api anyway.

Update all callers.
2019-03-16 21:24:45 -04:00
Matthias Clasen
8d5f1ae662 gdk: Add crossing mode and detail to focus events
We want focus events more similar to crossing events.
2019-03-16 21:24:45 -04:00
Matthias Clasen
a3abf0693d Clarify grab_focus docs 2019-03-16 21:24:45 -04:00
Matthias Clasen
7ca24f12d7 window: Remove initial-focus builder support
With focus-widget now a property, this is no longer needed.
2019-03-16 21:24:45 -04:00
Matthias Clasen
f68855341e window: Remove ::set-focus
The focus-widget is now a property, so we don't need
this signal anymore.
2019-03-16 21:24:45 -04:00
Matthias Clasen
31d9ecb5c3 popover: Stop using ::set-focus
This will change completely when GtkPopover becomes a
root. For now, stop using ::set-focus and just use the
focus-widget property.
2019-03-16 21:24:44 -04:00
Matthias Clasen
f13e6179e8 filechooser: Stop using ::set-focus
We can achieve the same with the focus-widget property.
2019-03-16 21:24:44 -04:00
Matthias Clasen
d279c666a9 inspector: Stop using ::set-focus
The focus-widget is just a regular property now that shows
up on the property page. No need to special-case it on
the misc page anymore.
2019-03-16 21:24:44 -04:00
Matthias Clasen
7819a5aab9 Drop gtk_widget_send_focus_change
Replace this with gtk_widget_set_has_focus + gtk_widget_event.
2019-03-16 21:24:44 -04:00
Matthias Clasen
15300f839e widget: Add a private setter for has-focus 2019-03-16 21:24:44 -04:00
Matthias Clasen
94b0e99be5 Exclude non-drawable widgets from focus
This was showing up as confusion between palette
and editor in the color chooser.
2019-03-16 21:24:44 -04:00
Matthias Clasen
8c1d852a84 widget: Drop the ::focus signal
The focus vfunc is an implementation detail
of GTK focus handling, and having external
signal handlers interfere with it is not
a good idea.
2019-03-16 21:24:44 -04:00
Matthias Clasen
2738926dcb Simplify the move_focus api
No need to pass the array in from the outside.
2019-03-16 21:24:44 -04:00
Matthias Clasen
029ec38e63 Move a check to gtk_window_set_focus
gtk_widget_grab_focus is just a wrapper for
gtk_window_set_focus. We should do all the enforcement
there.
2019-03-16 21:24:44 -04:00
Matthias Clasen
2bf1561b48 Port widgets to the root focus API 2019-03-16 21:24:44 -04:00
Matthias Clasen
bd44831987 window: Implement the root focus api
This just uses the existing get/set_focus functions.
We keep them public for now.
2019-03-16 21:24:44 -04:00
Matthias Clasen
ab5d3e756b root: Add focus
Add a getter and a setter for the focus widget.
The default implementations do nothing.
2019-03-16 21:24:44 -04:00
Matthias Clasen
92f1bdcf45 Redo focus handling
GtkWindow has a focus_widget that points to the current input focus.
GtkWidget has a focus_child that points to the child that contains
the input focus. Following the focus_child chain from the toplevel
always leads to the focus_widget. We never unset focus_child, we only
set it. We bubble focus change events.
2019-03-16 21:24:44 -04:00
Matthias Clasen
64b9114d98 password entry: Fix property notification
Both placeholder-text and activates-default were not
up to our usual standards for property notification,
and the tests complained.
2019-03-16 21:23:28 -04:00
Matthias Clasen
a1cc809c60 search entry: Fix property notification
Both placeholder-text and activates-default were not
up to our usual standards for property notification,
and the tests complained.
2019-03-16 21:23:28 -04:00
Matthias Clasen
7c19ab66ee single selection: Skip tests properly
Do runtime checks for the GLib version,
instead of compiling out tests.
This avoids compiler warnings.
2019-03-16 21:23:28 -04:00
Matthias Clasen
7ca528b896 widget: Check rootness for invisibility
Make the function that determines initial visibility
look at whether the class implements GtkRoot. That is
the eventual goal for this check. For now, allow
popovers in here as well.
2019-03-16 21:23:28 -04:00
Jordi Mas
2870f4dbfe Update Catalan translation 2019-03-16 22:06:43 +01:00
Matthias Clasen
f14d998c95 password entry: Don't show both icons
It can be a bit confusing to have an indicator
and an action next to each other, and with the
peek icon, the need for the Caps Lock warning is
reduced, since you can just reveal the text to
see that it is capitalized.

Therefore, only show the Caps Lock warning if
the peek icon is disabled.
2019-03-15 14:35:25 -04:00
Matthias Clasen
34e859a5bc Add a tagged entry demo
This can serve as an example for how composite entries
can now be done outside of GTK, easily.
2019-03-15 13:21:26 -04:00
Matthias Clasen
5822a35087 gtk-demo: Show password peek icon 2019-03-14 20:43:15 -04:00
Matthias Clasen
a3b73a416e password entry: Add a way to see the content
Add a ::show-peek-icon property and show a clickable
icon when it is set. Clicking it toggles the visibility
of the content. The same functionality is also accessible
via a context menu item.

This is a common feature of password entries.
2019-03-14 20:31:45 -04:00
Matthias Clasen
d3cecd65a5 password entry: Make the Caps Lock icon less prominent
Set a style class, and theme the Caps Lock icon to
be  less promient, so it does not appear clickable.
2019-03-14 20:03:34 -04:00