Commit Graph

61 Commits

Author SHA1 Message Date
Matthias Clasen
a8531605db Some more interning
This avoids more strdups at startup.
2017-11-18 08:18:11 -05:00
Matthias Clasen
ffd6baec42 gtk: Intern css names
This avoids a bunch of strdups at startup.
2017-11-17 22:49:57 -05:00
Timm Bäder
34f3c6bd52 revealer: Create clip node for right widget size
It should use gtk_widget_get_width/height here to get the correct
content size of the revealer.
2017-11-03 10:47:02 +01:00
Benjamin Otte
43c212ac28 build: Enable -Wswitch-enum and -Wswitch-default
This patch makes that work using 1 of 2 options:

1. Add all missing enums to the switch statement
  or
2. Cast the switch argument to a uint to avoid having to do that (mostly
   for GdkEventType).

I even found a bug while doing that: clearing a GtkImage with a surface
did not notify thae surface property.

The reason for enabling this flag even though it is tedious at times is
that it is very useful when adding values to an enum, because it makes
GTK immediately warn about all the switch statements where this enum is
relevant.
And I expect changes to enums to be frequent during the GTK4 development
cycle.
2017-10-06 21:23:39 +02:00
Timm Bäder
a8a755e5cd widget: Remove gtk_widget_set_redraw_on_alloc
Since gtk+ draws more than the widget and allocates more size to it than
it knows about, this flag doesn't work anymore. Removing it (or setting
it to TRUE for widgets that used to set it to FALSE) fixes drawing
invalidation when these widgets get allocated a new size.
2017-08-09 16:26:26 +02:00
Timm Bäder
d7056f5d22 revealer: Explain CSS oddities 2017-07-19 21:27:16 -04:00
Timm Bäder
36ab70ddf5 widget: Add baseline and out_clip parameters to size-allocate
Since setting a clip is mandatory for almost all widgets, we can as well
change the size-allocate signature to include a out_clip parameter, just
like GtkCssGadget did. And since we now always propagate baselines, we
might as well pass that one on to size-allocate.

This way we can also make sure to transform the clip returned from
size-allocate to parent-coordinates, i.e. the same coordinate space
priv->allocation is in.
2017-07-19 21:27:16 -04:00
Timm Bäder
ab1e8502e7 revealer: Fix DOWN and RIGHT transition types
Since we lost the bin_window, we now have to allocate the child widget
at a negative position when using these transition types.
2017-07-19 21:27:13 -04:00
Timm Bäder
ec1984bd93 revealer: Request child size for NONE transition type
Previously, we would request a size of 0×0 when the transition type was
NONE and the child un-revealed, making the revealer in this case a
gtk_widget_set_visible replacement. Instead, to the exact same thing we
do in the CROSSFADE case and request the child size instead. This also
keeps the revealer from under allocating the child when the transition
type is set to NONE.
2017-07-19 21:27:13 -04:00
Timm Bäder
12d2679aac revealer: Remove bin_window 2017-07-19 21:27:13 -04:00
Timm Bäder
cd6a8bff8f revealer: Stop calculating paddings ourselves
GtkWidget does it not for all widgets.
2017-07-19 21:27:12 -04:00
Timm Bäder
04fcb1f17f revealer: Don't add a clip node for CROSSFADE transitions
We don't need them there as we just change the opacity of the revealer.
2017-07-19 21:27:12 -04:00
Timm Bäder
2cd1a984cf set clip of more widgets 2017-07-19 21:27:11 -04:00
Carlos Garnacho
547370651b gtkrevealer: Remove view window
It's not necessary anymore for either clipping or event delivery
2017-05-25 16:25:59 +02:00
Carlos Garnacho
a72404dd5a gtk: Mass delete all GtkWidget event mask API
We now rely on toplevels receiving and forwarding all the events
the windowing should be able to handle. Event masks are no longer a
way to determine whether an event is deliverable ot a widget.

Events will always be delivered in the three captured/target/bubbled
phases, widgets can now just attach GtkEventControllers and let those
handle the events.
2017-05-25 16:25:58 +02:00
Benjamin Otte
b58de2d16c snapshot: Redo pop() API
gtk_snapshot_pop() => removed
gtk_snapshot_pop_and_append() => gtk_snapshot_pop()

So now there is no way to get a rendernode out of the snapshotting API
until you gtk_snapshot_finish().
2017-01-13 03:38:36 +01:00
Daniel Boles
0b7542bad1 revealer: Fix a typo in a function doc
Also, "ie" wasn't very clear, but fixing that to "i.e." would cause
truncation of the summary when processed by bindings using doxygen. So,
I replaced it with "in other words", which is no _less_ clear, at least.
2017-01-09 22:44:46 +00:00
Timm Bäder
47d4ad71fb Remove gtk_container_snapshot_child
Replace it with the already existing gtk_widget_snapshot_child.
2017-01-07 17:19:30 +01:00
Benjamin Otte
acaa04c031 revealer: Implement snapshot()
The revealer needs to clip the child during animations, whcih draw() did
automatically, but snapshot() does not.
2016-12-20 19:26:40 +01:00
Timm Bäder
1ab3d32808 revealer: Measure child widget size using gtk_widget_measure 2016-12-04 12:00:46 +01:00
Benjamin Otte
4850271ae8 API: Remove gtk_cairo_should_draw_window()
The answer is: Yes.
2016-11-23 18:48:38 +01:00
Benjamin Otte
c9a313a125 revealer: Port to no-window widget 2016-11-03 03:00:15 +01:00
Timm Bäder
9992a616ef widget: Use ::measure vfunc to measure size
Add a new ::measure vfunc similar to GtkCssGadget's that widget
implementations have to override instead of the old get_preferred_width,
get_preferred_height, get_preferred_width_for_height,
get_preferred_height_for_width and
get_preferred_height_and_baseline_for_width.
2016-10-22 19:05:47 +02:00
Benjamin Otte
73ef9e1438 revealer: Use gdk_window_new_child() 2016-10-18 00:22:35 +02:00
Benjamin Otte
1518fe0a8f API: stylecontext: Remove state argument from getters
The argument must always be the current state.
2016-10-16 18:18:58 +02:00
Benjamin Otte
662001b60a API: Remove ability to set visuals on windows
And with it, gtk_widget_get_visual() and gtk_widget_set_visual() are
gone.

We now always use the RGBA visual (if available) and otherwise fall back
to the system visual.
2016-10-16 18:17:21 +02:00
Matthieu Gautier
82aa83b0f6 revealer: emit notify::child-revealed when animation stops
Depending of float rounding during target calculation, the size of the
GtkRevealer can be set to zero will the animation is not finished.
If the GtkRevealer is in a GtkPaned, it will be hidden and so the animation
will be stopped before it is finished.

In this case, force the emission of the child-revealed signal to let
client code know the animation is finished.

https://bugzilla.gnome.org/show_bug.cgi?id=765973
2016-05-06 16:09:12 -04:00
Matthias Clasen
ff0107a4ac Use getter for gtk-enable-animations 2016-05-01 00:39:18 -04:00
Matt Watson
2ff62595ed revealer: port to progress tracker 2016-04-08 16:09:30 -07:00
Timm Bäder
e2e330db1a revealer: Don't use TRANSITION_NONE for disabled animations
If animations are disabled, the only difference we need to make is that
we don't have to start the transition. Size requests should remain the
same.

https://bugzilla.gnome.org/show_bug.cgi?id=762996
2016-03-03 18:54:09 +01:00
Timm Bäder
0c25c5d43d revealer: Don't report >0 preferred width...
... if the child is concealed and the transition type is set to NONE.
In this case, both preferred width and preferred height should be 0, but
we still can't use that to allocate a size for the child, so care about
the minimum size of the child in gtk_revealer_get_child_allocation.

https://bugzilla.gnome.org/show_bug.cgi?id=761760
2016-02-23 20:45:45 -05:00
Timm Bäder
d85b3fc60d revealer: Propagate draw event 2016-01-08 09:38:32 +01:00
Matthias Clasen
f0a2f9ef96 revealer: Add CSS node docs 2015-12-15 08:41:16 -05:00
Matthias Clasen
d40576fb3e revealer: Use an element name 2015-11-04 12:05:03 -05:00
Timm Bäder
d0779db1e1 GtkRevealer: Remove useless _start_animation call
The call just passed priv->target_pos, but _start_animation directly
returns if the given target is priv->target_pos (see line 627).
2015-10-16 15:07:49 +02:00
Alexander Larsson
d5f1754981 gtk: Stop setting GDK_EXPOSURE_MASK on random widgets
These days exposure happens only on the native windows (generally the
toplevel window) and is propagated down recursively. The expose event
is only useful for backwards compat, and in fact, for double buffered
widgets we totally ignore the event (and non-double buffering breaks
on wayland).

So, by not setting the mask we avoid emitting these events and then
later ignoring them.

We still keep it on eventbox, fixed and layout as these are used
in weird ways that want backwards compat.
2015-09-14 11:01:13 +02:00
Carlos Soriano
0f935a0483 gtkrevealer: fix preferred width calculation
A typo which was using minimum_width for natural_width and viceversa.
2015-07-07 22:49:45 +02:00
Cosimo Cecchi
f89c86df52 revealer: don't call gtk_style_context_set_background() 2015-07-01 16:09:23 -07:00
Carlos Soriano
c37f569ae8 gtkrevealer: add css padding support
Add css padding support to GtkRevealer.

As a future work, GtkRevealer still needs to support the border
property.

https://bugzilla.gnome.org/show_bug.cgi?id=750338
2015-06-04 23:18:17 -04:00
Matthias Clasen
fae5302eae GtkRevealer: Use G_PARAM_EXPLICIT_NOTIFY 2014-06-09 13:30:51 -04:00
Matthias Clasen
07e180fef0 GtkRevealer: Convert to g_object_class_install_properties 2014-06-09 13:30:51 -04:00
Benjamin Otte
c0f556ab71 revealer: Remove unneeded checks
Size vfuncs always get non-null out variables passed, so no need to
check for NULL.
2014-05-01 14:51:28 +02:00
Benjamin Otte
73aa7bd2f5 widgets: Remove (GtkTickCallback) casts
Instead, make the functions conform to the prototype, so that casting
isn't needed.
2014-04-29 19:35:29 +02:00
Benjamin Otte
9add8e261f revealer: Pass correct size to child hfw function
The refactoring in b9e37f8d2d broke this.

https://bugzilla.gnome.org/show_bug.cgi?id=724999
2014-02-23 15:40:46 +01:00
Benjamin Otte
b9e37f8d2d revealer: Allocate extra size to child
Do not constrain the child widget to its preferred size when the
revealer is larger.

https://bugzilla.gnome.org/show_bug.cgi?id=724742
2014-02-20 02:10:07 +01:00
William Jon McCann
469d333aa2 docs: use Returns: consistently
Instead of Return value:
2014-02-19 18:56:05 -05:00
William Jon McCann
c788b72768 docs: fix typo in property syntax 2014-01-21 18:57:37 -05:00
Matthias Clasen
087b61f653 GtkRevealer: Fix size allocation with disabled animation
When animation is disabled, we use 'none' as the effective
transition type. So far, this transition type failed to change
the size request, causing the revealer to always take up the
space of the child, even when the child is not shown.

https://bugzilla.gnome.org/show_bug.cgi?id=719568
2013-12-01 21:45:17 -05:00
Christian Persch
bf9ed44aa6 revealer: Respect gtk-enable-animations setting
https://bugzilla.gnome.org/show_bug.cgi?id=712632
2013-11-18 23:01:11 -05:00
Jasper St. Pierre
81538d492e revealer: Use the same transition animation as GtkStack 2013-10-09 18:29:41 -04:00