Usermode/AxWin3 - Updated for PTY support
authorJohn Hodge <[email protected]>
Mon, 20 May 2013 08:19:30 +0000 (16:19 +0800)
committerJohn Hodge <[email protected]>
Mon, 20 May 2013 08:19:30 +0000 (16:19 +0800)
Usermode/Applications/axwin3_src/WM/ipc.c
Usermode/Applications/axwin3_src/WM/resources/cursor.h
Usermode/Applications/axwin3_src/WM/video.c

index 79e0956..dcb43a9 100644 (file)
@@ -236,7 +236,7 @@ int _CompareClientPtrs(const void *_a, const void *_b)
        tIPC_Client     *b = *(tIPC_Client**)_b;
 
        ASSERT(a);
-       ASSERT(b);
+       if(!b)  return -1;
 
        if(a->IPCType < b->IPCType)     return -1;
        if(a->IPCType > b->IPCType)     return 1;
@@ -255,6 +255,7 @@ int IPC_int_BSearchClients(const tIPC_Client *TargetClient, int *Pos)
        while(div > 0)
        {
                div /= 2;
+               _SysDebug("Cmp with %i [%i] (%p)", pos, div, gIPC_Clients[pos]);
                cmp = _CompareClientPtrs(&TargetClient, &gIPC_Clients[pos]);
 //             _SysDebug("Checking against %i gives %i", pos, cmp);
                if(cmp == 0)    break;
index 0fda4fc..8fc6776 100644 (file)
@@ -6,10 +6,10 @@
 #include <stdint.h>
 
 static struct {
-       uint16_t        W, H, OfsX, OfsY;
+       uint16_t        W, H;
        uint32_t        Data[];
 } cCursorBitmap = {
-       8, 16, 0, 0,
+       8, 16,
        {
                0xFF000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
                0xFF000000, 0xFF000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
index b3ce1d7..0028560 100644 (file)
@@ -76,6 +76,12 @@ void Video_Setup(void)
        }
        giScreenWidth = dims.PW;
        giScreenHeight = dims.PH;
+       if( giScreenWidth < 640 || giScreenHeight < 480 ) {
+               Video_int_SetBufFmt(PTYBUFFMT_TEXT);
+               _SysDebug("Resoltion too small, 640x480 reqd but %ix%i avail",
+                       giScreenWidth, giScreenHeight);
+               exit(-1);
+       }
        _SysDebug("AxWin3 running at %ix%i", dims.PW, dims.PH);
 
        giVideo_LastDirtyLine = giScreenHeight;
@@ -84,8 +90,16 @@ void Video_Setup(void)
        gpScreenBuffer = malloc( giScreenWidth*giScreenHeight*4 );
 
        // Set cursor position and bitmap
-       // TODO: This will require using the 2DCMD buffer format
-       //_SysIOCtl(giTerminalFD, TERM_IOCTL_SETCURSORBITMAP, &cCursorBitmap);
+       {
+       Video_int_SetBufFmt(PTYBUFFMT_2DCMD);
+       struct ptycmd_header    hdr = {PTY2D_CMD_SETCURSORBMP,0,0};
+       size_t size = sizeof(hdr) + sizeof(cCursorBitmap) + cCursorBitmap.W*cCursorBitmap.H*4;
+       hdr.len_low = size / 4;
+       hdr.len_hi = size / (256*4);
+       _SysWrite(giTerminalFD, &hdr, sizeof(hdr));
+       _SysDebug("size = %i (%04x:%02x * 4)", size, hdr.len_hi, hdr.len_low);
+       _SysWrite(giTerminalFD, &cCursorBitmap, size-sizeof(hdr));
+       }
        Video_SetCursorPos( giScreenWidth/2, giScreenHeight/2 );
 }
 
@@ -132,7 +146,9 @@ void Video_int_SetBufFmt(int NewFmt)
 void Video_SetCursorPos(short X, short Y)
 {
        struct ptycmd_setcursorpos      cmd;
-       cmd.cmd = PTY2D_CMD_SETCURSORPOS;
+       cmd.hdr.cmd = PTY2D_CMD_SETCURSORPOS;
+       cmd.hdr.len_low = sizeof(cmd)/4;
+       cmd.hdr.len_hi = 0;
        cmd.x = giVideo_CursorX = X;
        cmd.y = giVideo_CursorY = Y;
 

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