Commit Graph

279 Commits

Author SHA1 Message Date
Matthias Clasen
18788c2a86 Remove gtk_widget_get/set_has_surface
These serve no purpose anymore - widgets don't
have surfaces, unless they're a GtkNative.
2019-05-28 20:25:15 +00:00
Emmanuele Bassi
59c6862a03 Use gtk_widget_class_set_layout_manager_type()
Instead of manually creating the layout manager inside the instance
initialization function, we can let GtkWidget do that for us.
2019-05-06 12:06:27 +01:00
Emmanuele Bassi
1fed357752 Port GtkBox to GtkBoxLayout
We can delegate all the layout management to a GtkBoxLayout, now that we
have one.
2019-03-26 00:11:27 +00:00
Matthias Clasen
32e61b955a Drop gtkboxprivate.h
Not needed anymore.
2019-02-05 07:54:35 -05:00
Matthias Clasen
f3f5a896de box: Avoid position in the reorder api
Change the reorder api to insert after a sibling,
so that moving to first place becomes reorder (... NULL).

And add a insert_after api that can replace the common
container_add / reorder_after (... NULL) combination.

Update all callers.
2019-01-23 19:30:47 -05:00
Matthias Clasen
883d5d8584 box: Remove the position child property
The position child property is problematic, since it
requires us to emit notification for all children when
inserting a child early in the list of children.

Remove the property from all ui files.
2019-01-23 19:30:47 -05:00
Timm Bäder
e9e40ddb42 box: Remove gtk_box_pack_start 2019-01-23 19:30:46 -05:00
Timm Bäder
a543ed84f6 box: Remove gtk_box_pack_end 2019-01-23 19:30:46 -05:00
Timm Bäder
3d34b91453 box: Simplify documentation
Remove all references to any sort of "packing".
2019-01-23 19:30:46 -05:00
Timm Bäder
1ccba26de9 box: Remove children list
GtkWidget saves a widget list for us, so we don't need to keep track of
them ourselves. This is okay now that we don't have a pack-type child
property anymore.
2019-01-23 19:30:46 -05:00
Timm Bäder
28c51175d8 box: Remove pack-type child property 2019-01-23 19:30:46 -05:00
Daniel Boles
72d09d22e9 Box, Grid: Improve various bits of documentation
Issue #1495 showed that the docs of GtkGrid retain outdated implications
that (as was once, but is no longer, the case) it is intended to replace
GtkBox, by discussing HfW and widget properties in a way that suggests
GtkBox can't handle them. But of course it does, and it's preferable for
simple single-row/column cases. Worse, we said GtkGrid “provides exactly
the same functionality” for the latter case, but the original point of
that Issues was that it doesn’t, at least for CSS positional selectors!

Box:
• Use an actually meaningful @Short_description.
• Remove unhelpful @See_also references to unrelated containers.
• Remove references to “rectangular area”: it might be another shape
  via CSS, or “rectangular” might falsely imply 2 dimensions of children.
• Mention Orientable:orientation.
• Emphasise usefulness of :[hv]align for allocating in the other axis.
• Don’t say that Grid “provides exactly the same functionality” for a
  single row or column, since (A) it is overkill for that case and (B)
  said Issue proved that it *doesn’t* for CSS child order, for example.

Grid:
• Don’t dwell on widget properties and height-for-width in a way that
  wrongly implies that Box can’t handle those (or Grid can better). In
  fact, just get rid of that bit altogether: Box handles them fine, and
  such wording was only needed years ago for migration from GTK+ 2 to 3.
• Point to GtkBox as being preferred for the simple row/column use case.
2018-12-04 20:43:19 +00:00
Timm Bäder
ade171a2ed widget: Don't pass a position to ->size_allocate
The values have been 0/0 for a long time now, so just drop the
GtkAllocation argument and replace it with width and height.
2018-11-13 16:28:54 +01:00
Timm Bäder
00a27c1e28 box: Remove gtk_box_get_size
One function to measure the box in the opposite of its internal
direction is enough.
2018-08-27 18:53:56 +02:00
Timm Bäder
f5f6597abc box: Rename avail_size to for_size everywhere
So we call it like we call it everywhere else.
2018-08-27 18:48:09 +02:00
Timm Bäder
fade0afbef box: Simplify compute_size_for_orientation 2018-08-27 18:45:03 +02:00
Timm Bäder
01d4538223 box: Don't reorder children based on text direction
Make :first-child always be the first child, i.e. the leftest one in LTR
and the rightest one in RTL.
2018-06-18 17:35:02 +02:00
Benjamin Otte
169203951b widget: Remove clip from size-allocate vfunc
As the clip is no longer needed, get rid of it.
2018-04-05 14:56:38 +02:00
Alexander Larsson
63e060a21d GtkWidget: Start renaming widget->window
This is an automated change doing these command:

git sed -f g gtk_widget_set_has_window gtk_widget_set_has_surface
git sed -f g gtk_widget_get_has_window gtk_widget_get_has_surface
git sed -f g gtk_widget_set_parent_window gtk_widget_set_parent_surface
git sed -f g gtk_widget_get_parent_window gtk_widget_get_parent_surface
git sed -f g gtk_widget_set_window gtk_widget_set_surface
git sed -f g gtk_widget_get_window gtk_widget_get_surface
git sed -f g gtk_widget_register_window gtk_widget_register_surface
git sed -f g gtk_widget_unregister_window gtk_widget_unregister_surface

git checkout NEWS*
2018-03-20 15:21:12 +01:00
Timm Bäder
1362609120 box: Remove an unnecessary include 2018-02-09 11:36:53 +01:00
Timm Bäder
89ac1d6197 box: Rename private pointers to "priv"
Which is the style we use everywhere else.
2018-02-09 11:36:53 +01:00
Timm Bäder
1cfbe9c3d0 box: Simplify size_allocate
Stop looking at the box allocation position since both x and y are 0.
2018-02-09 11:36:53 +01:00
Timm Bäder
3a4c6c18b3 box: Use widget child list when computing size request
Contrary to what the comments in this function might suggest, it does
not actually do anything about child positions, child child sizes. So,
packing doesn't matter and we don't need to iterate over all child
widgets twice.
2018-02-09 11:36:53 +01:00
Timm Bäder
5e9f5c17b5 box: Use widget child list in compute_size_for_orientation
And remove the non-NULL checks for minimum_size and natural_size since
these are non-NULL by definition since this function is only called from
measure().
2018-02-09 11:36:53 +01:00
Matthias Clasen
4c150d8eb5 The big versioning cleanup
Remove all the old 2.x and 3.x version annotations.
GTK+ 4 is a new start, and from the perspective of a
GTK+ 4 developer all these APIs have been around since
the beginning.
2018-02-06 01:16:32 -05:00
Timm Bäder
27c76db956 box: Simplify some code
All out varibles in measure implementations must be non-null and -1 is
the default value for the baseline parameters.
2018-01-17 21:57:20 +01:00
Timm Bäder
e763dac72e box: Remove self assignment 2018-01-17 21:57:19 +01:00
Timm Bäder
8ab2c79b77 box: Remove useless if statement
We already check right before this one whether child->pack != packing
and if so, we continue to the next iteration. So, no need to check again
whether the inverted condition child->pack == packing is true, because
it is.
2018-01-17 21:57:19 +01:00
Timm Bäder
c2d4f05ce0 box: Remove some unneeded checks
We only call this function from the measure implementation and we should
never get NULL pointers there.
2018-01-17 21:57:19 +01:00
Timm Bäder
c475047501 box: Remove an unnecessary local variable 2018-01-17 21:57:19 +01:00
Timm Bäder
3604816b9c box: Use GtkWidget's widget list in get_size 2018-01-17 21:57:19 +01:00
Matthias Clasen
ffd6baec42 gtk: Intern css names
This avoids a bunch of strdups at startup.
2017-11-17 22:49:57 -05:00
Benjamin Otte
43c212ac28 build: Enable -Wswitch-enum and -Wswitch-default
This patch makes that work using 1 of 2 options:

1. Add all missing enums to the switch statement
  or
2. Cast the switch argument to a uint to avoid having to do that (mostly
   for GdkEventType).

I even found a bug while doing that: clearing a GtkImage with a surface
did not notify thae surface property.

The reason for enabling this flag even though it is tedious at times is
that it is very useful when adding values to an enum, because it makes
GTK immediately warn about all the switch statements where this enum is
relevant.
And I expect changes to enums to be frequent during the GTK4 development
cycle.
2017-10-06 21:23:39 +02:00
Timm Bäder
3b9aa2f8d9 widget: Allow 0×0 allocations
Don't MAX the allocations with 1 anymore.
2017-10-06 14:38:07 +02:00
Timm Bäder
9125dc7069 box: Drop priv pointer 2017-10-06 14:24:52 +02:00
Timm Bäder
392af59140 box: Remove return value from box_pack
Unused.
2017-09-29 10:50:33 +02:00
Timm Bäder
ad1f5fe61a box: Remove size_allocate_no_center
GtkBox never has a center widget these days.
2017-09-29 10:49:41 +02:00
Timm Bäder
a8a755e5cd widget: Remove gtk_widget_set_redraw_on_alloc
Since gtk+ draws more than the widget and allocates more size to it than
it knows about, this flag doesn't work anymore. Removing it (or setting
it to TRUE for widgets that used to set it to FALSE) fixes drawing
invalidation when these widgets get allocated a new size.
2017-08-09 16:26:26 +02:00
Timm Bäder
36ab70ddf5 widget: Add baseline and out_clip parameters to size-allocate
Since setting a clip is mandatory for almost all widgets, we can as well
change the size-allocate signature to include a out_clip parameter, just
like GtkCssGadget did. And since we now always propagate baselines, we
might as well pass that one on to size-allocate.

This way we can also make sure to transform the clip returned from
size-allocate to parent-coordinates, i.e. the same coordinate space
priv->allocation is in.
2017-07-19 21:27:16 -04:00
Timm Bäder
1e4d11b995 box: Ignore baselines when vertical
For now.
2017-07-19 21:27:15 -04:00
Timm Bäder
99b00b4d9c sizerequest: Assert that min_size >= 0
This should generally be true, so remove the checks from gtkbox.c and
move it into gtksizerequest.c
2017-07-19 21:27:13 -04:00
Timm Bäder
a9f9ef3f53 box: Use widget children list in count_expand_children
It's still less dereferencing than the previous code.
2017-07-19 21:27:13 -04:00
Timm Bäder
e37457adf9 box: Remove gadget 2017-07-19 21:27:11 -04:00
Timm Bäder
5baaa76bac box: Remove gadget accessor 2017-07-19 21:27:11 -04:00
Timm Bäder
66b720fbb8 box: Remove gadget usage
Keep the gadget member in the private struct around for now so
GtkButtonBox doesn't break terribly.
2017-07-19 21:27:11 -04:00
Timm Bäder
7b7e85d618 box: Remove css box drawing 2017-07-19 21:27:10 -04:00
Timm Bäder
179b8b0cbc Fix gdk_rectangle_union calls
Turns out that the destination is the last parameter, not the first one.
This fixes the flickering in the first page of the widget-factory when
using the expander on page 2.
2017-04-28 11:27:09 +02:00
Timm Bäder
927f2f5c06 box: Compute clips directly
Instead of using _gtk_widget_set_simple_clip *and*
gtk_container_get_children_clip
2017-04-25 20:30:37 +02:00
Timm Bäder
fb927d1993 box: Remove center child 2017-04-25 20:30:37 +02:00
Timm Bäder
f053a63d74 container: Remove include_internals parameter from forall
with include_internals=TRUE, this is the same as the (still private)
gtk_widget_forall, or just using the children/sibling accessors in a
loop.
2017-04-25 20:30:37 +02:00