summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-01-15 06:49:52 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-01-15 06:51:00 +0100
commit78696236d3426a2b33bb35ea346cd66b4356021b (patch)
treec421505af40028b2eec5926f2af5b5c3f8fc965f /Kernel
parentc0ef060a7cff4530dcba72aca35a9bfc78c3629d (diff)
downloadserenity-78696236d3426a2b33bb35ea346cd66b4356021b.zip
Add very basic KeyDown events to the GUI event stream.
The Terminal program now hosts an interactive shell. :^)
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/GUITypes.h19
-rw-r--r--Kernel/Process.cpp3
2 files changed, 19 insertions, 3 deletions
diff --git a/Kernel/GUITypes.h b/Kernel/GUITypes.h
index 490f2499f8..088b94b734 100644
--- a/Kernel/GUITypes.h
+++ b/Kernel/GUITypes.h
@@ -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;
};
};
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp
index 9869f1421d..e6accc4761 100644
--- a/Kernel/Process.cpp
+++ b/Kernel/Process.cpp
@@ -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) {