From ae4f74ae1303ff2ef59d0885606f607e529c5ca0 Mon Sep 17 00:00:00 2001 From: "John Hodge (sonata)" Date: Sun, 20 Jan 2013 18:44:15 +0800 Subject: [PATCH] Usermode/axwin3 - Input fixes --- Usermode/Applications/axwin3_src/WM/ipc.c | 4 ++-- .../axwin3_src/WM/renderers/richtext.c | 24 +++++++++++++++++++ Usermode/Applications/axwin3_src/WM/wm.c | 2 ++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/Usermode/Applications/axwin3_src/WM/ipc.c b/Usermode/Applications/axwin3_src/WM/ipc.c index 5b600ee8..7874335c 100644 --- a/Usermode/Applications/axwin3_src/WM/ipc.c +++ b/Usermode/Applications/axwin3_src/WM/ipc.c @@ -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; diff --git a/Usermode/Applications/axwin3_src/WM/renderers/richtext.c b/Usermode/Applications/axwin3_src/WM/renderers/richtext.c index 90c97aba..7a98feb8 100644 --- a/Usermode/Applications/axwin3_src/WM/renderers/richtext.c +++ b/Usermode/Applications/axwin3_src/WM/renderers/richtext.c @@ -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; } diff --git a/Usermode/Applications/axwin3_src/WM/wm.c b/Usermode/Applications/axwin3_src/WM/wm.c index f9592db5..8886af19 100644 --- a/Usermode/Applications/axwin3_src/WM/wm.c +++ b/Usermode/Applications/axwin3_src/WM/wm.c @@ -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) ) -- 2.20.1