2003/09/20 05:03:47
[org.ibex.core.git] / src / org / xwt / plat / Darwin.cc
index c38f173..068b766 100644 (file)
 #include <org/xwt/plat/Darwin$CarbonOpenGL.h>
 #include <org/xwt/plat/Darwin$FileDialogHelper.h>
 #include <org/xwt/plat/GCJ$Retainer.h>
-#include <org/xwt/Proxy.h>
+#include <org/xwt/HTTP$Proxy.h>
 #include <org/xwt/util/Semaphore.h>
 
 #include <stdlib.h>
+#include <objc/objc.h>
 
 #include "DarwinCarbonHeaders.h"
 
@@ -540,6 +541,15 @@ void Darwin$CarbonSurface::natInit(jboolean framed) {
     rect.top = 0; rect.left = 0; rect.bottom = 10; rect.right=10;
     r = CreateNewWindow(wc,attr,&rect,&window);
     checkStatus(r,"CreateNewWindow");
+
+    id NSWindowClass = objc_getClass("NSWindow");
+    printf("nswindowclass is %x\n", NSWindowClass);
+    SEL selector = sel_registerName("initWithWindowRef");
+    printf("selector is %s\n", selector);
+    objc_method method = class_getClassMethod(NSWindowClass, selector);
+    printf("method is %x\n", method);
+    id windowInstance = objc_msgSend(NSWindowClass, selector, window);
+    printf("instance is %x\n", windowInstance);
     
     GCJ$Retainer::retain(this); // Need to account for the EventHandlers pointer to us
     EventHandlerUPP upp = NewEventHandlerUPP(our_windowEventHandler);
@@ -707,9 +717,9 @@ void Darwin::natSetClipBoard(jstring js) {
     checkStatus(r,"PutScrapFlavor");
 }
 
-Proxy *Darwin::natDetectProxy() {
-    using org::xwt::Proxy;
-    Proxy *p=0;
+HTTP$Proxy *Darwin::natDetectProxy() {
+    using org::xwt::HTTP$Proxy;
+    HTTP$Proxy *p=0;
     CFStringRef string;
     CFNumberRef number;
     SmartCFString smartString;
@@ -728,7 +738,7 @@ Proxy *Darwin::natDetectProxy() {
         number = (CFNumberRef) CFDictionaryGetValue(proxyInfo, kSCPropNetProxies ## proto ## Port); \
         if(number != NULL && CFGetTypeID(number) != CFNumberGetTypeID()) number = NULL;    \
         if(string && number && CFNumberGetValue(number,kCFNumberIntType,&i) && i) {        \
-            if(!p) p = new Proxy();                                                        \
+            if(!p) p = new HTTP$Proxy();                                                        \
             p->var ## ProxyHost = cfStringToJString(string);                           \
             p->var ## ProxyPort = i;                                                   \
         }                                                                                  \