Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [albireo-dev] AwtEnvironment & customizability

Bruno Haible wrote:

> Well, I dug a bit and found that the System.err output is a sufficient
> indicator of this situation. I turn this System.err output into an exception,
> and the rest is easy.
>
> I've renamed the constant from
>    LAFChoiceNativeSystemForceGtk
> to LAFChoiceNativeSystemPreferGtk,
> to match what it now does.

The same error can happen with certain themes when running with the GNOME desktop, so I made some minor changes to the code to handle the case where getSystemLookAndFeelClassName() returns the gtk look and feel (see patch).

BTW, sometimes I *don't* get the unsupported engine error when running KDE. Does this make sense?

I'm no GTK expert, and I didn't spend a lot of time on this. Here's the
reasoning... The primary distribution of Eclipse on Linux is GTK-based,
even if you are running on KDE (i.e. there is no Qt version of SWT). So
I concluded that the GTK look and feel would be a closer match, even
when running under a KDE window manager.

This is all right in principle. The only problem is that it leads to bad
results in the KDE case.


If it *never* makes sense for KDE and if the system look and feel is set to something else, then we should probably never change it to GTK_LOOK_AND_FEEL. However, it would still be nice to handle the unsupported engine error, so the "prefer GTK" option would still be useful.


### Eclipse Workspace Patch 1.0
#P org.eclipse.albireo.core
Index: src/org/eclipse/albireo/core/LookAndFeelHandler.java
===================================================================
RCS file: /cvsroot/technology/org.eclipse.albireo/org.eclipse.albireo.core/src/org/eclipse/albireo/core/LookAndFeelHandler.java,v
retrieving revision 1.4
diff -u -r1.4 LookAndFeelHandler.java
--- src/org/eclipse/albireo/core/LookAndFeelHandler.java	1 Feb 2008 19:21:44 -0000	1.4
+++ src/org/eclipse/albireo/core/LookAndFeelHandler.java	4 Feb 2008 23:28:04 -0000
@@ -150,7 +150,11 @@
             laf = UIManager.getSystemLookAndFeelClassName();
             if (Platform.isGtk()
                 && laf.equals(UIManager.getCrossPlatformLookAndFeelClassName())) {
-                // Try the Gtk look&feel.
+                
+                laf = GTK_LOOK_AND_FEEL_NAME;
+            }
+            if (laf.equals(GTK_LOOK_AND_FEEL_NAME)) {
+                // Try the Gtk look&feel. 
                 try {
                     doSetLookAndFeel(GTK_LOOK_AND_FEEL_NAME);
                     return;
@@ -159,7 +163,8 @@
                 } catch (IllegalAccessException e) {
                 } catch (UnsupportedLookAndFeelException e) {
                 }
-                // Second try: Use getSystemLookAndFeelClassName().
+                // Second try: Use cross platform look and feel
+                laf = UIManager.getCrossPlatformLookAndFeelClassName();
             }
         } else if (LAFChoiceNativeSystemNoGtk.equals(laf)) {
             laf = UIManager.getSystemLookAndFeelClassName();
@@ -187,6 +192,8 @@
         // com.sun.java.swing.plaf.gtk mockup. The error message in this case
         // reads:
         // "/opt/gnome/share/themes/Qt/gtk-2.0/gtkrc:5: Engine "qtengine" is unsupported, ignoring"
+        //
+        // This can also happens even when running the GNOME desktop, when certain themes are selected.  
         PrintStream origSystemErr = System.err;
         try {
             System.setErr(

Back to the top