GNOME Bugzilla – Bug 643328
"editing-canceled" signal not emitted when focusing out
Last modified: 2018-02-10 03:27:08 UTC
This appears to be a regression from GTK+ 2.x If you are editing e.g. a GtkCellRendererText, and you dismiss editing just with clicking in another area of the treeview (i.e. moving the focus out of the renderer entry), you won't get any signal. There's code in GtkCellRendererText to handle this (see gtk_cell_renderer_text_focus_out_event()), but AFAICS what happens is: - gtk_tree_view_button_press() calls gtk_tree_view_stop_editing (cancel_editing = FALSE) first thing - that in turns calls gtk_cell_area_stop_editing (cancel_editing = FALSE) - that calls gtk_cell_renderer_stop_editing (canceled = FALSE) - gtk_cell_renderer_stop_editing() does this if (priv->editing) { priv->editing = FALSE; if (canceled) g_signal_emit (cell, cell_renderer_signals[EDITING_CANCELED], 0); } resetting this way its 'editing' property [1]. - later on, from gtk_tree_view_button_press(), the focus-out handler of the renderer is called - the focus-out handler will call gtk_cell_renderer_stop_editing (canceled = TRUE), which will not emit the signal because priv->editing is FALSE already. [1] the fact that it does so directly without calling g_object_notify() for the property might be considered as another separate bug.
Note that I'm not at all sure how to best fix this, as the code is very convoluted between GtkCellArea, GtkTreeView and GtkCellRenderer, and I don't know all the assumptions those functions are run under.
*** Bug 642039 has been marked as a duplicate of this bug. ***
Bug #653289 might be related.
You should receive "edited" signal when focusing out from GtkCellRendererText by clicking on other area of the treeview. To get "editing-canceled" signal you for example press ESC. Please try a patch I attached in bug #653289: https://bugzilla.gnome.org/attachment.cgi?id=195377&action=edit
Cosimo, is this still an issue even with the fix that was pushed as part of bug #653289 ?
We're moving to gitlab! As part of this move, we are closing bugs that haven't seen activity in more than 5 years. If this issue is still imporant to you and still relevant with GTK+ 3.22 or master, please consider creating a gitlab issue for it.