Commit Graph

56736 Commits

Author SHA1 Message Date
Matthias Clasen
0ab4ec1169 search entry: Fix a copy-paste error 2019-03-03 23:29:04 -05:00
Matthias Clasen
a6d4c2adeb Factor out a common function
Use the same helper function to determine if a widget
can be made the focus-widget in all the places where
it is what we want to know.

The helper function takes into account can-focus,
sensitive and child-focusable.
2019-03-03 22:27:34 -05:00
Matthias Clasen
2dbd2381fa label: Bring back link focus
Handle key-pressed ourselves to maintain the intra-label
focus location for links. This works almost as well as
it did previously. One issue is that our ::focus-in
handler does not know which direction the focus is coming
from, so we always select the first link, whereas previously
we would select the last link for Shift-Tab.
2019-03-03 22:27:34 -05:00
Matthias Clasen
6c01e2e5e6 label: Redo select-on-focus handling
Similar to GtkEntry, move this from grab_focus to focus-in.
2019-03-03 22:27:34 -05:00
Matthias Clasen
530e3ff9c7 entry: Redo select-on-focus handling
GtkText was handling this just on grab_focus, which is
not the only way anymore that focus can reach it. Instead,
shift this to focus-in, and add a property that can be
used to override the select-on-focus setting. Remove
the gtk_text_grab_focus_without_selecting(), but keep
the GtkEntry variant of the function, reimplemented
to use the properties. GtkSearchEntry sets the select-on-focus
property of its text to FALSE, to match expectations.
2019-03-03 22:27:34 -05:00
Matthias Clasen
d4a5f3fe69 window: Remove initial-focus builder support
With focus-widget now a property, this is no longer needed.
2019-03-03 22:27:34 -05:00
Matthias Clasen
918b931cc6 window: Remove ::set-focus
The focus-widget is now a property, so we don't need
this signal anymore.
2019-03-03 22:27:34 -05:00
Matthias Clasen
a0dc7b473a 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-03 22:27:34 -05:00
Matthias Clasen
8a6cdeff1d filechooser: Stop using ::set-focus
We can achieve the same with the focus-widget property.
2019-03-03 22:27:34 -05:00
Matthias Clasen
90129235e1 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-03 22:27:34 -05:00
Matthias Clasen
542e2a27d7 Protect against focus cycles
Now that next_focus_child wraps around for windows,
GtkMenus cause an infinite lookp in next_Focus_child.
Prevent that.
2019-03-03 22:27:34 -05:00
Matthias Clasen
39c44b9d2e root: Add a ::focus-widget property 2019-03-03 22:27:34 -05:00
Matthias Clasen
ed3bd0977b color chooser: Prevent focus leaks
The color chooser switches from the palette to
the editor by just showing and hiding. Use
child-focusable to ensure that focus does not
wander off into the hidden parts.
2019-03-03 22:27:33 -05:00
Matthias Clasen
8d4c25fc09 window: Check for child-focusable
Don't allow gtk_window_set_focus to focus a widget
that is !can-focus or has an ancestor that is !child-focusable.
2019-03-03 22:27:33 -05:00
Matthias Clasen
45d76c9a6d Add a child-focusable flag
This gives a convenient way to exclude children from
the focus chain.
2019-03-03 22:27:33 -05:00
Matthias Clasen
02d7e6ee32 Remove no-longer used code
We no longer call the ::focus vfunc, so remove
all existing implementations. This needs careful
review to determine how to bring the functionality
in these handlers back.
2019-03-03 22:27:33 -05:00
Matthias Clasen
8224ac55f2 Remove gtk_widget_send_focus_change from public API
It should be dropped altogether. Until that happens,
keep it private.
2019-03-03 22:27:33 -05:00
Matthias Clasen
573fbc2ab3 Remove gtk_widget_focus_move
This is no longer used.
2019-03-03 22:27:33 -05:00
Matthias Clasen
fe2181f4a8 Exclude non-drawable widgets from focus
This was showing up as confusion between palette
and editor in the color chooser.
2019-03-03 22:27:33 -05:00
Matthias Clasen
9b8668520d window: Make focus wrap again
This is the traditional GTK behavior: wrap around when
the focus reaches the end of the toplevel's focus chain.
2019-03-03 22:27:33 -05:00
Matthias Clasen
9d72f73066 inspector: Add a focus overlay
Add an overlay that shows a segment of the focus chain.
2019-03-03 22:27:33 -05:00
Matthias Clasen
a361f09cb0 expander: remove the ::focus implementation 2019-03-03 22:27:33 -05:00
Matthias Clasen
b4c22a1236 stack: Implement next_focus_child
We only return the visible page here, to avoid
focus moving into other pages.
2019-03-03 22:27:33 -05:00
Matthias Clasen
9699c0883a widget: Add a next-focus-child API
Move things around to make the focus chain introspectable.
Use the next-focus-child api in the move-focus and
focus implementations.

We add a next_focus_child vfunc that containers can
override to tweak the behavior.
2019-03-03 22:27:33 -05:00
Matthias Clasen
9a98a373d3 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-03 22:27:33 -05:00
Matthias Clasen
4c6aad6457 Simplify the move_focus api
No need to pass the array in from the outside.
2019-03-03 22:27:33 -05:00
Matthias Clasen
549f5dc809 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-03 22:27:33 -05:00
Matthias Clasen
510f1ca461 Port widgets to the root focus API 2019-03-03 22:27:33 -05:00
Matthias Clasen
d63ef94bc8 window: Implement the root focus api
This just uses the existing get/set_focus functions.
We keep them public for now.
2019-03-03 22:27:33 -05:00
Matthias Clasen
50c0a79bb6 root: Add focus
Add a getter and a setter for the focus widget.
The default implementations do nothing.
2019-03-03 22:27:33 -05:00
Matthias Clasen
b9976ef9a7 paned: Stop using set_focus_child
We can instead use focus_child to find the last focus location
inside a child.
2019-03-03 22:27:33 -05:00
Matthias Clasen
1e38c78f55 notebook: Stop using set_focus_child
We can instead use focus_child to find the last focus
location inside a page.
2019-03-03 22:27:33 -05:00
Matthias Clasen
0addf7a4a4 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-03 22:27:33 -05:00
Matthias Clasen
02318dbda7 entries: Fix mnemonic activation
Since entries are no longer can-focus, the default
mnemonic_activate handler refuses to act on them.
2019-03-03 22:25:52 -05:00
Benjamin Otte
bed4c68041 widget: Fix gtk_widget_pick() on 3d-transformed widgets
Picking is done by drawing a line along the parent's z axis and picking
at the intersection with the child's z=0 plane.

However, the previous code was casting a ray along the child's z axis.

This patch actually transforms the line to pick into the target's
coordinate system and then computes the corrrect intersection with the
z=0 plane.

Using graphene_point3d_interpolate() to compute the final intersection
point is a bit of abuse of that function, but I found no better way in
Graphene to achieve the same thing.
2019-03-03 19:50:59 +01:00
Matthias Clasen
8ceff21497 gtk-demo: Minimally fix the sarch entry demo
This was broken by the entry refactoring.
2019-03-03 12:43:00 -05:00
Matej Urbančič
4fe67310fb Updated Slovenian translation 2019-03-02 20:57:57 +01:00
Timm Bäder
f35b8a7541 Fix compile time warnings 2019-03-02 05:28:55 +01:00
Timm Bäder
9948ca7be2 a11y: Include gtktextaccesible.h in gtk-a11y.h
Closes #1710
2019-03-02 05:26:26 +01:00
Emmanuele Bassi
eaf41cc90c Merge branch 'redundant-editable-api' into 'master'
entry, spin button: Drop redundant API

See merge request GNOME/gtk!611
2019-03-01 12:23:26 +00:00
Matthias Clasen
9e0c471b03 entry, spin button: Drop redundant API
Avoid duplicating GtkEditable APIs. Port existing users.
2019-02-28 16:34:00 -05:00
Timm Bäder
dc282991c6 roundedrect: Add gsk_rounded_rect_to_string
Keep it private for now, but it's very useful when debugging.
2019-02-28 10:33:18 +01:00
Timm Bäder
7931ab5f33 gl renderer: Change shadow cache eviction strategy
Since we can do partial redraws, dropping every shadow that's been
unused for one frame happens too fast. This is also a problem when a
shadow gets drawn on a texture for a few frames.
2019-02-28 10:33:18 +01:00
Timm Bäder
416a4cf5ea gl renderer: Ignore nodes with nan bounds
This can happen for certain transform nodes. The transform node's
child's bounds are fine, but the transform node bounds are all nan.
Just ignore those bounds since we can't meaningfully render them anyway.
2019-02-28 07:22:34 +01:00
Timm Bäder
bbd4e2f60d transformnode: Avoid matrix multiplication if we can
If the given matrix is explicitly of category IDENTITY, we don't need to
do anything, and in the 2D_TRANSLATE case, just offset the child bounds.
Those are the two most common cases.
2019-02-28 07:22:34 +01:00
Timm Bäder
5577e30ad4 gl renderer: Add more nodes that support transforms 2019-02-28 07:22:34 +01:00
Matthias Clasen
5caf8ca76b entry: Don't use the buffer directly
We want to be a wrapper of the GtkText, which in turn
wraps the GtkEntryBuffer. Not some weird mix.
2019-02-28 00:36:44 -05:00
Matthias Clasen
fda4546de5 treeview: Stop using set_focus_child
Do this with an event controller on the buttons instead.
2019-02-28 00:36:44 -05:00
Nirbheek Chauhan
fe7dcf6eec Merge branch 'alatiera/python3' into 'master'
build: Use python3 for the post install script

See merge request GNOME/gtk!608
2019-02-27 14:46:22 +00:00
Jordan Petridis
539e3d387b build: use condense the mkdir calls to oneliners 2019-02-27 16:25:58 +02:00