GNOME Bugzilla – Bug 776187
flowbox: Add gtk_flow_box_get_child_at_pos to gtk3
Last modified: 2016-12-19 23:33:46 UTC
It will be really useful to have a gtk_flow_box_get_child_at_pos in gtk3, just like we have gtk_list_box_get_row_at_y. In the GtkIcon/TreeView world, we have gtk_icon_view_get_path_at_pos and gtk_tree_view_get_path_at_pos. My main use case is writing a GtkFlowBox-equivalent to GdMainIconView (bug 774914) that is used in gnome-boxes, gnome-documents, gnome-photos, totem, etc.. The libgd widget behaves differently from its gtk+ counterpart in some ways. For example, GtkFlowBox doesn't handle right-click at all while the libgd widget does. That usually requires finding out the GtkFlowBoxChild under the mouse pointer, if any. Similarly for implementing drag-and-drop. Having an API to get the child from the (x, y) position will make it easier to do that. It is possible to hack around this by listening to events on the GtkFlowBoxChild itself and proxying it up to the parent GtkFlowBox. However, gtk_flow_box_find_child_at_pos already exists as a private method. Given how trivial it would be to expose it as a public method, I think we should just add it. It will make the API more complete without adding a lot of overhead.
Created attachment 342095 [details] [review] flowbox: Rename gtk_flow_box_find_child_at_pos for consistency
Created attachment 342096 [details] [review] flowbox: Export gtk_flow_box_get_child_at_pos as public API
Review of attachment 342095 [details] [review]: sure
Review of attachment 342096 [details] [review]: ::: gtk/gtkflowbox.c @@ +4315,3 @@ + * exists for the given x and y coordinates. + * + * Since: 3.22 I think we should actually break with our usual rules, and start including the micro version in the since tag here
(In reply to Matthias Clasen from comment #4) > Review of attachment 342096 [details] [review] [review]: > > ::: gtk/gtkflowbox.c > @@ +4315,3 @@ > + * exists for the given x and y coordinates. > + * > + * Since: 3.22 > > I think we should actually break with our usual rules, and start including > the micro version in the since tag here Ok, I will add the micro version. I wasn't sure if we were going to do one last 3.24 release to include such little API additions before gtk4 is more widely used, or we would stick to 3.22.x.
Comment on attachment 342095 [details] [review] flowbox: Rename gtk_flow_box_find_child_at_pos for consistency Pushed to master.
Created attachment 342219 [details] [review] flowbox: Export gtk_flow_box_get_child_at_pos as public API
Review of attachment 342219 [details] [review]: ok
Comment on attachment 342219 [details] [review] flowbox: Export gtk_flow_box_get_child_at_pos as public API Pushed only to master.
(In reply to Debarshi Ray from comment #9) > Comment on attachment 342219 [details] [review] [review] > flowbox: Export gtk_flow_box_get_child_at_pos as public API > > Pushed only to master. Sorry, wrong bug. Pushed to gtk-3-22 too.