Mac classic: Support resizing and fix not compiling with multiversal headers

This commit is contained in:
UnknownShadow200 2024-06-09 08:34:31 +10:00
parent 28a0929b6d
commit 8ef3bba286
3 changed files with 26 additions and 4 deletions

View File

@ -13,7 +13,7 @@ concurrency:
jobs:
build:
if: ${{ inputs.WEBHOOK_URL != '' }}
if: ${{ inputs.WEBHOOK_URL != '' }}
runs-on: ubuntu-latest
container:
image: ghcr.io/classicube/minimal-osxcross:latest

View File

@ -116,6 +116,15 @@ void Console_Write(const char* msg, int len) {
#endif
typedef unsigned long MAC_FourCharCode;
typedef SInt16 MAC_WindowPartCode;
typedef UInt16 MAC_EventMask;
// Workaround issue in multiversal headers
#if defined M68K_INLINE && TARGET_CPU_68K
// Availability: in InterfaceLib 7.1 and later
MAC_SYSAPI(void) _SetEventMask(MAC_EventMask value) MAC_TWOWORDINLINE(0x31DF, 0x0144);
#define SetEventMask _SetEventMask
#endif
/*########################################################################################################################*
*--------------------------------------------------Public implementation--------------------------------------------------*
@ -258,7 +267,7 @@ static void HandleMouseDown(EventRecord* event) {
MAC_WindowPartCode part;
WindowPtr window;
Point localPoint;
long res;
int x, y;
part = FindWindow(event->where, &window);
@ -273,6 +282,7 @@ static void HandleMouseDown(EventRecord* event) {
case inContent:
SetPt(&localPoint, event->where.h, event->where.v);
GlobalToLocal(&localPoint);
if (window != win) break;
x = localPoint.h;
y = localPoint.v;
@ -287,10 +297,21 @@ static void HandleMouseDown(EventRecord* event) {
Window_RequestClose();
Window_Main.Exists = false;
}
break;
case inGrow:
res = GrowWindow(window, event->where, &qd.screenBits.bounds);
x = res & 0xFFFF;
y = res >> 16;
SizeWindow(window, x, y, false);
if (window != win) break;
Window_Main.Width = x;
Window_Main.Height = y;
Event_RaiseVoid(&WindowEvents.Resized);
break;
}
}
static void HandleMouseUp(EventRecord* event) {
Input_SetReleased(CCMOUSE_L);
}

View File

@ -866,8 +866,9 @@ void GLContext_GetApiInfo(cc_string* info) {
GLinteger nRenders = 0;
CGLRendererInfoObj rend;
CGLQueryRendererInfo(-1, &rend, &nRenders);
int i;
for (int i = 0; i < nRenders; i++)
for (i = 0; i < nRenders; i++)
{
GLinteger curID = -1;
CGLDescribeRenderer(rend, i, kCGLRPRendererID, &curID);