/*
- * Acess2 USB Stack HID Driver
+ * Acess2 Kernel
* - By John Hodge (thePowersGang)
*
- * usb_keysyms.h
+ * keysyms.h
* - USB HID Keyboard Symbols
*/
#ifndef _USB_KEYSYMS_H_
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;
}
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 ;
#include <utf8.h>
#include <string.h>
+// TODO: Include a proper keysym header
+#define KEYSYM_LEFTARROW 0x50
+#define KEYSYM_RIGHTARROW 0x4F
+
struct sTextInputInfo
{
int DrawOfs; // Byte offset for the leftmost 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;
MSG_WIDGET_SETTEXT,
MSG_WIDGET_SETCOLOUR,
+
+ // Request (Client->Server->Client) messages
+ MSG_WIDGET_GETTEXT,
+
// Event (Server->Client) messages
MSG_WIDGET_FIRE,
MSG_WIDGET_KEYPRESS,
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);
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;
#include <axwin3/axwin.h>
#include <axwin3/widget.h>
#include "include/internal.h"
+#include "include/ipc.h"
#include <stdlib.h>
#include <widget_messages.h>
#include <string.h>
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;
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
{