Commit Graph

45085 Commits

Author SHA1 Message Date
Matthias Clasen
058dfb0723 entry: Use regular drag highlight
The entry code passes GTK_DEST_DEFAULT_HIGHLIGHT when setting
up the drop target, but that is ineffective because of the
custom drag_motion implementation. Instead, call
gtk_drag_[un]hightlight ourselves.
2015-12-02 23:52:55 -05:00
Matthias Clasen
0b9136842d Use :dnd pseudoclass for drag highlighting
Instead of a ::draw handler with a hardcoded outline,
use CSS for drawing the highlight.
2015-12-02 23:49:07 -05:00
Matthias Clasen
cbde3ee01f css: Add a :dnd pseudoclass
This will be used for drag highlighting.
2015-12-02 23:23:36 -05:00
Matthias Clasen
574246a3d8 Add a selected text example 2015-12-02 23:10:56 -05:00
Matthias Clasen
16eed47e87 Make foreign drawing example work
Set up multiple style contexts to get inheritance right.
2015-12-02 21:32:45 -05:00
Matthias Clasen
09c74f958d Add another hand-drawn scrollbar
This one is supposed to show up in active state, but doesn't.
2015-12-02 18:59:59 -05:00
Matthias Clasen
b5bcc299ad Add an example of foreign drawing
This uses the gtk_render apis with a style context constructed
from a style path.
2015-12-02 18:49:07 -05:00
Benjamin Otte
7fa37e4bf8 css: Introduct -gtk-icon-palette
This borrows heavily from the CSS4 fonts draft's font-palette, currently
found at https://drafts.csswg.org/css-fonts-4/#font-palette-control

The palette is mainly meant to trigger invalidations when colors used for
symbolic icons change, to potentially allow extending supported colors
in symbolic icons and to recolor all colors of a symbolic icon, not just
the main one.

The syntax for the property goes like this:
Name:        -gtk-icon-palette
Value:       default | name <color> [ , name <color> ]*
Initial:     default
Applies to:  all elements with icons
Inherited:   yes
Animatable:  yes, each color animated separately

The property defines a list of named colors to be used when looking up
icons. If a name is not defined, the value of the current "color"
property is used. Which names are relevant depends on the icons in use.
Currently symbolic icons make use of the names "success", "warning" and
"error".

"default" is the current behavior of the GTK when coloring symbolic
icons and is equal to the string
  success @success_color, warning @warning_color, error @error_color

Animation is crudely implemented by animating colors that are in both
palettes that are animated and otherwise keeping the color from the
palette that defined it. Note that this can cause a sharp cut at the
beginning or end of the animation when the color goes away and will
therefore be replaced with the color property.

You can see an example of animations at
http://gfycat.com/CautiousPeacefulIaerismetalmark
2015-12-03 00:47:00 +01:00
Daniel Mustieles
109c3aa65a Updated Spanish translation 2015-12-02 21:08:41 +01:00
Timm Bäder
2b9d57f726 GtkRange: Return proper constants in signal handlers 2015-12-02 21:06:11 +01:00
Timm Bäder
5a6bac7831 GtkRange: Remove recalc_marks field
And instead recalculate the marks on demand, i.e. whenever we were
previously setting recalc_marks to TRUE.
2015-12-02 21:06:11 +01:00
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