Fixed compile issues in AxWin2 WM
[tpg/acess2.git] / Usermode / Libraries / libaxwin2.so_src / main.c
1 /*
2  * AxWin Window Manager Interface Library
3  * By John Hodge (thePowersGang)
4  * This file is published under the terms of the Acess Licence. See the
5  * file COPYING for details.
6  * 
7  * main.c - Library Initialisation
8  */
9 #include "common.h"
10 #include <string.h>
11
12 // === GLOBALS ===
13  int    giAxWin_Mode = 0;
14  int    giAxWin_PID = 0;
15
16 // === CODE ===
17 int SoMain()
18 {
19         return 0;
20 }
21
22 int AxWin_Register(const char *Name)
23 {
24         tAxWin_Message  req;
25         tAxWin_Message  *msg;
26         tAxWin_RetMsg   *ret;
27          int    len = strlen(Name);
28         
29         req.ID = MSG_SREQ_REGISTER;
30         req.Size = 1 + (len+1)/4;
31         strcpy(req.Data, Name);
32         
33         AxWin_SendMessage(&req);
34         
35         for(;;)
36         {
37                 msg = AxWin_WaitForMessage();
38                 
39                 if(msg->ID == MSG_SREQ_ADDTAB)
40                 {
41                         ret = (void*) &msg->Data[0];
42                         if( ret->ReqID == MSG_SREQ_REGISTER )
43                                 break;
44                 }
45                 
46                 AxWin_HandleMessage(msg);
47                 free(msg);
48         }
49         
50         return !!ret->Bool;
51 }
52
53 tAxWin_Handle AxWin_AddTab(const char *Title)
54 {
55         tAxWin_Message  req;
56         tAxWin_Message  *msg;
57         tAxWin_RetMsg   *ret;
58          int    len = strlen(Title);
59         
60         req.ID = MSG_SREQ_ADDTAB;
61         req.Size = 1 + (len+1)/4;
62         strcpy(req.Data, Title);
63         
64         for(;;)
65         {
66                 msg = AxWin_WaitForMessage();
67                 
68                 if(msg->ID == MSG_SRSP_RETURN)
69                 {
70                         ret = (void*) &msg->Data[0];
71                         if( ret->ReqID == MSG_SREQ_ADDTAB )
72                                 break;
73                 }
74                 
75                 AxWin_HandleMessage(msg);
76                 free(msg);
77         }
78         
79         return (tAxWin_Handle) ret->Handle;
80 }

UCC git Repository :: git.ucc.asn.au