Commit Graph

88 Commits

Author SHA1 Message Date
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
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
Carlos Garnacho
fe40abc636 gtkoverlay: Remove per-child windows
They are no longer necessary to do child positioning nor input
handling.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
a72404dd5a gtk: Mass delete all GtkWidget event mask API
We now rely on toplevels receiving and forwarding all the events
the windowing should be able to handle. Event masks are no longer a
way to determine whether an event is deliverable ot a widget.

Events will always be delivered in the three captured/target/bubbled
phases, widgets can now just attach GtkEventControllers and let those
handle the events.
2017-05-25 16:25:58 +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
Timm Bäder
ae1a606c8b overlay: Ensure proper child widget order
Make sure the main widget stays below all the overlay children.
2017-04-25 20:29:02 +02:00
Alexander Larsson
7bee22bcb6 Avoid some more type checks for internal calls 2017-01-11 15:27:51 +01:00
Benjamin Otte
47a82640a8 Revert "Covert GtkOverlay to indirect rendering"
This reverts commit fd4a1cdad6.

GtkOverlay uses clipping and render nodes can't clip yet.
2016-11-15 17:49:19 +01:00
Pavel Grunt
5993117b84 overlay: Document availability of properties
Add missing "Since"

https://bugzilla.gnome.org/show_bug.cgi?id=773082
2016-10-21 11:53:01 -04:00
Matthias Clasen
fd4a1cdad6 Covert GtkOverlay to indirect rendering
There is no gadget, so we use the gtk_widget_create_render_node
function for the first time here.
2016-10-18 11:49:13 +01:00
Benjamin Otte
c3274eff6e overlay: Use gdk_window_new_child() 2016-10-18 00:22:35 +02:00
Benjamin Otte
662001b60a API: Remove ability to set visuals on windows
And with it, gtk_widget_get_visual() and gtk_widget_set_visual() are
gone.

We now always use the RGBA visual (if available) and otherwise fall back
to the system visual.
2016-10-16 18:17:21 +02:00
Timm Bäder
becfd18b07 overlay: set css name 2016-02-10 14:03:56 +01:00
Timm Bäder
ddbafa023a overlay: Don't access priv pointer before typ check 2016-01-23 10:30:53 +01:00
Alexander Larsson
d5f1754981 gtk: Stop setting GDK_EXPOSURE_MASK on random widgets
These days exposure happens only on the native windows (generally the
toplevel window) and is propagated down recursively. The expose event
is only useful for backwards compat, and in fact, for double buffered
widgets we totally ignore the event (and non-double buffering breaks
on wayland).

So, by not setting the mask we avoid emitting these events and then
later ignoring them.

We still keep it on eventbox, fixed and layout as these are used
in weird ways that want backwards compat.
2015-09-14 11:01:13 +02:00
Matthias Clasen
2bf97567ce Revert "gtkoverlay: Optimize size allocations"
This reverts commit 93171cf4f3.

This broke overlay controls in page 3 of widget-factory, gnome-photos,
gnome-documents, etc.
2015-08-22 15:51:42 -04:00
Matthias Clasen
bff28ac6b0 GtkOverlay: Update the description
State that the overlays are placed wrt to the GtkOverlay, not
with respect to the main widget. This makes a difference for
small main widgets which are not configured to fill the entire
GtkOverlay.
2015-08-21 18:19:26 -04:00
Benjamin Otte
8026575947 overlay: Always align widgets relative to the overlay
... not to the contained widget, which might not occupy the whole
overlay when an align mode is set.
2015-08-21 00:47:30 +02:00
Benjamin Otte
2039ab8853 overlay: Use actual size of the overlay when positioning
Previously we were using the natural requested size which is unrelated.
2015-08-21 00:47:30 +02:00
Jasper St. Pierre
93171cf4f3 gtkoverlay: Optimize size allocations
Doing raises / lowers here will invalidate the entire child widget
almost every time, since raising each widget causes it to invalidate
that area.
2015-07-31 20:39:02 -07:00
Cosimo Cecchi
9230143bbf overlay: don't call gtk_style_context_set_background() 2015-07-01 16:09:22 -07:00
Matthias Clasen
3b97a0b940 Fix an oversight 2015-06-23 16:46:26 -04:00