From: John Hodge Date: Sun, 11 Mar 2012 06:24:35 +0000 (+0800) Subject: Usermode/axwin3 - Little additions and bugfixes X-Git-Tag: rel0.15~732 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=8c12dd82f2a4e01d8de5d29db6d4fdd0802c7e83;p=tpg%2Facess2.git Usermode/axwin3 - Little additions and bugfixes --- diff --git a/KernelLand/Kernel/include/keysyms.h b/KernelLand/Kernel/include/keysyms.h index caabb4e6..d240ef30 100644 --- a/KernelLand/Kernel/include/keysyms.h +++ b/KernelLand/Kernel/include/keysyms.h @@ -1,8 +1,8 @@ /* - * Acess2 USB Stack HID Driver + * Acess2 Kernel * - By John Hodge (thePowersGang) * - * usb_keysyms.h + * keysyms.h * - USB HID Keyboard Symbols */ #ifndef _USB_KEYSYMS_H_ diff --git a/Usermode/Applications/axwin3_src/Interface/main.c b/Usermode/Applications/axwin3_src/Interface/main.c index 80bf3292..e34968c9 100644 --- a/Usermode/Applications/axwin3_src/Interface/main.c +++ b/Usermode/Applications/axwin3_src/Interface/main.c @@ -125,15 +125,20 @@ void create_mainmenu(void) AxWin3_Menu_AddItem(gSystemMenu, "&Run\tWin+R", mainmenu_run_dialog, NULL, 0, NULL); } +// -------------------------------------------------------------------- +// "Run" Dialog box +// -------------------------------------------------------------------- int run_dorun(tAxWin3_Widget *unused) { -// char *cmd = AxWin3_Widget_GetText(gRunInput); + char *cmd = AxWin3_Widget_GetText(gRunInput); + _SysDebug("Command string '%s'", cmd); AxWin3_ShowWindow(gRunDialog, 0); return 0; } int run_close(tAxWin3_Widget *unused) { + _SysDebug("Run diaglog closed"); AxWin3_ShowWindow(gRunDialog, 0); return 0; } diff --git a/Usermode/Applications/axwin3_src/WM/input.c b/Usermode/Applications/axwin3_src/WM/input.c index 9fe73ff7..bd23c0b2 100644 --- a/Usermode/Applications/axwin3_src/WM/input.c +++ b/Usermode/Applications/axwin3_src/WM/input.c @@ -125,8 +125,7 @@ void Input_HandleSelect(fd_set *set) return ; } if( mouseinfo->NAxies > c_n_axies || mouseinfo->NButtons > c_n_buttons ) { - _SysDebug( - "%i axies, %i buttons above prealloc counts (%i, %i)", + _SysDebug("%i axies, %i buttons above prealloc counts (%i, %i)", mouseinfo->NAxies, mouseinfo->NButtons, c_n_axies, c_n_buttons ); return ; diff --git a/Usermode/Applications/axwin3_src/WM/renderers/widget/textinput.c b/Usermode/Applications/axwin3_src/WM/renderers/widget/textinput.c index 2e21e789..9a0ae641 100644 --- a/Usermode/Applications/axwin3_src/WM/renderers/widget/textinput.c +++ b/Usermode/Applications/axwin3_src/WM/renderers/widget/textinput.c @@ -13,6 +13,10 @@ #include #include +// TODO: Include a proper keysym header +#define KEYSYM_LEFTARROW 0x50 +#define KEYSYM_RIGHTARROW 0x4F + struct sTextInputInfo { int DrawOfs; // Byte offset for the leftmost character @@ -128,7 +132,26 @@ int Widget_TextInput_KeyFire(tElement *Element, int KeySym, int Character) // _SysDebug("Key 0x%x fired ('%c')", Character, Character); if( Character == 0 ) + { + switch(KeySym) + { + case KEYSYM_LEFTARROW: + if( info->CursorByteOfs > 0 ) + { + len = ReadUTF8Rev(Element->Text, info->CursorByteOfs, &cp); + info->CursorByteOfs -= len; + } + break; + case KEYSYM_RIGHTARROW: + if( info->CursorByteOfs < info->Length ) + { + len = ReadUTF8(Element->Text + info->CursorByteOfs, &cp); + info->CursorByteOfs += len; + } + break; + } return 0; + } // TODO: Don't hard code if(Character > 0x30000000) return 0; diff --git a/Usermode/Applications/axwin3_src/include/widget_messages.h b/Usermode/Applications/axwin3_src/include/widget_messages.h index 53e7dcc5..0a4b2505 100644 --- a/Usermode/Applications/axwin3_src/include/widget_messages.h +++ b/Usermode/Applications/axwin3_src/include/widget_messages.h @@ -19,6 +19,10 @@ enum MSG_WIDGET_SETTEXT, MSG_WIDGET_SETCOLOUR, + + // Request (Client->Server->Client) messages + MSG_WIDGET_GETTEXT, + // Event (Server->Client) messages MSG_WIDGET_FIRE, MSG_WIDGET_KEYPRESS, diff --git a/Usermode/Applications/axwin3_src/libaxwin3.so_src/main.c b/Usermode/Applications/axwin3_src/libaxwin3.so_src/main.c index fcd572aa..d8f6a61f 100644 --- a/Usermode/Applications/axwin3_src/libaxwin3.so_src/main.c +++ b/Usermode/Applications/axwin3_src/libaxwin3.so_src/main.c @@ -28,7 +28,6 @@ void AxWin3_MainLoop(void) msg = AxWin3_int_GetIPCMessage(); if(!msg) continue; - // TODO: Handle message _SysDebug("oh look, a message (Type=%i, Window=%i, Len=%i)", msg->ID, msg->Window, msg->Size); diff --git a/Usermode/Applications/axwin3_src/libaxwin3.so_src/msg.c b/Usermode/Applications/axwin3_src/libaxwin3.so_src/msg.c index b03d64d0..17d089f9 100644 --- a/Usermode/Applications/axwin3_src/libaxwin3.so_src/msg.c +++ b/Usermode/Applications/axwin3_src/libaxwin3.so_src/msg.c @@ -121,8 +121,7 @@ tAxWin_IPCMessage *AxWin3_int_GetIPCMessage(void) switch(giConnectionType) { case CONNTYPE_SENDMESSAGE: - // TODO: Less hack, I need a version of select for GetMessage etc - if(SysGetMessage(NULL, NULL) == 0) _SysWaitEvent(THREAD_EVENT_IPCMSG); + _SysWaitEvent(THREAD_EVENT_IPCMSG); while(SysGetMessage(NULL, NULL)) { pid_t tid; diff --git a/Usermode/Applications/axwin3_src/libaxwin3.so_src/r_widget.c b/Usermode/Applications/axwin3_src/libaxwin3.so_src/r_widget.c index 17dd16e9..875f14b8 100644 --- a/Usermode/Applications/axwin3_src/libaxwin3.so_src/r_widget.c +++ b/Usermode/Applications/axwin3_src/libaxwin3.so_src/r_widget.c @@ -8,6 +8,7 @@ #include #include #include "include/internal.h" +#include "include/ipc.h" #include #include #include @@ -227,6 +228,30 @@ void AxWin3_Widget_SetText(tAxWin3_Widget *Widget, const char *Text) AxWin3_SendMessage(Widget->Window, Widget->Window, MSG_WIDGET_SETTEXT, sizeof(buf), buf); } +char *AxWin3_Widget_GetText(tAxWin3_Widget *Widget) +{ + char buf[sizeof(tWidgetMsg_SetText)]; + tWidgetMsg_SetText *msg = (void*)buf; + tAxWin_IPCMessage *retmsg; + char *ret; + + msg->WidgetID = Widget->ID; + + AxWin3_SendMessage(Widget->Window, Widget->Window, MSG_WIDGET_GETTEXT, sizeof(buf), buf); + + retmsg = AxWin3_int_WaitIPCMessage(MSG_WIDGET_GETTEXT); + msg = (void*)retmsg->Data; + + if( retmsg->Size < sizeof(*msg) ) { + free(retmsg); + return NULL; + } + + ret = strndup(msg->Text, retmsg->Size - sizeof(*msg)); + free(retmsg); + return ret; +} + void AxWin3_Widget_SetColour(tAxWin3_Widget *Widget, int Index, tAxWin3_Colour Colour) { tWidgetMsg_SetColour msg; diff --git a/Usermode/include/axwin3/widget.h b/Usermode/include/axwin3/widget.h index 03294257..29a02251 100644 --- a/Usermode/include/axwin3/widget.h +++ b/Usermode/include/axwin3/widget.h @@ -39,6 +39,8 @@ extern void AxWin3_Widget_SetFlags(tAxWin3_Widget *Widget, int FlagSet, int Flag extern void AxWin3_Widget_SetSize(tAxWin3_Widget *Widget, int Size); extern void AxWin3_Widget_SetText(tAxWin3_Widget *Widget, const char *Text); extern void AxWin3_Widget_SetColour(tAxWin3_Widget *Widget, int Index, tAxWin3_Colour Colour); +// --- Inspection +extern char *AxWin3_Widget_GetText(tAxWin3_Widget *Widget); enum eElementTypes {