Usermode/axwin3 - Input fixes
authorJohn Hodge (sonata) <[email protected]>
Sun, 20 Jan 2013 10:44:15 +0000 (18:44 +0800)
committerJohn Hodge (sonata) <[email protected]>
Sun, 20 Jan 2013 10:44:15 +0000 (18:44 +0800)
Usermode/Applications/axwin3_src/WM/ipc.c
Usermode/Applications/axwin3_src/WM/renderers/richtext.c
Usermode/Applications/axwin3_src/WM/wm.c

index 5b600ee..7874335 100644 (file)
@@ -461,8 +461,8 @@ int IPC_Msg_FocusWindow(tIPC_Client *Client, tAxWin_IPCMessage *Msg)
        ASSERT(Msg->ID == IPCMSG_FOCUSWINDOW);
        
        // Don't allow the focus to be changed unless the client has the focus
-       if(!gpWM_FocusedWindow) return 1;
-       if(gpWM_FocusedWindow->Client != Client)        return 1;
+//     if(!gpWM_FocusedWindow) return 1;
+//     if(gpWM_FocusedWindow->Client != Client)        return 1;
 
        win = IPC_int_GetWindow(Client, Msg->Window);
        if(!win)        return 1;
index 90c97ab..7a98feb 100644 (file)
@@ -224,6 +224,22 @@ void Renderer_RichText_Redraw(tWindow *Window)
                Window->W, (info->DispLines-i)*info->LineHeight,
                info->DefaultBG
                );
+       
+       // TODO: Text cursor
+       if( info->CursorRow >= info->FirstVisRow && info->CursorRow < info->FirstVisRow + info->DispLines )
+       {
+               if( info->CursorCol >= info->FirstVisCol && info->CursorCol < info->FirstVisCol + info->DispCols )
+               {
+                       // TODO: Kill hardcoded 8 with cached text distance
+                       WM_Render_FillRect(Window,
+                               (info->CursorCol - info->FirstVisCol) * 8,
+                               (info->CursorRow - info->FirstVisRow) * info->LineHeight,
+                               1,
+                               info->LineHeight,
+                               info->DefaultFG
+                               );
+               }
+       }
 }
 
 int Renderer_RichText_HandleIPC_SetAttr(tWindow *Window, size_t Len, const void *Data)
@@ -241,6 +257,10 @@ int Renderer_RichText_HandleIPC_SetAttr(tWindow *Window, size_t Len, const void
        case _ATTR_DEFFG:
                info->DefaultFG = msg->Value;
                break;
+       case _ATTR_CURSORPOS:
+               info->CursorRow = msg->Value >> 12;
+               info->CursorCol = msg->Value & 0xFFF;
+               break;
        case _ATTR_SCROLL:
                // TODO: Set scroll flag
                break;
@@ -314,6 +334,10 @@ int Renderer_RichText_HandleMessage(tWindow *Target, int Msg, int Len, const voi
                if(Len < sizeof(*msg))  return -1;
                info->DispLines = msg->H / info->LineHeight;
                return 1; }
+       case WNDMSG_KEYDOWN:
+       case WNDMSG_KEYUP:
+       case WNDMSG_KEYFIRE:
+               return 1;
        }
        return 0;
 }
index f9592db..8886af1 100644 (file)
@@ -173,6 +173,8 @@ void WM_FocusWindow(tWindow *Destination)
 {
        struct sWndMsg_Bool     _msg;
        
+       _SysDebug("WM_FocusWindow(%p)", Destination);
+
        if( gpWM_FocusedWindow == Destination )
                return ;
        if( Destination && !(Destination->Flags & WINFLAG_SHOW) )

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