1 /*
2 * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
1525 * XSettings and they are not initialized yet.
1526 *
1527 * @return true if the method has initialized XAWTXSettings.
1528 */
1529 private boolean initXSettingsIfNeeded(final String propName) {
1530 if (!loadedXSettings &&
1531 (propName.startsWith("gnome.") ||
1532 propName.equals(SunToolkit.DESKTOPFONTHINTS) ||
1533 propName.startsWith(dndPrefix)))
1534 {
1535 loadedXSettings = true;
1536 if (!GraphicsEnvironment.isHeadless()) {
1537 loadXSettings();
1538 /* If no desktop font hint could be retrieved, check for
1539 * KDE running KWin and retrieve settings from fontconfig.
1540 * If that isn't found let SunToolkit will see if there's a
1541 * system property set by a user.
1542 */
1543 if (desktopProperties.get(SunToolkit.DESKTOPFONTHINTS) == null) {
1544 if (XWM.isKDE2()) {
1545 Object hint = fcManager.getFontConfigAAHint();
1546 if (hint != null) {
1547 /* set the fontconfig/KDE property so that
1548 * getDesktopHints() below will see it
1549 * and set the public property.
1550 */
1551 desktopProperties.put(UNIXToolkit.FONTCONFIGAAHINT,
1552 hint);
1553 }
1554 }
1555 desktopProperties.put(SunToolkit.DESKTOPFONTHINTS,
1556 SunToolkit.getDesktopFontHints());
1557 }
1558
1559 return true;
1560 }
1561 }
1562 return false;
1563 }
1564
1565 private void loadXSettings() {
|
1 /*
2 * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
1525 * XSettings and they are not initialized yet.
1526 *
1527 * @return true if the method has initialized XAWTXSettings.
1528 */
1529 private boolean initXSettingsIfNeeded(final String propName) {
1530 if (!loadedXSettings &&
1531 (propName.startsWith("gnome.") ||
1532 propName.equals(SunToolkit.DESKTOPFONTHINTS) ||
1533 propName.startsWith(dndPrefix)))
1534 {
1535 loadedXSettings = true;
1536 if (!GraphicsEnvironment.isHeadless()) {
1537 loadXSettings();
1538 /* If no desktop font hint could be retrieved, check for
1539 * KDE running KWin and retrieve settings from fontconfig.
1540 * If that isn't found let SunToolkit will see if there's a
1541 * system property set by a user.
1542 */
1543 if (desktopProperties.get(SunToolkit.DESKTOPFONTHINTS) == null) {
1544 if (XWM.isKDE2()) {
1545 Object hint = FontConfigManager.getFontConfigAAHint();
1546 if (hint != null) {
1547 /* set the fontconfig/KDE property so that
1548 * getDesktopHints() below will see it
1549 * and set the public property.
1550 */
1551 desktopProperties.put(UNIXToolkit.FONTCONFIGAAHINT,
1552 hint);
1553 }
1554 }
1555 desktopProperties.put(SunToolkit.DESKTOPFONTHINTS,
1556 SunToolkit.getDesktopFontHints());
1557 }
1558
1559 return true;
1560 }
1561 }
1562 return false;
1563 }
1564
1565 private void loadXSettings() {
|