Commit Graph

109 Commits

Author SHA1 Message Date
Matthias Clasen
b96d7b62d1 Add gtk_overlay_remove_overlay
Now that GtkOverlay is not a container anymore,
gtk_container_remove can't be used for this anymore,
so add a separate api.
2020-05-04 22:53:08 -04:00
Matthias Clasen
edd5d36159 overlay: Derive from GtkWidget
We want to remove GtkBin and GtkContainer as they don't
provide much useful functionality anymore.

See #2681
2020-05-04 22:53:08 -04:00
Matthias Clasen
53f9737dcf overlay: Add a child property 2020-05-04 22:53:08 -04:00
Matthias Clasen
2356c9b503 overlay: Drop the Private struct 2020-04-26 15:38:09 -04:00
Daniel Boles
a7a0a34da1 Overlay: Document overlay children aren't measured
Some users expect that the Overlay will automatically request enough
size for its overlay children as well as its main child. It doesn't,
because it's just a GtkBin. Add a short paragraph pointing that out.

Close https://gitlab.gnome.org/GNOME/gtk/issues/1939
2019-06-20 21:41:59 +01:00
Christian Hergert
828c36636c va_marshaller: add various va_marshallers
We don't need to cover every case with a va_marshaller, but there are a
number of them that are useful because they will often only be connected
to by a single signal handler.

Generally speaking, if I opened into a file to add a va_marshaller, I just
set all of them.
2019-06-06 15:30:42 -07:00
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
Matthias Clasen
b49d1e8c6b overlay: Make final 2019-05-27 20:23:50 -04: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
Matthias Clasen
866640c0c2 overlay: Use a layout manager
This lets us get rid of the child properties,
by converting them to layout properties.
2019-03-28 16:36:59 -04:00
Benjamin Otte
a44ac75e65 gtk: Don't include gtkstylecontext.h from gtkcsstypesprivate.h
And make sure it's included everywhere it's needed.
2019-03-19 08:53:25 +01:00
Matthias Clasen
d3c45cb979 docs: Miscellaneous doc fixes
Additions and correction all over the place,
in GDK and GTK docs.
2019-02-24 16:53:12 -05:00
Matthias Clasen
beb8d362ff overlay: Remove gtk_overlay_set_overlay_pass_through
gtk_overlay_set_overlay_pass_through has been made
redundant by gtk_widget_set_can_pick. Remove it.
2019-02-21 21:57:43 -05:00
Matthias Clasen
f57e66cf37 overlay: Drop the index child property
And don't allow reordering children.
2019-02-21 19:43:33 -05:00
Matthias Clasen
1818f5589d overlay: Drop the blur support
This was really just a demo of what gsk can do.
It can be done with public api, and has been moved
to gtk-demo.
2019-02-21 19:39:42 -05:00
Benjamin Otte
cd37b872ca overlay: Remove hack for scrolled windows
It's not needed now that we don't use scrollbars or overlays inside
scrolled windows anymore.
2019-02-15 06:28:11 +01:00
Timm Bäder
44a2a49f31 overlay: Directly create cairo_region
Instead of doing a cairo_region_create + union, just pass the rect
directly to cairo_region_create_rectangle
2019-01-13 08:41:37 +01:00
Timm Bäder
269535c844 overlay: Blur the clipped node, not clip the blurred node
Blurring is a lot more expensive than clipping, so try to blur less by
clipping first.
2019-01-13 08:23:25 +01:00
Timm Bäder
c7f773f3e3 overlay: Trivial indentation fix 2019-01-13 08:23:25 +01:00
Timm Bäder
d098cd5865 overlay: Don't offset the main window snapshot
We need the node without an offset applied.

Fixes the rose picture being offset in tests/testoverlay
2019-01-13 08:23:25 +01: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
50d5666db0 container: Remove focus chains
They're prectically unused.

Widgets who want to influcence the focus chain behavior should implement
GtkWidgetClass::focus and deal with focus there.
2018-07-31 22:34:27 +02:00
Mohammed Sadiq
0c57e3131f overlay: Use the right property variable name 2018-06-11 17:43:16 +05:30
Mohammed Sadiq
0d46081645 overlay: Add support for clipping overlay widgets
Sometimes users may want to restrict the growth of child
widgets in a GtkOverlay to grow atmost the size of the overlay.

Let's add a support for that.
2018-06-11 16:24:29 +05:30
Benjamin Otte
9c0acf62b4 widget: Allow adding event controllers in ui files 2018-04-26 17:59:41 +02:00
Benjamin Otte
73b4a62f51 snapshot: Redo debug messages
Instead of every snapshot function having debug messages, have an
explicit gtk_snapshot_push_debug() function that appends a debug node.
2018-04-24 04:06:58 +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
Benjamin Otte
e3a717363b snapshot: Remove clip argument from gtk_snapshot_new()
It's not used anymore. And anybody who wants to have a clip on a
newly created snapshot can achieve that using gtk_snapshot_push_clip().
2018-04-05 14:56:38 +02:00
Benjamin Otte
e6d24f4c15 snapshot: Make gtk_snapshot_append_node() take care of offset
Push an offset node when append_node is called. That resets the offset.
2018-03-26 18:16:36 +02:00
Benjamin Otte
1cfa88ed91 snapshot: Remove renderer
Now that there's no longer a need to keep the renderer around for Cairo
rendering, don't do that then.
2018-03-24 21:57:20 +01: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
Matthias Clasen
d55da3fd44 Use GtkSnapshot getters
We can avoid direct struct access and gtksnapshotprivate.h
everywhere.
2018-03-11 00:31:44 -05:00
Matthias Clasen
694f1d8ecd Stop using stack-allocated snapshots
Use the new/free api instead of init/finish
for GtkSnapshot.
2018-03-11 00:31:44 -05:00
Benjamin Otte
db6fed1496 overlay: Add GtkOverlay::measure child property
It determines whether a child is included in the overlay's size
measurement.

The first user is (gonna be) GtkVideo.
2018-03-07 16:17:15 +01:00
Timm Bäder
84b4f85f1a overlay: Make forall() remove-safe
Since this is a GtkContainer, forall will be used to destroy all the
widgets.
2018-03-04 20:04:43 +01:00
Timm Bäder
0bb1e1b1fd overlay: Fix GSlide/g_free mixup
We free the allocated data later using g_free, so don't use GSlice when
allocating it.
2018-03-04 20:04:17 +01:00
Timm Bäder
53410bab0f overlay: Fix remove implementation
Use the child widget list of the overlay, not the passed child.
2018-03-04 20:03:54 +01:00
Timm Bäder
f44642c7cb overlay: Remove child list 2018-03-04 19:12:04 +01:00
Timm Bäder
9beb5490f5 overlay: Remove priv pointer 2018-03-04 19:12:04 +01:00
Timm Bäder
cfbac153a3 overlay: Fix coordinates in child_update_style_classes
Both main child and all others are in the same coordinate space, so no
need to add the parent position here.
2018-03-04 19:12:04 +01:00
Timm Bäder
ddcc9b9f2f overlay: Don't chain up in size_allocate
The GtkBin size_allocate implementation will allocate a size to the main
child, which GtkOverlay already does.
2018-03-04 19:12:04 +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
Timm Bäder
afea254526 overlay: Remove unused NULL-check 2017-10-20 15:12:28 +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
Daniel Boles
761194dad7 Overlay: Document style classes added per position 2017-09-20 19:19:25 +01:00
Matthias Clasen
5f6fdc4dd8 Render the main overlay child only once
Use a separate snapshot to capture the main child render node
and reuse it multiple times, instead of generating multiple
nodes for the same content.
2017-09-04 14:28:16 -04:00
Matthias Clasen
31349e71d3 Add a blur child property to GtkOverlay
When set, it blurs the content behind the child.
2017-09-04 14:28:16 -04:00
Timm Bäder
e92eebb434 overlay: Fix child widget allocation
Just adding the overlay's own position is wrong now.
2017-07-20 12:40:46 +02:00
Timm Bäder
c3176ed302 overlay: Keep the main child at the bottom
Since gtk_bin_add does a gtk_widget_set_parent call, we cannot use it in
a GtkBin implementation that has multiple child widgets and cares about
their order.
2017-07-20 12:33:57 +02:00