[gtk/wip/baedert/for-master: 57/57] widget: Use gtk_widget_get_native() in get_surface_allocation()
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/baedert/for-master: 57/57] widget: Use gtk_widget_get_native() in get_surface_allocation()
- Date: Thu, 31 Dec 2020 07:08:30 +0000 (UTC)
commit 16788185088e4bc892c45ff4968ed4d72ddc0363
Author: Timm Bäder <mail baedert org>
Date: Thu Dec 31 08:02:10 2020 +0100
widget: Use gtk_widget_get_native() in get_surface_allocation()
gtk/gtkwidget.c | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index a61bf419e1..2ab136a486 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -3425,21 +3425,18 @@ void
gtk_widget_get_surface_allocation (GtkWidget *widget,
GtkAllocation *allocation)
{
- GtkWidget *parent;
+ GtkNative *native;
graphene_rect_t bounds;
double nx, ny;
- /* Don't consider the parent == widget case here. */
- parent = _gtk_widget_get_parent (widget);
- while (parent && !GTK_IS_NATIVE (parent))
- parent = _gtk_widget_get_parent (parent);
+ native = gtk_widget_get_native (widget);
- g_assert (GTK_IS_WINDOW (parent) || GTK_IS_POPOVER (parent));
- gtk_native_get_surface_transform (GTK_NATIVE (parent), &nx, &ny);
+ g_assert (GTK_IS_WINDOW (native) || GTK_IS_POPOVER (native));
+ gtk_native_get_surface_transform (native, &nx, &ny);
- if (gtk_widget_compute_bounds (widget, parent, &bounds))
+ if (gtk_widget_compute_bounds (widget, GTK_WIDGET (native), &bounds))
{
- *allocation = (GtkAllocation){
+ *allocation = (GtkAllocation) {
floorf (bounds.origin.x) + nx,
floorf (bounds.origin.y) + ny,
ceilf (bounds.size.width),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]