File: nomotif-mtoolkit.patch

package info (click to toggle)
openjdk-6 6b27-1.12.6-1~deb6u1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze-proposed-updates
  • size: 133,540 kB
  • ctags: 37,146
  • sloc: java: 173,188; cpp: 13,710; asm: 6,470; ansic: 4,827; sh: 4,156; makefile: 4,149; perl: 1,005; python: 310
file content (168 lines) | stat: -rw-r--r-- 6,382 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
--- openjdk.orig/jdk/src/solaris/native/sun/awt/awt_LoadLibrary.c	2009-11-23 13:06:29.271625283 +0000
+++ openjdk/jdk/src/solaris/native/sun/awt/awt_LoadLibrary.c	2010-01-15 15:31:25.577635803 +0000
@@ -81,7 +81,6 @@
     int32_t len;
     char *p;
     JNI_OnLoad_type *JNI_OnLoad_ptr;
-    int32_t motifVersion = 2;
     struct utsname name;
     JNIEnv *env = (JNIEnv *)JNU_GetEnv(vm, JNI_VERSION_1_2);
     void *v;
@@ -106,7 +105,7 @@
 
     /*
      * The code below is responsible for:
-     * 1. Loading appropriate awt library, i.e. motif/libmawt, xawt/libmawt or headless/libwawt
+     * 1. Loading appropriate awt library, i.e. xawt/libmawt or headless/libwawt
      * 2. Setting "awt.toolkit" system property to use the appropriate Java toolkit class,
      *    (if user has specified the toolkit in env varialble)
      */
@@ -115,10 +114,7 @@
     /* Check if toolkit is specified in env variable */
     envvar = getenv("AWT_TOOLKIT");
     if (envvar) {
-        if (strstr(envvar, "MToolkit")) {
-            toolkit = (*env)->NewStringUTF(env, "sun.awt.motif.MToolkit");
-        }
-        else if (strstr(envvar, "XToolkit")) {
+        if (strstr(envvar, "XToolkit")) {
             toolkit = (*env)->NewStringUTF(env, "sun.awt.X11.XToolkit");
         }
         /* If user specified toolkit then set java system property */
@@ -136,128 +132,15 @@
     if (AWTIsHeadless()) {
         strcpy(p, "/headless/libmawt");
     } else {
-        /* Try java system property */
-        if (!toolkit && propname) {
-            toolkit = JNU_CallStaticMethodByName (env,
-                                                  NULL,
-                                                  "java/lang/System",
-                                                  "getProperty",
-                                                  "(Ljava/lang/String;)Ljava/lang/String;",
-                                                  propname).l;
-        }
-
-        /* Calculate kind of toolkit */
-        if (toolkit) {
-            const char* toolkit_name = (*env)->GetStringUTFChars(env, toolkit, 0);
-            if (strstr(toolkit_name,"MToolkit")) {
-                XAWT = 0;
-            } else {
-                XAWT = 1;
-            }
-            if (toolkit_name) {
-                (*env)->ReleaseStringUTFChars(env, toolkit, toolkit_name);
-            }
-        } else {
-            /* Default AWT Toolkit on Linux and Solaris is XAWT. */
-            XAWT = 1;
-        }
-
-        /* Find loaded Motif version and if Xt is loaded */
-        if (!XAWT) {
-            /* Has a Motif library been loaded already, e.g. by an application
-             * embedding java?   Netscape plugin?
-             */
-
-            v = dlsym(RTLD_DEFAULT, "vendorShellWidgetClass");
-            if (v != NULL && dladdr(v, &dlinfo)) {
-
-                /*
-                 * If we are picking up the vendorShellWigetClass from libXt
-                 * instead of libXm (it exists in both), then we are very stuck.
-                 * Abort.
-                 */
-                if (strstr(dlinfo.dli_fname, "libXt.so") != NULL) {
-                    xt_before_xm = 1;
-                }
-
-                if (strstr(dlinfo.dli_fname, "libXm.so.3") != NULL) {
-#ifdef VERBOSE_AWT_DEBUG
-                    fprintf(stderr, "Motif 1.2 detected, using that.\n");
-#endif
-                    motifVersion = 1;
-                }
-                else if (strstr(dlinfo.dli_fname, "libXm.so.4") != NULL) {
-#ifdef VERBOSE_AWT_DEBUG
-                    fprintf(stderr, "Motif 2.1 detected, using that.\n");
-#endif
-                    motifVersion = 2;
-                }
-            }
-
-            /* Determine desired Motif Version, and set appropriate properties
-             * to load the correct version of libmawt.so
-             */
-            else {
-                uname(&name);
-
-                if ((strcmp(name.release, "5.5.1") == 0) ||
-                    (strcmp(name.release, "5.6") == 0)) {
-#ifdef VERBOSE_AWT_DEBUG
-                    fprintf(stderr, "default to Motif 1.2, os is: %s\n",name.release);
-#endif
-                    motifVersion = 1;
-                } else {
-#ifdef VERBOSE_AWT_DEBUG
-                    fprintf(stderr, "default to Motif 2.1, os is: %s\n",name.release);
-#endif
-                    motifVersion = 2;
-                }
-                if (getenv("_JAVA_AWT_USE_MOTIF_1_2")) {
-#ifdef VERBOSE_AWT_DEBUG
-                    fprintf(stderr,"_JAVA_AWT_USE_MOTIF_1_2 is set, using Motif 1.2\n");
-#endif
-                    motifVersion = 1;
-                } else if (getenv("_JAVA_AWT_USE_MOTIF_2_1")) {
-#ifdef VERBOSE_AWT_DEBUG
-                    fprintf(stderr,"_JAVA_AWT_USE_MOTIF_2_1 is set, using Motif 2.1\n");
-#endif
-                    motifVersion = 2;
-                }
-            }
-        }
-
-        /* Update library name */
-        if (toolkit) {
-            const char* toolkit_name = (*env)->GetStringUTFChars(env, toolkit, 0);
-            if (strstr(toolkit_name,"MToolkit")) {
-                strcpy(p, (motifVersion != 1) ? "/motif21/libmawt" : "/motif12/libmawt");
-            }
-            else {
-                strcpy(p, "/xawt/libmawt");
-            }
-            if (toolkit_name) {
-                (*env)->ReleaseStringUTFChars(env, toolkit, toolkit_name);
-            }
-        }
-        else {
-            /* Default AWT Toolkit on Linux and Solaris is XAWT. */
-            strcpy(p, "/xawt/libmawt");
-        }
+        /* Default AWT Toolkit on Linux and Solaris is XAWT. */
+        strcpy(p, "/xawt/libmawt");
+    }
 
-        if (toolkit) {
-            (*env)->DeleteLocalRef(env, toolkit);
-        }
-        if (propname) {
-            (*env)->DeleteLocalRef(env, propname);
-        }
-        if (xt_before_xm && !XAWT) {
-            fprintf(stderr, "\nRuntime link error - it appears that "
-                    "libXt got loaded before libXm,\n"
-                    "which is not allowed.\n");
-            JNU_ThrowByName(env, "java/lang/InternalError",
-                            "libXt loaded before libXm");
-            return JNI_VERSION_1_2;
-        }
+    if (toolkit) {
+        (*env)->DeleteLocalRef(env, toolkit);
+    }
+    if (propname) {
+        (*env)->DeleteLocalRef(env, propname);
     }
 
     strcat(p, ".so");