Merge pull request #8841 from BastiaanOlij/osx_cleanup_old_classes
Removing unused files and old GLFW comments on OSX
This commit is contained in:
commit
161bc31c53
|
@ -7,7 +7,6 @@ files = [
|
||||||
'godot_main_osx.mm',
|
'godot_main_osx.mm',
|
||||||
'audio_driver_osx.cpp',
|
'audio_driver_osx.cpp',
|
||||||
'sem_osx.cpp',
|
'sem_osx.cpp',
|
||||||
# 'context_gl_osx.cpp',
|
|
||||||
'dir_access_osx.mm',
|
'dir_access_osx.mm',
|
||||||
'joypad_osx.cpp',
|
'joypad_osx.cpp',
|
||||||
'power_osx.cpp',
|
'power_osx.cpp',
|
||||||
|
|
|
@ -1,103 +0,0 @@
|
||||||
/*************************************************************************/
|
|
||||||
/* context_gl_osx.cpp */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* This file is part of: */
|
|
||||||
/* GODOT ENGINE */
|
|
||||||
/* http://www.godotengine.org */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
|
||||||
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
|
||||||
/* */
|
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
||||||
/* a copy of this software and associated documentation files (the */
|
|
||||||
/* "Software"), to deal in the Software without restriction, including */
|
|
||||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
||||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
||||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
||||||
/* the following conditions: */
|
|
||||||
/* */
|
|
||||||
/* The above copyright notice and this permission notice shall be */
|
|
||||||
/* included in all copies or substantial portions of the Software. */
|
|
||||||
/* */
|
|
||||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
||||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
||||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
||||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
||||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
||||||
/*************************************************************************/
|
|
||||||
#include "context_gl_osx.h"
|
|
||||||
|
|
||||||
#ifdef OSX_ENABLED
|
|
||||||
#if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED)
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091
|
|
||||||
#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092
|
|
||||||
|
|
||||||
void ContextGL_OSX::release_current() {
|
|
||||||
|
|
||||||
aglSetCurrentContext(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ContextGL_OSX::make_current() {
|
|
||||||
|
|
||||||
aglSetCurrentContext(NULL);
|
|
||||||
}
|
|
||||||
void ContextGL_OSX::swap_buffers() {
|
|
||||||
|
|
||||||
aglSwapBuffers(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
Error ContextGL_OSX::initialize() {
|
|
||||||
|
|
||||||
if ((Ptr)kUnresolvedCFragSymbolAddress == (Ptr)aglChoosePixelFormat)
|
|
||||||
return FAILED;
|
|
||||||
|
|
||||||
GLint attributes[] = { AGL_RGBA,
|
|
||||||
AGL_DOUBLEBUFFER,
|
|
||||||
AGL_DEPTH_SIZE, 32,
|
|
||||||
AGL_NO_RECOVERY,
|
|
||||||
AGL_NONE,
|
|
||||||
AGL_NONE };
|
|
||||||
|
|
||||||
AGLPixelFormat format = NULL;
|
|
||||||
|
|
||||||
format = aglChoosePixelFormat(NULL, 0, attributes);
|
|
||||||
|
|
||||||
if (!format)
|
|
||||||
return FAILED;
|
|
||||||
|
|
||||||
context = aglCreateContext(format, 0);
|
|
||||||
|
|
||||||
if (!context)
|
|
||||||
return FAILED;
|
|
||||||
|
|
||||||
aglDestroyPixelFormat(format);
|
|
||||||
|
|
||||||
aglSetWindowRef(context, window);
|
|
||||||
|
|
||||||
GLint swapInterval = 1;
|
|
||||||
aglSetInteger(context, AGL_SWAP_INTERVAL, &swapInterval);
|
|
||||||
|
|
||||||
aglSetCurrentContext(context);
|
|
||||||
|
|
||||||
return OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
ContextGL_OSX::ContextGL_OSX(WindowRef p_window) {
|
|
||||||
|
|
||||||
window = p_window;
|
|
||||||
}
|
|
||||||
|
|
||||||
ContextGL_OSX::~ContextGL_OSX() {
|
|
||||||
|
|
||||||
if (context)
|
|
||||||
aglDestroyContext(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
#endif
|
|
|
@ -1,64 +0,0 @@
|
||||||
/*************************************************************************/
|
|
||||||
/* context_gl_osx.h */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* This file is part of: */
|
|
||||||
/* GODOT ENGINE */
|
|
||||||
/* http://www.godotengine.org */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
|
||||||
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
|
||||||
/* */
|
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
||||||
/* a copy of this software and associated documentation files (the */
|
|
||||||
/* "Software"), to deal in the Software without restriction, including */
|
|
||||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
||||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
||||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
||||||
/* the following conditions: */
|
|
||||||
/* */
|
|
||||||
/* The above copyright notice and this permission notice shall be */
|
|
||||||
/* included in all copies or substantial portions of the Software. */
|
|
||||||
/* */
|
|
||||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
||||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
||||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
||||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
||||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
||||||
/*************************************************************************/
|
|
||||||
#ifndef CONTEXT_GL_OSX_H
|
|
||||||
#define CONTEXT_GL_OSX_H
|
|
||||||
|
|
||||||
/**
|
|
||||||
@author Juan Linietsky <reduzio@gmail.com>
|
|
||||||
*/
|
|
||||||
#ifdef OSX_ENABLED
|
|
||||||
|
|
||||||
#if defined(OPENGL_ENABLED) || defined(LEGACYGL_ENABLED)
|
|
||||||
|
|
||||||
#include "drivers/gl_context/context_gl.h"
|
|
||||||
#include "os/os.h"
|
|
||||||
#include <AGL/agl.h>
|
|
||||||
#include <Carbon/Carbon.h>
|
|
||||||
|
|
||||||
class ContextGL_OSX : public ContextGL {
|
|
||||||
|
|
||||||
AGLContext context;
|
|
||||||
WindowRef window;
|
|
||||||
|
|
||||||
public:
|
|
||||||
virtual void release_current();
|
|
||||||
virtual void make_current();
|
|
||||||
virtual void swap_buffers();
|
|
||||||
|
|
||||||
virtual Error initialize();
|
|
||||||
|
|
||||||
ContextGL_OSX(WindowRef window);
|
|
||||||
~ContextGL_OSX();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
#endif
|
|
|
@ -1,38 +0,0 @@
|
||||||
/*************************************************************************/
|
|
||||||
/* godot_osx.h */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* This file is part of: */
|
|
||||||
/* GODOT ENGINE */
|
|
||||||
/* http://www.godotengine.org */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
|
||||||
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
|
||||||
/* */
|
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
||||||
/* a copy of this software and associated documentation files (the */
|
|
||||||
/* "Software"), to deal in the Software without restriction, including */
|
|
||||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
||||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
||||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
||||||
/* the following conditions: */
|
|
||||||
/* */
|
|
||||||
/* The above copyright notice and this permission notice shall be */
|
|
||||||
/* included in all copies or substantial portions of the Software. */
|
|
||||||
/* */
|
|
||||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
||||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
||||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
||||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
||||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
||||||
/*************************************************************************/
|
|
||||||
#ifndef GODOT_OSX_H
|
|
||||||
#define GODOT_OSX_H
|
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
|
||||||
|
|
||||||
@interface GodotMain : NSObject
|
|
||||||
@end
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,208 +0,0 @@
|
||||||
/*************************************************************************/
|
|
||||||
/* godot_osx.mm */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* This file is part of: */
|
|
||||||
/* GODOT ENGINE */
|
|
||||||
/* http://www.godotengine.org */
|
|
||||||
/*************************************************************************/
|
|
||||||
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
|
||||||
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
|
||||||
/* */
|
|
||||||
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
||||||
/* a copy of this software and associated documentation files (the */
|
|
||||||
/* "Software"), to deal in the Software without restriction, including */
|
|
||||||
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
||||||
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
||||||
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
||||||
/* the following conditions: */
|
|
||||||
/* */
|
|
||||||
/* The above copyright notice and this permission notice shall be */
|
|
||||||
/* included in all copies or substantial portions of the Software. */
|
|
||||||
/* */
|
|
||||||
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
||||||
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
||||||
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
||||||
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
||||||
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
||||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
||||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
||||||
/*************************************************************************/
|
|
||||||
#include "godot_osx.h"
|
|
||||||
|
|
||||||
#include <sys/param.h> /* for MAXPATHLEN */
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
/* For some reaon, Apple removed setAppleMenu from the headers in 10.4,
|
|
||||||
but the method still is there and works. To avoid warnings, we declare
|
|
||||||
it ourselves here. */
|
|
||||||
@interface NSApplication ()
|
|
||||||
- (void)setAppleMenu:(NSMenu *)menu;
|
|
||||||
@end
|
|
||||||
|
|
||||||
static int global_argc;
|
|
||||||
static char **global_argv;
|
|
||||||
static BOOL gCalledAppMainline = FALSE;
|
|
||||||
|
|
||||||
static NSString *getApplicationName(void) {
|
|
||||||
const NSDictionary *dict;
|
|
||||||
NSString *appName = 0;
|
|
||||||
|
|
||||||
/* Determine the application name */
|
|
||||||
dict = (const NSDictionary *)CFBundleGetInfoDictionary(CFBundleGetMainBundle());
|
|
||||||
if (dict)
|
|
||||||
appName = [dict objectForKey:@"CFBundleName"];
|
|
||||||
|
|
||||||
if (![appName length])
|
|
||||||
appName = [[NSProcessInfo processInfo] processName];
|
|
||||||
|
|
||||||
return appName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The main class of the application, the application's delegate */
|
|
||||||
@implementation GodotMain
|
|
||||||
|
|
||||||
static void setApplicationMenu(void) {
|
|
||||||
/* warning: this code is very odd */
|
|
||||||
NSMenu *appleMenu;
|
|
||||||
NSMenuItem *menuItem;
|
|
||||||
NSString *title;
|
|
||||||
NSString *appName;
|
|
||||||
|
|
||||||
appName = getApplicationName();
|
|
||||||
appleMenu = [[NSMenu alloc] initWithTitle:@""];
|
|
||||||
|
|
||||||
/* Add menu items */
|
|
||||||
title = [@"About " stringByAppendingString:appName];
|
|
||||||
[appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""];
|
|
||||||
|
|
||||||
[appleMenu addItem:[NSMenuItem separatorItem]];
|
|
||||||
|
|
||||||
title = [@"Hide " stringByAppendingString:appName];
|
|
||||||
[appleMenu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"];
|
|
||||||
|
|
||||||
menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@"h"];
|
|
||||||
[menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask | NSCommandKeyMask)];
|
|
||||||
|
|
||||||
[appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""];
|
|
||||||
|
|
||||||
[appleMenu addItem:[NSMenuItem separatorItem]];
|
|
||||||
|
|
||||||
title = [@"Quit " stringByAppendingString:appName];
|
|
||||||
[appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"];
|
|
||||||
|
|
||||||
/* Put menu into the menubar */
|
|
||||||
menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""];
|
|
||||||
[menuItem setSubmenu:appleMenu];
|
|
||||||
[[NSApp mainMenu] addItem:menuItem];
|
|
||||||
|
|
||||||
/* Tell the application object that this is now the application menu */
|
|
||||||
[NSApp setAppleMenu:appleMenu];
|
|
||||||
|
|
||||||
/* Finally give up our references to the objects */
|
|
||||||
[appleMenu release];
|
|
||||||
[menuItem release];
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Create a window menu */
|
|
||||||
static void setupWindowMenu(void) {
|
|
||||||
NSMenu *windowMenu;
|
|
||||||
NSMenuItem *windowMenuItem;
|
|
||||||
NSMenuItem *menuItem;
|
|
||||||
|
|
||||||
windowMenu = [[NSMenu alloc] initWithTitle:@"Window"];
|
|
||||||
|
|
||||||
/* "Minimize" item */
|
|
||||||
menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"];
|
|
||||||
[windowMenu addItem:menuItem];
|
|
||||||
[menuItem release];
|
|
||||||
|
|
||||||
/* Put menu into the menubar */
|
|
||||||
windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""];
|
|
||||||
[windowMenuItem setSubmenu:windowMenu];
|
|
||||||
[[NSApp mainMenu] addItem:windowMenuItem];
|
|
||||||
|
|
||||||
/* Tell the application object that this is now the window menu */
|
|
||||||
[NSApp setWindowsMenu:windowMenu];
|
|
||||||
|
|
||||||
/* Finally give up our references to the objects */
|
|
||||||
[windowMenu release];
|
|
||||||
[windowMenuItem release];
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Replacement for NSApplicationMain */
|
|
||||||
static void CustomApplicationMain(int argc, char **argv) {
|
|
||||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
|
||||||
GodotMain *main;
|
|
||||||
|
|
||||||
/* Ensure the application object is initialised */
|
|
||||||
[NSApplication sharedApplication];
|
|
||||||
|
|
||||||
/* Set up the menubar */
|
|
||||||
[NSApp setMainMenu:[[NSMenu alloc] init]];
|
|
||||||
setApplicationMenu();
|
|
||||||
setupWindowMenu();
|
|
||||||
|
|
||||||
main = [[main alloc] init];
|
|
||||||
[NSApp setDelegate:main];
|
|
||||||
|
|
||||||
/* Start the main event loop */
|
|
||||||
[NSApp run];
|
|
||||||
|
|
||||||
[main release];
|
|
||||||
[pool release];
|
|
||||||
}
|
|
||||||
|
|
||||||
extern int godot_main(int argc, char **argv);
|
|
||||||
|
|
||||||
/* Called when the internal event loop has just started running */
|
|
||||||
- (void)applicationDidFinishLaunching:(NSNotification *)note {
|
|
||||||
int status;
|
|
||||||
|
|
||||||
/* Hand off to main application code */
|
|
||||||
gCalledAppMainline = TRUE;
|
|
||||||
|
|
||||||
int ret = godot_main(global_argc, global_argv);
|
|
||||||
|
|
||||||
exit(ret);
|
|
||||||
}
|
|
||||||
@end
|
|
||||||
|
|
||||||
#ifdef main
|
|
||||||
#undef main
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
|
||||||
/* Copy the arguments into a global variable */
|
|
||||||
/* This is passed if we are launched by double-clicking */
|
|
||||||
if (argc >= 2 && strncmp(argv[1], "-psn", 4) == 0) {
|
|
||||||
global_argv = (char **)malloc(sizeof(char *) * 2);
|
|
||||||
global_argv[0] = argv[0];
|
|
||||||
global_argv[1] = NULL;
|
|
||||||
global_argc = 1;
|
|
||||||
|
|
||||||
// chdir to binary's dir when launched from finder
|
|
||||||
int len = strlen(global_argv[0]);
|
|
||||||
|
|
||||||
while (len--) {
|
|
||||||
if (global_argv[0][len] == '/') break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (len >= 0) {
|
|
||||||
char *path = (char *)malloc(len + 1);
|
|
||||||
memcpy(path, global_argv[0], len);
|
|
||||||
path[len] = 0;
|
|
||||||
printf("Path: %s\n", path);
|
|
||||||
chdir(path);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
int i;
|
|
||||||
global_argc = argc;
|
|
||||||
global_argv = (char **)malloc(sizeof(char *) * (argc + 1));
|
|
||||||
for (i = 0; i <= argc; i++)
|
|
||||||
global_argv[i] = argv[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
CustomApplicationMain(argc, argv);
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -53,35 +53,6 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
//uses portions of glfw
|
|
||||||
|
|
||||||
//========================================================================
|
|
||||||
// GLFW 3.0 - www.glfw.org
|
|
||||||
//------------------------------------------------------------------------
|
|
||||||
// Copyright (c) 2002-2006 Marcus Geelnard
|
|
||||||
// Copyright (c) 2006-2010 Camilla Berglund <elmindreda@elmindreda.org>
|
|
||||||
//
|
|
||||||
// This software is provided 'as-is', without any express or implied
|
|
||||||
// warranty. In no event will the authors be held liable for any damages
|
|
||||||
// arising from the use of this software.
|
|
||||||
//
|
|
||||||
// Permission is granted to anyone to use this software for any purpose,
|
|
||||||
// including commercial applications, and to alter it and redistribute it
|
|
||||||
// freely, subject to the following restrictions:
|
|
||||||
//
|
|
||||||
// 1. The origin of this software must not be misrepresented; you must not
|
|
||||||
// claim that you wrote the original software. If you use this software
|
|
||||||
// in a product, an acknowledgment in the product documentation would
|
|
||||||
// be appreciated but is not required.
|
|
||||||
//
|
|
||||||
// 2. Altered source versions must be plainly marked as such, and must not
|
|
||||||
// be misrepresented as being the original software.
|
|
||||||
//
|
|
||||||
// 3. This notice may not be removed or altered from any source
|
|
||||||
// distribution.
|
|
||||||
//
|
|
||||||
//========================================================================
|
|
||||||
|
|
||||||
static NSRect convertRectToBacking(NSRect contentRect) {
|
static NSRect convertRectToBacking(NSRect contentRect) {
|
||||||
|
|
||||||
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
|
#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
|
||||||
|
@ -249,14 +220,7 @@ static int button_mask = 0;
|
||||||
|
|
||||||
+ (void)initialize {
|
+ (void)initialize {
|
||||||
if (self == [GodotContentView class]) {
|
if (self == [GodotContentView class]) {
|
||||||
/*
|
// nothing left to do here at the moment..
|
||||||
if (_glfw.ns.cursor == nil) {
|
|
||||||
NSImage* data = [[NSImage alloc] initWithSize:NSMakeSize(1, 1)];
|
|
||||||
_glfw.ns.cursor = [[NSCursor alloc] initWithImage:data
|
|
||||||
hotSpot:NSZeroPoint];
|
|
||||||
[data release];
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -336,13 +300,6 @@ static int button_mask = 0;
|
||||||
ev.mouse_button.doubleclick = [event clickCount] == 2;
|
ev.mouse_button.doubleclick = [event clickCount] == 2;
|
||||||
ev.mouse_button.mod = translateFlags([event modifierFlags]);
|
ev.mouse_button.mod = translateFlags([event modifierFlags]);
|
||||||
OS_OSX::singleton->push_input(ev);
|
OS_OSX::singleton->push_input(ev);
|
||||||
|
|
||||||
/*
|
|
||||||
_glfwInputMouseClick(window,
|
|
||||||
GLFW_MOUSE_BUTTON_LEFT,
|
|
||||||
GLFW_PRESS,
|
|
||||||
translateFlags([event modifierFlags]));
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)mouseDragged:(NSEvent *)event {
|
- (void)mouseDragged:(NSEvent *)event {
|
||||||
|
@ -363,13 +320,6 @@ static int button_mask = 0;
|
||||||
ev.mouse_button.button_mask = button_mask;
|
ev.mouse_button.button_mask = button_mask;
|
||||||
ev.mouse_button.mod = translateFlags([event modifierFlags]);
|
ev.mouse_button.mod = translateFlags([event modifierFlags]);
|
||||||
OS_OSX::singleton->push_input(ev);
|
OS_OSX::singleton->push_input(ev);
|
||||||
|
|
||||||
/*
|
|
||||||
_glfwInputMouseClick(window,
|
|
||||||
GLFW_MOUSE_BUTTON_LEFT,
|
|
||||||
GLFW_RELEASE,
|
|
||||||
translateFlags([event modifierFlags]));
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)mouseMoved:(NSEvent *)event {
|
- (void)mouseMoved:(NSEvent *)event {
|
||||||
|
@ -393,17 +343,6 @@ static int button_mask = 0;
|
||||||
|
|
||||||
OS_OSX::singleton->input->set_mouse_position(Point2(mouse_x, mouse_y));
|
OS_OSX::singleton->input->set_mouse_position(Point2(mouse_x, mouse_y));
|
||||||
OS_OSX::singleton->push_input(ev);
|
OS_OSX::singleton->push_input(ev);
|
||||||
|
|
||||||
/*
|
|
||||||
if (window->cursorMode == GLFW_CURSOR_DISABLED)
|
|
||||||
_glfwInputCursorMotion(window, [event deltaX], [event deltaY]);
|
|
||||||
else {
|
|
||||||
const NSRect contentRect = [window->ns.view frame];
|
|
||||||
const NSPoint p = [event locationInWindow];
|
|
||||||
|
|
||||||
_glfwInputCursorMotion(window, p.x, contentRect.size.height - p.y);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)rightMouseDown:(NSEvent *)event {
|
- (void)rightMouseDown:(NSEvent *)event {
|
||||||
|
@ -420,13 +359,6 @@ static int button_mask = 0;
|
||||||
ev.mouse_button.button_mask = button_mask;
|
ev.mouse_button.button_mask = button_mask;
|
||||||
ev.mouse_button.mod = translateFlags([event modifierFlags]);
|
ev.mouse_button.mod = translateFlags([event modifierFlags]);
|
||||||
OS_OSX::singleton->push_input(ev);
|
OS_OSX::singleton->push_input(ev);
|
||||||
|
|
||||||
/*
|
|
||||||
_glfwInputMouseClick(window,
|
|
||||||
GLFW_MOUSE_BUTTON_RIGHT,
|
|
||||||
GLFW_PRESS,
|
|
||||||
translateFlags([event modifierFlags]));
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)rightMouseDragged:(NSEvent *)event {
|
- (void)rightMouseDragged:(NSEvent *)event {
|
||||||
|
@ -447,13 +379,6 @@ static int button_mask = 0;
|
||||||
ev.mouse_button.button_mask = button_mask;
|
ev.mouse_button.button_mask = button_mask;
|
||||||
ev.mouse_button.mod = translateFlags([event modifierFlags]);
|
ev.mouse_button.mod = translateFlags([event modifierFlags]);
|
||||||
OS_OSX::singleton->push_input(ev);
|
OS_OSX::singleton->push_input(ev);
|
||||||
|
|
||||||
/*
|
|
||||||
_glfwInputMouseClick(window,
|
|
||||||
GLFW_MOUSE_BUTTON_RIGHT,
|
|
||||||
GLFW_RELEASE,
|
|
||||||
translateFlags([event modifierFlags]));
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)otherMouseDown:(NSEvent *)event {
|
- (void)otherMouseDown:(NSEvent *)event {
|
||||||
|
@ -473,13 +398,6 @@ static int button_mask = 0;
|
||||||
ev.mouse_button.button_mask = button_mask;
|
ev.mouse_button.button_mask = button_mask;
|
||||||
ev.mouse_button.mod = translateFlags([event modifierFlags]);
|
ev.mouse_button.mod = translateFlags([event modifierFlags]);
|
||||||
OS_OSX::singleton->push_input(ev);
|
OS_OSX::singleton->push_input(ev);
|
||||||
|
|
||||||
/*
|
|
||||||
_glfwInputMouseClick(window,
|
|
||||||
(int) [event buttonNumber],
|
|
||||||
GLFW_PRESS,
|
|
||||||
translateFlags([event modifierFlags]));
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)otherMouseDragged:(NSEvent *)event {
|
- (void)otherMouseDragged:(NSEvent *)event {
|
||||||
|
@ -503,13 +421,6 @@ static int button_mask = 0;
|
||||||
ev.mouse_button.button_mask = button_mask;
|
ev.mouse_button.button_mask = button_mask;
|
||||||
ev.mouse_button.mod = translateFlags([event modifierFlags]);
|
ev.mouse_button.mod = translateFlags([event modifierFlags]);
|
||||||
OS_OSX::singleton->push_input(ev);
|
OS_OSX::singleton->push_input(ev);
|
||||||
|
|
||||||
/*
|
|
||||||
_glfwInputMouseClick(window,
|
|
||||||
(int) [event buttonNumber],
|
|
||||||
GLFW_RELEASE,
|
|
||||||
translateFlags([event modifierFlags]));
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)mouseExited:(NSEvent *)event {
|
- (void)mouseExited:(NSEvent *)event {
|
||||||
|
@ -520,11 +431,9 @@ static int button_mask = 0;
|
||||||
OS_OSX::singleton->main_loop->notification(MainLoop::NOTIFICATION_WM_MOUSE_EXIT);
|
OS_OSX::singleton->main_loop->notification(MainLoop::NOTIFICATION_WM_MOUSE_EXIT);
|
||||||
if (OS_OSX::singleton->input)
|
if (OS_OSX::singleton->input)
|
||||||
OS_OSX::singleton->input->set_mouse_in_window(false);
|
OS_OSX::singleton->input->set_mouse_in_window(false);
|
||||||
//_glfwInputCursorEnter(window, GL_FALSE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)mouseEntered:(NSEvent *)event {
|
- (void)mouseEntered:(NSEvent *)event {
|
||||||
//_glfwInputCursorEnter(window, GL_TRUE);
|
|
||||||
if (!OS_OSX::singleton)
|
if (!OS_OSX::singleton)
|
||||||
return;
|
return;
|
||||||
if (OS_OSX::singleton->main_loop && OS_OSX::singleton->mouse_mode != OS::MOUSE_MODE_CAPTURED)
|
if (OS_OSX::singleton->main_loop && OS_OSX::singleton->mouse_mode != OS::MOUSE_MODE_CAPTURED)
|
||||||
|
@ -534,12 +443,7 @@ static int button_mask = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)viewDidChangeBackingProperties {
|
- (void)viewDidChangeBackingProperties {
|
||||||
/*
|
// nothing left to do here
|
||||||
const NSRect contentRect = [window->ns.view frame];
|
|
||||||
const NSRect fbRect = convertRectToBacking(window, contentRect);
|
|
||||||
|
|
||||||
_glfwInputFramebufferSize(window, fbRect.size.width, fbRect.size.height);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)updateTrackingAreas {
|
- (void)updateTrackingAreas {
|
||||||
|
@ -780,12 +684,6 @@ static int translateKey(unsigned int key) {
|
||||||
ev.key.mod = translateFlags([event modifierFlags]);
|
ev.key.mod = translateFlags([event modifierFlags]);
|
||||||
ev.key.scancode = latin_keyboard_keycode_convert(translateKey([event keyCode]));
|
ev.key.scancode = latin_keyboard_keycode_convert(translateKey([event keyCode]));
|
||||||
OS_OSX::singleton->push_input(ev);
|
OS_OSX::singleton->push_input(ev);
|
||||||
|
|
||||||
/*
|
|
||||||
const int key = translateKey([event keyCode]);
|
|
||||||
const int mods = translateFlags([event modifierFlags]);
|
|
||||||
_glfwInputKey(window, key, [event keyCode], GLFW_RELEASE, mods);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void sendScrollEvent(int button, double factor) {
|
inline void sendScrollEvent(int button, double factor) {
|
||||||
|
|
Loading…
Reference in a new issue