Commit Graph

44924 Commits

Author SHA1 Message Date
Timm Bäder
414ffbb708 GtkRange: Use G_MININT as default mouse position, not -1
Otherwise we're getting MOUSE_WIDGET as mouse position for unmapped
GtkRanges.
2015-12-02 21:06:11 +01:00
Timm Bäder
591e7f5ef8 GtkScale: Add missing nullable annotations 2015-12-02 21:06:11 +01:00
Lapo Calamandrei
8efdd94a31 Adwaita: button.color fix
border-radius: 0 for colorswatch overlay as well.
2015-12-02 17:42:42 +01:00
Lapo Calamandrei
a25fa9922d Adwaita: vertically linked insensitive entries
Brighter border in that case as well.
2015-12-02 17:02:58 +01:00
Benjamin Otte
c10b6b7297 dnd: Add gtk_image_set_from_definition()
... and use it in the DND code, thereby getting rid of the icon helper.
2015-12-02 15:45:14 +01:00
Benjamin Otte
4d31bf91db dnd: No need to reset the icon
When we start a drag cancel animation, we can just keep the existing
window. The reset was only necessary to convert from cursor icon to
window and we removed the cursor handling.
2015-12-02 15:22:23 +01:00
Benjamin Otte
8a7dbe5f36 image: Remove unused code
I wonder how long that stuff has existed and not been used...
2015-12-02 14:56:15 +01:00
Benjamin Otte
c66a2057af image: Split out a function 2015-12-02 14:54:15 +01:00
Krzesimir Nowak
cbbaad4135 imagedefinition: Assert when trying to free empty definition
Empty definitions are not allocated on a heap, so doing a g_free() on
it would crash anyway.
2015-12-02 12:46:21 +01:00
Krzesimir Nowak
f6ce2cd975 cssprovider: Pass NULL unconditionally
We know that parent is NULL at this point.

Also, fix indentation.
2015-12-02 12:46:21 +01:00
Olivier Fourdan
e933233479 gtkwindow: apply CSD in configure size request
Just like we did for the default size, that reduces the chances of
having the headerbar missing or wrongly sized when computing the client
side decorations controls.

https://bugzilla.gnome.org/show_bug.cgi?id=756618
2015-12-02 08:41:31 +01:00
Matthias Clasen
0384f9eaf3 popover: Make position property not CONSTRUCT
There is no good reason for it, and it causes problems
with widget templates.
2015-12-02 01:07:02 -05:00
Matthias Clasen
564e11cc4e popover: Port to g_object_install_properties
And use the pspecs for notification.
2015-12-02 01:03:35 -05:00
Matthias Clasen
93d9c77ead dnd: Drop an unused argument 2015-12-02 00:51:47 -05:00
Matthias Clasen
676862a213 dnd: Some simplifications
We can now use a GtkImage instead of toplevel with
a custom draw callback and a specially prepared cairo
pattern.
2015-12-02 00:48:37 -05:00
Matthias Clasen
9fd6db87d2 Drop gdk_wayland_drag_context_get_dnd_window
This backend-specific and libgtk-only API is now unused,
so drop it.
2015-12-02 00:47:53 -05:00
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
Matthias Clasen
fff8297a50 Add gdk_drag_context_get_drag_window
This makes gdk_wayland_drag_context_get_dnd_window
backend-independent API and adds an implementation
for X11.
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