Commit Graph

19 Commits

Author SHA1 Message Date
Carlos Garnacho
074e17e100 popover: Don't overdraw background
It was only done so the background would connect visually to the popover
tail, but then it brings aliasing issues when the border is drawn over the
background. Instead, overdraw the tail, so it also fills the gap left by
the border.
2014-01-22 18:32:16 +01:00
Carlos Garnacho
eb2c1242fe popover: Update child visibility when scrolling happens
If pointing_to starts falling outside of the parent scrollable allocation,
the popover will be automatically hidden, and shown back again when
pointing_to scrolls back to visibility.
2014-01-22 17:10:07 +01:00
Carlos Garnacho
8d3439db61 popover: Track parent scrollable adjustments
This makes sure popovers follow the relative_to widget if it is
contained within a GtkScrollable.
2014-01-22 17:10:07 +01:00
Carlos Garnacho
81f13232d8 popover: fix g-i warning 2014-01-22 17:10:07 +01:00
Carlos Garnacho
d0c74dc288 popover: Fix documentation blurb
The grabbing behavior is no longer exclusively controlled by the caller,
mention gtk_popover_set_modal().
2014-01-22 17:10:07 +01:00
Carlos Garnacho
5f667b5820 popover: use GtkWindow private popover API 2014-01-22 17:10:07 +01:00
Carlos Garnacho
649004ce43 popover: Do not set GTK_STYLE_CLASS_OSD directly
That's up to the caller, popovers are by design not only meant to
have that role.
2014-01-22 17:10:06 +01:00
Carlos Garnacho
462e7f0de1 popover: Fix allocation of CSS margins
that was forgotten about, leaving no room for theme shadows that'd
make popovers look less flat.
2014-01-22 17:10:06 +01:00
Carlos Garnacho
69182c03fb popover: Flip popovers positioning on left/right on RTL.
If widgets have GTK_TEXT_DIRECTION_RTL, popovers being positioned
on GTK_POS_LEFT/RIGHT will default to appearing on the other side
too.
2014-01-22 17:10:06 +01:00
Matthias Clasen
ea0a1e31a7 Implement wfh functions
With only get_preferred_width and get_preferred_height implemented,
we end up calling the GtkBin height_for_width implmementation, which
knows nothing about the margins and paddings that GtkPopover needs.
As a result, a listbox added to a popover was getting cut off
at the bottom.
2014-01-22 17:10:06 +01:00
Carlos Garnacho
e8fa9e1851 popover: Remember last focused widget on the toplevel when a popover is shown
This is so the previously focused widget can regain focus when a modal popover
is dismissed.
2014-01-22 17:10:06 +01:00
Carlos Garnacho
1d495cbafd popover: Add a "modal" boolean property to GtkPopover
This property is TRUE by default, when a popover is modal, it
will automatically set a GTK+ grab on the popover, and grab
the keyboard focus into the popover.
2014-01-22 17:10:06 +01:00
Carlos Garnacho
31042fe95f popover: Fix memory management of popovers
Popovers are strange in the sense that they aren't attached to a
parent directly, they rely on the relative_to widget so the toplevel
is shared, and when they have a parent, it is the toplevel itself,
not relative_to. This also means that there are conditions where the
popover loses it's parent, so they must survive unparenting.

The previous code would be floating the last reference as soon as the
parent is gone, but it was non-obvious who'd own that reference. So
fix this situation by granting the ownership of popovers to their
relative_to widget, an extra reference may be held by the toplevel
when the popover has a parent, but the popover object will be
guaranteed to be alive as long as the parent lives.

This way, memory management of popovers is as hidden from the user
as regular widgets within containers are, users are free to call
gtk_widget_destroy() on a popover, but it'd eventually become
destructed when relative_to is.
2014-01-22 17:10:06 +01:00
Carlos Garnacho
342c23da23 popover: Implement keyboard focus behavior
When a popover is focused, the focus is forwarded so the first
child what would get the focus actually gets it. Also, implement
correct focus chain, so the keyboard focus stays within the popover
when navigating with keyboard.
2014-01-22 17:10:06 +01:00
Carlos Garnacho
bb7ef098c4 popover: Add documentation 2014-01-22 17:10:05 +01:00
Carlos Garnacho
4d12d85919 popover: Honor GtkContainer::border-width
The border width is now set around the contained widget.
2014-01-22 17:10:05 +01:00
Carlos Garnacho
7c10fc5580 popover: remove GTK+ grab (if any) on unmap
If there is a GTK+ grab on the popover, ensure that it's removed when it's
unmapped. If no GTK+ grab was performed on the popover, this function will
do nothing.
2014-01-22 17:10:05 +01:00
Carlos Garnacho
b4805f7076 popover: listen harder on the widget being pointed to
Hierarchy, size allocation and widget visibility are now listened
to in order to update the popover state accordingly.
2014-01-22 17:10:05 +01:00
Carlos Garnacho
caeb896096 Introduce GtkPopover
Now that the GtkBubbleWindow object has been cleaned up and made
more generic, rename it as GtkPopover and make it public.
2014-01-22 17:10:04 +01:00