GtkPopover attached to GtkCellEditable is misplaced
@kjellahl
Submitted by Kjell Ahlstedt Link to original bug (#743437)
Description
Created attachment 295314 Test case
If a GtkPopover is attached to an editable cell in a GtkTreeView when the cell is opened for editing, the GtkPopover is not drawn at that cell.
When the popover is attached in an editing-started signal handler, the GtkCellEditable (which is a GtkEntry) has not yet been added to a container widget. When it is added to a container, the hierarchy-changed signal is emitted, and the following functions are called: _gtk_popover_parent_hierarchy_changed() gtk_popover_update_position() _gtk_window_set_popover_position()
But _gtk_window_set_popover_position() does not update the position of any GdkWindow. That's done in popover_size_allocate() in gtkwindow.c.
It's tempting to try to fix the bug by calling popover_size_allocate() from _gtk_window_set_popover_position(), but that would result in infinite recursive function calls: _gtk_window_set_popover_position() popover_size_allocate() gtk_popover_update_position() _gtk_window_set_popover_position() ...........
The test case also shows a second bug. When the editing is finished, and the GtkEntry is unmapped, warnings such as these are printed:
(example:2861): Gtk-WARNING **: GtkWindow 0x802230 is mapped but visible child GtkPopover 0x8679f0 is not mapped
They come from gtk_widget_verify_invariants().
Attachment 295314, "Test case":
editable_cells.c
Version: 3.22.x