Commit Graph

24923 Commits

Author SHA1 Message Date
Matthias Clasen
28b97ff0e9 dnd: Prevent black background in icons 2015-12-02 00:03:11 -05:00
Matthias Clasen
ae4f6da550 DND: Drop support for using rgba cursors as icons
This adds a lot of complication to the code, and is not really
a big win, since still need to support icon windows anyway.
2015-12-01 23:47:56 -05:00
Matthias Clasen
5bb12474d9 dnd: Fix issues with drag icons under Wayland
The Wayland dnd surface must remain in place until the drag
is over. Setting it directly as the hardcoded window of the
widget we construct carries the danger that it might get
destroyed prematurely, e.g. when the application calls
gtk_drag_set_icon_name more than once and we recreate the
widget.

Instead, create a dedicated toplevel, and reparent the widget
into it. To keep the code simple, we use the same approach
under X11 as well, and make it the responsibility of the
GDK dnd code to keep the window position updated. We already
pass the current pointer position to gdk_drag_motion, which
makes this very easy.

As a side-effect of these changes, it is now possible to use
non-toplevel widgets as drag icons.

https://bugzilla.gnome.org/show_bug.cgi?id=748763
2015-12-01 23:47:56 -05:00
Benjamin Otte
d46b67dc79 widget: Don't update pango context in state_flags_changed
It only needs to be updated in style_updated, and we do it there.
2015-12-02 05:04:41 +01:00
Benjamin Otte
3513e5e87b Chain up in state_flags_changed
When introducing handlers for state_flags_changed in the node
transitions, chaining up was forgotten.
2015-12-02 04:36:31 +01:00
Benjamin Otte
da6beb994e css: Add ability to specify icontheme in CSS
-gtk-icontheme: "oxygen" works now.

This is a very crude implementation. It's meant for testing only.
2015-12-02 03:54:41 +01:00
Benjamin Otte
e1d74f7c71 window: Listen to icon theme changes on CSS
No need to connect a signal handler to the icon theme, we get notified
via CSS.
2015-12-02 03:28:36 +01:00
Benjamin Otte
bc1b53a34c css: Query icon theme from style, not from settings
No need to look at the settings when the CSS has a property for the icon
theme.
2015-12-02 03:18:26 +01:00
Benjamin Otte
d26a4b5555 spinner: Active spinners should be :checked, not :active
If that sounds confusing, it's because GTK and CSS can sometimes not
agree on naming.

:active for CSS means that a button is currently pressed on an element.
And that is clearly not the case for spinning spinners.
2015-12-02 00:39:25 +01:00
Benjamin Otte
8355ee3053 stylecontext: Don't emit state warning for transient nodes
It's fine to call set_state() on those.

https://bugzilla.gnome.org/show_bug.cgi?id=758930
2015-12-02 00:29:36 +01:00
Benjamin Otte
2396265523 css: Rename -gtk-image-effect to -gtk-icon-effect
This is a property for icons, so we should name it as such.
2015-12-02 00:29:31 +01:00
Benjamin Otte
7f93858ccc Stop using gtk_icon_size_lookup_for_settings()
Use the equivalent gtk_icon_size_lookup() instead.
2015-12-02 00:29:31 +01:00
Benjamin Otte
0c027937e8 iconhelper: Stop tracking state
The iconfactory code doesn't use it anymore, so we don't need to track
it either.
2015-12-02 00:29:31 +01:00
Benjamin Otte
6d65b7d772 iconfactory: Make state depend on image-effect
This removes the dependency on state, which should be used for selection
CSS styles, not for actually applying them.

And image-effect does exactly what we want already, so we can start
using it.
2015-12-02 00:29:30 +01:00
Benjamin Otte
6a4b91d0ed iconhelper: Remove _gtk_icon_helper_ensure_pixbuf()
The code isn't used anymore. Everything uses
gtk_icon_helper_load_surface() now.
2015-12-02 00:29:30 +01:00
Benjamin Otte
b411c31832 statusicon: Use gtk_icon_helper_load_surface()
This is in preparation for the next commit.
2015-12-02 00:29:30 +01:00
Benjamin Otte
7a154d9acd dnd: Add gtk_drag_set_icon_definition()
... and use it for entry icons.

As a side effect, icons dragged from entries will now resize to DND
size.
2015-12-02 00:29:30 +01:00
Benjamin Otte
4a42aa5229 imagedefinition: Remove icon-size
The size of icons is a property that is relevant to who is rendering the
icon, not to the icon itself.

Example: Starting a DND operation from an entry icon should cause the
icon to resize (from the entr icon's size to the DND icon size).
2015-12-02 00:29:30 +01:00
Benjamin Otte
e99eba4415 dnd: Rewrite iconhelper code
It now uses GtkImageDefinition instead.
2015-12-02 00:29:30 +01:00
Benjamin Otte
85423ea278 entry: Use gtk_icon_helper_load_surface()
This is the first step towards getting rid of pixbuf loading code in the
icon helper.
2015-12-02 00:29:30 +01:00
Benjamin Otte
482d71d680 iconhelper: Add a scale argument to gtk_icon_helper_load_surface()
It will be used in the next patch.
2015-12-02 00:29:30 +01:00
Benjamin Otte
afad393b15 iconhelper: Refactor ensure_surface()
Make gtk_icon_helper_ensure_surface() a private function that just
ensures the surface was loaded.

Add gtk_icon_helper_load_surface() that is called by the above function
and the dnd code to actually load the surface.
2015-12-02 00:29:30 +01:00
Benjamin Otte
2ce67f0098 iconhelper: Store surface in ensure_surface()
Do not assign it in the functions that actually load the surface. Make
those just return the surface.
2015-12-02 00:29:30 +01:00
Benjamin Otte
b2584eb8ed iconhelper: Don't store surface size
Instead, compute it on demand.

This avoids having to cache it in lots of places and simplifies code.
2015-12-02 00:29:29 +01:00
Benjamin Otte
751a1a9926 iconhelper: Move invalidation check
Just do the invalidation check once, there's no need to do it in every
branch of the switch.

Also remove useless checks: These functions will not be called if we
already have a rendered surface.
2015-12-02 00:29:29 +01:00
Benjamin Otte
3bacffd063 dnd: Use surface for dnd icon instead of pixbuf 2015-12-02 00:29:29 +01:00
Benjamin Otte
c601a9653a iconhelper: Move invalidation check
Just do the invalidation check once, there's no need to do it in every
branch of the switch.

Also remove useless checks: These functions will not be called if we
already have a rendered surface.
2015-12-02 00:29:29 +01:00
Benjamin Otte
afd0e28437 iconhelper: Improve size determination for surfaces
Instead of just working for image surface, this should now work for all
bounded surfaces.

Test included.
2015-12-02 00:29:29 +01:00
Benjamin Otte
071d2a1d69 iconhelper: Move size computation
We do a switch on the image type, so compute the size for a certain
image type right there.
2015-12-02 00:29:29 +01:00
Benjamin Otte
a81bdf1e60 image: queue_resize() after changing icon-size property 2015-12-02 00:29:29 +01:00
Benjamin Otte
1c96b703a6 dragsource: Store an itemdefinition, not an iconhelper
The icon is never rendered, so there's no need for the extra iconhelper
code.
2015-12-02 00:29:29 +01:00
Benjamin Otte
e666106a43 imagedefinition: Split out from icon helper
The image definition is supposed to hold the description about the image
to be displayed. The icon helper actually does caching and tracks
changes.
2015-12-02 00:29:29 +01:00
Benjamin Otte
67ab00e01e window: Remove suspicious branch
It seems this branch is not needed anymore. It was originally added in
1999 to support gtk_widget_realize(), but all those reasons seem
obsolete today.
Instead just call gtk_widget_realize().

If you end up at this commit when bisecting:
There is no bug that made me remove this code, it was purely meant to be
cleanup / dead code removal. I seem to have introduced a new bug or
bisecting wouldn't have let you here. So it seems we should just revert
this commit.
2015-12-02 00:29:29 +01:00
Matthias Clasen
e626038467 popover: Make it possible to constrain to toplevel
Under X11, popovers are always constrained to the toplevel
window. Under Wayland, they aren't. This commit adds a
property that allows to explicitly constrain popovers to
the toplevel, giving them the same behavior under Wayland
as under X11.

https://bugzilla.gnome.org/show_bug.cgi?id=757474
2015-12-01 17:26:25 -05:00
Christian Hergert
5dcf4e10b7 filechooserbutton: add some spacing between icon and text
These were a bit crammed, which doesn't match well with spacing used in
various other parts of gtk.
2015-12-01 11:23:12 -08:00
Olivier Fourdan
103d369ff6 gtkwindow: remove headerbar after disposing parent
Widgets such as gtkfilechooser may be saving their size and position on
the unmap callback, if the client-side decoration header bar is removed
first, the reported size will be wrong.

https://bugzilla.gnome.org/show_bug.cgi?id=756618
2015-12-01 16:18:03 +01:00
Timm Bäder
a28103cf51 Add some more missing nullable annotations 2015-12-01 13:41:35 +01:00
Timm Bäder
88b4955fd9 GtkBox: The center widget can be NULL
Propagates to GtkActionBar.
2015-12-01 13:41:35 +01:00
Timm Bäder
1551ad4908 GtkWidget: Add some missing nullable annotations 2015-12-01 13:41:35 +01:00
Matthias Clasen
150728d6b0 inspector: Show the size request mode
This is not a property, so show it in the misc page.
2015-11-30 22:27:27 -05:00
Matthias Clasen
d908c38ec3 window: Use g_set_object
No need to do the same thing manually.
2015-11-30 20:45:57 -05:00
Sébastien Wilmet
1a8f3e2462 textiter: fix bug in case insensitive backward search
'win.lines' contains the same content as the GtkTextBuffer, so to find
@match_start, forward_chars_with_skipping() is called with
skip_decomp=FALSE (the last parameter). So far so good.

On the other hand, the content 'lines' (the needle split in lines) is
casefolded and normalized for a case insensitive search. So,
forward_chars_with_skipping(..., skip_decomp=TRUE) must be called only
for the portion of text containing the needle.

Since 'start_tmp' contains the location at the start of the match, we
can simply begin at that location to find the end of the match.

Unit tests are added.

https://bugzilla.gnome.org/show_bug.cgi?id=758698
2015-11-30 19:46:16 +01:00
Florian Müllner
0a35886b0a listbox: Use :focus-on-click policy from row instead of list
Using the property from the container is inconsistent with the
:selectable and :activatable properties, which are per row.
2015-11-30 17:59:06 +01:00
Matthias Clasen
373ce9f652 stack: Update windows before allocating children
Doing things the other way around seems to cause problems in
some cases where children want to do different things depending
on the window position.

https://bugzilla.gnome.org/show_bug.cgi?id=758563
2015-11-30 10:41:13 -05:00
Emmanuele Bassi
11eab60f43 scalebutton: Annotate the return type
Instead of just listing the return type of get_plus_button() and
get_minus_button() in the documentation, we can use the (type)
annotation to ensure that the introspection data reflects the actual
type of the returned widget.
2015-11-30 14:09:19 +00:00
Benjamin Otte
f30b4ba22e gtkwindow: fix regression with firefox dropdown menu
Fix a regression introduced by:

commit 6866d1c widget: Make gtk_widget_queue_allocate() not resize

Where the dropdown menu in Firefox would not be relocated after the
toplevel window is moved.

bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=758609
2015-11-30 14:32:39 +01:00
Timm Bäder
886686973c GtkScaleButton: _get_(plus|minus)_button returns a GtkButton
https://bugzilla.gnome.org/show_bug.cgi?id=539944
2015-11-28 21:09:53 +01:00
Matthias Clasen
8ea14162d3 Adwaita: No background for spinners
Blue background for spinners doesn't make sense.
2015-11-26 15:08:54 -05:00
Carlos Garnacho
4981ca9f13 GtkWindow: Reset gestures after triggering right click titlebar action
Just like it happens for window dragging, we're likely to not see the
matching button release for this event, so we must reset the controller
manually here.

https://bugzilla.gnome.org/show_bug.cgi?id=758661
2015-11-25 21:59:48 +01:00
Benjamin Otte
923ad2767a window: Don't lose position information
Before calling gdk_window_move_resize(), store the full configure
request, not just width and height.

Fixes firefox randomly losing position of its dropdown windows.

https://bugzilla.gnome.org/show_bug.cgi?id=758609
2015-11-25 20:31:27 +01:00