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 776187 - flowbox: Add gtk_flow_box_get_child_at_pos to gtk3
flowbox: Add gtk_flow_box_get_child_at_pos to gtk3
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
3.22.x
Other All
: Normal enhancement
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks: 774914
 
 
Reported: 2016-12-16 23:47 UTC by Debarshi Ray
Modified: 2016-12-19 23:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
flowbox: Rename gtk_flow_box_find_child_at_pos for consistency (3.80 KB, patch)
2016-12-16 23:49 UTC, Debarshi Ray
committed Details | Review
flowbox: Export gtk_flow_box_get_child_at_pos as public API (4.17 KB, patch)
2016-12-16 23:49 UTC, Debarshi Ray
none Details | Review
flowbox: Export gtk_flow_box_get_child_at_pos as public API (4.69 KB, patch)
2016-12-19 14:19 UTC, Debarshi Ray
committed Details | Review

Description Debarshi Ray 2016-12-16 23:47:45 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.
Comment 1 Debarshi Ray 2016-12-16 23:49:03 UTC
Created attachment 342095 [details] [review]
flowbox: Rename gtk_flow_box_find_child_at_pos for consistency
Comment 2 Debarshi Ray 2016-12-16 23:49:21 UTC
Created attachment 342096 [details] [review]
flowbox: Export gtk_flow_box_get_child_at_pos as public API
Comment 3 Matthias Clasen 2016-12-17 13:30:23 UTC
Review of attachment 342095 [details] [review]:

sure
Comment 4 Matthias Clasen 2016-12-17 13:44:30 UTC
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
Comment 5 Debarshi Ray 2016-12-19 06:35:10 UTC
(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 6 Debarshi Ray 2016-12-19 14:18:30 UTC
Comment on attachment 342095 [details] [review]
flowbox: Rename gtk_flow_box_find_child_at_pos for consistency

Pushed to master.
Comment 7 Debarshi Ray 2016-12-19 14:19:28 UTC
Created attachment 342219 [details] [review]
flowbox: Export gtk_flow_box_get_child_at_pos as public API
Comment 8 Matthias Clasen 2016-12-19 19:33:52 UTC
Review of attachment 342219 [details] [review]:

ok
Comment 9 Debarshi Ray 2016-12-19 23:33:05 UTC
Comment on attachment 342219 [details] [review]
flowbox: Export gtk_flow_box_get_child_at_pos as public API

Pushed only to master.
Comment 10 Debarshi Ray 2016-12-19 23:33:46 UTC
(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.