Commit Graph

74 Commits

Author SHA1 Message Date
Matthias Clasen
7f6a964c47 Docs: Remove all entities and turn off sgml mode
With all element markup gone, it is time to turn off
sgml mode, and get rid of entities as well.
2014-02-09 17:58:07 -05:00
William Jon McCann
7a208fbbf3 docs: use proper apostrophe
https://wiki.gnome.org/Design/OS/Typography
2014-02-07 13:06:10 -05:00
Matthias Clasen
245c385ae7 Docs: Don't use note elements
In most cases, the text itself makes the message clear enough.
2014-02-02 01:22:14 -05:00
William Jon McCann
13ace3ef33 docs: fix name of function to use for baseline alignment 2014-01-21 18:57:38 -05:00
Benjamin Otte
689905c1b4 widget: make gtk_widget_compute_size_for_orientation() static
It's not used anywhere outside of gtksizerequest.c anymore.
2013-05-11 15:11:53 +02:00
Benjamin Otte
bd4d00918e API: Don't export gtk_widget_preferred_size_and_baseline()
gtk_widget_preferred_size() is only useful if you want to quickly port a
widget from GTK2 sizing code to GTK3 but does not properly work with
height-for-width as used in GTK. So we don't want to encourage people to
use it. In particular we want people to convert to height-for-width
before adding baseline support to their widgets.
2013-05-11 14:48:01 +02:00
Benjamin Otte
1349292e47 widget: Adapt _gtk_widget_get_preferred_size_for_size()
... for baseline support byu taking two extra (possible NULL) arguments.
2013-05-01 16:41:11 +02:00
Alexander Larsson
316d450421 Handle non-baseline supporting subclasses overriding baseline supporting classes
If a subclass (say a child of GtkButton) overrides the non-baseline
size request methods we need to call these, rather than the new
get_height_and_baseline_for_width method.

In order to handle this we make the default for this method to be
NULL, and instead check at runtime which method to call. If any
non-baseline vfunc has changed in a class but the baseline one
hasn't, then we can't use the baseline one.
2013-04-23 05:58:48 +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
3450388ff0 sizerequest: Split out a common function 2013-04-22 18:29:01 -04:00
Benjamin Otte
e69e609bd7 style: Add missing deprecation markers
Some functions in gtkstyle.h were overlooked when we added the
GDK_DEPRECATED macros.

Also add IGNORE_DEPRECATIONS to the few remaining callers of those
functions.
2013-04-02 11:45:45 +02:00
Benjamin Otte
154204e891 widget: Allow invisible toplevels to do sizing operations
This is a quickfix to keep things working.

It turns out GtkWindow assumes it can do sizing operations while not
being visible, or while in the process of show()ing/hide()ing itself.
And commit b495ce54 broke these operations.

Figuring this properly requires some more thinking and restructuring on
my part, so for now we relax the requirement of visiblility enough for
these things to start working again.
2013-01-24 14:28:58 +01:00
Benjamin Otte
da100207b3 sizerequest: Make invisible widgets return a 0x0 size. 2013-01-08 12:26:04 +01:00
Benjamin Otte
53262cf7a6 sizerequest: Optimize CONSTANT_SIZE better
We can set for_size to -1 earlier than we did. Doing so makes sure we
only cache one value (as we should in the first place). In GTK 3.6, this
worked properly, but with Previously, this check was moved further up to
avoid interacting with size groups. But after recent refactorings, size
groups are handled way earlier anyway.
2012-11-14 14:03:47 +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
14c8e33ab9 widget: Get rid of unused flags
Now that we clear the cache immediately, there's no need anymore to
track if a request has been queued.
2012-11-14 01:55:28 +01:00
Benjamin Otte
c08efb2b32 sizerequest: Cache the request mode
... in the GtkSizeRequestCache. That way, we only need to query it once,
and can remove the caching code from GtkContainer.
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
Benjamin Otte
0a1a2ac148 sizerequest: Split out size request cache code into separate header 2012-11-14 01:55:28 +01:00
Stefano Facchini
a46368dede sizerequest: do not derefence NULL pointers 2012-11-04 17:48:02 +01:00
Benjamin Otte
7f870abf17 sizerequest: Restructure code
Make the compute_size_request() function take into account size groups
itself instead of doing a weird "bump_requisition" call.
2012-11-04 16:10:20 +01:00
Benjamin Otte
7501f9770f sizerequest: Move sizegroups function to different source file 2012-11-04 16:02:14 +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
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
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
9f6067a804 sizegroup: Handle hfw in size groups 2012-11-04 15:24:17 +01:00
Benjamin Otte
5722f9ab0f sizerequest: Improve warning message
Actually print out the function we're warning about
2012-05-07 17:37:36 +02:00
Javier Jardón
9d0febc9a6 Change FSF Address 2012-02-27 17:06:11 +00:00
Matthias Clasen
2de4405c32 Move deprecated gtkwidget style api to gtkstyle 2011-11-02 08:10:42 -04:00
Benjamin Otte
dcae3598b3 sizerequest: return CONSTANT_SIZE in return_if_fail() 2011-04-14 14:59:24 +02:00
Tristan Van Berkom
d4021d7a1b Fixed bug in GtkSizeRequest code where the cache is not reset properly
Fixes this bug https://bugzilla.gnome.org/show_bug.cgi?id=646500
2011-04-04 13:58:05 +09:00
Benjamin Otte
fafee4e276 widget: Emit initial style-set signal in the same situations as GTK2
This ensures that widgets that aren't ported and rely on the style-set
signal being emitted work as well as before. They should not rely on
style-set being emitted however.

Note that this function is a no-op if the initial style has been set
already and is very cheap if it has not been set yet. It only becomes
relevant if the resulting style actually gets used.

https://bugzilla.gnome.org/show_bug.cgi?id=639584
2011-03-27 00:48:26 +01:00
Tristan Van Berkom
5989a6405f Fixed possible segmentation fault while freeing size request caches. 2011-03-25 18:42:08 +09:00
Tristan Van Berkom
38b5c8cf45 Cache heights-for-range-of-widths instead of height for every width.
This patch optimizes window resizes by assuming that if a widget
has the same height at a width of 50 as with a width of 150, the
height for width 100 will also be the same.

The patch also further optimizes the cache allocator, now there
are 2 pointer arrays of up to a maximum of 5 requests, the arrays
will only be allocated if a request is ever made in that orientation
and the array will be sparse until each request is made (i.e. if a
label can only wrap to 3 lines, there will only be 3 out of a
possible 5 SizeRequest structures allocated to cache it).
2011-03-25 18:42:08 +09:00
Tristan Van Berkom
82ae7b77ca Reduce memory consumption of the size request cache.
This patch makes contextual height-for-width request caching
optional (the contextual cache is not allocated for widgets that
report GTK_SIZE_REQUEST_CONSTANT_SIZE).
2011-03-25 18:42:08 +09:00
Tristan Van Berkom
887142f1f5 Added GTK_SIZE_REQUEST_CONSTANT_SIZE to GtkSizeRequestMode
The constant size request mode defines a request mode where
height-for-width geometry is unneeded, thus optimizing GTK+
by reducing the overall amount of requests that need to be
performed and cached while resizing an interface.
2011-03-25 18:42:07 +09:00
Tristan Van Berkom
5a5854f6f6 Add default class implementation of gtk_widget_get_request_mode().
Instead of checking if klass->get_request_mode is != NULL from
the gtk_widget_get_request_mode() api, this allows classes to
trust that there is a default implementation and chain up (specifically
added this for gtkmm wrapper objects).
2011-01-28 15:58:07 +09:00
Carlos Garnacho
6c21f3d8e6 Remove unneeded/deprecated call from size requisition code 2011-01-04 03:06:19 +01:00
Tristan Van Berkom
7fab89d93f Removed checks in gtksizerequest.c
Checks were in place to ensure that widgets never request taller
or wider than screen size. This was there to test a theory about
scrolled window children functioning correctly with dynamic content
however it breaks GtkViewport children which can generally return a
value taller than screen height intentionally, GtkViewport uses this
value to update the adjustments.
2010-12-29 16:12:11 +09:00
Benjamin Otte
544146b9be size-request: Clamp size requests to screen size
Size requests should only ever need to return the screen's width/height
and max. This way, potentially large widgets (tree view or icon view)
don't need to do so many computations, but can stop when their computed
size has reached the screen size.
2010-12-15 10:41:20 +01:00
Tristan Van Berkom
fc5cabba90 Added minimum size parameter to GtkWidgetClass->adjust_size_allocation.
This allows us to add a check before executing
->get_preferred_height_for_width() to ensure we always
request for at least the minimum required size (and lets
us remove the warning in gtkcontainer.c telling implementors
to do this check manually from thier container implementations).
2010-12-07 23:47:40 +09:00
Michael Natterer
bc0e6b2b21 gtk: remove GtkWidget::size-request
Fixes Bug 633324 - Stop invoking size-request completely
2010-11-19 19:38:48 +01:00
Murray Cumming
d1829ecd74 GtkWidget/GtkContainer: Slight fixes to geometry-management docs.
Replace it's with its in several places.
Replace some , with .
Replace some ; with .
Fix some plurals.
Other minor corrections.
2010-11-04 16:37:54 +01:00
Matthias Clasen
9ff207bd25 Avoid exporting an extra symbol 2010-11-01 09:17:21 -04:00
Tristan Van Berkom
c41ec57fb0 Fire a warning if there are any handlers connected to the deprecated "size-request" signal. 2010-10-28 16:00:19 +09:00
Tristan Van Berkom
18f46adb7d Added a runtime warning if any class is implementing the ->size_request() vfunc. 2010-10-28 15:41:00 +09:00
Matthias Clasen
b69232e51b Stop calling GtkWidget parameters 'request'
There were at least a few places where we were using GTK_WIDGET()
on something that was already a GtkWidget*, just because it was
named wrong.
2010-10-26 10:53:46 -04:00