Commit Graph

1758 Commits

Author SHA1 Message Date
Timm Bäder
ec18661bbb widget: Only check display debug flags if the global ones are set
The gtk_widget_get_display call in this if statement is showing up in
profiles. It ends up walking up the hierarchy to the toplevel to get its
GdkScreen, etc. so it is relatively costly. Avoid that call in most
cases by first checking if the RESIZE debugging is enabled for any of
the displays and only then checking if it is enabled for the widget's
display.
2017-10-14 07:37:06 +02:00
Timm Bäder
eee335557c widget: Avoid some type checks when invalidating window
Use the private _gtk_widget_get_has_window instead of the public version
2017-10-14 07:26:09 +02:00
Timm Bäder
9bc7581f1c css: Replace _AFFECTS_TEXT with _TEXT_SIZE and _TEXT_CLIP
It was used to mark css properties that affect widgets with text, but it
caused unnecessary invalidations. E.g. 'color' was marked as
AFFECTS_TEXT but changing just the color of a label should not
automatically queue a resize, which is what the code in
gtk_widget_real_style_updated does.

Replace this flag with GTK_CSS_AFFECTS_TEXT_SIZE and
GTK_CSS_AFFECTS_TEXT_CLIP, which GtkWidget can use only if the widget
actually has text.
2017-10-12 15:42:03 +02:00
Timm Bäder
a6904ba2cc widget: Use blue for resize debugging
Red is already taken by drawing.
2017-10-12 15:42:03 +02:00
Carlos Garnacho
d4a6c2c241 gtkwidget: Check return value before running bubble phase
If the target widget gets the event consumed on the target phase,
we should not attempt to bubble up, not even within the same widget.
2017-10-12 14:47:15 +02:00
Carlos Garnacho
564ae6967d gtkwidget: Lookup target widget when propagating emulated pressed
After a gesture first claims, and later rejects a touch sequence,
a press event will be propagated further along. However propagation
got messed up since we only emitted as far as the toplevel.
2017-10-12 14:47:15 +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
869d9e8fe7 Widget: make sure windowed widgets have a 1×1 min size 2017-10-06 14:38:07 +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
a196ad725a widget: Fix inserting child widgets at the beginning
We have to care about the child widget's current prev/next sibling as
well.
2017-09-29 12:15:23 +02:00
Carlos Garnacho
44cb3ccfa1 gdk: Remove motion hints
Motion hints are now literally a thing of the past. Everything should be
using the full motion event stream.
2017-09-19 18:40:51 +02:00
Carlos Garnacho
a9988e18b0 gtk: Remove 2BUTTON and 3BUTTON events and event types
Those should be interpreted by widget-local gestures, not guessed at a
high level with no notions of the specific context. Users will want
GtkGestureMultiPress to replace these events.
2017-09-19 18:40:50 +02:00
Carlos Garnacho
f2ded6a685 gtk: Change gtk_propagate_event() to propagate both ways.
This change is made for consistency, it doesn't make sense to expose
one-way propagation, as it can only break expectations from GTK+. This
function might be made entirely private in the future, but it still
makes sense to do this in one go for our internal usecases.
2017-09-19 18:39:03 +02:00
Carlos Garnacho
5b9287ed77 gtkwidget: Drop pointer emulation out of touch events
Users of touch events are required to either use a GtkGesture, or handle
touch events themselves.
2017-09-19 18:39:03 +02:00
Carlos Garnacho
8c350459ae gtk: Run GtkWidgetClass event signals inside a GtkEventController
This will allow further cleanups and optimizations in capture/target/bubble
event delivery. For simplicity, ATM every widget will receive its own
GtkEventControllerLegacy, it could be desirable to add finer control over
this in the future, so widgets that fully use event controllers for input
management can do away without this legacy piece.
2017-09-19 18:39:03 +02:00
Matthias Clasen
880d44aa48 widget: Give up on GdkEvent api for now 2017-09-19 18:39:03 +02:00
Matthias Clasen
a05895e029 Record node names for debug output
This is useful for GSK_NOTE output as well.
2017-09-03 11:32:09 -04:00
Timm Bäder
a23ea01c8f widget: Fix UPDATES debug rendering
Choose the right widget to add the debug updates to (the one with the
window) and the correct region (the one in that window's coordinates).
2017-08-23 13:58:21 +02:00
Timm Bäder
8e0ed691e3 widget: Remove unused draw_internal prototype
gtk_widget_draw_internal is now only used inside gtkwidget.c, so remove
the prototype from gtkwidgetprivate.h. And since all incovacations call
it with clip_to_size=TRUE, remove that parameter.
2017-08-23 11:05:36 +02:00
Timm Bäder
3613f96f59 widget: Remove outdated comment about widget coordinates
Not so odd anymore.
2017-08-19 11:43:29 +02:00
Timm Bäder
5204802f61 widget: Remove some always-true precondition checks 2017-08-15 21:45:03 +02:00
Daniel Boles
915d8197a0 Widget: Fix outdated comments about tooltips
They are not usually yellow anymore, the previous advice about how to
style them was for pre-3.20 versions, and the immediate replacement (CSS
class .tooltip) does not seem ready for primetime.

https://bugzilla.gnome.org/show_bug.cgi?id=784421
2017-08-15 19:17:57 +01:00
Timm Bäder
9f3f640c0d widget: Remove gtk_widget_get_border_allocation 2017-08-14 12:22:39 +02:00
Timm Bäder
5f859a1f24 widget: Remove gtk_widget_get_content_allocation
Replace it where we still need something similar, e.g. in
gtk_widget_translate_coordinates
2017-08-14 12:22:39 +02:00
Timm Bäder
9c7e089fc2 widget: Remove gtk_widget_get_margin_allocation
It's not needed anymore with get_outer_allocation (which will be
replaced by something more appropriately named).
2017-08-14 12:22:39 +02:00
Timm Bäder
07d6c7817d widget: Remove private _gtk_widget_set_has_focus
The css state here is now handled in gtk_widget_set_focus_child
2017-08-12 15:56:53 +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
Daniel Boles
bae6d3d45c Fix some nullable Returns annotations
based on reports and patches by Iñaki García Etxebarria:

https://bugzilla.gnome.org/show_bug.cgi?id=781246
https://bugzilla.gnome.org/show_bug.cgi?id=785423
2017-08-03 20:27:29 +01:00
Timm Bäder
e70a3fab0d widget: Constify state parameter of propagate_state
Makes sense.
2017-08-02 08:58:30 +02:00
Timm Bäder
8c08a33220 widget: Don't try to propagate 0 state flags
This happens quite often and has no effect anyway.
2017-08-02 08:58:30 +02:00
Timm Bäder
9a3049009e widget: Fix size_allocate's out_clip annotation 2017-08-02 08:58:30 +02:00
Timm Bäder
f7bb6a7aa8 widget: Unset PRELIGHT and ACTIVE state in _set_sensitive
They both depend on input, which an insensitive widget does not receive.
2017-08-01 18:43:42 +02:00
Timm Bäder
2cbcee8549 widget: Don't access highlight_resize in non-debug builds
The GtkWidgetPrivate struct only contains that member if G_ENABLE_DEBUG
is defined.
2017-07-28 21:28:32 +02:00
Timm Bäder
3f9bcf3b31 widget: Stop invalidating recursively 2017-07-24 14:32:06 +02:00
Timm Bäder
5720f2a845 widget: Make _set_clip private
We don't need this anymore since clips are now reported in
size-allocate.
2017-07-19 21:27:16 -04:00
Timm Bäder
5116ce19b7 widget: Remove queue_draw_region vfunc
Unused
2017-07-19 21:27:16 -04:00
Timm Bäder
65209da486 widget: Set :focus on focus children 2017-07-19 21:27:16 -04: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
95bd58ac00 widget: Don't propagate size-allocate if only the position changed
We can do this now so we should
2017-07-19 21:27:15 -04:00
Timm Bäder
2e6b1158ee widget: Fix priv dereference in size_allocate_with_baseline
Accessing ->priv is only safe *after* the GTK_IS_WIDGET precondition, so
use the get_instance_private function instead.
2017-07-19 21:27:15 -04:00
Timm Bäder
6d9a0d432a widget: Fix a widget/container mixup 2017-07-19 21:27:15 -04:00
Timm Bäder
0ebd8840a8 widget: Remove gtk_cairo_transform_to_window
Useless in a world without windows and cairo.
2017-07-19 21:27:15 -04:00
Timm Bäder
097ab2baed widget: Draw css box after pushing a opacity node 2017-07-19 21:27:15 -04:00
Timm Bäder
eb34c68ff4 widget: Move get_resize_needed to gtkwidget.c
It's only used in there so we don't need it in the private header.
2017-07-19 21:27:15 -04:00
Timm Bäder
f0d6cb5f40 widget: Propagate correct baseline 2017-07-19 21:27:15 -04:00
Timm Bäder
e19e3b72a3 widget: Always pass on baselines 2017-07-19 21:27:15 -04:00
Timm Bäder
fb2bb87bb1 widget: Simplify snapshot_child 2017-07-19 21:27:15 -04:00
Timm Bäder
0726148ca5 widget: Draw debug nodes for widget margins too 2017-07-19 21:27:15 -04:00
Timm Bäder
fa5203e700 widget: Fix copy&paste error when creating debug nodes 2017-07-19 21:27:15 -04:00
Timm Bäder
cef4df1e7e widget: Unset PRELIGHT and ACTIVE state flags in unmap 2017-07-19 21:27:15 -04:00