Commit Graph

36796 Commits

Author SHA1 Message Date
Daniel Mustieles
363ec9a9e7 Updated Spanish translation 2014-01-23 10:53:51 +01:00
GunChleoc
c924fe4b59 Updated Scottish Gaelic translation 2014-01-22 21:10:54 +01:00
Carlos Garnacho
090a4f0af3 window: add missing return
A branch in the if/else if/else was missing a return, that was
unintended.
2014-01-22 20:50:33 +01:00
Carlos Garnacho
8595a38145 magnifier: Fix compiler warning 2014-01-22 20:50:33 +01:00
Piotr Drąg
a2b8a96f09 Updated POTFILES.in and POTFILES.skip 2014-01-22 19:41:26 +01:00
Carlos Garnacho
ce32476f32 Merge branch 'popovers' 2014-01-22 18:42:29 +01:00
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
9fe26a93eb texthandle: Update child visibility of handles within scrollables
If the rect a handle points to starts falling outside of the parent
scrollable allocation, the handle will be automatically hidden, and
shown again when the rectangle is visible too.
2014-01-22 17:10:07 +01:00
Carlos Garnacho
328404795b texthandle: Track parent scrollable adjustments
This makes sure texthandles follow the parent if it is contained within a
GtkScrollable.
2014-01-22 17:10:07 +01:00
Carlos Garnacho
360d5f04c0 texthandle: ensure handles are recreated on parent hierarchy changes
This ensures the handles come out right even if the parent widget is
reparented to a different toplevel.
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
834ad653ea texthandle: Use GtkWindow private popover API. 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
168227165d window: Make popover window private 2014-01-22 17:10:07 +01:00
Carlos Garnacho
889a280979 window: Use GList to store popover structs
When all popovers are removed on destroy(), if a popover is nested into
(eg. with relative_to within) another popover, the removal of one can
lead to the other being removed while the hashtable is being iterated,
which would lead to undefined behavior in further iterations.

Then, use a GList to store popovers, iterating can be made more resilient
on these situations, and unless on pathological cases there's not going
to be as many of those popovers as to cause performance decreases at the
times those are iterated.
2014-01-22 17:10:06 +01:00
Carlos Garnacho
5bb259bc6a textview: Set GTK_STYLE_CLASS_OSD on text selection popovers 2014-01-22 17:10:06 +01:00
Carlos Garnacho
65edb10243 entry: Set GTK_STYLE_CLASS_OSD on text selection popovers 2014-01-22 17:10:06 +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
Carlos Garnacho
a3b3b4621c window: Remove popovers on dispose() before unsetting focus.
The popovers may return keyboard grabs to previous widgets, so if
called after unsetting the focus, the window may be left with a
dangling GtkWidget that would cause crash at later dispose() calls.
2014-01-22 17:10:06 +01:00
Carlos Garnacho
d105a3a36a entry: Improve positioning of touch selection magnifier
Always show completely above or below entry to avoid covering
content, and limit horizontal position so it doesn't overflow
to the right.
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
7e30b82aee gtk-demo: Fix crash after running popovers demo
The GtkBuilder window containing the complex popover UI was left
dangling, and with a dangling pointer to its former child, causing
crashes on gtk_grab_notify() after the popover was destroyed.
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
bd5490ad62 texthandle: Fix arguments in ::style-updated callback 2014-01-22 17:10:06 +01:00
Carlos Garnacho
36abb4b829 gtkmain: Let windows handle WM-related events before delivering to the grab_widget
This makes it possible to move/resize client-side decorated windows that are
otherwise obscured by a GTK+ grab somewhere else, either a popover within the
window itself or a modal dialog above the window.
2014-01-22 17:10:05 +01:00
Carlos Garnacho
bfc87a315d entry: Show a GtkMagnifier popover on touch selection 2014-01-22 17:10:05 +01:00
Carlos Garnacho
4a8a2286e1 texthandle: Remove relative_to API
It's unused now, GtkTextHandle uses widget coordinates.
2014-01-22 17:10:05 +01:00
Carlos Garnacho
844c6b8951 texthandles: Use GtkWindow popovers API
This offers the same behavior, but GDK_WINDOW_TEMP windows aren't used
anymore, involving less translations from/to root coordinates, plus no
glitches in having handles snap to content as windows move.
2014-01-22 17:10:05 +01:00
Carlos Garnacho
db9e1d36d0 window: Keep track of popover children mapped status
In order to maintain visibility of the GdkWindow that's the parent window
of the popover widget.
2014-01-22 17:10:05 +01:00
Carlos Garnacho
ace25368b1 window: Add gtk_window_get_popover_position()
A getter to complement the setter
2014-01-22 17:10:05 +01:00
Carlos Garnacho
7b9e060994 entry: Set use-underline in popover GtkToolButtons 2014-01-22 17:10:05 +01:00
Carlos Garnacho
d7acd29421 textview: Set use-underline in popover GtkToolButtons 2014-01-22 17:10:05 +01:00
Carlos Garnacho
3e6462c71b textview: Use GtkMagnifier on touch selection
The magnifier renders the area covered by the finger, making it easier to follow
the text being selected.
2014-01-22 17:10:05 +01:00
Carlos Garnacho
61ab302c75 Add GtkMagnifier
This is a private widget that takes another widget on construction, and is able
to render parts of it, possibly at a different magnification level.
2014-01-22 17:10:05 +01:00
Carlos Garnacho
15d7d5b31f pixelcache: check whether cached surface and cairo_t scales match 2014-01-22 17:10:05 +01:00
Carlos Garnacho
695b979b10 gtk-demo: Add GtkPopovers demo
In this demo several widget create popovers with different complexities,
positions, and grabbing behavior.
2014-01-22 17:10:05 +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
Carlos Garnacho
8a661b8786 bubblewindow: Remove popup/popdown() APIs
Those functions aren't as useful anymore, hiding/showing can be
controlled by setting the widget visibility, and grabbing can be
achieved by performing a GTK+ grab.
2014-01-22 17:10:04 +01:00