[DEBUG] correct build on MacOs and IOs
This commit is contained in:
parent
aef5975529
commit
1543d214f0
@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
#include "gale/context/IOs/Interface.hpp"
|
#include "gale/context/IOs/Interface.h"
|
||||||
|
|
||||||
#import <gale/context/IOs/OpenglView.hpp>
|
#import <gale/context/IOs/OpenglView.hpp>
|
||||||
#import <gale/context/IOs/AppDelegate.hpp>
|
#import <gale/context/IOs/AppDelegate.hpp>
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
#include <sys/times.h>
|
#include <sys/times.h>
|
||||||
#include <mach/clock.h>
|
#include <mach/clock.h>
|
||||||
#include <mach/mach.h>
|
#include <mach/mach.h>
|
||||||
#include <etk/etk.h>
|
#include <etk/etk.hpp>
|
||||||
|
|
||||||
class MacOSInterface : public gale::Context {
|
class MacOSInterface : public gale::Context {
|
||||||
private:
|
private:
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
#include <sys/times.h>
|
#include <sys/times.h>
|
||||||
#include <mach/clock.h>
|
#include <mach/clock.h>
|
||||||
#include <mach/mach.h>
|
#include <mach/mach.h>
|
||||||
#include <etk/etk.h>
|
#include <etk/etk.hpp>
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
|
@ -55,16 +55,26 @@ int mm_main(int _argc, const char* _argv[]) {
|
|||||||
// -- basic windows creation :
|
// -- basic windows creation :
|
||||||
// ---------------------------------------------------------------
|
// ---------------------------------------------------------------
|
||||||
// create a windows of size 800/600
|
// create a windows of size 800/600
|
||||||
window = [ [ [GaleMainWindows alloc] initWithContentRect:NSMakeRect(0, 0, 800, 600)
|
#ifdef __MAC_10_12
|
||||||
styleMask:(NSTitledWindowMask|NSMiniaturizableWindowMask|NSClosableWindowMask) backing:NSBackingStoreBuffered defer:NO]
|
window = [ [ [GaleMainWindows alloc] initWithContentRect:NSMakeRect(0, 0, 800, 600)
|
||||||
autorelease];
|
styleMask:(NSWindowStyleMaskTitled|NSWindowStyleMaskMiniaturizable|NSWindowStyleMaskClosable) backing:NSBackingStoreBuffered defer:NO]
|
||||||
|
autorelease];
|
||||||
|
#else
|
||||||
|
window = [ [ [GaleMainWindows alloc] initWithContentRect:NSMakeRect(0, 0, 800, 600)
|
||||||
|
styleMask:(NSTitledWindowMask|NSMiniaturizableWindowMask|NSClosableWindowMask) backing:NSBackingStoreBuffered defer:NO]
|
||||||
|
autorelease];
|
||||||
|
#endif
|
||||||
[window setAcceptsMouseMovedEvents:YES];
|
[window setAcceptsMouseMovedEvents:YES];
|
||||||
//id window = [ [MacOsAppDelegate alloc] autorelease];
|
//id window = [ [MacOsAppDelegate alloc] autorelease];
|
||||||
|
|
||||||
// set the windows at a specific position :
|
// set the windows at a specific position :
|
||||||
[window cascadeTopLeftFromPoint:NSMakePoint(50,50)];
|
[window cascadeTopLeftFromPoint:NSMakePoint(50,50)];
|
||||||
// set the windows resizable
|
// set the windows resizable
|
||||||
[window setStyleMask:[window styleMask] | NSResizableWindowMask];
|
#ifdef __MAC_10_12
|
||||||
|
[window setStyleMask:[window styleMask] | NSWindowStyleMaskResizable];
|
||||||
|
#else
|
||||||
|
[window setStyleMask:[window styleMask] | NSResizableWindowMask];
|
||||||
|
#endif
|
||||||
// oposite : [window setStyleMask:[window styleMask] & ~NSResizableWindowMask];
|
// oposite : [window setStyleMask:[window styleMask] & ~NSResizableWindowMask];
|
||||||
// set the title
|
// set the title
|
||||||
[window setTitle:appName];
|
[window setTitle:appName];
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
#import <gale/context/MacOs/OpenglView.h>
|
#import <gale/context/MacOs/OpenglView.hpp>
|
||||||
|
|
||||||
@interface GaleMainWindows : NSWindow {
|
@interface GaleMainWindows : NSWindow {
|
||||||
OpenGLView* _view;
|
OpenGLView* _view;
|
||||||
|
@ -30,7 +30,11 @@
|
|||||||
[windowsID cascadeTopLeftFromPoint:NSMakePoint(50,50)];
|
[windowsID cascadeTopLeftFromPoint:NSMakePoint(50,50)];
|
||||||
GALE_DEBUG("ALLOCATE ...");
|
GALE_DEBUG("ALLOCATE ...");
|
||||||
// set the windows resizable
|
// set the windows resizable
|
||||||
[windowsID setStyleMask:[windowsID styleMask] | NSResizableWindowMask];
|
#ifdef __MAC_10_12
|
||||||
|
[windowsID setStyleMask:[windowsID styleMask] | NSWindowStyleMaskResizable];
|
||||||
|
#else
|
||||||
|
[windowsID setStyleMask:[windowsID styleMask] | NSResizableWindowMask];
|
||||||
|
#endif
|
||||||
GALE_DEBUG("ALLOCATE ...");
|
GALE_DEBUG("ALLOCATE ...");
|
||||||
// oposite : [window setStyleMask:[window styleMask] & ~NSResizableWindowMask];
|
// oposite : [window setStyleMask:[window styleMask] & ~NSResizableWindowMask];
|
||||||
// set the title
|
// set the title
|
||||||
@ -175,8 +179,12 @@ static gale::key::Special guiKeyBoardMode;
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)flagsChanged:(NSEvent *)theEvent {
|
- (void)flagsChanged:(NSEvent *)theEvent {
|
||||||
if (([theEvent modifierFlags] & NSAlphaShiftKeyMask) != 0) {
|
#ifdef __MAC_10_12
|
||||||
GALE_VERBOSE("NSAlphaShiftKeyMask");
|
if (([theEvent modifierFlags] & NSEventModifierFlagCapsLock) != 0) {
|
||||||
|
#else
|
||||||
|
if (([theEvent modifierFlags] & NSAlphaShiftKeyMask) != 0) {
|
||||||
|
#endif
|
||||||
|
GALE_VERBOSE("NSEventModifierFlagCapsLock");
|
||||||
if (guiKeyBoardMode.getCapsLock() == false) {
|
if (guiKeyBoardMode.getCapsLock() == false) {
|
||||||
guiKeyBoardMode.setCapsLock(true);
|
guiKeyBoardMode.setCapsLock(true);
|
||||||
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard::capLock, true, false);
|
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard::capLock, true, false);
|
||||||
@ -188,8 +196,12 @@ static gale::key::Special guiKeyBoardMode;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (([theEvent modifierFlags] & NSShiftKeyMask) != 0) {
|
#ifdef __MAC_10_12
|
||||||
GALE_VERBOSE("NSShiftKeyMask");
|
if (([theEvent modifierFlags] & NSEventModifierFlagShift) != 0) {
|
||||||
|
#else
|
||||||
|
if (([theEvent modifierFlags] & NSShiftKeyMask) != 0) {
|
||||||
|
#endif
|
||||||
|
GALE_VERBOSE("NSEventModifierFlagShift");
|
||||||
if (guiKeyBoardMode.getShift() == false) {
|
if (guiKeyBoardMode.getShift() == false) {
|
||||||
guiKeyBoardMode.setShift(true);
|
guiKeyBoardMode.setShift(true);
|
||||||
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard::shiftLeft, true, false);
|
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard::shiftLeft, true, false);
|
||||||
@ -201,23 +213,31 @@ static gale::key::Special guiKeyBoardMode;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (([theEvent modifierFlags] & NSControlKeyMask) != 0) {
|
#ifdef __MAC_10_12
|
||||||
//GALE_VERBOSE("NSControlKeyMask");
|
if (([theEvent modifierFlags] & NSEventModifierFlagControl) != 0) {
|
||||||
|
#else
|
||||||
|
if (([theEvent modifierFlags] & NSControlKeyMask) != 0) {
|
||||||
|
#endif
|
||||||
|
//GALE_VERBOSE("NSEventModifierFlagControl");
|
||||||
if (guiKeyBoardMode.getCtrl() == false) {
|
if (guiKeyBoardMode.getCtrl() == false) {
|
||||||
GALE_VERBOSE("NSControlKeyMask DOWN");
|
GALE_VERBOSE("NSEventModifierFlagControl DOWN");
|
||||||
guiKeyBoardMode.setCtrl(true);
|
guiKeyBoardMode.setCtrl(true);
|
||||||
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard::ctrlLeft, true, false);
|
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard::ctrlLeft, true, false);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (guiKeyBoardMode.getCtrl() == true) {
|
if (guiKeyBoardMode.getCtrl() == true) {
|
||||||
GALE_VERBOSE("NSControlKeyMask UP");
|
GALE_VERBOSE("NSEventModifierFlagControl UP");
|
||||||
guiKeyBoardMode.setCtrl(false);
|
guiKeyBoardMode.setCtrl(false);
|
||||||
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard::ctrlLeft, false, false);
|
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard::ctrlLeft, false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (([theEvent modifierFlags] & NSAlternateKeyMask) != 0) {
|
#ifdef __MAC_10_12
|
||||||
GALE_VERBOSE("NSAlternateKeyMask");
|
if (([theEvent modifierFlags] & NSEventModifierFlagOption) != 0) {
|
||||||
|
#else
|
||||||
|
if (([theEvent modifierFlags] & NSAlternateKeyMask) != 0) {
|
||||||
|
#endif
|
||||||
|
GALE_VERBOSE("NSEventModifierFlagOption");
|
||||||
if (guiKeyBoardMode.getAlt() == false) {
|
if (guiKeyBoardMode.getAlt() == false) {
|
||||||
guiKeyBoardMode.setAlt(true);
|
guiKeyBoardMode.setAlt(true);
|
||||||
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard::alt, true, false);
|
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard::alt, true, false);
|
||||||
@ -229,8 +249,12 @@ static gale::key::Special guiKeyBoardMode;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (([theEvent modifierFlags] & NSCommandKeyMask) != 0) {
|
#ifdef __MAC_10_12
|
||||||
GALE_VERBOSE("NSCommandKeyMask");
|
if (([theEvent modifierFlags] & NSEventModifierFlagCommand) != 0) {
|
||||||
|
#else
|
||||||
|
if (([theEvent modifierFlags] & NSCommandKeyMask) != 0) {
|
||||||
|
#endif
|
||||||
|
GALE_VERBOSE("NSEventModifierFlagCommand");
|
||||||
if (guiKeyBoardMode.getMeta() == false) {
|
if (guiKeyBoardMode.getMeta() == false) {
|
||||||
guiKeyBoardMode.setMeta(true);
|
guiKeyBoardMode.setMeta(true);
|
||||||
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard::metaLeft, true, false);
|
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard::metaLeft, true, false);
|
||||||
@ -242,8 +266,12 @@ static gale::key::Special guiKeyBoardMode;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (([theEvent modifierFlags] & NSNumericPadKeyMask) != 0) {
|
#ifdef __MAC_10_12
|
||||||
GALE_VERBOSE("NSNumericPadKeyMask");
|
if (([theEvent modifierFlags] & NSEventModifierFlagNumericPad) != 0) {
|
||||||
|
#else
|
||||||
|
if (([theEvent modifierFlags] & NSNumericPadKeyMask) != 0) {
|
||||||
|
#endif
|
||||||
|
GALE_VERBOSE("NSEventModifierFlagNumericPad");
|
||||||
if (guiKeyBoardMode.getNumLock() == false) {
|
if (guiKeyBoardMode.getNumLock() == false) {
|
||||||
guiKeyBoardMode.setNumLock(true);
|
guiKeyBoardMode.setNumLock(true);
|
||||||
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard::numLock, true, false);
|
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard::numLock, true, false);
|
||||||
@ -254,11 +282,19 @@ static gale::key::Special guiKeyBoardMode;
|
|||||||
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard::numLock, false, false);
|
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard::numLock, false, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (([theEvent modifierFlags] & NSHelpKeyMask) != 0) {
|
#ifdef __MAC_10_12
|
||||||
GALE_VERBOSE("NSHelpKeyMask");
|
if (([theEvent modifierFlags] & NSEventModifierFlagHelp) != 0) {
|
||||||
|
#else
|
||||||
|
if (([theEvent modifierFlags] & NSHelpKeyMask) != 0) {
|
||||||
|
#endif
|
||||||
|
GALE_VERBOSE("NSEventModifierFlagHelp");
|
||||||
}
|
}
|
||||||
if (([theEvent modifierFlags] & NSFunctionKeyMask) != 0) {
|
#ifdef __MAC_10_12
|
||||||
GALE_VERBOSE("NSFunctionKeyMask");
|
if (([theEvent modifierFlags] & NSEventModifierFlagFunction) != 0) {
|
||||||
|
#else
|
||||||
|
if (([theEvent modifierFlags] & NSFunctionKeyMask) != 0) {
|
||||||
|
#endif
|
||||||
|
GALE_VERBOSE("NSEventModifierFlagFunction");
|
||||||
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard::contextMenu, true, false);
|
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard::contextMenu, true, false);
|
||||||
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard::contextMenu, false, false);
|
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard::contextMenu, false, false);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user