|
@@ -45,6 +45,9 @@
|
|
#include <X11/cursorfont.h>
|
|
#include <X11/cursorfont.h>
|
|
#include <GL/glx.h>
|
|
#include <GL/glx.h>
|
|
#endif
|
|
#endif
|
|
|
|
+#ifdef __APPLE__
|
|
|
|
+#include <execinfo.h>
|
|
|
|
+#endif
|
|
#ifdef _WIN32
|
|
#ifdef _WIN32
|
|
#include <GL/wglew.h>
|
|
#include <GL/wglew.h>
|
|
#include <GL/wgl.h>
|
|
#include <GL/wgl.h>
|
|
@@ -436,7 +439,7 @@ void la_DestroySystemWindowWin32(laWindow* w) {
|
|
};
|
|
};
|
|
#endif
|
|
#endif
|
|
|
|
|
|
-#ifdef __linux__
|
|
|
|
|
|
+#if defined(__linux__) || defined(__APPLE__)
|
|
void la_HandlerSIGSEGV(int sig) {
|
|
void la_HandlerSIGSEGV(int sig) {
|
|
void *array[30];
|
|
void *array[30];
|
|
size_t sz;
|
|
size_t sz;
|
|
@@ -527,6 +530,9 @@ int la_CreateSystemWindow(laWindow *window, int SyncToVBlank){
|
|
#endif
|
|
#endif
|
|
#ifdef _WIN32
|
|
#ifdef _WIN32
|
|
SYSWINDOW hwnd = la_CreateWindowWin32(window->X, window->Y, window->W, window->H, window->Title->Ptr, SyncToVBlank, &glc);
|
|
SYSWINDOW hwnd = la_CreateWindowWin32(window->X, window->Y, window->W, window->H, window->Title->Ptr, SyncToVBlank, &glc);
|
|
|
|
+#endif
|
|
|
|
+#ifdef __APPLE__
|
|
|
|
+ SYSWINDOW hwnd = glfwCreateWindow(window->W, window->H, window->Title->Ptr, NULL, NULL);
|
|
#endif
|
|
#endif
|
|
window->win = hwnd;
|
|
window->win = hwnd;
|
|
window->glc = glc;
|
|
window->glc = glc;
|
|
@@ -884,7 +890,7 @@ void laProcessInitArguments(int argc, char* argv[],laInitArguments* ia) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
int laGetReadyWith(laInitArguments* ia){
|
|
int laGetReadyWith(laInitArguments* ia){
|
|
-#ifdef __linux__
|
|
|
|
|
|
+#if defined(__linux__) || defined(__APPLE__)
|
|
signal(SIGSEGV,la_HandlerSIGSEGV);
|
|
signal(SIGSEGV,la_HandlerSIGSEGV);
|
|
#endif
|
|
#endif
|
|
|
|
|
|
@@ -1134,6 +1140,9 @@ int laGetReadyWith(laInitArguments* ia){
|
|
#endif
|
|
#endif
|
|
#ifdef __linux__
|
|
#ifdef __linux__
|
|
int dpi = la_GetDPI(DefaultRootWindow(MAIN.dpy));
|
|
int dpi = la_GetDPI(DefaultRootWindow(MAIN.dpy));
|
|
|
|
+#endif
|
|
|
|
+#ifdef __APPLE__
|
|
|
|
+ int dpi = 72;
|
|
#endif
|
|
#endif
|
|
if((!dpi) || dpi<144){ dpi=144; } if(dpi>300){ dpi=300; }
|
|
if((!dpi) || dpi<144){ dpi=144; } if(dpi>300){ dpi=300; }
|
|
int UiSize=(int)(tnsLinearItp(16.0f,24.0f,tnsGetRatiod(96,144,dpi))+0.5);
|
|
int UiSize=(int)(tnsLinearItp(16.0f,24.0f,tnsGetRatiod(96,144,dpi))+0.5);
|
|
@@ -1519,7 +1528,9 @@ int la_OnWindowDestroy(SYSWINDOW wnd){
|
|
void la_MakeSpecialKeyBit(SYSWINDOW hwnd,laWindow*wnd,laEvent *e,int use_last_pos){
|
|
void la_MakeSpecialKeyBit(SYSWINDOW hwnd,laWindow*wnd,laEvent *e,int use_last_pos){
|
|
laListHandle *el = &wnd->EventList;
|
|
laListHandle *el = &wnd->EventList;
|
|
laEvent* last_e=el->pLast;
|
|
laEvent* last_e=el->pLast;
|
|
|
|
+#ifndef __APPLE__ // TODO
|
|
SYSWINDOW root_ret, win_ret; int rrx=0,rry=0,rx=e->x,ry=e->y,rmask=0;
|
|
SYSWINDOW root_ret, win_ret; int rrx=0,rry=0,rx=e->x,ry=e->y,rmask=0;
|
|
|
|
+#endif
|
|
#ifdef __linux__
|
|
#ifdef __linux__
|
|
XQueryPointer(MAIN.dpy, wnd->win, &root_ret,&win_ret,&rrx,&rry,&rx,&ry,&rmask);
|
|
XQueryPointer(MAIN.dpy, wnd->win, &root_ret,&win_ret,&rrx,&rry,&rx,&ry,&rmask);
|
|
e->SpecialKeyBit = ((rmask&ShiftMask)?LA_KEY_SHIFT:0)|((rmask&ControlMask)?LA_KEY_CTRL:0)|((rmask&Mod1Mask)?LA_KEY_ALT:0);
|
|
e->SpecialKeyBit = ((rmask&ShiftMask)?LA_KEY_SHIFT:0)|((rmask&ControlMask)?LA_KEY_CTRL:0)|((rmask&Mod1Mask)?LA_KEY_ALT:0);
|