93 return true; |
93 return true; |
94 } |
94 } |
95 else |
95 else |
96 { |
96 { |
97 //display = DisplayExtension.getDisplayInstance(); |
97 //display = DisplayExtension.getDisplayInstance(); |
98 //As now the thread is always available we are taking it from Toolkit. |
98 //As now the thread is always available we are taking it from Toolkit. |
99 display = Toolkit. getInternalDisplay(); |
99 display = Toolkit. getInternalDisplay(); |
100 |
100 |
101 |
101 |
102 if (display == null) |
102 if (display == null) |
103 { |
103 { |
104 |
104 |
105 return false; |
105 return false; |
106 } |
106 } |
107 else |
107 else |
108 { |
108 { |
109 |
109 |
110 // UI thread is available, so load native library if not already loaded |
110 // UI thread is available, so load native library if not already loaded |
111 if (!libraryLoaded) |
111 if (!libraryLoaded) |
112 { |
112 { |
113 |
113 |
114 com.nokia.mj.impl.rt.support.Jvm.loadSystemLibrary("javam2g"); |
114 com.nokia.mj.impl.rt.support.Jvm.loadSystemLibrary("javam2g"); |
115 libraryLoaded = true; |
115 libraryLoaded = true; |
116 } |
116 } |
117 return true; |
117 return true; |
118 } |
118 } |
119 } |
119 } |
120 } |
120 } |
121 |
|
122 /** |
|
123 * Load Library if not already loaded |
|
124 * |
|
125 |
|
126 static void loadLibarary() |
|
127 { |
|
128 if (!libraryLoaded) |
|
129 { |
|
130 |
|
131 com.nokia.mj.impl.rt.support.Jvm.loadSystemLibrary("javam2g"); |
|
132 libraryLoaded = true; |
|
133 } |
|
134 }*/ |
|
135 |
121 |
136 /** |
122 |
137 * Registers an Object3D in the global handle-to-object map. The |
123 |
138 * handle of the object must already be set at this point! |
|
139 */ |
|
140 // static final void registerFinalizer(Object3D obj) |
|
141 // { |
|
142 // //heuristicGC(); |
|
143 // } |
|
144 // |
|
145 // /** |
|
146 // * Registers a Graphics3D object (not derived from Object3D) for |
|
147 // * finalization. |
|
148 // */ |
|
149 // static final void registerFinalizer(Graphics3D g3d) |
|
150 // { |
|
151 // //heuristicGC(); |
|
152 // } |
|
153 // |
|
154 // /** |
|
155 // * Registers an Interface object for finalization |
|
156 // */ |
|
157 // static final void registerFinalizer(Interface m2G) |
|
158 // { |
|
159 // } |
|
160 // |
|
161 // /** |
|
162 // * Registers a Loader object for finalization |
|
163 // */ |
|
164 // static final void registerFinalizer(Loader loader) |
|
165 // { |
|
166 // } |
|
167 // |
|
168 // /** |
|
169 // * Flushes all pending rendering to a Graphics context and blocks |
|
170 // * until finished |
|
171 // */ |
|
172 // static final void sync(Graphics g) |
|
173 // { |
|
174 // //ToolkitInvoker invoker = ToolkitInvoker.getToolkitInvoker(); |
|
175 // //invoker.toolkitSync(invoker.getToolkit()); |
|
176 // } |
|
177 // |
|
178 // /** |
|
179 // * Flushes all pending rendering to an Image object |
|
180 // */ |
|
181 // static final void sync(Image img) |
|
182 // { |
|
183 // //ToolkitInvoker invoker = ToolkitInvoker.getToolkitInvoker(); |
|
184 // //invoker.toolkitSync(invoker.getToolkit()); |
|
185 // } |
|
186 // |
|
187 // /** |
|
188 // * Finalizes the native peer of an interface |
|
189 // */ |
|
190 // static final native void finalizeInterface(int handle); |
|
191 // |
|
192 // /** |
|
193 // * Finalizes the native peer of an object |
|
194 // * JCF: added this wrapper method so we could pass the toolkit handle to the native method. |
|
195 // */ |
|
196 static final void finalizeObject(int handle) |
124 static final void finalizeObject(int handle) |
197 { |
125 { |
198 try |
126 try |
199 { |
127 { |
200 final int finalHandle = handle; |
128 final int finalHandle = handle; |
211 { |
139 { |
212 // do nothing |
140 // do nothing |
213 } |
141 } |
214 } |
142 } |
215 |
143 |
216 /** |
|
217 * Finalizes the native peer of an object associated with |
|
218 * given Interface instance |
|
219 */ |
|
220 // static final void finalizeObject(int handle, Interface aInterface) |
|
221 // { |
|
222 // try |
|
223 // { |
|
224 // final int finalHandle = handle; |
|
225 // executeInUIThread( |
|
226 // new M2GRunnableQt() |
|
227 // { |
|
228 // public void doRun() |
|
229 // { |
|
230 // _finalizeObject(finalHandle); |
|
231 // } |
|
232 // }); |
|
233 // } |
|
234 // catch (Exception e) |
|
235 // { |
|
236 // // do nothing |
|
237 // } |
|
238 // } |
|
239 |
|
240 |
|
241 //------------------------------------------------------------------ |
144 //------------------------------------------------------------------ |
242 // Private methods |
145 // Private methods |
243 //------------------------------------------------------------------ |
146 //------------------------------------------------------------------ |
244 |
147 |
245 /** |
148 /** |