Commit Graph

32566 Commits

Author SHA1 Message Date
Matthias Clasen
65f71cdbae popover bar: Add setters
Add setters/getters for the menu-model property.
2019-06-09 17:40:51 +00:00
Matthias Clasen
d936967b7a Adwaita: Adapt to popover bar changes
Add some initial styling for popover bars
and popover menus. This needs revision.
2019-06-09 17:40:08 +00:00
Matthias Clasen
d78b6451b3 popoverbar: Use a box layout
Its the cool way to do layout these days.
2019-06-09 17:40:00 +00:00
Matthias Clasen
bc4f744562 main: Warn if GDK sends us bad focus events
The new rule for focus events from the windowing
system is: We only want them for toplevels. If you
put focus on popups, we don't want to know about
it, and you still need to deliver key events to
the toplevel.
2019-06-09 17:38:54 +00:00
Matthias Clasen
6342287288 popover menu: Disappear on focus out
We try to keep focus inside by wrapping arrow keynav.
But focus can still escape. If it does, we want to
disappear, like any good menu should.
2019-06-09 17:38:54 +00:00
Matthias Clasen
143ea34ca1 popover bar: Don't grab focus away from open menus
It makes them unhappy and disappear.
2019-06-09 17:38:54 +00:00
Matthias Clasen
abc9fef615 popover menu: Implement focus
We want to cycle around for up/down arrows.
2019-06-09 17:38:54 +00:00
Matthias Clasen
18fd512c80 popover bar: Implement focus
This is the proper way to do focus.
We want to cycle around for left/right arrows.
2019-06-09 17:38:54 +00:00
Matthias Clasen
f82898f393 model button: Make left/right switch submenus
This is expected menu keynav behavior: If the
focused item has a submenu, open it on right
arrow press. And if we are in a submenu title,
make left arrow press close it.
2019-06-09 17:38:54 +00:00
Matthias Clasen
ae8373f116 menu button: Use proper focus api
Widgets are supposed to call gtk_widget_child_focus.
Calling internal focus_move function directly makes
us skip the childs ::focus() implementation, which
is where the magic happens.
2019-06-09 17:38:54 +00:00
Matthias Clasen
f01e5d2267 popover bar: Add arrow keynav
Make left/right cycle the active item
among the bars children. Separate the styling
for the active item from :hover, since it is
a separate state, and only mixed up in menus
for historical reasons.
2019-06-09 17:38:54 +00:00
Matthias Clasen
0d800acd40 popover bar: Add a model property
This makes it less annoying to use in ui files.
2019-06-09 17:38:54 +00:00
Matthias Clasen
4ecaa754e2 popover bar: Break out items
These will grow enough functionality that its
worth having an object for it.
2019-06-09 17:38:54 +00:00
Matthias Clasen
6f689ec5b1 label: Fix mnemonic visibility handling
With non-widgets having children, we can no
longer assume that using gtk_container_forall
lets us walk the entire tree.
2019-06-09 17:38:54 +00:00
Matthias Clasen
583c6a9072 popover bar: towards menubar-like behavior
Make the open popover follow the pointer.
2019-06-09 17:38:54 +00:00
Matthias Clasen
c1791d030a widget: Ignore natives for picking
The natives transforms are not set up properly
to make this work, so ignore them here, for now.
This my need to be revisited later.
2019-06-09 17:38:54 +00:00
Matthias Clasen
d736778c2f popover: Respect alignment for positioning
We lost the code that takes the halign of
the popover into account when positioning it.
Bring it back, since we want to use it for
popover menus.
2019-06-09 17:38:54 +00:00
Matthias Clasen
f91cc6c473 Introduce a popover bar
This is meant to grow into a menubar replacement
with popovers. For now, it is just a box of menubuttons,
and not very much like a menubar at all.
2019-06-09 17:38:54 +00:00
Matthias Clasen
609f1659bd Rationalize popover menu apis
Make gtk_popover_new_from_model() return a GtkPopoverMenu,
rename it to gtk_popover_menu_new_from_model() and add
a relative_to argument to gtk_popover_menu_new().

Update all callers.
2019-06-09 17:38:54 +00:00
Matthias Clasen
724f315ae6 Stop exporting gtk_popover_bind_model
We can't improve popover menus as long as we
have to be able to work with any old popover
we're given. Remove this, so we can make
gtk_popover_new_from_model return a subclass.
2019-06-09 17:38:54 +00:00
Matthias Clasen
59ed4da717 box layout: Handle native children
These need to be skipped in measuring,
and we need to call gtk_native_check_resize
on them during allocation.

This was showing up as the new-style
context menu in widget-factory forcing
its relative-to box to grow when its
shown.
2019-06-09 17:38:53 +00:00
Matthias Clasen
640c7939ea modelbutton: Sizing fixes
We only want to reserve indicator size if
there are any checks or radios in the popover.
Unfortunately, GtkIcon has a hardcoded min-size
of 16, defeating this use. Work around by
wrapping each indicator in a box, and showing/
hiding the actual indicator.
2019-06-09 17:38:53 +00:00
Matthias Clasen
698e39bcac popover menu: Fix style classes
We want the same style classes that are produced
when creating a popover from a menu model.
2019-06-09 17:38:53 +00:00
Matthias Clasen
e080f35d25 menu section box: Add style classes for display hints
This makes it easier to realize some of the new
styles for popover menus.
2019-06-09 17:38:53 +00:00
Matthias Clasen
3313322864 menu section box: Introduce more section variants
Allow display-hint to be circular-buttons or
inline-buttons, to produce variations of horizontal
button layouts.
2019-06-09 17:38:53 +00:00
Matthias Clasen
dd572ed10a model button: Look up accels if needed
When we are not given an explicit accel (as is
the case when the popover is constructed from
a model), then look it up from the GtkApplication
at map time.
2019-06-09 17:38:53 +00:00
Matthias Clasen
fc3d3fb3af model button: Show shortcuts
Most of the machinery for this is already
in place. We just need to add an accel property
to GtkMenuButton and pass it through.
2019-06-09 17:38:53 +00:00
Matthias Clasen
eda31dff5d model button: Redo layout
Move checks to the left, and introduce a size group
to align things. The size group is provided by the
parent, using the new ::indicator-size-group property.
2019-06-09 17:38:53 +00:00
Matthias Clasen
30f6bea25f model button: Drop centered, inverted properties
These properties were only useful for titles,
and we have a role for that now.
2019-06-09 17:38:53 +00:00
Matthias Clasen
fc6010be37 model button: Add a role for titles
This gets us out of using direct presentational
markup like 'inverted' and 'centered' and will
make it easier to play with different layout.

Use the new role when creating popover
menus from models.
2019-06-09 17:38:53 +00:00
Matthias Clasen
0d59ece4a4 model button: Small fixes
Make iconic model buttons work better.
2019-06-09 17:38:53 +00:00
Christian Hergert
828c36636c va_marshaller: add various va_marshallers
We don't need to cover every case with a va_marshaller, but there are a
number of them that are useful because they will often only be connected
to by a single signal handler.

Generally speaking, if I opened into a file to add a va_marshaller, I just
set all of them.
2019-06-06 15:30:42 -07:00
Matthias Clasen
0aa9e16294 Bring brink skip_allocate
This was removed by accident in 580aa8204f,
together with some no longer needed popover
special-casing.
2019-06-05 00:31:53 +00:00
Benjamin Otte
bb5871fd81 docs: Remove mention of queue_draw_area()
and queue_draw_region(). They're gone since 73650c6da2.
2019-06-04 14:59:32 +00:00
Timm Bäder
ac333d712d snapshot: Make append_node_internal transfer-full
There is only one case where we do *not* directly unref the node again
after calling this.
2019-06-04 16:48:08 +02:00
Benjamin Otte
836635d1ae builder: Allow values of type GType
In particular this allows setting the item-type property of GListStore.
2019-06-04 06:11:44 +02:00
Benjamin Otte
6a0e0031b1 builder: Make GListStore buildable
Treats GListStore like any other object and allows <child> to add items
to it.
2019-06-04 06:11:44 +02:00
Timm Bäder
88344ccf4e widget: Unref priv->{allocated_,}transform 2019-06-03 17:03:02 +02:00
Matthias Clasen
c7ccaa5ef2 menu: Update scrollbar policy
We want to avoid sizing problems for small menus
due to the vertical scrollbar imposing a min-height on
its slider.

Closes: https://gitlab.gnome.org/GNOME/gtk/issues/1930
2019-06-03 14:49:13 +00:00
Michael Natterer
caf50bcb93 gtk: fix weed_out_neg_zero() in spinbutton and scale
It was not copying the terminating \0 in the string, breaking output
in spinbutton (didn't try scale). Fixes #3452.


(cherry picked from commit ae2ef1472c)
2019-06-03 00:34:44 +00:00
Christian Hergert
41e373f10c gtk: fix all uses of g_cclosure_marshal_generic
This adds specific marshallers for all of the locations where a generic
marshaller is being used. It also provides va_marshallers to reduce the
chances that we get stack traces from perf going through ffi_call_unix64.

This is forward ported from gtk-3-24.

# Conflicts:
#	gtk/gtkeventcontrollerkey.c
#	gtk/gtkeventcontrollermotion.c
#	gtk/gtkgesture.c
#	gtk/gtkgesturemultipress.c
2019-06-02 14:24:51 -07:00
Matthias Clasen
aa267c1c84 Add gtkmenubarprivate.h
Move private api into a private header.
2019-06-01 21:56:49 +00:00
Matthias Clasen
3dea73bd4a Cosmetics
Remove comments that are old enough to still
talk about option menus and item factories.
2019-06-01 21:56:49 +00:00
Matthias Clasen
03964b5edb Remove an unused enum
No use of GtkArrowPlacement anywhere.
2019-06-01 04:11:22 +00:00
Matthias Clasen
0c7e567c32 Merge branch 'global-coords' into 'master'
Drop global coordinates

See merge request GNOME/gtk!899
2019-06-01 03:53:13 +00:00
Matthias Clasen
fcdea03796 Fix menu item accessible
The menu shell is not a direct parent anymore.
2019-06-01 03:39:12 +00:00
Matthias Clasen
feef0ef93a menu: Fix destruction
Now that menubar and menu are containers
with internal structure, we need to be
careful about doing the right thing in
forall and dispose.
2019-06-01 03:32:10 +00:00
Matthias Clasen
6c201e7927 menu: Fix keynav between submenus
Left/Right arrow now work again to enter
or leave a submenu.
2019-05-31 23:36:35 +00:00
Matthias Clasen
ace30d42ea menu: Bring back the scroll keybindings
Home, End, Page Up/Down, work again.
2019-05-31 23:36:35 +00:00
Matthias Clasen
e599336ad4 menu: Keep selected item in view
This gets us most of the way to working scrolling.
2019-05-31 23:36:35 +00:00