Bug 471329

Summary: [GTK] Flipped button order and default button
Product: [Eclipse Project] Platform Reporter: Marvin Fröhlich <eclipse>
Component: SWTAssignee: Markus Keller <markus.kell.r>
Status: RESOLVED FIXED QA Contact:
Severity: minor    
Priority: P3 CC: arunkumar.thondapu, Lars.Vogel, lshanmug, malaperle, markus.kell.r, niraj.modi, stephan.herrmann
Version: 4.5   
Target Milestone: 4.6 M4   
Hardware: PC   
OS: Linux   
See Also: https://git.eclipse.org/r/51294
https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=39342ffc9e64b250c13f32265b898e0c6e960a40
https://git.eclipse.org/r/59042
https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=d166f958b55c0c62dde5c74dee5645ea913de43e
Whiteboard:
Bug Depends on:    
Bug Blocks: 480806, 479727    

Description Marvin Fröhlich CLA 2015-06-29 10:27:05 EDT
Eclipse flips more and more buttons on Linux. I suspect, this is due to GTK changes. Well, odd enough.

If jar creation finishes with warnings, it displays a dialog, with "Ok" and "Details", now "Details" and "Ok". It looks like the first button is the default, which is now "Details". If I simply hit the space bar to close the dialog, it shows me details, instead of closing the dialog.
Comment 1 Stephan Herrmann CLA 2015-06-29 11:33:48 EDT
If you're on KDE, than this might be the result of the GTK theme in use: in previous releases of, e.g., Kubuntu, oxygen-gtk was the default theme for GTK applications which had Eclipse follow the KDE style wrt button order.
Neither can oxygen-gtk be recommended for recent versions of Eclipse when running on GTK3, nor does Kubuntu 15.04 use this theme by default. 

I'm yet to find a theme that works well for Eclipse on GTK3 and preserves the KDE-conform button order, but Andrey may have some workarounds for this, for a start you may refer to http://www.jroller.com/andyl/entry/mars_on_linux
Comment 2 Marvin Fröhlich CLA 2015-06-30 08:03:11 EDT
Yes, I am on KDE, OpenSuSE 13.1.

I am using GTK3 theme Adviata as of KDE system settings.

Thanks for the link. Unfortunately it's dead though.
Comment 3 Markus Keller CLA 2015-07-01 09:18:08 EDT
JFace relies on Display#getDismissalAlignment(), which reads GTK's "gtk-alternative-button-order" property. This code hasn't been touched for years.
Comment 4 Marvin Fröhlich CLA 2015-07-02 04:15:05 EDT
Well, I am not sure, if this topic should be closed. We elaborated some kind of a workaround. But the problem, that the wrong button is enabled by default, still exists.

If you don't restore the original button order the "Details" button is focussed by default, which is plain wrong and annoying. This should be fixed, shouldn't it?
Comment 5 Markus Keller CLA 2015-07-02 09:04:56 EDT
(In reply to Marvin  Fröhlich from comment #4)
> If you don't restore the original button order the "Details" button is
> focussed by default, which is plain wrong and annoying. This should be
> fixed, shouldn't it?

Yes, I missed that part of the bug.

For the Export > JAR file scenario, the dialog is an org.eclipse.jface.dialogs.ErrorDialog. However, there are quite a few other similar dialogs, e.g. org.eclipse.ui.internal.statushandlers.InternalDialog.

MessageDialog#createButton(..) already hacks around this problem, thereby violating OS X conventions. On OS X, the focused button can be activated with the Space key, but the focus doesn't override the default button (which stays accessible via the Enter key).

I think this should be fixed in SWT for GTK, probably via the commented code in org.eclipse.swt.widgets.Decorations#restoreFocus(). Note that this text was recently removed from the comment there: "Motif doesn't do this."
Comment 6 Eclipse Genie CLA 2015-07-02 13:05:12 EDT
New Gerrit change created: https://git.eclipse.org/r/51294
Comment 7 Markus Keller CLA 2015-07-02 13:20:04 EDT
(In reply to Eclipse Genie from comment #6)
> New Gerrit change created: https://git.eclipse.org/r/51294

The same should be done for win32. An example is the Delete dialog for files in the Package Explorer. org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2#createButtonsForButtonBar(Composite) currently forces the focus on the OK button. That's wrong on the Mac, where the "Preview >" button should have focus initially.

RefactoringWizardDialog2 and MessageDialog can only be fixed after this bug has been fixed on win32 and GTK.
Comment 8 Niraj Modi CLA 2015-10-14 05:15:18 EDT
(In reply to Markus Keller from comment #7)
> (In reply to Eclipse Genie from comment #6)
> > New Gerrit change created: https://git.eclipse.org/r/51294
> 
> The same should be done for win32. An example is the Delete dialog for files
> in the Package Explorer.
> org.eclipse.ltk.internal.ui.refactoring.
> RefactoringWizardDialog2#createButtonsForButtonBar(Composite) currently
> forces the focus on the OK button. That's wrong on the Mac, where the
> "Preview >" button should have focus initially.
> 
> RefactoringWizardDialog2 and MessageDialog can only be fixed after this bug
> has been fixed on win32 and GTK.

Created bug 479727 to track Win32 changes.
Comment 10 Arun Thondapu CLA 2015-10-23 15:03:47 EDT
Tested the patch and pushed it, thanks Markus, do you intend to provide a patch for the win32 changes as well?
Comment 11 Marc-André Laperle CLA 2015-10-27 11:19:42 EDT
This seems to have broken some focus behavior, see bug 480770.
Comment 12 Lars Vogel CLA 2015-10-27 11:34:19 EDT
Reopened as of comment 11
Comment 13 Eclipse Genie CLA 2015-10-27 13:40:26 EDT
New Gerrit change created: https://git.eclipse.org/r/59042
Comment 14 Markus Keller CLA 2015-10-27 14:43:32 EDT
(In reply to Eclipse Genie from comment #13)
> New Gerrit change created: https://git.eclipse.org/r/59042

This fixes bug 480770 and the cases mentioned in this bug. Should only be released after M3, ideally together with bug 479727.
Comment 16 Markus Keller CLA 2015-11-02 11:45:21 EST
.