Commit Graph

16 Commits

Author SHA1 Message Date
Matthias Clasen
929a56e53c Clean up lots of GTK+ -> GTK
Replace most remaining uses of GTK+ in the docs and
user-visible strings by GTK. Also remove some leftover
"Was added in 3.x" sentences from the docs.
2020-09-12 12:01:04 -04:00
Benjamin Otte
d7266b25ba Replace "gint" with "int" 2020-07-25 00:47:36 +02:00
Timm Bäder
c67bcf09b9 sizerequestcache: Inline out-var assignments
The additional assignment to the old result variable just adds an
indirection even though we know the point where we assign it in all
cases. Just pass the values out and return in those cases instead.
2018-08-05 10:22:10 +02:00
Timm Bäder
9b8ff8d6c3 sizerequestcache: Directly initialize some locals
Declaring them and initializing them in the same block of code without
an empty line in between is really just confusing.
2018-04-21 19:06:54 +02:00
Timm Bäder
fae1bbb3fe sizerequestcache: Constify some locals
Make it clear that we only use them for lookups here.
2018-04-21 10:06:57 +02:00
Timm Bäder
bd855c11ab sizerequestcache: Use int instead of gint 2018-04-21 10:06:57 +02:00
Alexander Larsson
8cb78d82d6 gtksizerequestcache: Fix typo that lead to crash/leak
We were checking for cache->requests_x but freeing cache->requests_y
which could cause a crash/leak.
2013-04-29 18:17:02 +02:00
Alexander Larsson
5ad618cb95 GtkSizeRequestCache: Don't store baselines in horizontal case
This saves memory for every widget (maximum 48 bytes per widget) at
a cost of a few duplicated codepaths in the size request cache.
2013-04-23 05:50:37 +02:00
Alexander Larsson
852cbb62b8 Initial support for baselines
This modifies the size machinery in order to allow baseline support.

We add a new widget vfunc get_preferred_height_and_baseline_for_width
which queries the normal height_for_width (or non-for-width if width
is -1) and additionally returns optional (-1 means "no baseline")
baselines for the minimal and natural heights.

We also add a new gtk_widget_size_allocate_with_baseline() which
baseline-aware containers can use to allocate children with a specific
baseline, either one inherited from the parent, or one introduced due
to requested baseline alignment in the container
itself. size_allocate_with_baseline() works just like a normal size
allocation, except the baseline gets recorded so that the child can
access it via gtk_widget_get_allocated_baseline() when it aligns
itself.

There are also adjust_baseline_request/allocation similar to the
allocation adjustment, and we extend the size request cache to also
store the baselines.
2013-04-23 05:50:37 +02:00
Benjamin Otte
d3143779d2 sizerequestcache: Move rest of code to array
... of orientation. Reduces more duplicate if branches.
2012-11-14 01:55:29 +01:00
Benjamin Otte
43fc428cf0 sizerequestcache: Make code an array
We can use orientation as the index into an array. That way we can
delete half the code. Do it for the base request first in this patch.
2012-11-14 01:55:29 +01:00
Benjamin Otte
fd6ea42319 sizerequest: Use GtkOrientation
... instead of GtkSizeGroupMode. Orientation is what we're interested in
after all. When we need a GtkSizeGroupMode, we can do the translation
where we need it.
2012-11-14 01:55:29 +01:00
Benjamin Otte
0e0ee480d3 sizerequestcache: Move lookup function
...and clean up its API.
2012-11-14 01:55:29 +01:00
Benjamin Otte
78d0ef1d0b sizerequestcache: Move commit function 2012-11-14 01:55:28 +01:00
Benjamin Otte
c98ee1ec39 sizerequestcache: Make clear_cache clear all the cache 2012-11-14 01:55:28 +01:00
Benjamin Otte
4366f80aab sizerequestcache: Move functions
... into the sizerequestcache.c file.
2012-11-14 01:55:28 +01:00