Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 185817

Summary: MouseListener (with count for e.g. 2) on Linux-Gtk
Product: [Eclipse Project] Platform Reporter: Thomas Schindl <tom.schindl>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: ericwill, ipun, pinnamur, snorthov
Version: 3.3Keywords: triaged
Target Milestone: ---   
Hardware: Other   
OS: Linux   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=510803
Whiteboard:
Bug Depends on:    
Bug Blocks: 184346    
Attachments:
Description Flags
Snippet to try out
none
Patch none

Description Thomas Schindl CLA 2007-05-07 13:40:48 EDT
When trying to activate an editor on Linux-Gtk by registering an MouseListener and activating when the MouseEvent.count == 2 the editor looses focus directly after the activation because an FocusOut-Occurs on the Text-Control. This an GTK only issue and works on WinXP and MacOSX. By the way if you use mouseDoubleClick() instead the activation works on Linux-Gtk. Snippet attached
Comment 1 Thomas Schindl CLA 2007-05-07 13:41:50 EDT
Created attachment 66160 [details]
Snippet to try out
Comment 2 Praveen CLA 2009-05-12 01:51:42 EDT
Created attachment 135272 [details]
Patch

We used to grab the focus onto Table for every button-press-event. Due to this, though user tries to assign the focus to Text in editor, the focus is being grabbed by Table. 
For every double-click, 3 events are generated- 2 button-press-events for single-click and a button-press-event for double-click. As we post the event for 2nd button-press-event (clickCount is 2), editor is created in the eventHandler code. Then, another button-press-event of Double-click is generated, at which we incorrectly grab the focus to table.
The fix is to grab the focus on only button-press-event of single-click. The same rule applies for List and Tree also.

Bogdan, the fix works well for single/double-click events. However, while I was testing, I realize that it does not work for triple-click (the focus is reassigned back to table). After the editor is created, Text loses the focus and assigns it back to Table. I was not able to spot the code that grabs the focus to table. I've seen only focus-out (for Text) event generated after triple-click. I'm not quite sure whether this is native behaviour or not. Can you suggest whether I miss anything here ? Thanks!
Comment 3 Eric Williams CLA 2016-10-09 10:29:19 EDT
This is still reproducible.
Comment 4 Eric Williams CLA 2019-02-20 14:02:38 EST
(In reply to Eric Williams from comment #3)
> This is still reproducible.

I cannot reproduce this issue any longer using SWT from master, GTK3.24, and Fedora 29.