Commit Graph

133 Commits

Author SHA1 Message Date
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
Timm Bäder
489aee5d00 widget: Remove unused adjust_* vfuncs
Expose them privately to gtksizerequest.c using normal functions
instead.
2016-12-07 18:12:54 +01:00
Timm Bäder
07a9b202ab widget: Remove _gtk_widget_supports_clip 2016-12-07 08:19:22 +01:00
Timm Bäder
3063d4a5e3 widget: Remove gtk_widget_invalidate_style_context 2016-12-07 08:19:22 +01:00
Benjamin Otte
2745c2502f snapshot: Move GtkSnapshot declaration to gtypes.h 2016-11-19 20:58:36 +01:00
Benjamin Otte
b8710d8962 widget: Remove get_render_node() vfunc 2016-11-15 17:49:19 +01:00
Benjamin Otte
d1fec79c00 snapshot: Completely reengineer API
We now try to emulate cairo_t:

We keep a stack of nodes via push/pop and a transform matrix.

So whenever a new node is added to the snapshot, we transform it
by the current transform matrix and append it to the current node.
2016-11-15 17:48:45 +01:00
Benjamin Otte
93cbba6c3e gtk: Add gtk_widget_snapshot()
It's functionally equivalent to gtk_widget_get_render_node() but uses a
GtkSnapshot argument to carry the state.
2016-11-15 17:48:45 +01:00
Benjamin Otte
b0a5e8764c widget: Insist on widgets calling gtk_widget_set_has_window()
This way, we can grep the code for the bad widgets that set this to
TRUE and fix them.
2016-11-02 06:54:57 +01:00
Timm Bäder
5071206d60 widget: Remove app-paintable 2016-10-31 19:28:28 +01:00
Benjamin Otte
a334316d5e API: widget: Remove GtkWidget::composited-changed signal
Nobody uses it.

If you need the functionality, listen to display changes on
your widget and then connect to the display's notify::composited.
2016-10-29 04:49:47 +02:00
Timm Bäder
9992a616ef widget: Use ::measure vfunc to measure size
Add a new ::measure vfunc similar to GtkCssGadget's that widget
implementations have to override instead of the old get_preferred_width,
get_preferred_height, get_preferred_width_for_height,
get_preferred_height_for_width and
get_preferred_height_and_baseline_for_width.
2016-10-22 19:05:47 +02:00
Timm Bäder
18f0b80e2e widget: Remove in_reparent flag
gtk_widget_reparent is gone so we don't need this anymore.
2016-10-20 20:12:05 +02:00
Emmanuele Bassi
354d4435b1 gtk: Add convenience function for creating render nodes
GtkWidget.create_render_node() sets up a GskRenderNode appropriate for
rendering the contents of a widget, including its bounds,
transformation, and anchor point.
2016-10-18 11:49:11 +01:00
Emmanuele Bassi
b997f4c575 gtk: Use GskRenderNode to render widgets
We need a virtual function to retrieve the GskRenderNode for each
widget, which is supposed to attach its own children's GskRenderNodes.
Additionally, we want to maintain the existing GtkWidget::draw mechanism
for widgets that do not implement get_render_node() — as well as widgets
that have handlers connected to the ::draw signal.
2016-10-18 11:49:06 +01:00
Timm Bäder
dd3c3b683f widget: Remove push/pop_composite_child
as well as the composite-child property
2016-10-18 00:29:18 +02:00
Benjamin Otte
4a95f8802c widget: Remove gtk_widget_set_double_buffered()
Everything is always double-buffered.
2016-10-16 18:18:58 +02:00
Benjamin Otte
0df388051d API: Remove GtkStyle
All the remaining gtkrc.c stuff like GtkRcStyle goes with it.
2016-10-16 18:17:21 +02:00
Timm Bäder
d52f6ff710 widget: Don't unnecessarily export function
_gtk_widget_get_translation_to_window is only used in gtkwidget.c
2016-06-27 14:43:53 +02:00
Emmanuele Bassi
2c7b21718f Simplify the widget rendering entry point
Now that GDK has the appropriate API, we can simplify the widget drawing
code into a single function.

https://bugzilla.gnome.org/show_bug.cgi?id=766675
2016-06-09 17:45:40 +01:00
Benjamin Otte
ddcf47026d widget: No longer postpone style-updated on unrealized widgets
GTK used to not emit GtkWidget::style-updated on widgets that weren't
realized. This sped up construction of complex widgetry in the early
days of GTK3 where we instantly invalidated on every change.
We don't do that anymore, so in theory (and in my limited testing with
widget-factory) this shouldn't be a prolem anymore.

What is a problem though is that postponing style-updated leads to 2
problems:
(1) Unrealized widgets will not emit style-updated which may cause them
    to not properly update their state and return wrong values from
    get_preferred_width/height() etc
(2) Emitting style-updated during realize can happen too late.
    When a widget is not made child-visible by its parent (common
    examples: notebook, paned) it will also not be realized when the
    parent is initially shown. However, when they get realized later
    (after a resize of the parent), they will emit style-updated (and
    potentially queue a resize) during size-allocate.

https://bugzilla.gnome.org/show_bug.cgi?id=765700
2016-05-14 18:48:22 +02:00
Matthias Clasen
12dfb368e2 Don't emit ::query-tooltip by name
This signal is emitted quite a bit, and we can easily avoid it.
2016-05-06 10:14:07 -04:00