After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 753568 - Optimize the GtkPopover transition
Optimize the GtkPopover transition
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: .General
3.17.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2015-08-12 17:08 UTC by Timm Bäder
Modified: 2015-08-16 02:04 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GtkPopover: Don't resize in the transition callback (1.19 KB, patch)
2015-08-12 17:08 UTC, Timm Bäder
none Details | Review

Description Timm Bäder 2015-08-12 17:08:18 UTC
Created attachment 309169 [details] [review]
GtkPopover: Don't resize in the transition callback

GtkPopover cals gtk_widget_queue_resize in its frameclock callback. I think it was even me who wrote it, but it turns out that just repainting it does not make any difference visually (I think? At least in my tests).
Comment 1 Benjamin Otte (Company) 2015-08-14 13:12:31 UTC
Review of attachment 309169 [details] [review]:

::: gtk/gtkpopover.c
@@ +496,3 @@
                  gpointer       user_data)
 {
+  GtkPopover *popover = (GtkPopover *) widget;

Don't do this, always cast using the macro. You can make the macro expand to just the cast by compiling with G_DISABLE_CAST_CHECKS.

@@ +519,3 @@
     }
 
+  gtk_widget_queue_draw (widget);

Why is that even necessary? What property are we changing that requires a redraw?
Comment 2 Timm Bäder 2015-08-14 13:34:30 UTC
(In reply to Benjamin Otte (Company) from comment #1)
> +  gtk_widget_queue_draw (widget);
> 
> Why is that even necessary? What property are we changing that requires a
> redraw?

Well we are using gtk_widget_set_opacity but that already queues a redraw (no idea if we can rely on that). We also set priv->transition_diff which is used in gtk_popover_update_position, which is e.g. use in the size_allocate handler and that's why I previously thought that a queue_resize would be necessary, but it either seems to happen anyway or it just doesn't make a difference.

In any case, is there a way to make a GtkPopover resize not bubble up to its parent? I can't think of a case where the popover size would affect the toplevel size.