[DEBUG] correct build on MacOs and IOs

This commit is contained in:
Edouard DUPIN 2016-10-25 22:29:01 +02:00
parent aef5975529
commit 1543d214f0
6 changed files with 73 additions and 27 deletions

View File

@ -5,7 +5,7 @@
*/
#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/AppDelegate.hpp>

View File

@ -26,7 +26,7 @@
#include <sys/times.h>
#include <mach/clock.h>
#include <mach/mach.h>
#include <etk/etk.h>
#include <etk/etk.hpp>
class MacOSInterface : public gale::Context {
private:

View File

@ -27,7 +27,7 @@
#include <sys/times.h>
#include <mach/clock.h>
#include <mach/mach.h>
#include <etk/etk.h>
#include <etk/etk.hpp>
#import <Cocoa/Cocoa.h>

View File

@ -55,16 +55,26 @@ int mm_main(int _argc, const char* _argv[]) {
// -- basic windows creation :
// ---------------------------------------------------------------
// create a windows of size 800/600
window = [ [ [GaleMainWindows alloc] initWithContentRect:NSMakeRect(0, 0, 800, 600)
styleMask:(NSTitledWindowMask|NSMiniaturizableWindowMask|NSClosableWindowMask) backing:NSBackingStoreBuffered defer:NO]
autorelease];
#ifdef __MAC_10_12
window = [ [ [GaleMainWindows alloc] initWithContentRect:NSMakeRect(0, 0, 800, 600)
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];
//id window = [ [MacOsAppDelegate alloc] autorelease];
// set the windows at a specific position :
[window cascadeTopLeftFromPoint:NSMakePoint(50,50)];
// 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];
// set the title
[window setTitle:appName];

View File

@ -5,7 +5,7 @@
*/
#import <Cocoa/Cocoa.h>
#import <gale/context/MacOs/OpenglView.h>
#import <gale/context/MacOs/OpenglView.hpp>
@interface GaleMainWindows : NSWindow {
OpenGLView* _view;

View File

@ -30,7 +30,11 @@
[windowsID cascadeTopLeftFromPoint:NSMakePoint(50,50)];
GALE_DEBUG("ALLOCATE ...");
// 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 ...");
// oposite : [window setStyleMask:[window styleMask] & ~NSResizableWindowMask];
// set the title
@ -175,8 +179,12 @@ static gale::key::Special guiKeyBoardMode;
}
- (void)flagsChanged:(NSEvent *)theEvent {
if (([theEvent modifierFlags] & NSAlphaShiftKeyMask) != 0) {
GALE_VERBOSE("NSAlphaShiftKeyMask");
#ifdef __MAC_10_12
if (([theEvent modifierFlags] & NSEventModifierFlagCapsLock) != 0) {
#else
if (([theEvent modifierFlags] & NSAlphaShiftKeyMask) != 0) {
#endif
GALE_VERBOSE("NSEventModifierFlagCapsLock");
if (guiKeyBoardMode.getCapsLock() == false) {
guiKeyBoardMode.setCapsLock(true);
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard::capLock, true, false);
@ -188,8 +196,12 @@ static gale::key::Special guiKeyBoardMode;
}
}
if (([theEvent modifierFlags] & NSShiftKeyMask) != 0) {
GALE_VERBOSE("NSShiftKeyMask");
#ifdef __MAC_10_12
if (([theEvent modifierFlags] & NSEventModifierFlagShift) != 0) {
#else
if (([theEvent modifierFlags] & NSShiftKeyMask) != 0) {
#endif
GALE_VERBOSE("NSEventModifierFlagShift");
if (guiKeyBoardMode.getShift() == false) {
guiKeyBoardMode.setShift(true);
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard::shiftLeft, true, false);
@ -201,23 +213,31 @@ static gale::key::Special guiKeyBoardMode;
}
}
if (([theEvent modifierFlags] & NSControlKeyMask) != 0) {
//GALE_VERBOSE("NSControlKeyMask");
#ifdef __MAC_10_12
if (([theEvent modifierFlags] & NSEventModifierFlagControl) != 0) {
#else
if (([theEvent modifierFlags] & NSControlKeyMask) != 0) {
#endif
//GALE_VERBOSE("NSEventModifierFlagControl");
if (guiKeyBoardMode.getCtrl() == false) {
GALE_VERBOSE("NSControlKeyMask DOWN");
GALE_VERBOSE("NSEventModifierFlagControl DOWN");
guiKeyBoardMode.setCtrl(true);
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard::ctrlLeft, true, false);
}
} else {
if (guiKeyBoardMode.getCtrl() == true) {
GALE_VERBOSE("NSControlKeyMask UP");
GALE_VERBOSE("NSEventModifierFlagControl UP");
guiKeyBoardMode.setCtrl(false);
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard::ctrlLeft, false, false);
}
}
if (([theEvent modifierFlags] & NSAlternateKeyMask) != 0) {
GALE_VERBOSE("NSAlternateKeyMask");
#ifdef __MAC_10_12
if (([theEvent modifierFlags] & NSEventModifierFlagOption) != 0) {
#else
if (([theEvent modifierFlags] & NSAlternateKeyMask) != 0) {
#endif
GALE_VERBOSE("NSEventModifierFlagOption");
if (guiKeyBoardMode.getAlt() == false) {
guiKeyBoardMode.setAlt(true);
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard::alt, true, false);
@ -229,8 +249,12 @@ static gale::key::Special guiKeyBoardMode;
}
}
if (([theEvent modifierFlags] & NSCommandKeyMask) != 0) {
GALE_VERBOSE("NSCommandKeyMask");
#ifdef __MAC_10_12
if (([theEvent modifierFlags] & NSEventModifierFlagCommand) != 0) {
#else
if (([theEvent modifierFlags] & NSCommandKeyMask) != 0) {
#endif
GALE_VERBOSE("NSEventModifierFlagCommand");
if (guiKeyBoardMode.getMeta() == false) {
guiKeyBoardMode.setMeta(true);
MacOs::setKeyboardMove(guiKeyBoardMode, gale::key::keyboard::metaLeft, true, false);
@ -242,8 +266,12 @@ static gale::key::Special guiKeyBoardMode;
}
}
if (([theEvent modifierFlags] & NSNumericPadKeyMask) != 0) {
GALE_VERBOSE("NSNumericPadKeyMask");
#ifdef __MAC_10_12
if (([theEvent modifierFlags] & NSEventModifierFlagNumericPad) != 0) {
#else
if (([theEvent modifierFlags] & NSNumericPadKeyMask) != 0) {
#endif
GALE_VERBOSE("NSEventModifierFlagNumericPad");
if (guiKeyBoardMode.getNumLock() == false) {
guiKeyBoardMode.setNumLock(true);
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);
}
}
if (([theEvent modifierFlags] & NSHelpKeyMask) != 0) {
GALE_VERBOSE("NSHelpKeyMask");
#ifdef __MAC_10_12
if (([theEvent modifierFlags] & NSEventModifierFlagHelp) != 0) {
#else
if (([theEvent modifierFlags] & NSHelpKeyMask) != 0) {
#endif
GALE_VERBOSE("NSEventModifierFlagHelp");
}
if (([theEvent modifierFlags] & NSFunctionKeyMask) != 0) {
GALE_VERBOSE("NSFunctionKeyMask");
#ifdef __MAC_10_12
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, false, false);
}