mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-18 20:15:35 -04:00
Fix not being able to click on some dialog boxes on OSX
This commit is contained in:
parent
d3022d86ab
commit
021bb42853
@ -14,7 +14,6 @@
|
|||||||
#include "freetype/ftglyph.h"
|
#include "freetype/ftglyph.h"
|
||||||
|
|
||||||
static void Platform_InitDisplay(void);
|
static void Platform_InitDisplay(void);
|
||||||
static void Platform_InitStopwatch(void);
|
|
||||||
struct DisplayDevice DisplayDevice_Default;
|
struct DisplayDevice DisplayDevice_Default;
|
||||||
void* DisplayDevice_Meta;
|
void* DisplayDevice_Meta;
|
||||||
|
|
||||||
@ -1786,27 +1785,6 @@ int Platform_ConvertString(void* data, const String* src) {
|
|||||||
return src->length * 2;
|
return src->length * 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Platform_Init(void) {
|
|
||||||
WSADATA wsaData;
|
|
||||||
ReturnCode res;
|
|
||||||
|
|
||||||
Platform_InitDisplay();
|
|
||||||
Platform_InitStopwatch();
|
|
||||||
heap = GetProcessHeap();
|
|
||||||
|
|
||||||
res = WSAStartup(MAKEWORD(2, 2), &wsaData);
|
|
||||||
if (res) Logger_Abort2(res, "WSAStartup failed");
|
|
||||||
|
|
||||||
hasDebugger = IsDebuggerPresent();
|
|
||||||
if (!AttachConsole(ATTACH_PARENT_PROCESS)) return;
|
|
||||||
conHandle = GetStdHandle(STD_OUTPUT_HANDLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Platform_Free(void) {
|
|
||||||
WSACleanup();
|
|
||||||
HeapDestroy(heap);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Platform_InitDisplay(void) {
|
static void Platform_InitDisplay(void) {
|
||||||
HDC hdc = GetDC(NULL);
|
HDC hdc = GetDC(NULL);
|
||||||
|
|
||||||
@ -1829,6 +1807,27 @@ static void Platform_InitStopwatch(void) {
|
|||||||
} else { sw_freqDiv = 10; }
|
} else { sw_freqDiv = 10; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Platform_Init(void) {
|
||||||
|
WSADATA wsaData;
|
||||||
|
ReturnCode res;
|
||||||
|
|
||||||
|
Platform_InitDisplay();
|
||||||
|
Platform_InitStopwatch();
|
||||||
|
heap = GetProcessHeap();
|
||||||
|
|
||||||
|
res = WSAStartup(MAKEWORD(2, 2), &wsaData);
|
||||||
|
if (res) Logger_Warn(res, "starting WSA");
|
||||||
|
|
||||||
|
hasDebugger = IsDebuggerPresent();
|
||||||
|
if (!AttachConsole(ATTACH_PARENT_PROCESS)) return;
|
||||||
|
conHandle = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Platform_Free(void) {
|
||||||
|
WSACleanup();
|
||||||
|
HeapDestroy(heap);
|
||||||
|
}
|
||||||
|
|
||||||
ReturnCode Platform_SetCurrentDirectory(const String* path) {
|
ReturnCode Platform_SetCurrentDirectory(const String* path) {
|
||||||
TCHAR str[300];
|
TCHAR str[300];
|
||||||
Platform_ConvertString(str, path);
|
Platform_ConvertString(str, path);
|
||||||
@ -1985,11 +1984,10 @@ int Platform_ConvertString(void* data, const String* src) {
|
|||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Platform_Init(void) {
|
static void Platform_InitCommon(void) {
|
||||||
signal(SIGCHLD, SIG_IGN);
|
signal(SIGCHLD, SIG_IGN);
|
||||||
Platform_InitDisplay();
|
Platform_InitDisplay();
|
||||||
Platform_InitStopwatch();
|
pthread_mutex_init(&audio_lock, NULL);
|
||||||
pthread_mutex_init(&audio_lock, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Platform_Free(void) {
|
void Platform_Free(void) {
|
||||||
@ -2094,7 +2092,12 @@ ReturnCode Platform_StartOpen(const String* args) {
|
|||||||
const static String path = String_FromConst("xdg-open");
|
const static String path = String_FromConst("xdg-open");
|
||||||
return Platform_StartProcess(&path, args);
|
return Platform_StartProcess(&path, args);
|
||||||
}
|
}
|
||||||
static void Platform_InitStopwatch(void) { sw_freqDiv = 1000; }
|
|
||||||
|
void Platform_Init(void) {
|
||||||
|
Platform_InitCommon();
|
||||||
|
/* stopwatch always in nanoseconds */
|
||||||
|
sw_freqDiv = 1000;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef CC_BUILD_LINUX
|
#ifdef CC_BUILD_LINUX
|
||||||
ReturnCode Platform_GetExePath(String* path) {
|
ReturnCode Platform_GetExePath(String* path) {
|
||||||
@ -2166,4 +2169,15 @@ static void Platform_InitStopwatch(void) {
|
|||||||
sw_freqMul = tb.numer;
|
sw_freqMul = tb.numer;
|
||||||
sw_freqDiv = tb.denom * 1000;
|
sw_freqDiv = tb.denom * 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Platform_Init(void) {
|
||||||
|
ProcessSerialNumber psn;
|
||||||
|
Platform_InitCommon();
|
||||||
|
Platform_InitStopwatch();
|
||||||
|
|
||||||
|
/* NOTE: Call as soon as possible, otherwise can't click on dialog boxes. */
|
||||||
|
GetCurrentProcess(&psn);
|
||||||
|
/* NOTE: TransformProcessType is OSX 10.3 or later */
|
||||||
|
TransformProcessType(&psn, kProcessTransformToForegroundApplication);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -88,9 +88,9 @@ int main(int argc, char** argv) {
|
|||||||
uint8_t ip[4];
|
uint8_t ip[4];
|
||||||
uint16_t port;
|
uint16_t port;
|
||||||
|
|
||||||
Program_SetCurrentDirectory();
|
|
||||||
Logger_Hook();
|
Logger_Hook();
|
||||||
Platform_Init();
|
Platform_Init();
|
||||||
|
Program_SetCurrentDirectory();
|
||||||
#ifdef CC_TEST_VORBIS
|
#ifdef CC_TEST_VORBIS
|
||||||
main_imdct();
|
main_imdct();
|
||||||
#endif
|
#endif
|
||||||
|
@ -2119,10 +2119,7 @@ void Window_Create(int x, int y, int width, int height, struct GraphicsMode* mod
|
|||||||
title_height = Rect_Height(r);
|
title_height = Rect_Height(r);
|
||||||
AcquireRootMenu();
|
AcquireRootMenu();
|
||||||
|
|
||||||
/* TODO: Apparently GetCurrentProcess is needed */
|
|
||||||
GetCurrentProcess(&psn);
|
GetCurrentProcess(&psn);
|
||||||
/* NOTE: TransformProcessType is OSX 10.3 or later */
|
|
||||||
TransformProcessType(&psn, kProcessTransformToForegroundApplication);
|
|
||||||
SetFrontProcess(&psn);
|
SetFrontProcess(&psn);
|
||||||
|
|
||||||
/* TODO: Use BringWindowToFront instead.. (look in the file which has RepositionWindow in it) !!!! */
|
/* TODO: Use BringWindowToFront instead.. (look in the file which has RepositionWindow in it) !!!! */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user