Bug 79203 - [consistency] List fires second selection on default selection
Summary: [consistency] List fires second selection on default selection
Status: RESOLVED WORKSFORME
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.1   Edit
Hardware: PC Linux-GTK
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Grant Gayed CLA
QA Contact:
URL:
Whiteboard:
Keywords: consistency
Depends on:
Blocks:
 
Reported: 2004-11-22 11:40 EST by Grant Gayed CLA
Modified: 2016-08-28 05:17 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Grant Gayed CLA 2004-11-22 11:40:35 EST
- run the ControlExample, go to the List tab
- listen for Selection and Default Selection
- double click an item in the example List on the page
  -> on gtk you'll get Selection - Selection - Default Selection
  -> on all other platforms you'll get Selection - Default Selection
Comment 1 Steve Northover CLA 2004-11-22 19:01:53 EST
Probably true in Tree and Table as well.  I tried to work around this once. 
GTK is actually issuing two events.  The only way to fix this is to remember 
that a selection happened in mouse down and issue the selection in mouse up 
but only if a default selection has not happened.  Since this would be 
changing GTK platform behavior, I didn't attempt it.

Need to verify that GTK is in fact doing this and it's not an obvious bug in 
SWT.
Comment 2 Felipe Heidrich CLA 2004-11-23 18:27:54 EST
I think GTK is doing it (there is no obvious bug in SWT in this part).
Changing the selection to happen on mouse up instead of using gtk_changed is
gonna cause trouble: the selection can be changed by keyboard input.

The problem is that GtkTreeView is using mouse down to implement the
gtk_changed, so a double click consist:
- mouse click -> selection
- mouse click -> selection
- mouse double click -> default selection.

we can try to detect we are in the second mouse click with
" if ((event->button.time < (display->button_click_time[0] +
display->double_click_time)) &&
           (event->button.window == display->button_window[0]) &&
           (event->button.button == display->button_number[0]) &&
           (ABS (event->button.x - display->button_x[0]) <=
display->double_click_distance) &&
           (ABS (event->button.y - display->button_y[0]) <=
display->double_click_distance))"


It means you must remember the time, the window, the button, and the x,y
position for every button down in the toolkit.






Comment 3 Felipe Heidrich CLA 2004-11-23 18:30:07 EST
Some other possible solution is to use gtk_change when the event type is
keyboard and use mouse up to implement our own selection (as steve suggested).
I think it is too hacky.

Any other ideas ?
Comment 4 Steve Northover CLA 2005-01-19 19:51:27 EST
Grant to prioirtize.
Comment 5 Eric Williams CLA 2016-08-05 08:47:52 EDT
I can't reproduce this bug, please re-open if the issue persists.