Commit Graph

32803 Commits

Author SHA1 Message Date
Benjamin Otte
dd6931d1ba sizegroup: Use _gtk_widget_compute_size_for_orientation()
With this function now available, we can do size computation in 2
ways:
(1) Compute size with size groups
(2) Compute size without size groups

And have (1) use (2) instead of setting flags on widgets. This patch
does exactly that.
2012-11-04 15:28:43 +01:00
Benjamin Otte
c3148a81d2 sizerequest: Move optimization
With size groups now doing hfw, doing the optimization for CONSTANT_SIZE
was done too early. Size groups need to know that it's a hfw request, so
the other widgets in the size group get the correct behavior.
2012-11-04 15:28:43 +01:00
Benjamin Otte
aba0c5cc3b label: Redo get_preferred_width/height()
This is important for size groups mostly, but also has some small fixes.
The label-sizing reftest as been updated accordingly.
2012-11-04 15:28:43 +01:00
Benjamin Otte
f55fe7e20b label: Fix ellipsize and wrap being set
The label code assumed that Pango treats this as "wrap to as much space
as possible and then ellipsize all the lines", but for Pango, ellipsize
takes precedence over wrap. So do the same thing in GtkLabel.

Also updated is the reftest that checked this behavior.
2012-11-04 15:28:43 +01:00
Benjamin Otte
035e55d1ab reftests: Improve reftest performance
Get rid of all the event boxes in this test. Event boxes need GDK
windows which cost a lot of performance when running the test and they
clip the label output.

Getting rid of the clipping also shows 2 bugs in this test that weren't
visible before. Those will be fixed in a followup patch.
2012-11-04 15:28:42 +01:00
Benjamin Otte
f48b30c13a reftests: Make label-sizing tests use better CSS
ow that labels can have backgrounds, just use label backgrounds
2012-11-04 15:28:42 +01:00
Benjamin Otte
02bc589583 sizerequest: Export _gtk_widget_compute_size_for_orientation()
and add an "ignore_size_groups" flag to it. This way we can use it for
size group shenanigans.
2012-11-04 15:24:18 +01:00
Benjamin Otte
1d6e896fef sizegroup: Move GtkSizeGroupMode to gtkenums.h
This is in preparation for the next patch, which would otherwise lead to
conflicts.
2012-11-04 15:24:18 +01:00
Benjamin Otte
62f5414742 sizerequest: Cache sizes without size groups
We compute on-demand for size groups anyway, so we can (in theory, this
patch doesn't do that yet) get around costly cache blowing when
invalidating single widgets of a size group this way.
2012-11-04 15:24:17 +01:00
Benjamin Otte
be1bde9111 sizegroups: Use is_visible() instead of get_mapped() for visibility
The current approach of using gtk_widget_get_mapped() is broken:
The usual steps taken when showing a window are:
(1) request the sizes
(2) allocate the sizes
(3) show the window in the allocated size

Showing the window with a random size between steps (1) and (2) would of
course
result in extra work and potential flickering when the widgets get
resized to
their proper sizes.

However, as GtkSizeGroup::ignore-hidden uses gtk_widget_get_mapped() to
determine visibility for a widget, the following will happen:
(1) the widget will request a 0 size
(2) the widget will be allocated a 0 size
(3) the widget will be too small when it is shown

gtk_widget_get_visible() however is set in advance. Note that toggling
visibility also causes a gtk-widget_queue_resize() call already so we
take care of changes in here automatically.
2012-11-04 15:24:17 +01:00
Benjamin Otte
48ff2fc7ed API: Add gtk_widget_is_visible()
This is a recursive gtk_widget_get_visible(): Returns TRUE if the widget
and all its parents are visible.
2012-11-04 15:24:17 +01:00
Benjamin Otte
9f6067a804 sizegroup: Handle hfw in size groups 2012-11-04 15:24:17 +01:00
Benjamin Otte
c8f2328337 sizegroup: Add a function for clarity
... and restructure code to accomodate that function.
2012-11-04 15:24:17 +01:00
Benjamin Otte
dbbdefe4e0 sizegroup: Don't keep groups around everywhere
The code is only interested in the actual widgets that belong together,
not in the groups. So just don't return the groups.
2012-11-04 15:24:17 +01:00
Benjamin Otte
dfea266e1f sizegroup: Check ignore_hidden flag when adding groups
Instead of only checking the ignore_hidden flag when getting the
preferred sizes, respect it already when constructing the list of
widgets. This way, widgets don't queue resizes for groups they're
ignored in anyway.
2012-11-04 15:24:17 +01:00
Benjamin Otte
a1f6887f17 sizegroup: Use for loops
For loops to loop over lists look nicer and actually do the right thing
with "break" and "continue" statements. So they are vastly preferred to
while loops.
2012-11-04 15:24:17 +01:00
Benjamin Otte
8796fe6d1c sizegroups: Restructure code
This way, we do the checks at the start of the effected function, not
before calling it.
2012-11-04 15:24:16 +01:00
Benjamin Otte
8710d97945 sizegroup: Don't cache the sizes anymore
This simplifies code and because sizes are cached by the widgets
themselves, it's not a large performance problem (unless people use huge
amounts of widgets in a single size group, but who does that?
2012-11-04 15:24:16 +01:00
Federico Mena Quintero
9c6e560819 Merge branch 'bgo687196-filesystemmodel-crash' 2012-11-02 14:13:02 -06:00
Federico Mena Quintero
ea3a750f13 bgo#687196 - Fix model corruption during file removal
The main problem is that we were emitting the row-deleted signal for the model in the middle
of the process that actually deletes the row from the model (remove the row from the array,
update the model->file_lookup hash table, etc.).  In the model's caller, one of the row-deleted
callbacks was requesting an iter, which caused the model to revalidate itself - but it did
this while it was in an inconsistent state.  This led to an assertion failure later when the
model resorted itself.

The fix in remove_file() is like this:

* The filteredness/visibility of the deleted node is not updated.  The
  node will simply be gone; we don't need to update those values at
  all.

* We invalidate just the node that is being deleted.

* The model->file_lookup hash table is not completely nuked; instead,
  we carefully adjust its indices.

* The row-deleted signal is only emitted at the very end, when
  deletion is complete and the model is consistent.

Many thanks to William Hua for doing the detective work on this bug!

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-11-02 14:09:01 -06:00
Federico Mena Quintero
94e3d7faf1 Make freeze_updates() and thaw_updates() static functions
They were in the semi-public API of GtkFileSystemModel, but never actually used outside of it.

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-11-01 17:21:47 -06:00
Federico Mena Quintero
1cee5ff0dd Comments on how the filtering and sorting processes work
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-11-01 17:19:10 -06:00
Benjamin Otte
0306278145 sizegroup: Always at least use widget's size
When widgets were hidden, they were otherwise assigned a 0 size.
2012-11-01 20:22:35 +01:00
Benjamin Otte
4067a45aff settings: Reset all styles when the enable-animations settings changes
https://bugzilla.gnome.org/show_bug.cgi?id=686021
2012-11-01 12:27:31 +01:00
Benjamin Otte
625f8a6dd3 Raleigh: Fix spinners with disabled animations
When animations are disabled, active and inactive spinners should look
different.

https://bugzilla.gnome.org/show_bug.cgi?id=686021
2012-11-01 12:27:31 +01:00
Benjamin Otte
0bfbf39306 cssimage: Implement some equal functions 2012-11-01 12:27:31 +01:00
Federico Mena Quintero
f39f574914 Remove argument to _gtk_file_system_model_update_file() that should not be part of the internal API
Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-10-31 20:54:02 -06:00
Federico Mena Quintero
281c592ea9 Rename gtk_tree_path_new_from_node() to tree_path_new_from_node()
This is a function internal to the file system model; let's not pollute the gtk_tree_path namespace.

Also, make the 'i' variable into 'r' as it refers to a row index, not a file-array index (for
consistency with the docs and the rest of the code).

Signed-off-by: Federico Mena Quintero <federico@gnome.org>
2012-10-31 20:21:47 -06:00
Cosimo Cecchi
86ecf54139 icon-theme: support loading symbolic GFileIcons from generic URIs
Right now we support loading and recoloring symbolic GFileIcons, but
only if the underlying GFile has a local path. This breaks when the
GFileIcon is loaded from a GResource, which is a reasonable option for an
application that wants to ship a custom symbolic icon.

This patch changes GtkIconInfo to store a GFile together with the file
path, and changes the symbolic icon lookup code to use the GFile URI,
which transparently makes the code work also for GResources.

https://bugzilla.gnome.org/show_bug.cgi?id=687059
2012-10-31 11:53:50 -04:00
Benjamin Otte
2e287576b4 themingbackground: Remove struct members
... and put them in the only function they are used in.
2012-10-31 11:09:12 +01:00
Benjamin Otte
762e2d9322 reftests: Add reftest for fractional border sizes 2012-10-31 11:09:12 +01:00
Benjamin Otte
fd73c1f8d9 themingengine: Draw fradctional border sizes 2012-10-31 11:09:12 +01:00
Benjamin Otte
1e08fe8646 reftests: Fix linear-gradient reftest
... and add it to the Makefile
2012-10-31 11:09:12 +01:00
Benjamin Otte
6821a8f7b2 themingbackground: Remove GtkThemingBackgroundLayer
The struct was just the index. So just pass the index around instead of
a full struct.
2012-10-31 11:09:11 +01:00
Benjamin Otte
5e7949c47b themingbackground: Use get_box() for background image size 2012-10-31 11:09:11 +01:00
Benjamin Otte
ba96c34787 themingbackground: Introduce gtk_theming_background_get_box()
to query the different clip boxes used by the background drawing code.
Use this function to query these boxes when clipping.
2012-10-31 11:09:11 +01:00
Benjamin Otte
12dec5279e themingbackground: Add content_box variable
... to go with border_box and padding_box.
2012-10-31 11:09:11 +01:00
Benjamin Otte
e9dbfc0e06 themingbackground: Get rid of flags variable 2012-10-31 11:09:11 +01:00
Benjamin Otte
0ccb7db245 themingbackground: Move image variable
... from the Layer struct onto the stack of the only function using it.
2012-10-31 11:09:11 +01:00
Benjamin Otte
ccaf1c2c67 themingbackground: Restructure code some more
Move variable initialization outside the first code with side effects.
This allows adding some more early returns, including one for code that
used to trigger g_return_if_fail() in certain corner cases.
2012-10-31 11:09:11 +01:00
Benjamin Otte
ce56248930 themingbackground: Restructure code
Make if statements encompassing the whole function into early returns.
The rest of the diff is reindenting.
2012-10-31 11:09:11 +01:00
Benjamin Otte
016647edb1 cssimage: Add a warning for drawing empty images
width and height of an image must be > 0 for the image to get drawn.
It's up to the code further up to ensure that this is not happening.
2012-10-31 11:09:10 +01:00
Benjamin Otte
a68e76e058 reftests: Add a reftest for recent commit
Check that a computed background-size of 0 is treated as 0.
2012-10-31 11:09:10 +01:00
Benjamin Otte
67302c5ee0 cssvalue: Compute "background-size: 0 0" properly
Previously a computed value of 0 was treated as "auto", which is wrong.
2012-10-31 11:09:10 +01:00
Benjamin Otte
16677bb85a stylecontext: Don't use bg image in gtk_style_context_set_background()
Old code tried to use the "background-image" proeprty for setting the
default image background. While this used to work in the early days of
GTK3, today it is grossly misleading as the backgronud image may be
resized, repositioned and semi-translucent which causes very weird
artifacts when rendering.

So we use the background-color only instead.
2012-10-31 11:09:10 +01:00
Benjamin Otte
c13efbf8b0 cssimage: Add an equal vfunc
No implementations for it exist yet.
2012-10-31 11:09:10 +01:00
Benjamin Otte
73fe9a2acf menuitem: Draw background unconditionally 2012-10-31 11:09:10 +01:00
Benjamin Otte
b1ad5c8abc settings: Use _gtk_css_provider_load_named()
This way we create one provider per settings object instead of stuffing
it into a global unchanging never-deleting hash table.
Also, we now reload the theme when instructed instead of keeping the old
loaded (and possibly stale) data forever.

https://bugzilla.gnome.org/show_bug.cgi?id=683896
2012-10-31 11:09:10 +01:00
Benjamin Otte
b41215bdea cssprovider: Move fallback code into _gtk_css_provider_load_named()
This makes sure the full theme loading logic resides in one function and
isn't scattered around.

As a side-effect, the hash table kept by gtk_css_provider_get_named()
will now be populated with fallback themes. This will not be a problem
after the next commit though.
2012-10-31 11:09:09 +01:00
Benjamin Otte
738b453c66 cssprovider: Export gtk_css_provider_load_named) function
... and document it.
For now, the function is only exported internally.
2012-10-31 11:09:09 +01:00