Commit Graph

81 Commits

Author SHA1 Message Date
Matt Watson
ae487840f0 gtkstack: remove needless queue_resize
In gtk_stack_set_transition_position we should only need to
queue_resize if we are non-homogeneous, which is already done
earlier in the function.
2015-12-10 16:51:29 -08: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
Timm Bäder
f154875e08 GtkStack: Add some missing nullable annotations 2015-11-24 11:16:51 +01:00
Carlos Soriano
9f3839066e gtkstack: allow templates to override all properties
Currently GtkStack has some G_PARAM_CONSTRUCT properties. That means,
the properties are set with its default value after the initializacion
of the object.
When using GtkBuilder to build objects, GtkBuilder creates them and
after that sets the properties found on the xml definition.
However, this is not true for templates because the template is initialized
in the init() function of the actual object, and after that, the construct
properties will be set.

This is a problem when someone wants to use templates with GtkStack and
set those properties, since they will be set on the tempalt initialization
and set again to its default values afterwards.

To fix this, make those properties not G_PARAM_CONSTRUCT.

https://bugzilla.gnome.org/show_bug.cgi?id=758086
2015-11-19 14:50:09 -05:00
Matthias Clasen
14f4b7ead2 Avoid excessive property notification for GtkStack::interpolate-size
make check checks this for writable properties, and fails now that
we've made this property writable.
2015-11-09 14:53:25 -05:00
Benjamin Otte
c7491fa144 stack: Store actual widget size, not preferred size
This is just a cleanup commit, no actual bug.
2015-11-05 15:23:12 +01:00
Benjamin Otte
b6b00c31d7 stack: Queue a resize/allocate when switching children
We only allocate a size to the currently visible child, so we obviously
need to rerun allocation when the visible child changes.

In the case where the stack is not homogenous, we also need to queue a
resize because our size request just changed.
2015-11-04 19:39:29 +01:00
Matthias Clasen
910f4f72ba stack: Set an element name
And it is...stack.
2015-11-03 23:20:24 -05:00
Christian Hergert
24391634b5 stack: GtkStack:interpolate-size should be read/write
It looks like the param spec for interpolate-size was
copied from the line above it, which is a read only property.

There is a setter for interpolate-size, and it is implemented in
set_property().
2015-11-03 15:13:51 -08: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
Matthias Clasen
0bee97de5c stack: Convert to gtk_container_child_notify_by_pspec 2015-09-08 08:07:33 -04:00
Matthias Clasen
0f851be368 Fix a doc comment typo 2015-08-09 23:32:04 +02:00
Matthias Clasen
9711608ba3 Fix a doc comment 2015-08-05 14:20:12 -04:00
Ting-Wei Lan
50a2428739 Fix return value error in gtk_stack_get_interpolate_size 2015-07-20 21:55:40 +08:00
Timm Bäder
469db13b81 GtkStack: Add interpolate-size property
And use it to determine whether we should actually interpolate between
stack sizes or not.
2015-07-20 10:26:06 +02:00
Matthias Clasen
7ce96cb6ac GtkStack: Avoid some unnecessary complication
We already have an in-destruction flag, so use it.
2015-06-23 06:45:07 -04:00
Paolo Borelli
4e155d784d Avoid spurious operations on destroy
When the stack is destroyed we do not want to waste time running
animations and notifying listeners about which is our current
visible child.

This is not only an optimization, but it is important for the stack
switcher widgets: since they are in another branch of the hieratchy
we do not want to get notifications while the stack is being destroyed.

Based on a patch by Paolo Borelli
https://bugzilla.gnome.org/show_bug.cgi?id=724506
2015-06-21 11:32:31 -04:00
Matthias Clasen
f5b245ff04 GtkStack: Don't mix code and declarations 2015-05-30 09:43:56 -04:00
Timm Bäder
4d75d62033 GtkStack: Interpolate between size changes 2015-05-29 17:37:04 +02:00
Timm Bäder
0eddfcedb9 GtkStack: Remove some useless function calls
We will call gtk_widget_queue_resize anyway later when finishing the
(maybe non-running) transition, which will also cause the stack to be
repainted.
2015-05-29 17:37:04 +02:00
Timm Bäder
24193a38f0 GtkStack: Keep the last_visible_child around during transitions
We need it later.
2015-05-29 17:37:04 +02:00
Timm Bäder
dc55a895ed GtkStack: Misc indentation fixes 2015-05-29 17:37:04 +02:00
Timm Bäder
6d25e52a4d GtkStack: Remove useless cast 2015-05-29 17:37:04 +02:00
Timm Bäder
c0d535a718 GtkStack: Remove useless function calls
These both just use the default values anyway.
2015-05-29 17:37:04 +02:00
Timm Bäder
bdabea3ae3 GtkStack: Save last visible widget size
When interpolating the stack size, we compute the current size by using
the prefered/minimum current size and the last size. We can't use the
last_visible_surface_allocation because that is not available until the
first _draw call and it doesn't include the child's margins.
2015-05-29 17:37:04 +02:00
Timm Bäder
b3bbe99001 GtkStack: Remove gtk_widget_set_opacity call
The corresponding call with 0.999 opacity is gone, so we don't need to
reset the opacity anymore.
2015-05-29 17:37:04 +02:00
Debarshi Ray
39e7afecb1 GtkStack: Don't emit notify::visible-child during destruction
https://bugzilla.gnome.org/show_bug.cgi?id=749012
2015-05-07 15:18:20 +02:00
Christian Hergert
bb53f893e2 stack: check for widget before calling is_ancestor()
We can hit this path during the destruction case, where widget has
been released.

This fixes a lot of superfluous error messages on console.
2015-02-14 18:11:54 -08:00
Benjamin Otte
059cd3e51f stack: Remove commented out line
It always shows up in my greps and confuses me.
2015-01-07 14:26:48 +01:00
Matthias Clasen
123c6dc558 GtkStack: Improve focus handling
Add notebook-like focus handling: Keep track of the last focused
descendent of each page, and focus it again when switching back
to the page. If there is no last focused child, we move the focus
into the page as if the user had hit Tab.
2014-12-10 22:32:45 -05:00
Matthias Clasen
f71831c780 GtkStack: silently ignore visible-child-name set to NULL
This can happen when loading empty stacks in glade.
2014-11-25 00:14:47 -05:00
Matthias Clasen
cd8576ec19 GtkStack: Fix an oversight in child renaming
We currently emit a warning if you rename a child to the name
it already has. We shouldn't do that.
2014-11-18 13:37:51 +01:00
Matthias Clasen
95b075b8eb Drop unused variables
Keeps the compiler happy.
2014-11-14 11:48:50 -05:00
Matthias Clasen
c8d9e5b564 GtkStack: Remove some clumsy use of GList API
No need for g_list_next(), and don't open-code g_list_index().
2014-11-10 18:45:58 -05:00
Matthias Clasen
b86356bc1c GtkStack: split homogeneous
Split homogeneous into separate hhomogeneous and vhomogeneous
properties. vhomogeneous is what we want for popover menus.
2014-10-26 14:59:21 -04:00
Carlos Garnacho
8ff47570af stack: Ensure the bin window has an evmask suitable to windowless children
If a child has set_has_window == FALSE, it purely relies on the events set on
the parent window, for which the bin window used to just ensure the exposure
mask, eating all input events.

https://bugzilla.gnome.org/show_bug.cgi?id=734357
2014-08-12 14:28:34 +02:00
Benjamin Otte
02ccfb5d62 GtkStack: Render a background
https://bugzilla.gnome.org/show_bug.cgi?id=733027
2014-07-12 07:16:33 +02:00
Matthias Clasen
c1867761ca Revert "GtkStack: Render background and chain up gtk_widget_draw ()."
This reverts commit f6695b962f.
2014-07-12 00:33:19 -04:00
William Hua
f6695b962f GtkStack: Render background and chain up gtk_widget_draw ().
https://bugzilla.gnome.org/show_bug.cgi?id=733027
2014-07-11 20:46:03 -04:00
Matthias Clasen
d591341bd1 GtkStack: Avoid a few redundant notify emissions
A few of the property setters were missing the
standard checks.
2014-06-09 13:30:50 -04:00
Matthias Clasen
0a681f9224 GtkStack: Use G_PARAM_EXPLICIT_NOTIFY 2014-06-09 13:30:49 -04:00
Matthias Clasen
3957ce4898 GtkStack: Avoid compiler warnings
gcc warns about unhandled enum values in these switch statements,
so add an empty default: case to placate the compiler.
2014-05-02 17:15:49 -04:00
Philip Chimento
5b5813fcdc stack: Add counterparts of OVER_UP_DOWN transition
The GtkStackTransitionType enum now has OVER_DOWN_UP, OVER_LEFT_RIGHT,
and OVER_RIGHT_LEFT values to complement OVER_UP_DOWN.

https://bugzilla.gnome.org/show_bug.cgi?id=726676
2014-05-02 16:54:41 -04:00
Philip Chimento
a27b0bad86 stack: More readability when adding transitions
This small refactor makes the code more readable when adding more
transition types that have left, right, up, and down variations.

It adds inline boolean functions to tell information about transition
types (avoiding long if clauses) and changes long chains of "else if
(transition_type == ...)" into switch statements. Both are only likely
to get longer as more transition types are added.

https://bugzilla.gnome.org/show_bug.cgi?id=726676
2014-05-02 16:54:41 -04: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
Matthias Clasen
8195244e3b Improve GtkStack documentation
As has been pointed out in
https://bugzilla.gnome.org/show_bug.cgi?id=725711
it is a little confusing that we have the concept of
a visible child and of the child being visible itself.
2014-03-06 22:50:40 -05:00
William Jon McCann
469d333aa2 docs: use Returns: consistently
Instead of Return value:
2014-02-19 18:56:05 -05:00
William Jon McCann
529dafdf0b docs: don't use signal syntax for properties 2014-01-21 22:40:55 -05:00
Steve Frécinaux
49bf3cdba8 GtkStack: add gtk_stack_get_child_by_name()
This new method allows getting a widget from a GtkStack when we know its
name, and will also return NULL if there is no widget going by that
name.

Usage example would be to check if a child with a given name exists
before calling gtk_stack_set_visible_child_name().

https://bugzilla.gnome.org/show_bug.cgi?id=722588
2014-01-21 09:35:22 +01:00
Benjamin Otte
8308f4c1e9 stack: Fix crash on g_object_get("visible-child")
priv->visible_child is not a GtkWidget but a custom struct holding the
widget. So use the getter instead.
2013-11-25 03:49:35 +01:00