X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fibex%2Fplat%2FDarwin.cc;h=ed01572dd16211ff5d64fdc97ad1040606433bb4;hb=0db1ff365b2acfa1be6420aca33a27dd01eb78f2;hp=7adf0eed4b48049c36c5bd41f55389343e00a136;hpb=3591b88b94a6bb378af3d4abe6eb5233ce583104;p=org.ibex.core.git diff --git a/src/org/ibex/plat/Darwin.cc b/src/org/ibex/plat/Darwin.cc index 7adf0ee..ed01572 100644 --- a/src/org/ibex/plat/Darwin.cc +++ b/src/org/ibex/plat/Darwin.cc @@ -18,13 +18,14 @@ #include #include +#include #include #include #include #include #include #include -#include +#include #include #include @@ -256,9 +257,9 @@ class SmartCFString { }; // CHECKME: Is just making up your own four char codes really correct? -const static UInt32 kEventClassCarbonMessage = 'ibexa'; -const static UInt32 kEventCarbonMessage = 'ibexb'; -const static UInt32 kEventParamCarbonMessage = 'ibexc'; +const static UInt32 kEventClassCarbonMessage = 'ibxa'; +const static UInt32 kEventCarbonMessage = 'ibxb'; +const static UInt32 kEventParamCarbonMessage = 'ibxc'; static OSStatus carbonMessageEventHandler(EventHandlerCallRef handler, EventRef e, void *userData); static EventHandlerUPP carbonMessageEventHandlerUPP; @@ -587,11 +588,12 @@ static OSStatus windowEventHandler(EventHandlerCallRef handler, EventRef e, void SInt32 delta; r = WC(GetEventParameter)(e,kEventParamMouseWheelAxis,typeMouseWheelAxis,NULL,sizeof(axis),NULL,&axis); checkStatus(r,"GetEventParameter"); - if(axis != kEventMouseWheelAxisY) break; r = WC(GetEventParameter)(e,kEventParamMouseWheelDelta,typeSInt32,NULL,sizeof(delta),NULL,&delta); checkStatus(r,"GetEventParameter"); - fprintf(stderr,"kEventMouseWheelMoved: delta: %d",delta); - // surface->MouseWheelMoved(...) IMPROVMENT: mouse wheel support in ibex + switch(axis) { + case kEventMouseWheelAxisX: surface->HScroll((jint)(40 * delta)); break; + case kEventMouseWheelAxisY: surface->VScroll((jint)(40 * delta)); break; + } return noErr; } } @@ -701,7 +703,7 @@ static OSStatus paintProc ( Darwin$CarbonSurface *surface = (Darwin$CarbonSurface*) userData; Rect rect; WC(GetRegionBounds)(inClientPaintRgn, &rect); - surface->Dirty(rect.left,rect.top,rect.right-rect.left,rect.bottom-rect.top); + surface->dirty(rect.left,rect.top,rect.right-rect.left,rect.bottom-rect.top); return noErr; } @@ -714,9 +716,9 @@ void Darwin$CarbonSurface::natInit(jboolean framed) { WindowAttributes attr = kWindowStandardHandlerAttribute| (framed ? kWindowInWindowMenuAttribute|kWindowStandardDocumentAttributes|kWindowLiveResizeAttribute : 0); OSStatus r; - rect.top = rect.left = 0; - rect.bottom = rect.right = 10; - winWidth = winHeight = 10; + rect.top = rect.left = 100; + rect.bottom = rect.right = 200; + winWidth = winHeight = 100; r = WC(CreateNewWindow)(wc, attr, &rect, &window); checkStatus(r,"CreateNewWindow"); @@ -739,7 +741,7 @@ void Darwin$CarbonSurface::natDispose() { WC(DisposeWindow)(window); } -void Darwin$CarbonSurface::natSetIcon(org::ibex::Picture *_p) { +void Darwin$CarbonSurface::natSetIcon(org::ibex::graphics::Picture *_p) { } void Darwin$CarbonSurface::natSetLocation() { @@ -888,9 +890,8 @@ void Darwin::natSetClipBoard(jstring js) { checkStatus(r,"PutScrapFlavor"); } -HTTP$Proxy *Darwin::natDetectProxy() { - using org::ibex::HTTP$Proxy; - HTTP$Proxy *p=0; +org::ibex::net::HTTP$Proxy *Darwin::natDetectProxy() { + org::ibex::net::HTTP$Proxy *p=0; CFStringRef string; CFNumberRef number; SmartCFString smartString; @@ -909,7 +910,7 @@ HTTP$Proxy *Darwin::natDetectProxy() { number = (CFNumberRef) WC(CFDictionaryGetValue)(proxyInfo, kSCPropNetProxies ## proto ## Port); \ if(number != NULL && WC(CFGetTypeID)(number) != WC(CFNumberGetTypeID)()) number = NULL; \ if(string && number && WC(CFNumberGetValue)(number,kCFNumberIntType,&i) && i) { \ - if(!p) p = new HTTP$Proxy(); \ + if(!p) p = new org::ibex::net::HTTP$Proxy(); \ p->var ## ProxyHost = cfStringToJString(string); \ p->var ## ProxyPort = i; \ } \ @@ -1139,6 +1140,12 @@ void Darwin$GLCarbonPixelBuffer::activateContext() { WC(aglSetCurrentContext)(ctx); } +void Darwin$GLCarbonSurface$GLCarbonSurfacePixelBuffer::activateContext() { + // hooray for Brian's forward-thinking design abstractions, because I have no idea what the fuck this does, but it works + AGLContext ctx = (AGLContext) rawCTX; + WC(aglSetCurrentContext)(ctx); +} + void Darwin$GLCarbonPixelBuffer::natCleanup(RawData* rawWindowRef, RawData* rawCTX) { WindowRef window = (WindowRef) rawWindowRef; AGLContext ctx = (AGLContext) rawCTX;