Process messages with Intuition translation of IDCMP_CLOSEWINDOW

This commit is contained in:
deadwood 2024-03-25 15:52:21 +01:00
parent f6a3ac09fd
commit 909d02e309
4 changed files with 78 additions and 0 deletions

View File

@ -261,11 +261,34 @@ MAKE_PROXY_ARG_1(CreateMsgPort)
struct MessageV0 * abiv0_GetMsg(struct MsgPortV0 *port, struct ExecBaseV0 *SysBaseV0)
{
struct MsgPortProxy *proxy = (struct MsgPortProxy *)port;
struct Message *msg = GetMsg(proxy->native);
if (proxy->translate)
{
return proxy->translate(msg);
}
if (msg)
{
bug("abiv0_GetMsg: STUB\n");
asm("int3");
}
return NULL;
}
MAKE_PROXY_ARG_2(GetMsg)
void abiv0_ReplyMsg(struct MessageV0 *message, struct ExecBaseV0 *SysBaseV0)
{
if (message)
{
struct Message *native = (struct Message *)*(IPTR*)&message->mn_Node;
ReplyMsg(native);
}
}
MAKE_PROXY_ARG_2(ReplyMsg)
ULONG abiv0_Wait(ULONG signalSet, struct ExecBaseV0 *SysBaseV0)
{
return Wait(signalSet);
@ -375,6 +398,7 @@ struct ExecBaseV0 *init_exec()
__AROS_SETVECADDRV0(abiv0SysBase, 43, execfunctable[42]); // RemHead
__AROS_SETVECADDRV0(abiv0SysBase, 62, (APTR32)(IPTR)proxy_GetMsg);
__AROS_SETVECADDRV0(abiv0SysBase, 53, (APTR32)(IPTR)proxy_Wait);
__AROS_SETVECADDRV0(abiv0SysBase, 63, (APTR32)(IPTR)proxy_ReplyMsg);
return abiv0SysBase;
}

View File

@ -7,6 +7,7 @@ struct MsgPortProxy
{
struct MsgPortV0 base;
struct MsgPort *native;
struct MessageV0 *(*translate)(struct Message *);
};
#endif

View File

@ -158,4 +158,24 @@ struct DrawInfoV0
ULONG dri_Reserved[3];
};
/***** Intuition Message *****/
struct IntuiMessageV0
{
struct MessageV0 ExecMessage;
ULONG Class;
UWORD Code;
UWORD Qualifier;
APTR32 IAddress;
WORD MouseX;
WORD MouseY;
ULONG Seconds;
ULONG Micros;
APTR32 IDCMPWindow;
APTR32 SpecialLink;
};
#endif

View File

@ -154,6 +154,9 @@ static struct TagItem *CloneTagItemsV02Native(const struct TagItemV0 *tagList)
}
struct WindowV0 *g_v0window;
struct Window *g_nativewindow;
struct WindowV0 *abiv0_OpenWindowTagList(APTR /*struct NewWindowV0 **/newWindow, struct TagItemV0 *tagList, struct LibraryV0 *IntuitionBaseV0)
{
if (newWindow != NULL) asm("int3");
@ -182,6 +185,9 @@ struct WindowV0 *abiv0_OpenWindowTagList(APTR /*struct NewWindowV0 **/newWindow,
proxy->native = wndnative;
g_v0window = &proxy->base;
g_nativewindow = wndnative;
bug("abiv0_OpenWindowTagList: STUB\n");
return (struct WindowV0 *)proxy;
}
@ -194,6 +200,32 @@ BOOL abiv0_WindowLimits(struct WindowV0 *window, WORD MinWidth, WORD MinHeight,
}
MAKE_PROXY_ARG_6(WindowLimits)
static struct MessageV0 *Intuition_Translate(struct Message *native)
{
struct IntuiMessage *imsg = (struct IntuiMessage *)native;
if (native == NULL)
return NULL;
if (imsg->Class == IDCMP_CLOSEWINDOW)
{
struct IntuiMessageV0 *v0msg = abiv0_AllocMem(sizeof(struct IntuiMessageV0), MEMF_CLEAR, Intuition_SysBaseV0);
v0msg->Class = imsg->Class;
if (imsg->IDCMPWindow == g_nativewindow)
v0msg->IDCMPWindow = (APTR32)(IPTR)g_v0window;
/* Store original message in Node of v0msg for now */
*((IPTR *)&v0msg->ExecMessage.mn_Node) = (IPTR)imsg;
return (struct MessageV0 *)v0msg;
}
bug("Intuition_Translate - missing code\n");
return NULL;
}
BOOL abiv0_ModifyIDCMP(struct WindowV0 *window, ULONG flags, struct LibraryV0 *IntuitionBaseV0)
{
struct WindowProxy *winproxy = (struct WindowProxy *)window;
@ -201,6 +233,7 @@ BOOL abiv0_ModifyIDCMP(struct WindowV0 *window, ULONG flags, struct LibraryV0 *I
if (msgpproxy != NULL)
{
winproxy->native->UserPort = msgpproxy->native;
msgpproxy->translate = Intuition_Translate;
}
return ModifyIDCMP(winproxy->native, flags);
}