Community
Participate
Working Groups
There is a different system behaviors against Mac Cocoa and Mac Carbon/Windows/Linux. IF there are two windows on the screen, window 1 has focus(on top), window 2 not, click a control on window 2: 1. On Mac Carbon/Windows/Linux, window 2 will get focus(move to top) and the clicked control will take effective. It means single click do two things: (1) Windows got focus (2)Control is clicked 2. On Mac Cocoa, partial controls has same behaviors, but most of other controls difference. Single click only make window get focus, if we want to the control work, another click is necessary. In the SWT's Control class, if the style is STW.ON_TOP, the acceptsFirstMouse will return true, then the control will be focused only a single click. But STW.ON_TOP will be used in other scenario, can we provide a new style to control whether accept the first mouse? boolean acceptsFirstMouse (int /*long*/ id, int /*long*/ sel, int /*long*/ theEvent) { Shell shell = getShell (); if ((shell.style & SWT.ON_TOP) != 0) return true; return super.acceptsFirstMouse (id, sel, theEvent); }
SWT for carbon only overwrote this Mac behavior for four widgets (Table, Tree, List and Browser). Other widgets do not accept the first click (i.e Button, ToolBar, etc). I was considering adding acceptsFirstMouse to those widgets only (to be consistent with carbon) and return true, but that does not seem to fix the problem for those widgets. Does it fix the problem for you?
Created attachment 220075 [details] patch for R3_7_maintenance branch This patch fix the problem for Table/Tree/List. Browser already works as mentioned. We are not changing the behaviour for other widgets. Overwriting acceptsFirstMouse for Table/Tree/List is not enough. We need to overwrite needsPanelToBecomeKey and acceptsFirstResponder. Please try this patch out. It works for me, but I have done only minimal testing.
Created attachment 220743 [details] new patch for R3_7_maintenance I missed one case. Custom widgets also accepts the first click on SWT for carbon. Please try this patch out.
Tha new patch works now. Thanks very much. (In reply to comment #3) > Created attachment 220743 [details] > new patch for R3_7_maintenance > > I missed one case. Custom widgets also accepts the first click on SWT for > carbon. > > Please try this patch out.
Thanks for verifying the fix. Released to master (4.3). http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=904726b3be2bccd3138b183ec66e6878016a6ed0
The fix for this caused bug 390734, which is now fixed.