Commit Graph

96 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
Timm Bäder
1ee5c2cac4 grid: Fix annotation typo 2019-04-16 07:20:13 -04:00
Matthias Clasen
b14f0b8987 grid: Annotate out args as optional
They are optional, so annotate them as such.
2019-04-05 12:01:43 +00:00
Emmanuele Bassi
faafd23225 Add convenience function for querying a child of GtkGrid
Getting the layout manager instance out of GtkGrid, and then querying
all layout properties can be tedious, especially for code that was
usually calling gtk_container_child_get().

To replace that, we can add a simple query function that returns the two
attach points and the spans.
2019-04-04 22:41:19 +01:00
Emmanuele Bassi
62acb80671 Port GtkGrid to use GtkGridLayout 2019-04-04 22:41:03 +01: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
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
695d141f32 Merge branch 'rename-window-to-surface' into 'master'
Rename window to surface

See merge request GNOME/gtk!72
2018-03-20 16:16:57 +00: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
922b2cf99a grid: Remove child list
Save the child info using g_object_set_qdata and just use the widget's
built-in child list for everthing else. This is especially simple for
GtkGrid since it has never supported reordering its child widgets.
2018-03-20 09:37:59 +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
Matthias Clasen
ffd6baec42 gtk: Intern css names
This avoids a bunch of strdups at startup.
2017-11-17 22:49:57 -05:00
Matthias Clasen
fb8589671d Drop unused includes of gtkrender.h
We don't use the gtk_render apis internally anymore.
Drop these includes so it is clear where the remaining
uses are.
2017-10-25 21:46:46 -04:00
Timm Bäder
b3fedda29e grid: Only pass baselines to children that request it 2017-10-11 08:50:21 +02:00
Timm Bäder
e7e3ef9d3e grid: Simplify allocating children
allocation->x and allocation->y are always 0. MAX'ing width/height with
1 is also wrong now since 0 is a valid width/height for widgets.
2017-10-11 08:50:21 +02:00
Timm Bäder
b994cac6dd grid: Drop priv pointer 2017-10-10 09:49:35 +02: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
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
ede6f2ab59 Slightly rework clip handling
always initialize clips to the (content) allocation, don't walk up the
widget hierarchy in gtk_widget_set_clip, implement
gtk_widget_size_allocate in GtkSeparator. This way we don't end up using
uninitialized clip values.

The entire clip handling is up for major rework since we can't and don't
want to force every single widget to call _set_clip in size-allocate
implementations.
2017-07-19 21:27:12 -04:00
Timm Bäder
e8bedcbff8 grid: Remove gadget 2017-07-19 21:27:11 -04:00
Timm Bäder
5a575c3594 gtkgrid: Remove css box drawing 2017-07-19 21:27:10 -04:00
Timm Bäder
70aeeab355 grid: Remove unnecessary NULL checks
The minimum and natural pointers passed to measure are never NULL and
that's the only place where we call gtk_grid_get_size_for_size.
2017-04-28 11:27:09 +02: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
74ef45bfbf grid: Compute clip directly
Instead of iterating over the children again in
gtk_container_get_children_clip
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
Daniel Boles
5e816f7283 grid: Fix plural error in docs' @Short_description 2017-01-15 20:37:49 +00:00
Alexander Larsson
7bee22bcb6 Avoid some more type checks for internal calls 2017-01-11 15:27:51 +01:00
Benjamin Otte
0dbdf0c428 gadget: Remove gtk_css_gadget_draw()
And with it, remove the draw func from custom gadgets, that has been
NULL everywhere.

All gadgets are snapshot now.
2016-12-20 18:01:12 +01:00
Benjamin Otte
0eecc6f686 grid: Implement support for CSS border-spacing 2016-12-10 04:32:55 +01:00
Benjamin Otte
cc1b422f64 snapshot: Convert GtkGrid 2016-11-15 17:48:45 +01:00
Benjamin Otte
da207c9fdd snapshot: Add a snapshot function to GtkCssCustomGadget 2016-11-15 17:48:45 +01:00
Timm Bäder
997fd3c81e grid: Use gtk_wiget_measure 2016-11-12 20:37:10 +01:00
Timm Bäder
9992a616ef widget: Use ::measure vfunc to measure size
Add a new ::measure vfunc similar to GtkCssGadget's that widget
implementations have to override instead of the old get_preferred_width,
get_preferred_height, get_preferred_width_for_height,
get_preferred_height_for_width and
get_preferred_height_and_baseline_for_width.
2016-10-22 19:05:47 +02:00
Matthias Clasen
72ccb39f66 Convert GtkGrid to indirect rendering
Following the example of GtkBox.
2016-10-18 11:49:11 +01:00
Timm Bäder
d844abe066 Remove GtkTable 2016-10-18 00:29:18 +02:00
Benjamin Otte
4df6ddad54 API: container: Remove gtk_container_set_border_width() 2016-10-16 18:18:58 +02:00
Timm Bäder
fb3d9022ad Remove GtkHBox 2016-10-16 18:17:21 +02:00
Matthias Clasen
2f544655f9 Revise CSS node documentation
Clarify the use of brackets in the CSS node diagrams:
[] means optional nodes or classes, <> means child widgets.
2015-12-16 10:58:47 -05:00
Matthias Clasen
f3561eaa9b grid: Convert to gadgets 2015-12-15 08:41:16 -05:00
Timm Bäder
a28103cf51 Add some more missing nullable annotations 2015-12-01 13:41:35 +01:00
Timm Bäder
86f4346c29 GtkGrid: Remove invalid return annotation 2015-11-13 14:12:35 +01:00
Matthias Clasen
2580c050d8 grid: Convert to gtk_container_child_notify_by_pspec
For the same reasons as g_object_child_notify_by_pspec.
2015-09-08 08:07:32 -04:00
Matthias Clasen
0f92a43e10 Move GtkWidgetPrivate to gtkwidgetprivate.h
This lets us use inlined getters for members in there,
avoiding the type checks in the public getters.
2015-09-07 02:40:22 -04:00
Matthias Clasen
7fd307f881 Revert "GtkGrid: Add a few NULL checks"
This reverts commit e215db6da2.

We are actually requiring non-NULL out arguments here now.
2015-07-17 20:18:34 -04:00
Matthias Clasen
e215db6da2 GtkGrid: Add a few NULL checks
Coverity complained about these.
2015-07-17 18:38:59 -04:00
Benjamin Otte
d3c147a62d stylecontext: Split render functions out into gtkrender.[ch] 2014-10-03 06:18:05 +02:00
Benjamin Otte
b5a8b7ef3b widget: Make _gtk_set_simple_clip() take an optional content clip 2014-08-21 00:54:07 +02:00