How to get the row at cursor of GtkListBox?

Sometimes, the row at cursor and the selected row in the GtkListBox are different, while popping the context menu on the row at cursor but not the selected row:

So how to get the row at cursor?

The current solution I used:

int x = 0, y = 0;
Gdk.Device? pointer = this.get_display().get_default_seat().get_pointer();
this.get_window().get_device_position(pointer, out x, out y, null);
m_list_row_pointer = m_expr_list_box.get_row_at_y(y);

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.