mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-15 02:25:32 -04:00
Fix cursor staying hidden when showing dialog boxes on OSX
This is particularly annoying for the crash dialog box. Although you can still press Enter to dismiss it.
This commit is contained in:
parent
96b57b80d0
commit
96a6416725
@ -1753,7 +1753,7 @@ void Window_Create(int width, int height) {
|
|||||||
kWindowStandardDocumentAttributes | kWindowStandardHandlerAttribute |
|
kWindowStandardDocumentAttributes | kWindowStandardHandlerAttribute |
|
||||||
kWindowInWindowMenuAttribute | kWindowLiveResizeAttribute, &r, &win_handle);
|
kWindowInWindowMenuAttribute | kWindowLiveResizeAttribute, &r, &win_handle);
|
||||||
|
|
||||||
if (res) Logger_Abort2(res, "Failed to create window");
|
if (res) Logger_Abort2(res, "Creating window failed");
|
||||||
Window_RefreshBounds();
|
Window_RefreshBounds();
|
||||||
|
|
||||||
AcquireRootMenu();
|
AcquireRootMenu();
|
||||||
@ -1916,12 +1916,14 @@ void Cursor_SetPosition(int x, int y) {
|
|||||||
CGDisplayMoveCursorToPoint(CGMainDisplayID(), point);
|
CGDisplayMoveCursorToPoint(CGMainDisplayID(), point);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool cursorVisible = true;
|
||||||
void Cursor_SetVisible(bool visible) {
|
void Cursor_SetVisible(bool visible) {
|
||||||
if (visible) {
|
if (visible) {
|
||||||
CGDisplayShowCursor(CGMainDisplayID());
|
CGDisplayShowCursor(CGMainDisplayID());
|
||||||
} else {
|
} else {
|
||||||
CGDisplayHideCursor(CGMainDisplayID());
|
CGDisplayHideCursor(CGMainDisplayID());
|
||||||
}
|
}
|
||||||
|
cursorVisible = visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window_ShowDialog(const char* title, const char* msg) {
|
void Window_ShowDialog(const char* title, const char* msg) {
|
||||||
@ -1933,7 +1935,12 @@ void Window_ShowDialog(const char* title, const char* msg) {
|
|||||||
CreateStandardAlert(kAlertPlainAlert, titleCF, msgCF, NULL, &dialog);
|
CreateStandardAlert(kAlertPlainAlert, titleCF, msgCF, NULL, &dialog);
|
||||||
CFRelease(titleCF);
|
CFRelease(titleCF);
|
||||||
CFRelease(msgCF);
|
CFRelease(msgCF);
|
||||||
|
|
||||||
|
/* If cursor is hidden, showing a dialog doesn't cause it to reappear */
|
||||||
|
/* So just manually make the cursor reappear */
|
||||||
|
if (!cursorVisible) CGDisplayShowCursor(CGMainDisplayID());
|
||||||
RunStandardAlert(dialog, NULL, &itemHit);
|
RunStandardAlert(dialog, NULL, &itemHit);
|
||||||
|
if (!cursorVisible) CGDisplayHideCursor(CGMainDisplayID());
|
||||||
}
|
}
|
||||||
|
|
||||||
static CGrafPtr fb_port;
|
static CGrafPtr fb_port;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user