GNOME Bugzilla – Bug 691181
egg-list-box prelights wrong widget
Last modified: 2013-01-08 16:10:57 UTC
This is visible e.g. in gnome-control-center's Power or Search panels by hovering over a switch in an egg-list-box row. I have two slightly different patches that both work to fix the bug; comments welcome.
Created attachment 232820 [details] [review] egg-list-box: filter out motion-notify events for other windows We need to filter out motion events not relative to our window; since we use the relative coordinate to fetch the prelight/active child, we will always fetch the wrong child when using coordinates that are not relative to our window. -- This is the simpler approach, just filter out motion events for child windows, like we do for enter/leave events.
Created attachment 232821 [details] [review] egg-list-box: translate motion-notify events for child windows When a motion event is received relative to a child window, translate the y coordinate of the event relative to our own window, since that's what we need to fetch the correct child. -- Slightly more complex patch that tries to translate the motion event relative to the listbox's window before fetching the child.
I can easily imagine a case where approach 1 fails. For instance, if you have a row with a windowed widget in it that takes up the whole height of the row (but not the whole width), then if the mouse enters the row over the widget then the row will not get a motion event, but part of the row that should be prelighted is visible (but is not prelighted). Actually there are two issues there. a) the previous row should be un-prelighted, and b) the new row should *possibly* be prelighted (as per previous discussion about prelight propagation struff). So, i think the second approach is more right. However, i disagree with its implementation. First of all gdk_window_get_origin() is a sync X call, and secondly it fails in more complicated cases like embedding with transformations. I think a gdk_window_coords_to_parent() loop like in gtk_widget_translate_coordinates() makes more sense.
Attachment 232821 [details] pushed as 706210c - egg-list-box: translate motion-notify events for child windows Pushed to master a fixed version after Alex ACKed it on IRC