Mercurial > projects > dwt-linux
diff dwt/DWT.d @ 104:62a654ba5276
optimation of static ctors
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Fri, 18 Jan 2008 19:13:47 +0100 |
parents | 5899e0b43e5d |
children | 08177d42526b |
line wrap: on
line diff
--- a/dwt/DWT.d Fri Jan 18 17:00:39 2008 +0100 +++ b/dwt/DWT.d Fri Jan 18 19:13:47 2008 +0100 @@ -23,6 +23,8 @@ import tango.core.Exception; +//version=CARBON; + /** * This class provides access to a small number of DWT system-wide * methods, and in addition defines the public constants provided @@ -1748,7 +1750,7 @@ * * @since 2.1 */ - public static /*const*/ int MODIFIER_MASK; + public static const int MODIFIER_MASK = ALT | SHIFT | CTRL | COMMAND; /** * Keyboard and/or mouse event mask indicating that mouse button one @@ -1798,7 +1800,7 @@ * * @since 2.1 */ - public static /*const*/ int BUTTON_MASK; + public static const int BUTTON_MASK = BUTTON1 | BUTTON2 | BUTTON3 | BUTTON4 | BUTTON5; /** * Keyboard and/or mouse event mask indicating that the MOD1 key @@ -1808,7 +1810,12 @@ * * @since 2.1 */ - public static /*const*/ int MOD1; + version(CARBON){ + public static const int MOD1 = COMMAND; + } + else{ + public static const int MOD1 = CONTROL; + } /** * Keyboard and/or mouse event mask indicating that the MOD2 key @@ -1818,7 +1825,12 @@ * * @since 2.1 */ - public static /*const*/ int MOD2; + version(CARBON){ + public static const int MOD2 = SHIFT; + } + else{ + public static const int MOD2 = SHIFT; + } /** * Keyboard and/or mouse event mask indicating that the MOD3 key @@ -1826,7 +1838,12 @@ * * @since 2.1 */ - public static /*const*/ int MOD3; + version(CARBON){ + public static const int MOD3 = ALT; + } + else{ + public static const int MOD3 = ALT; + } /** * Keyboard and/or mouse event mask indicating that the MOD4 key @@ -1834,7 +1851,12 @@ * * @since 2.1 */ - public static /*const*/ int MOD4; + version(CARBON){ + public static const int MOD4 = CONTROL; + } + else{ + public static const int MOD4 = 0; + } /** * Constants to indicate line scrolling (value is 1). @@ -3613,32 +3635,4 @@ throw error; } -public static void static_this() { - /* - * These values represent bit masks that may need to - * expand in the future. Therefore they are not initialized - * in the declaration to stop the compiler from inlining. - */ - BUTTON_MASK = BUTTON1 | BUTTON2 | BUTTON3 | BUTTON4 | BUTTON5; - MODIFIER_MASK = ALT | SHIFT | CTRL | COMMAND; - - /* - * These values can be different on different platforms. - * Therefore they are not initialized in the declaration - * to stop the compiler from inlining. - */ - char[] platform = getPlatform (); - if ("carbon" == platform ) { //$NON-NLS-1$ - MOD1 = COMMAND; - MOD2 = SHIFT; - MOD3 = ALT; - MOD4 = CONTROL; - } else { - MOD1 = CONTROL; - MOD2 = SHIFT; - MOD3 = ALT; - MOD4 = 0; - } } - -}