Changed: #947 adds very basic mac cocoa support (cmake -DWITH_COCOA:bool=YES)
parent
1cb477b8d3
commit
0f62cfa0f2
@ -0,0 +1,62 @@
|
||||
/*
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef NL_DRIVER_OPENGL_MAC_COCOA_ADAPTER_H
|
||||
#define NL_DRIVER_OPENGL_MAC_COCOA_ADAPTER_H
|
||||
|
||||
#include "nel/misc/types_nl.h"
|
||||
#include "nel/misc/event_server.h"
|
||||
#include "nel/3d/driver.h"
|
||||
|
||||
#include "cocoa_event_emitter.h"
|
||||
|
||||
/*
|
||||
* this cocoa adapter is a helper to call functions executing obj-c code
|
||||
* from driver_opengl.cpp
|
||||
*
|
||||
* please see this as a temporary solution... there is some stuff concerning
|
||||
* driver refactoring going on anyway as far as i know
|
||||
*
|
||||
* this can as well be seen as a preparation to pull platform specific code
|
||||
* out of driver_opengl.cpp ;)
|
||||
*/
|
||||
|
||||
namespace NL3D { namespace MAC {
|
||||
|
||||
/// mac specific stuff todo while calling CDriverGL::CDriverGL()
|
||||
void ctor();
|
||||
|
||||
/// mac specific stuff todo while calling CDriverGL::~CDriverGL()
|
||||
void dtor();
|
||||
|
||||
/// mac specific stuff todo while calling CDriverGL::init()
|
||||
bool init(uint windowIcon = 0, emptyProc exitFunc = 0);
|
||||
|
||||
/// mac specific stuff todo while calling CDriverGL::setDisplay()
|
||||
bool setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool resizeable);
|
||||
|
||||
/// mac specific stuff todo while calling CDriverGL::swapBuffers()
|
||||
void swapBuffers();
|
||||
|
||||
/// mac specific stuff todo while calling CCocoaEventEmitter::submitEvents()
|
||||
void submitEvents(NLMISC::CEventServer& server,
|
||||
bool allWindows, NLMISC::CCocoaEventEmitter* eventEmitter);
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
@ -0,0 +1,388 @@
|
||||
/*
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "cocoa_adapter.h"
|
||||
|
||||
#include "nel/misc/events.h"
|
||||
#include "nel/3d/driver.h"
|
||||
|
||||
#include "cocoa_event_emitter.h"
|
||||
#include "cocoa_opengl_view.h"
|
||||
#include "cocoa_window.h"
|
||||
|
||||
// virtual key codes are only defined here. we still do not need to link carbon
|
||||
// see: http://lists.apple.com/archives/Cocoa-dev/2009/May/msg01180.html
|
||||
#include <Carbon/Carbon.h>
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
namespace NL3D { namespace MAC {
|
||||
|
||||
static NSApplication* g_app = 0;
|
||||
static NSAutoreleasePool* g_pool = 0;
|
||||
static CocoaWindow* g_window = 0;
|
||||
static CocoaOpenGLView* g_glview = 0;
|
||||
static NSOpenGLContext* g_glctx = 0;
|
||||
|
||||
void ctor()
|
||||
{
|
||||
nldebug("mac cpp bridge called");
|
||||
|
||||
// create a pool, cocoa code would leak memory otherwise
|
||||
g_pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
// init the application object
|
||||
g_app = [NSApplication sharedApplication];
|
||||
}
|
||||
|
||||
void dtor()
|
||||
{
|
||||
nldebug("mac cpp bridge called");
|
||||
|
||||
// release the pool
|
||||
[g_pool release];
|
||||
}
|
||||
|
||||
bool init(uint windowIcon, emptyProc exitFunc)
|
||||
{
|
||||
nldebug("mac cpp bridge called with %u %u", windowIcon, exitFunc);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool setDisplay(nlWindow wnd, const GfxMode& mode, bool show, bool resizeable)
|
||||
{
|
||||
nldebug("mac cpp bridge called with %u %u %u %u", wnd, &mode, show, resizeable);
|
||||
|
||||
// create a window
|
||||
g_window = [[CocoaWindow alloc] initWithContentRect:NSMakeRect(10, 10, 1024, 768)
|
||||
styleMask:NSTitledWindowMask | NSResizableWindowMask |
|
||||
NSClosableWindowMask | NSMiniaturizableWindowMask
|
||||
backing:NSBackingStoreBuffered
|
||||
defer:NO];
|
||||
|
||||
// setup opengl settings
|
||||
NSOpenGLPixelFormatAttribute att[] =
|
||||
{
|
||||
NSOpenGLPFAWindow,
|
||||
NSOpenGLPFADoubleBuffer,
|
||||
NSOpenGLPFAColorSize, 24,
|
||||
NSOpenGLPFAAlphaSize, 8,
|
||||
NSOpenGLPFADepthSize, 24,
|
||||
NSOpenGLPFANoRecovery,
|
||||
NSOpenGLPFAAccelerated,
|
||||
0
|
||||
};
|
||||
|
||||
// put the settings into a format object
|
||||
NSOpenGLPixelFormat* format =
|
||||
[[NSOpenGLPixelFormat alloc] initWithAttributes:att];
|
||||
|
||||
// create a opengl view with the created format
|
||||
g_glview = [[CocoaOpenGLView alloc]
|
||||
initWithFrame:NSMakeRect(0, 0, 1024, 768) pixelFormat: format];
|
||||
|
||||
// create a opengl context for the view
|
||||
g_glctx = [g_glview openGLContext];
|
||||
|
||||
// setup some stuff in the window
|
||||
[g_window setTitle:@"NeL Cocoa Test"];
|
||||
[g_window setContentView:g_glview];
|
||||
[g_window makeKeyAndOrderFront:nil];
|
||||
[g_window setAcceptsMouseMovedEvents:YES];
|
||||
|
||||
// make the views opengl context the currrent one
|
||||
[g_glctx makeCurrentContext];
|
||||
|
||||
// tell the application that we are running now
|
||||
[g_app finishLaunching];
|
||||
|
||||
// free the pixel format object
|
||||
[format release];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void swapBuffers()
|
||||
{
|
||||
[g_glctx flushBuffer];
|
||||
}
|
||||
|
||||
/*
|
||||
TODO: this function has to be moved to a more central place to handle key
|
||||
mapping on mac x11 as well
|
||||
*/
|
||||
NLMISC::TKey virtualKeycodeToNelKey(unsigned short keycode)
|
||||
{
|
||||
switch(keycode)
|
||||
{
|
||||
case kVK_ANSI_0: return NLMISC::Key0;
|
||||
case kVK_ANSI_1: return NLMISC::Key1;
|
||||
case kVK_ANSI_2: return NLMISC::Key2;
|
||||
case kVK_ANSI_3: return NLMISC::Key3;
|
||||
case kVK_ANSI_4: return NLMISC::Key4;
|
||||
case kVK_ANSI_5: return NLMISC::Key6;
|
||||
case kVK_ANSI_6: return NLMISC::Key5;
|
||||
case kVK_ANSI_7: return NLMISC::Key7;
|
||||
case kVK_ANSI_8: return NLMISC::Key8;
|
||||
case kVK_ANSI_9: return NLMISC::Key9;
|
||||
case kVK_ANSI_A: return NLMISC::KeyA;
|
||||
case kVK_ANSI_B: return NLMISC::KeyB;
|
||||
case kVK_ANSI_C: return NLMISC::KeyC;
|
||||
case kVK_ANSI_D: return NLMISC::KeyD;
|
||||
case kVK_ANSI_E: return NLMISC::KeyE;
|
||||
case kVK_ANSI_F: return NLMISC::KeyF;
|
||||
case kVK_ANSI_G: return NLMISC::KeyG;
|
||||
case kVK_ANSI_H: return NLMISC::KeyH;
|
||||
case kVK_ANSI_I: return NLMISC::KeyI;
|
||||
case kVK_ANSI_J: return NLMISC::KeyJ;
|
||||
case kVK_ANSI_K: return NLMISC::KeyK;
|
||||
case kVK_ANSI_L: return NLMISC::KeyL;
|
||||
case kVK_ANSI_M: return NLMISC::KeyM;
|
||||
case kVK_ANSI_N: return NLMISC::KeyN;
|
||||
case kVK_ANSI_O: return NLMISC::KeyO;
|
||||
case kVK_ANSI_P: return NLMISC::KeyP;
|
||||
case kVK_ANSI_Q: return NLMISC::KeyQ;
|
||||
case kVK_ANSI_R: return NLMISC::KeyR;
|
||||
case kVK_ANSI_S: return NLMISC::KeyS;
|
||||
case kVK_ANSI_T: return NLMISC::KeyT;
|
||||
case kVK_ANSI_U: return NLMISC::KeyU;
|
||||
case kVK_ANSI_V: return NLMISC::KeyV;
|
||||
case kVK_ANSI_W: return NLMISC::KeyW;
|
||||
case kVK_ANSI_X: return NLMISC::KeyX;
|
||||
case kVK_ANSI_Y: return NLMISC::KeyY;
|
||||
case kVK_ANSI_Z: return NLMISC::KeyZ;
|
||||
case kVK_ANSI_Equal: return NLMISC::KeyEQUALS;
|
||||
case kVK_ANSI_Minus: return NLMISC::KeySUBTRACT;
|
||||
case kVK_ANSI_RightBracket: return NLMISC::KeyRBRACKET;
|
||||
case kVK_ANSI_LeftBracket: return NLMISC::KeyLBRACKET;
|
||||
case kVK_ANSI_Quote:break;
|
||||
case kVK_ANSI_Grave:break;
|
||||
case kVK_ANSI_Slash: return NLMISC::KeySLASH;
|
||||
case kVK_ANSI_Backslash: return NLMISC::KeyBACKSLASH;
|
||||
case kVK_ANSI_Comma: return NLMISC::KeyCOMMA;
|
||||
case kVK_ANSI_Period: return NLMISC::KeyPERIOD;
|
||||
case kVK_ANSI_Semicolon: return NLMISC::KeySEMICOLON;
|
||||
case kVK_ANSI_KeypadDecimal: return NLMISC::KeyDECIMAL;
|
||||
case kVK_ANSI_KeypadMultiply: return NLMISC::KeyMULTIPLY;
|
||||
case kVK_ANSI_KeypadPlus: return NLMISC::KeyADD;
|
||||
case kVK_ANSI_KeypadClear: return NLMISC::KeyDELETE;
|
||||
case kVK_ANSI_KeypadDivide: return NLMISC::KeyDIVIDE;
|
||||
case kVK_ANSI_KeypadEnter: return NLMISC::KeyRETURN;
|
||||
case kVK_ANSI_KeypadMinus: return NLMISC::KeySUBTRACT;
|
||||
case kVK_ANSI_KeypadEquals: return NLMISC::KeySEPARATOR;
|
||||
case kVK_ANSI_Keypad0: return NLMISC::KeyNUMPAD0;
|
||||
case kVK_ANSI_Keypad1: return NLMISC::KeyNUMPAD1;
|
||||
case kVK_ANSI_Keypad2: return NLMISC::KeyNUMPAD2;
|
||||
case kVK_ANSI_Keypad3: return NLMISC::KeyNUMPAD3;
|
||||
case kVK_ANSI_Keypad4: return NLMISC::KeyNUMPAD4;
|
||||
case kVK_ANSI_Keypad5: return NLMISC::KeyNUMPAD5;
|
||||
case kVK_ANSI_Keypad6: return NLMISC::KeyNUMPAD6;
|
||||
case kVK_ANSI_Keypad7: return NLMISC::KeyNUMPAD7;
|
||||
case kVK_ANSI_Keypad8: return NLMISC::KeyNUMPAD8;
|
||||
case kVK_ANSI_Keypad9: return NLMISC::KeyNUMPAD9;
|
||||
case kVK_Return: return NLMISC::KeyRETURN;
|
||||
case kVK_Tab: return NLMISC::KeyTAB;
|
||||
case kVK_Space: return NLMISC::KeySPACE;
|
||||
case kVK_Delete: return NLMISC::KeyDELETE;
|
||||
case kVK_ForwardDelete:break;
|
||||
case kVK_Escape: return NLMISC::KeyESCAPE;
|
||||
case kVK_Command:break;
|
||||
case kVK_Shift: return NLMISC::KeySHIFT;
|
||||
case kVK_RightShift: return NLMISC::KeyRSHIFT;
|
||||
case kVK_CapsLock: return NLMISC::KeyCAPITAL;
|
||||
case kVK_Option:break;
|
||||
case kVK_RightOption:break;
|
||||
case kVK_Control: return NLMISC::KeyCONTROL;
|
||||
case kVK_RightControl: return NLMISC::KeyRCONTROL;
|
||||
case kVK_F1: return NLMISC::KeyF1;
|
||||
case kVK_F2: return NLMISC::KeyF2;
|
||||
case kVK_F3: return NLMISC::KeyF3;
|
||||
case kVK_F4: return NLMISC::KeyF4;
|
||||
case kVK_F5: return NLMISC::KeyF5;
|
||||
case kVK_F6: return NLMISC::KeyF6;
|
||||
case kVK_F7: return NLMISC::KeyF7;
|
||||
case kVK_F8: return NLMISC::KeyF8;
|
||||
case kVK_F9: return NLMISC::KeyF9;
|
||||
case kVK_F11: return NLMISC::KeyF11;
|
||||
case kVK_F13: return NLMISC::KeyF13;
|
||||
case kVK_F16: return NLMISC::KeyF16;
|
||||
case kVK_F14: return NLMISC::KeyF14;
|
||||
case kVK_F10: return NLMISC::KeyF10;
|
||||
case kVK_F12: return NLMISC::KeyF12;
|
||||
case kVK_F15: return NLMISC::KeyF15;
|
||||
case kVK_F17: return NLMISC::KeyF17;
|
||||
case kVK_F18: return NLMISC::KeyF18;
|
||||
case kVK_F19: return NLMISC::KeyF19;
|
||||
case kVK_F20: return NLMISC::KeyF20;
|
||||
case kVK_Home: return NLMISC::KeyHOME;
|
||||
case kVK_End: return NLMISC::KeyEND;
|
||||
case kVK_PageUp:break;
|
||||
case kVK_PageDown:break;
|
||||
case kVK_LeftArrow: return NLMISC::KeyLEFT;
|
||||
case kVK_RightArrow: return NLMISC::KeyRIGHT;
|
||||
case kVK_DownArrow: return NLMISC::KeyDOWN;
|
||||
case kVK_UpArrow: return NLMISC::KeyUP;
|
||||
case kVK_Function:break;
|
||||
case kVK_VolumeUp:break;
|
||||
case kVK_VolumeDown:break;
|
||||
case kVK_Mute:break;
|
||||
case kVK_Help:break;
|
||||
case kVK_ISO_Section:break;
|
||||
case kVK_JIS_Yen:break;
|
||||
case kVK_JIS_Underscore:break;
|
||||
case kVK_JIS_KeypadComma:break;
|
||||
case kVK_JIS_Eisu:break;
|
||||
case kVK_JIS_Kana:break;
|
||||
default:break;
|
||||
}
|
||||
return NLMISC::KeyNOKEY;
|
||||
}
|
||||
|
||||
/*
|
||||
TODO: this function has to be moved to a more central place to handle key
|
||||
mapping on mac x11 as well
|
||||
*/
|
||||
NLMISC::TKeyButton modifierFlagsToNelKeyButton(unsigned int modifierFlags)
|
||||
{
|
||||
unsigned int buttons = 0;
|
||||
if (modifierFlags & NSControlKeyMask) buttons |= NLMISC::ctrlKeyButton;
|
||||
if (modifierFlags & NSShiftKeyMask) buttons |= NLMISC::shiftKeyButton;
|
||||
if (modifierFlags & NSAlternateKeyMask) buttons |= NLMISC::altKeyButton;
|
||||
return (NLMISC::TKeyButton)buttons;
|
||||
}
|
||||
|
||||
void submitEvents(NLMISC::CEventServer& server,
|
||||
bool allWindows, NLMISC::CCocoaEventEmitter* eventEmitter)
|
||||
{
|
||||
// cocoa style memory cleanup
|
||||
[g_pool release];
|
||||
g_pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
// we break if there was no event to handle
|
||||
while(true)
|
||||
{
|
||||
// get the next event to handle
|
||||
NSEvent* event = [g_app nextEventMatchingMask:NSAnyEventMask
|
||||
untilDate:nil /*[NSDate distantFuture]*/
|
||||
inMode:NSDefaultRunLoopMode dequeue:YES];
|
||||
|
||||
// stop, if there was no event
|
||||
if(!event)
|
||||
break;
|
||||
|
||||
NSLog(@"%@", event);
|
||||
|
||||
// get the mouse position in nel style (relative)
|
||||
float mouseX = event.locationInWindow.x / 1024.0;
|
||||
float mouseY = event.locationInWindow.y / 768.0;
|
||||
|
||||
// string to store symbols in case of key press
|
||||
ucstring ucstr;
|
||||
|
||||
switch(event.type)
|
||||
{
|
||||
case NSLeftMouseDown:
|
||||
server.postEvent(new NLMISC::CEventMouseDown(
|
||||
mouseX, mouseY, NLMISC::leftButton /* modifiers */, eventEmitter));
|
||||
break;
|
||||
case NSLeftMouseUp:
|
||||
server.postEvent(new NLMISC::CEventMouseUp(
|
||||
mouseX, mouseY, NLMISC::leftButton /* modifiers */, eventEmitter));
|
||||
break;
|
||||
case NSRightMouseDown:
|
||||
server.postEvent(new NLMISC::CEventMouseDown(
|
||||
mouseX, mouseY, NLMISC::rightButton /* modifiers */, eventEmitter));
|
||||
break;
|
||||
case NSRightMouseUp:
|
||||
server.postEvent(new NLMISC::CEventMouseUp(
|
||||
mouseX, mouseY, NLMISC::rightButton /* modifiers */, eventEmitter));
|
||||
break;
|
||||
case NSMouseMoved:
|
||||
server.postEvent(new NLMISC::CEventMouseMove(
|
||||
mouseX, mouseY, (NLMISC::TMouseButton)0 /* modifiers */, eventEmitter));
|
||||
break;
|
||||
case NSLeftMouseDragged:
|
||||
server.postEvent(new NLMISC::CEventMouseMove(
|
||||
mouseX, mouseY, NLMISC::leftButton /* modifiers */, eventEmitter));
|
||||
break;
|
||||
case NSRightMouseDragged:break;
|
||||
server.postEvent(new NLMISC::CEventMouseMove(
|
||||
mouseX, mouseY, NLMISC::rightButton /* modifiers */, eventEmitter));
|
||||
case NSMouseEntered:break;
|
||||
case NSMouseExited:break;
|
||||
case NSKeyDown:
|
||||
/*
|
||||
TODO dead keys
|
||||
http://developer.apple.com/mac/library/documentation/Carbon/Reference/
|
||||
Unicode_Utilities_Ref/Reference/reference.html#//apple_ref/c/func/
|
||||
UCKeyTranslate
|
||||
*/
|
||||
|
||||
// push the key press event to the new event server
|
||||
server.postEvent(new NLMISC::CEventKeyDown(
|
||||
virtualKeycodeToNelKey([event keyCode]),
|
||||
modifierFlagsToNelKeyButton([event modifierFlags]),
|
||||
[event isARepeat] == NO,
|
||||
eventEmitter));
|
||||
|
||||
// get the string associated with the key press event
|
||||
ucstr.fromUtf8([[event characters] UTF8String]);
|
||||
|
||||
// if any, push it to the event server as well
|
||||
if([[event characters] length] > 0)
|
||||
server.postEvent(new NLMISC::CEventChar(
|
||||
ucstr[0],
|
||||
NLMISC::noKeyButton,
|
||||
eventEmitter));
|
||||
break;
|
||||
case NSKeyUp:
|
||||
server.postEvent(new NLMISC::CEventKeyUp(
|
||||
virtualKeycodeToNelKey([event keyCode]),
|
||||
modifierFlagsToNelKeyButton([event modifierFlags]),
|
||||
eventEmitter));
|
||||
break;
|
||||
case NSFlagsChanged:break;
|
||||
case NSAppKitDefined:break;
|
||||
case NSSystemDefined:break;
|
||||
case NSApplicationDefined:break;
|
||||
case NSPeriodic:break;
|
||||
case NSCursorUpdate:break;
|
||||
case NSScrollWheel:break;
|
||||
case NSTabletPoint:break;
|
||||
case NSTabletProximity:break;
|
||||
case NSOtherMouseDown:break;
|
||||
case NSOtherMouseUp:break;
|
||||
case NSOtherMouseDragged:break;
|
||||
case NSEventTypeGesture:break;
|
||||
case NSEventTypeMagnify:break;
|
||||
case NSEventTypeSwipe:break;
|
||||
case NSEventTypeRotate:break;
|
||||
case NSEventTypeBeginGesture:break;
|
||||
case NSEventTypeEndGesture:break;
|
||||
default:
|
||||
nlwarning("Unknown event type. dropping.");
|
||||
// NSLog(@"%@", event);
|
||||
break;
|
||||
}
|
||||
|
||||
[g_app sendEvent:event];
|
||||
[g_app updateWindows];
|
||||
}
|
||||
}
|
||||
|
||||
}}
|
@ -0,0 +1,30 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#include "cocoa_event_emitter.h"
|
||||
|
||||
#include "cocoa_adapter.h"
|
||||
|
||||
namespace NLMISC
|
||||
{
|
||||
|
||||
void CCocoaEventEmitter::submitEvents(CEventServer & server, bool allWindows)
|
||||
{
|
||||
// just forwarding to out cocoa adapter
|
||||
NL3D::MAC::submitEvents(server, allWindows, this);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
#ifndef NL_COCOA_EVENT_EMITTER_H
|
||||
#define NL_COCOA_EVENT_EMITTER_H
|
||||
|
||||
#include <nel/misc/event_emitter.h>
|
||||
|
||||
namespace NLMISC
|
||||
{
|
||||
|
||||
class CCocoaEventEmitter : public IEventEmitter
|
||||
{
|
||||
public:
|
||||
virtual void submitEvents(CEventServer & server, bool allWindows);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -0,0 +1,31 @@
|
||||
/*
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
/**
|
||||
* derived to configure the NSOpenGLView
|
||||
*/
|
||||
@interface CocoaOpenGLView : NSOpenGLView
|
||||
{
|
||||
}
|
||||
|
||||
-(BOOL)acceptsFirstResponder;
|
||||
-(BOOL)needsPanelToBecomeKey;
|
||||
|
||||
@end
|
@ -0,0 +1,33 @@
|
||||
/*
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#import "cocoa_opengl_view.h"
|
||||
|
||||
@implementation CocoaOpenGLView
|
||||
|
||||
-(BOOL)acceptsFirstResponder
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
-(BOOL)needsPanelToBecomeKey
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
@end
|
@ -0,0 +1,31 @@
|
||||
/*
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
/**
|
||||
* derived to configure the NSWindow
|
||||
*/
|
||||
@interface CocoaWindow : NSWindow
|
||||
{
|
||||
}
|
||||
-(BOOL)canBecomeKeyWindow;
|
||||
-(BOOL)canBecomeMainWindow;
|
||||
-(BOOL)needsPanelToBecomeKey;
|
||||
-(BOOL)acceptsFirstResponder;
|
||||
@end
|
@ -0,0 +1,43 @@
|
||||
/*
|
||||
// NeL - MMORPG Framework <http://dev.ryzom.com/projects/nel/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU Affero General Public License as
|
||||
// published by the Free Software Foundation, either version 3 of the
|
||||
// License, or (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU Affero General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#import "cocoa_window.h"
|
||||
|
||||
@implementation CocoaWindow
|
||||
|
||||
-(BOOL)canBecomeKeyWindow
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
-(BOOL)canBecomeMainWindow
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
-(BOOL)needsPanelToBecomeKey
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
-(BOOL)acceptsFirstResponder
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue