Commit Graph

44304 Commits

Author SHA1 Message Date
Matthias Clasen
826633b5b7 lockbutton: Revisit element name
Instead of a separate element name, keep button, and just
add a .lock style class, to inherit the button theming.
2015-10-30 00:26:04 -04:00
Matthias Clasen
cc2f189144 Adwaita: button fixes 2015-10-29 23:17:41 -04:00
Matthias Clasen
b350779a6f togglebutton: Add a style class
This lets us differentiate toggle buttons from plain buttons
with button.toggle, without having to redo all the styling.
2015-10-29 23:04:47 -04:00
Matthias Clasen
a953e37735 button: Use an element name instead of a style class 2015-10-29 22:55:29 -04:00
Benjamin Otte
e39b8611bd widget: Queue redraw on gtk_widget_queue_allocate()
Mirror the behavior of gtk_widget_queue_resize() and always queue a
redraw. If we ever want to cause allocates without redraws we can add
gtk_widget_queue_allocate_no_redraw() then.

I had initially assumed gtk_widget_size_allocate() would take care of
queueing redraws, but it does not do that when neither size nor position
change. And that is obviously what's happening after
gtk_widget_queue_allocate().

Fixes buttons sometimes not redrawing (the record button in
widget-factory after locking it, all buttons when switching to the dark
theme).
2015-10-30 02:09:17 +01:00
Matthias Clasen
32de7edf1d Assistant: Fix page rmoval
We have to remove the page itself from the intermediate box
first, before removing the box from the notebook. Otherwise,
reffing the page to keep it alive is ineffective: the box
gets destroyed, and that destruction recurses over the page.

This fixes the problem in
https://bugzilla.gnome.org/show_bug.cgi?id=756385
2015-10-29 19:21:47 -04:00
Sébastien Granjoux
ffaaa1e66e Add a more complex widget in the flipping assistant
This reproduces the problem from bug
https://bugzilla.gnome.org/show_bug.cgi?id=756385
2015-10-29 19:21:20 -04:00
Florian Müllner
a0a78a8973 Adwaita: Update double-border tweak for scrolled windows
Since commit b6dbfc791f, GtkViewPort uses an element name.
2015-10-29 18:24:40 +01:00
Dominique Leuenberger
4f24c8569c placessidebar: do not crash if uris is NULL
On Drag'n'Drop actions across system boundaries (VM host to guest), the
happen to be null.

https://bugzilla.gnome.org/show_bug.cgi?id=757298
2015-10-29 17:32:13 +01:00
Benjamin Otte
fc6f41c751 spinbutton: Don't set .entry
Also fix Adwaita to not use .entry anymore
2015-10-29 16:03:15 +01:00
Benjamin Otte
63f2fc752a searchentry: Fix includes 2015-10-29 15:55:28 +01:00
Matthias Clasen
b6dbfc791f viewport: Add an element name to the css node
This lets us avoid hardcoding the type in CSS.
2015-10-29 07:47:31 -04:00
Matthias Clasen
ea5f16fd2d searchbar: Add an element name to the css node
This lets us avoid hardcoding the type in CSS.
2015-10-29 07:43:30 -04:00
Matthias Clasen
d634403d91 actionbar: Add an element name to the css node
This lets us avoid hardcoding the type in CSS.
2015-10-29 07:08:15 -04:00
Matthias Clasen
2936d7bae8 statusbar: Add an element name to the css node
This lets us avoid hardcoding the type in CSS.
2015-10-29 07:01:57 -04:00
Matthias Clasen
56d3e42a00 search entry: Add a style class
There should be little need to have separate styling for search
entries, so a separate name would be a bit overkill.
2015-10-28 23:58:39 -04:00
Matthias Clasen
a840a6d597 lock button: Add an element name 2015-10-28 23:57:57 -04:00
Matthias Clasen
bb7d7851ac entry, spinbutton: Finish css node conversion
This commit creates entry and button subnodes for the buttons
in GtkSpinButton. The nodes are ordered like this for horizontal

  spinbutton
  + entry
    + image.left
    + image.right
    + progress
  + button.down
  + button.up

and like this for vertical ones:

  spinbutton
  + button.down
  + entry
  + button.up

This arrangement requires cooperation from GtkEntry to place
the entry subnodes correctly, and some small changes in the theme.

This commit also fixes progress rendering in vertical spin buttons.
2015-10-28 23:43:32 -04:00
Matthias Clasen
ebcad63e31 wip: spinbutton 2015-10-28 21:55:13 -04:00
Matthias Clasen
811c1c9484 spinbutton: Trivial cleanup
Use g_clear_object in a few places.
2015-10-28 21:55:13 -04:00
Benjamin Otte
4483636016 widget: Queue resize on parent on show/hide
When gtk_widget_show() or gtk_widget_hide() is called, don't queue a
resize on the widget itself but on the parent.

The widget itself may already be marked as in need of a resize and
the call would be optimized out and never reach the parent.
The parent size will change though because a child widget just changed
its visibility.

Fixes a bunch of issues with menus appearing black, toolbas not hiding
in widget-factory and also various reftests.
2015-10-29 01:03:09 +01:00
Benjamin Otte
cd20ae8fe1 container: Don't keep our own variable trying to track need for resize
Insteaad, introduce gtk_widget_needs_allocate() and use that.
2015-10-28 19:44:29 +01:00
Benjamin Otte
e07ff714b9 widget: Make invisible widgets not propagate resizes
Do not queue a resize on the parent if the widget is not visible.
Invisible widgets do not influence the parents size.
2015-10-28 19:44:29 +01:00
Benjamin Otte
bef44ab294 window: Don't queue resizes when inhibiting resizes
Since the frame clock, the inhibit happens on the GDK level, so this
code is no longer necessary.
2015-10-28 19:44:29 +01:00
Benjamin Otte
6866d1c06e widget: Make gtk_widget_queue_allocate() not resize
This commit toggles the big switch. We now don't run size_allocate()
from the toplevel up anymore in cases where we don't need to.

Things might be broken in subtle ways as a result of this commit. We'll
have to find them and fix them.
2015-10-28 19:44:28 +01:00
Benjamin Otte
299600a7d4 widget: Track if a child needs an allocation
This is not used so far.
2015-10-28 19:44:28 +01:00
Benjamin Otte
f706891dd3 widget: Refactor function
Turn it from a loop into tail-calling itself.
2015-10-28 19:44:28 +01:00
Benjamin Otte
ab7e901cfd widget: Move resize function into gtkwidget.c
There's no sizegroup specific code left in it, but lots of
widget-specifics.
2015-10-28 19:44:28 +01:00
Benjamin Otte
4fa74e68e9 sizegroup: Merge function into only caller 2015-10-28 19:44:28 +01:00
Benjamin Otte
b5dfe9b833 sizegroup: Simplify widget's size group invalidation
Since we do not queue resizes twice anymore, we can just walk the list
of groups without deduplication.
2015-10-28 19:44:28 +01:00
Benjamin Otte
a31123e9f0 sizegroup: Skip resizes on widgets that have resize queued
Widgets that already have a resize queued don't need to walk the whole
parent chain and queue another resize. It's enough to do it once per
resize.

This also means that sizegroups cannot use the shortcut of just
invalidating the first widget in the group anymore. That widget might
already have a resize queued while others don't.
2015-10-28 19:44:28 +01:00
Benjamin Otte
a4587ef4a0 widget: Warn on calls to queue_resize() during size_allocate()
This happens way too much, so it's disabled unless GTK_DEBUG=geometry is
on.

Also, we can't detect it in the call to queue_resize() yet, only during
size_allocate(), so the warning comes after the signal emission.
2015-10-28 19:44:28 +01:00
Benjamin Otte
4d631a9144 widget: Clear pending resizes after size_allocate()
This catches the cases where widgets call gtk_widget_queue_resize()
in their size_allocate() callback.
2015-10-28 19:44:28 +01:00
Benjamin Otte
3e3f17576e widget: Warn if size-unqueried widgets get allocated
Widgets should have gtk_widget_get_preferred_width/height() called
on them before gtk_widget_size_allocate() gets called.
Add a check for this.
2015-10-28 19:44:28 +01:00
Benjamin Otte
6cc2615b63 widget: Add a resize_needed flag
... and API to set and unset it.

It is set when gtk_widget_queue_resize() is called.
It is unset when gtk_widget_get_preferred_width/height() is called.

So far it is not used.
2015-10-28 19:44:28 +01:00
Benjamin Otte
3ff894c201 widget: Add a function that does actual resize
It's just shuffling code around.
2015-10-28 19:44:28 +01:00
Benjamin Otte
58d506fb11 sizegroup: Merge function into only caller
Both functions were running the same loop. Just running the loop once
seems advantageous.
2015-10-28 19:44:28 +01:00
Benjamin Otte
85ab8ad001 sizegroup: Don't invalidate over resize containers.
Before this commit, a widget tree like this:
  Window
    AnyContainer (part of SizeGroup1)
      GtkClutterEmbed
        SomeWidget
when calling gtk_widget_queue_resize(SomeWidget), would invalidate
SizeGroup1, when it should have stopped at the GtkClutterEmbed (which is
a RESIZE_IMMEDIATE child).
2015-10-28 19:44:28 +01:00
Benjamin Otte
1f2e21ab9a sizegroup: Refactor function
Get rid of continues in loop. This allows doing more complex things in
future commits.
2015-10-28 19:44:27 +01:00
Benjamin Otte
0721d964e4 sizegroup: Refactor function 2015-10-28 19:44:27 +01:00
Benjamin Otte
dd0e5cfce6 sizegroup: Remove special case before loop
The loop actually does the right thing already. There's no need to
complicate things.
2015-10-28 19:44:27 +01:00
Benjamin Otte
8fea3b02c9 sizegroup: refactor
The code looks a lot less dangerous if it doesn't look like we're
casting a random widget to a container.
2015-10-28 19:44:27 +01:00
Benjamin Otte
e19818359a sizegroup: Fold function into only caller 2015-10-28 19:44:27 +01:00
Benjamin Otte
690e015ed1 sizegroup: Move container function into its only caller 2015-10-28 19:44:27 +01:00
Benjamin Otte
0912a6c2f5 widget: Use gtk_widget_queue_allocate() when clip changes
There's no need to queue a full resize there.
2015-10-28 19:44:27 +01:00
Benjamin Otte
195397e87a API: widget: Add gtk_widget_queue_allocate()
This is so widgets can queue a rerun of their allocation logic, but
without triggering resizes everywhere.

For now, it just calls gtk_widget_queue_resize().
2015-10-28 19:44:27 +01:00
Benjamin Otte
798a288405 container: Use correct allocation for calling size_allocate() 2015-10-28 19:44:27 +01:00
Benjamin Otte
d3d9f52365 API: widget: Add gtk_widget_get_allocated_size()
See docs for what this is.
2015-10-28 19:44:27 +01:00
Benjamin Otte
ab2d236d3d sizegroup: Remove GtkQueueResizeFlags
They were only used with geometry widgets.
2015-10-28 19:44:27 +01:00
Benjamin Otte
5dd2087d19 widget: Remove _gtk_widget_override_size_request()
The function was only used by the geometry widget.
2015-10-28 19:44:27 +01:00