1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 14:37:45 +00:00

Add very basic KeyDown events to the GUI event stream.

The Terminal program now hosts an interactive shell. :^)
This commit is contained in:
Andreas Kling 2019-01-15 06:49:52 +01:00
parent c0ef060a7c
commit 78696236d3
4 changed files with 33 additions and 8 deletions

View file

@ -42,11 +42,18 @@ struct GUI_WindowBackingStoreInfo {
enum class GUI_MouseButton : unsigned char {
NoButton = 0,
Left = 1,
Right = 2,
Middle = 4,
Left = 1,
Right = 2,
Middle = 4,
};
struct GUI_KeyModifiers { enum {
Shift = 1 << 0,
Alt = 1 << 1,
Ctrl = 1 << 2,
}; };
struct GUI_Event {
enum Type : unsigned {
Invalid,
@ -54,6 +61,8 @@ struct GUI_Event {
MouseMove,
MouseDown,
MouseUp,
KeyDown,
KeyUp,
};
Type type { Invalid };
int window_id { -1 };
@ -66,6 +75,10 @@ struct GUI_Event {
GUI_Point position;
GUI_MouseButton button;
} mouse;
struct {
char character;
unsigned modifiers;
} key;
};
};

View file

@ -1173,6 +1173,7 @@ int Process::sys$fcntl(int fd, int cmd, dword arg)
case F_GETFL:
return descriptor->file_flags();
case F_SETFL:
// FIXME: Support changing O_NONBLOCK
descriptor->set_file_flags(arg);
break;
default:
@ -1294,6 +1295,8 @@ int Process::sys$open(const char* path, int options)
return error;
if (options & O_DIRECTORY && !descriptor->is_directory())
return -ENOTDIR; // FIXME: This should be handled by VFS::open.
if (options & O_NONBLOCK)
descriptor->set_blocking(false);
int fd = 0;
for (; fd < (int)m_max_open_file_descriptors; ++fd) {