Commit Graph

154 Commits

Author SHA1 Message Date
Timm Bäder
0aad5da1b3 widget: Remove controller sequence-state-changed signal connection
We can avoid a signal connection per event controller (and the
EventControllerData struct) since every event controller knows the
widget it's attached to.
2018-05-19 10:18:50 +02:00
Benjamin Otte
ba7849960e eventcontroller: Make widget no longer a construct-only property
The new API model is now complete. To set a widget on a controller, it
is now necessary to call gtk_widget_add_controller().
2018-04-26 17:59:42 +02:00
Benjamin Otte
9af03fa602 widget: Expose gtk_widget_add_controller()
.. and gtk_widget_remove_controller().
2018-04-26 17:59:41 +02:00
Timm Bäder
c3e02b2b22 widget: Add static inline version of gtk_widget_display()
Due to the few type checks in gtk_widget_get_display(), it was the
slowest part of a call to gtk_widget_query_size_for_orientation if the
in case of a cache hit.
2018-04-21 18:48:15 +02:00
Benjamin Otte
2db43edbd6 snapshot: Don't handle clip anymore
If widgets want to clip things, they now need to do it themselves.

By not taking care of clip, we avoid the need to track clip. And by not
tracking clip, we can avoid all unnecessary cache invalidations that we
were doing for render nodes whenever the clip changed.

And when you are scrolling, the clip changes *a lot*.
2018-04-17 23:21:37 +02:00
Benjamin Otte
2862ee7682 widget: Remove unused member 2018-04-11 03:16:34 +02:00
Timm Bäder
3ce6355bf4 widget: Remove _get_own_allocation
Replace all usages of it with _compute_bounds
2018-04-10 09:43:47 +02:00
Timm Bäder
3a5b2f54ea widget: Remove gtk_widget_get_own_allocation
Use compute_bounds everywhere.
2018-04-10 09:43:47 +02:00
Benjamin Otte
fc6de135fe widget: Don't keep track of clip anymore.
It's not used anywhere, so why would we need it?
2018-04-05 14:56:38 +02:00
Benjamin Otte
4bf90633ea widget: Cache clip from creating render node
When the clip changes that is passed to a snapshot function, we need to
create eventual cached render nodes because they might not have drawn
their whole area before.

Fixes issues with redrawing when scrolling.
2018-04-05 14:56:38 +02:00
Benjamin Otte
2d10c2568c gtk: Add GtkWidgetPaintable
A GtkWidgetPaintable is a paintable that observes a given GtkWidget and
renders that widget into a paintable.
2018-04-05 14:56:38 +02:00
Benjamin Otte
29111a16d4 widget: Cache the render node
This requires a bunch of refactorings:

1. Don't pass the current clip region to gtk_widget_snapshot()
   so we don't create full widget contents
3. Have a widget->priv->draw_needed that we invalidate on every
   queue_draw() call and set on every snapshot()
2. In queue_draw(), walk the widget chain to invalidate the
   render nodes of all parents
2018-04-05 14:56:38 +02:00
Alexander Larsson
39851fbdbf Continue renaming window to surface
This renames a lot of arguments, local variables and functions.
2018-03-21 11:49:14 +01:00
Benjamin Otte
0ce19eed08 gdk: Remove gdk_surface_shape_combine_region()
If you want transparent region, you can just render them transparent.
If you want input shaping, use gdk_surface_input_shape_combine_region().

Also remove gtk_widget_shape_combine_region().
2018-03-21 04:10:07 +01:00
Alexander Larsson
19ca2789c0 GtkWidget: Continuer rename of widget->surface
This completes the rename manually.
2018-03-20 15:40:31 +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
Alexander Larsson
391727bd0d GdkWindow -> GdkSurface initial type rename
This renames the GdkWindow class and related classes (impl, backend
subclasses) to surface. Additionally it renames related types:
GdkWindowAttr, GdkWindowPaint, GdkWindowWindowClass, GdkWindowType,
GdkWindowTypeHint, GdkWindowHints, GdkWindowState, GdkWindowEdge

This is an automatic conversion using the below commands:

git sed -f g GdkWindowWindowClass GdkSurfaceSurfaceClass

git sed -f g GdkWindow GdkSurface
git sed -f g "gdk_window\([ _\(\),;]\|$\)" "gdk_surface\1" # Avoid hitting gdk_windowing
git sed -f g "GDK_WINDOW\([ _\(]\|$\)" "GDK_SURFACE\1" # Avoid hitting GDK_WINDOWING
git sed "GDK_\([A-Z]*\)IS_WINDOW\([_ (]\|$\)" "GDK_\1IS_SURFACE\2"
git sed GDK_TYPE_WINDOW GDK_TYPE_SURFACE
git sed -f g GdkPointerWindowInfo GdkPointerSurfaceInfo

git sed -f g "BROADWAY_WINDOW" "BROADWAY_SURFACE"
git sed -f g "broadway_window" "broadway_surface"
git sed -f g "BroadwayWindow" "BroadwaySurface"
git sed -f g "WAYLAND_WINDOW" "WAYLAND_SURFACE"
git sed -f g "wayland_window" "wayland_surface"
git sed -f g "WaylandWindow" "WaylandSurface"
git sed -f g "X11_WINDOW" "X11_SURFACE"
git sed -f g "x11_window" "x11_surface"
git sed -f g "X11Window" "X11Surface"
git sed -f g "WIN32_WINDOW" "WIN32_SURFACE"
git sed -f g "win32_window" "win32_surface"
git sed -f g "Win32Window" "Win32Surface"
git sed -f g "QUARTZ_WINDOW" "QUARTZ_SURFACE"
git sed -f g "quartz_window" "quartz_surface"
git sed -f g "QuartzWindow" "QuartzSurface"

git checkout NEWS* po-properties
2018-03-20 11:40:08 +01:00
Timm Bäder
4e23daa998 widget: Don't export propagate_hierarchy_changed 2018-02-23 22:14:38 +01:00
Benjamin Otte
f08bc40fbb a11y: Don't include gtk.h
Also add missing includes and sort them for all the widgets that relied
on that before.
2018-02-08 15:25:53 +01:00
Emmanuele Bassi
fcaa9aa22d Rename GtkActionMuxer's private header
Follow the naming policy for private headers.
2018-02-02 10:28:17 +01:00
Timm Bäder
8224e7ac72 inspector: Allow picking insensitive widgets
The default gtk_widget_contains/gtk_widget_pick don't consider
insensitive widgets.
2018-01-19 10:16:15 +01:00
Timm Bäder
1aa811ce12 Remove all gtk_widget_get_content_size usages
And remove the function itself. Make everything use gtk_widget_get_width
and gtk_widget_get_height instead.
2017-12-06 07:56:12 +01:00
Benjamin Otte
b38a4cb824 widget: Export gtk_widget_set_cursor()
Widgets can now set their favorite cursor using public API.

This is very necessary because all cursor-setting APIs are still
setting it on their GdkWindow, which by now is the toplevel - oops.
2017-11-04 01:00:27 +01:00
Benjamin Otte
44614394e6 widget: Turn screen-changed signal into display-changed 2017-10-31 00:43:11 +01:00
Matthias Clasen
18b8a7f91f Add a state flag for visible focus
The new flag is called GTK_STATE_FLAGS_FOCUS_VISIBLE.
2017-10-25 17:49:43 -04: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
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
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
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
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
2cbaa998db widget: Fix drawing invalidation with windowed widgets
E.g. popovers. Find the parent of the given widget with the window and
invalidate the given region in that window.
2017-07-19 21:27:14 -04:00
Timm Bäder
a826ee37ca widget: Remove _set_simple_clip
Unused.
2017-07-19 21:27:14 -04:00
Timm Bäder
b17d998eb5 widget: Add new allocation accessors 2017-07-19 21:27:14 -04:00
Timm Bäder
a71edd2925 widget: Add private get_margin_allocation 2017-07-19 21:27:12 -04:00
Timm Bäder
ff6db012d9 widget: Add private get_border_allocation 2017-07-19 21:27:11 -04:00
Timm Bäder
a1b3a26ba4 widget: Add private gtk_widget_get_content_allocation 2017-07-19 21:27:11 -04:00
Timm Bäder
a0016758a8 widget: Copy event in gtk_widget_event and _captured_event
To ensure that we never translate the coordinates to widget coordinates
twice.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
e2c38ddc22 gtkwidget: Add private set_pass_through() call
We could eventually support pointer-event in CSS here, in the mean
time add this call to replace the GdkWindow API.
2017-05-25 16:25:59 +02:00
Carlos Garnacho
7c16bb93b5 gtkwidget: Add private cursor setter/getter
This should be eventually replaced by CSS cursors, but at the moment
it must be handled on the gtk/ side.
2017-05-25 16:25:58 +02:00
Carlos Garnacho
f50875f8d0 gtkwidget: Expose gtk_widget_common_ancestor()
This function will be useful in other places, such as determining the
widgets that must receive crossing events after pointer picking points
to another widget.
2017-05-25 16:25:58 +02:00
Timm Bäder
1b36c325eb widget: Fold queue_resize_on_widget into its only caller 2017-04-30 18:38:10 +02:00
Timm Bäder
c9fc201f77 Implement tab/up-down/left-right focus sorting for widgets
basically do what GtkContainer already did.
2017-03-31 09:50:40 +02:00
Timm Bäder
43cdeee3c4 widget: Save pointer to focus child
Do the same thing GtkContainer does.
2017-03-31 09:50:39 +02:00
Timm Bäder
f4341ee9f7 widget: Remove show-all property
Doesn't make sense anymore now that gtk_widget_show_all is gone.
2017-01-20 21:37:07 +01:00
Timm Bäder
47d4ad71fb Remove gtk_container_snapshot_child
Replace it with the already existing gtk_widget_snapshot_child.
2017-01-07 17:19:30 +01:00
Timm Bäder
52aed5d607 Add gtk_widget_snapshot_child 2017-01-07 17:19:30 +01:00
Timm Bäder
1e031cba99 widget: Add children and sibling pointers
and a (private) way to access them. We will later use these pointers to
manage children of non-container widgets and containers alike.
2017-01-07 16:44:00 +01:00