mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 23:28:11 +00:00
WindowServer: Don't crash if unable to open input peripherals
Seems a bit extreme, other operating systems don't have their graphical environment crash if there is no keyboard or no mouse.
This commit is contained in:
parent
4d755725bf
commit
491a67ddc4
1 changed files with 12 additions and 7 deletions
|
@ -66,14 +66,19 @@ EventLoop::EventLoop()
|
|||
IPC::new_client_connection<ClientConnection>(client_socket.release_nonnull(), client_id);
|
||||
};
|
||||
|
||||
ASSERT(m_keyboard_fd >= 0);
|
||||
ASSERT(m_mouse_fd >= 0);
|
||||
if (m_keyboard_fd >= 0) {
|
||||
m_keyboard_notifier = Core::Notifier::construct(m_keyboard_fd, Core::Notifier::Read);
|
||||
m_keyboard_notifier->on_ready_to_read = [this] { drain_keyboard(); };
|
||||
} else {
|
||||
dbgln("Couldn't open /dev/keyboard");
|
||||
}
|
||||
|
||||
m_keyboard_notifier = Core::Notifier::construct(m_keyboard_fd, Core::Notifier::Read);
|
||||
m_keyboard_notifier->on_ready_to_read = [this] { drain_keyboard(); };
|
||||
|
||||
m_mouse_notifier = Core::Notifier::construct(m_mouse_fd, Core::Notifier::Read);
|
||||
m_mouse_notifier->on_ready_to_read = [this] { drain_mouse(); };
|
||||
if (m_mouse_fd >= 0) {
|
||||
m_mouse_notifier = Core::Notifier::construct(m_mouse_fd, Core::Notifier::Read);
|
||||
m_mouse_notifier->on_ready_to_read = [this] { drain_mouse(); };
|
||||
} else {
|
||||
dbgln("Couldn't open /dev/mouse");
|
||||
}
|
||||
}
|
||||
|
||||
EventLoop::~EventLoop()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue