changeset 6501:15f389017ffb

SWT Glass: Return the window handle for the Shell (rather than the view handle)
author snorthov
date Tue, 18 Mar 2014 07:34:50 -0700
parents a50800b8372c
children 286673912389
files modules/graphics/src/main/java/com/sun/glass/ui/swt/SWTApplication.java
diffstat 1 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/modules/graphics/src/main/java/com/sun/glass/ui/swt/SWTApplication.java	Tue Mar 18 09:24:51 2014 -0400
+++ b/modules/graphics/src/main/java/com/sun/glass/ui/swt/SWTApplication.java	Tue Mar 18 07:34:50 2014 -0700
@@ -768,6 +768,19 @@
         return 0;
     }
 
+    static long getHandleCocoa(Shell control) {
+        try {
+            Field field = control.getClass().getDeclaredField("window");
+            field.setAccessible(true);
+            Object view = field.get(control);
+            Class clazz = Class.forName("org.eclipse.swt.internal.cocoa.id");
+            return getHandle(clazz, view, "id");
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return 0;
+    }
+
     static void invokeLock(Control control, String name) {
         try {
             Field field = control.getClass().getField("view");