Commit Graph

67 Commits

Author SHA1 Message Date
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
Matthias Clasen
b684e70dd5 GtkOverlay: Sync up parameter names
gtk-doc gets confused if the parameter names between header,
source and doc comment don't match up.
2015-06-20 10:52:44 -04:00
Cosimo Cecchi
9c7b0f0491 overlay: remove gtk_overlay_add_pass_through_overlay()
The API to access this functionality will be the setter we just added in
the previous commit.

https://bugzilla.gnome.org/show_bug.cgi?id=750568
2015-06-17 11:48:37 -07:00
Cosimo Cecchi
3b1b171be5 overlay: add setters and getters for pass-through child property
This will make the API easier to use from bindings too.

https://bugzilla.gnome.org/show_bug.cgi?id=750568
2015-06-17 11:48:37 -07:00
Alexander Larsson
9fc19b5a26 gtkoverlay: Fix issues with remove
The iteration now progresses past a delete, so make sure we iterate
safely. Also, don't chain up if we removed a child.
2015-06-15 16:32:50 +02:00
Alexander Larsson
4dd66b0c53 GtkOverlay: Add support for input pass-through overlays
For these widgets we set pass-through on the child window so that
input over these widgets (that are not on a child input window) goes
to the window below the overlay.

https://bugzilla.gnome.org/show_bug.cgi?id=750568

https://bugs.freedesktop.org/show_bug.cgi?id=90917
2015-06-15 10:56:46 +02:00
Alexander Larsson
76ba5a03b9 overlay: Add reorder_overlay()
This allows you to control the z-ordering of overlay children

https://bugzilla.gnome.org/show_bug.cgi?id=750568

https://bugs.freedesktop.org/show_bug.cgi?id=90917
2015-06-15 10:56:45 +02:00
Benjamin Otte
95959ef470 overlay: Handle overlays when no main widget exists
Just pretend that the main widget is an empty widget the size of the
overlay.
Makes it possible to write testcases where no size requests are run on
overlay widgets before size_allocate() is called.

Testcase included.
2014-09-07 01:57:09 +02:00
Javier Jardón
c5b0ae5574 docs: Change documentation to consistenly use "Returns:"
Instead "Return value:" or "Return:"
2014-07-10 16:54:34 +01:00
Evan Nemerson
07d825574f gtk: add missing type annotations ported from Vala bindings
https://bugzilla.gnome.org/show_bug.cgi?id=730745
2014-05-27 21:10:33 -07:00
Cosimo Cecchi
c05525127b overlay: don't have a custom draw implementation
We can't think with Benjamin of a reason this should be needed, so let's
just remove it.
2014-05-02 20:42:54 +02:00
Matthias Clasen
2a26c39b29 overlay: deal gracefully with main widget being absent
It can happen that we get a size request when the main widget
is still NULL. Currently we hit a critical in this case, and
stumble on. We can do better.
Opening a new tab in nautilus is hitting this case.
https://bugzilla.gnome.org/show_bug.cgi?id=727643
2014-04-05 11:21:50 -04:00
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
2a45418b67 docs: use proper quotes 2014-02-05 15:08:42 -05:00
William Jon McCann
3b3d8ca456 docs: Use "#" for refsect2 instead of ## 2014-02-04 21:00:58 -05:00
William Jon McCann
76447c3512 docs: use quotes instead of <firstterm> 2014-02-04 18:10:11 -05:00
William Jon McCann
6ba5e6bb1a docs: don't use <tag> docbook elements 2014-02-04 17:38:09 -05:00
Matthias Clasen
09d1b28249 docs: Convert to markdown
Specifically, switch to using markdown syntax for sections.
2014-02-02 00:30:27 -05:00
Yosef Or Boczko
719dd636a9 Replace all margin-left and margin-right with margin-start and margin-end
https://bugzilla.gnome.org/show_bug.cgi?id=710238
2013-11-15 02:54:35 +01:00
Jasper St. Pierre
499b4bb60f gtkoverlay: Remove get_preferred_width / get_preferred_height implementation
GtkBin now handles this for us.
2013-11-01 01:15:25 -04:00
Emmanuele Bassi
0899ef7cc9 gtk: Use new macros for defining private data
https://bugzilla.gnome.org/show_bug.cgi?id=702996
2013-07-09 09:30:02 +01:00
Alexander Larsson
bb7054b508 overlay/paned: Ensure we set the right visual on windows
This was always "needed", but the problems with not doing it
now are worse, since any CSD window will have a nonstandard
rgba visual.
2013-05-08 15:51:00 +02:00