diff --git a/repos/ports/src/virtualbox/frontend/console.cc b/repos/ports/src/virtualbox/frontend/console.cc index a330f2c004..1abd79da9e 100644 --- a/repos/ports/src/virtualbox/frontend/console.cc +++ b/repos/ports/src/virtualbox/frontend/console.cc @@ -179,7 +179,7 @@ void GenodeConsole::update_video_mode() 32); } -void GenodeConsole::handle_input(unsigned) +void GenodeConsole::handle_input() { static LONG64 mt_events [64]; unsigned mt_number = 0; @@ -329,7 +329,7 @@ void GenodeConsole::handle_input(unsigned) RTTimeMilliTS()); } -void GenodeConsole::handle_mode_change(unsigned) +void GenodeConsole::handle_mode_change() { Display *d = getDisplay(); Genodefb *fb = dynamic_cast(d->getFramebuffer()); @@ -365,7 +365,7 @@ void GenodeConsole::init_clipboard() } } -void GenodeConsole::handle_cb_rom_change(unsigned) +void GenodeConsole::handle_cb_rom_change() { if (!_clipboard_rom) return; @@ -373,7 +373,7 @@ void GenodeConsole::handle_cb_rom_change(unsigned) vboxClipboardSync(nullptr); } -void GenodeConsole::event_loop(IKeyboard * gKeyboard, IMouse * gMouse) +void GenodeConsole::init_backends(IKeyboard * gKeyboard, IMouse * gMouse) { _vbox_keyboard = gKeyboard; _vbox_mouse = gMouse; @@ -383,16 +383,6 @@ void GenodeConsole::event_loop(IKeyboard * gKeyboard, IMouse * gMouse) Genodefb *fb = dynamic_cast(d->getFramebuffer()); fb->mode_sigh(_mode_change_signal_dispatcher); - for (;;) { - - Genode::Signal sig = _receiver.wait_for_signal(); - Genode::Signal_dispatcher_base *dispatcher = - dynamic_cast(sig.context()); - - if (dispatcher) - dispatcher->dispatch(sig.num()); - } - } void GenodeConsole::onMouseCapabilityChange(BOOL supportsAbsolute, BOOL supportsRelative, diff --git a/repos/ports/src/virtualbox/frontend/console.h b/repos/ports/src/virtualbox/frontend/console.h index 6c3b8e71ee..a7a9883994 100644 --- a/repos/ports/src/virtualbox/frontend/console.h +++ b/repos/ports/src/virtualbox/frontend/console.h @@ -111,20 +111,19 @@ class GenodeConsole : public Console { private: - Input::Connection _input; - Genode::Signal_receiver _receiver; - unsigned _ax, _ay; - bool _last_received_motion_event_was_absolute; - Report::Connection _shape_report_connection; - Genode::Attached_dataspace _shape_report_ds; - Vbox_pointer::Shape_report *_shape_report; - Genode::Reporter *_clipboard_reporter; - Genode::Attached_rom_dataspace *_clipboard_rom; - IKeyboard *_vbox_keyboard; - IMouse *_vbox_mouse; - Genode::Signal_dispatcher _input_signal_dispatcher; - Genode::Signal_dispatcher _mode_change_signal_dispatcher; - Genode::Signal_dispatcher _clipboard_signal_dispatcher; + Input::Connection _input; + unsigned _ax, _ay; + bool _last_received_motion_event_was_absolute; + Report::Connection _shape_report_connection; + Genode::Attached_dataspace _shape_report_ds; + Vbox_pointer::Shape_report *_shape_report; + Genode::Reporter *_clipboard_reporter; + Genode::Attached_rom_dataspace *_clipboard_rom; + IKeyboard *_vbox_keyboard; + IMouse *_vbox_mouse; + Genode::Signal_handler _input_signal_dispatcher; + Genode::Signal_handler _mode_change_signal_dispatcher; + Genode::Signal_handler _clipboard_signal_dispatcher; bool _key_status[Input::KEY_MAX + 1]; @@ -151,9 +150,9 @@ class GenodeConsole : public Console { _clipboard_rom(nullptr), _vbox_keyboard(0), _vbox_mouse(0), - _input_signal_dispatcher(_receiver, *this, &GenodeConsole::handle_input), - _mode_change_signal_dispatcher(_receiver, *this, &GenodeConsole::handle_mode_change), - _clipboard_signal_dispatcher(_receiver, *this, &GenodeConsole::handle_cb_rom_change) + _input_signal_dispatcher(genode_env().ep(), *this, &GenodeConsole::handle_input), + _mode_change_signal_dispatcher(genode_env().ep(), *this, &GenodeConsole::handle_mode_change), + _clipboard_signal_dispatcher(genode_env().ep(), *this, &GenodeConsole::handle_cb_rom_change) { for (unsigned i = 0; i <= Input::KEY_MAX; i++) _key_status[i] = 0; @@ -163,7 +162,7 @@ class GenodeConsole : public Console { void init_clipboard(); - void event_loop(IKeyboard * gKeyboard, IMouse * gMouse); + void init_backends(IKeyboard * gKeyboard, IMouse * gMouse); void onMouseCapabilityChange(BOOL supportsAbsolute, BOOL supportsRelative, BOOL supportsMT, BOOL needsHostCursor); @@ -229,7 +228,7 @@ class GenodeConsole : public Console { void update_video_mode(); - void handle_input(unsigned); - void handle_mode_change(unsigned); - void handle_cb_rom_change(unsigned); + void handle_input(); + void handle_mode_change(); + void handle_cb_rom_change(); }; diff --git a/repos/ports/src/virtualbox/frontend/main.cc b/repos/ports/src/virtualbox/frontend/main.cc index b3dc4f6b80..61ee5410fd 100644 --- a/repos/ports/src/virtualbox/frontend/main.cc +++ b/repos/ports/src/virtualbox/frontend/main.cc @@ -96,13 +96,13 @@ HRESULT setupmachine(Genode::Env &env) static com::Utf8Str vm_name(c_vbox_vmname); /* Machine object */ - ComObjPtr machine; + static ComObjPtr machine; rc = machine.createObject(); if (FAILED(rc)) return rc; /* Virtualbox object */ - ComObjPtr virtualbox; + static ComObjPtr virtualbox; rc = virtualbox.createObject(); if (FAILED(rc)) return rc; @@ -120,7 +120,7 @@ HRESULT setupmachine(Genode::Env &env) return rc; // open a session - ComObjPtr session; + static ComObjPtr session; rc = session.createObject(); if (FAILED(rc)) return rc; @@ -130,17 +130,17 @@ HRESULT setupmachine(Genode::Env &env) return rc; /* Console object */ - ComPtr gConsole; + static ComPtr gConsole; rc = session->COMGETTER(Console)(gConsole.asOutParam()); /* handle input of Genode and forward it to VMM layer */ - ComPtr genodeConsole = gConsole; + static ComPtr genodeConsole = gConsole; RTLogPrintf("genodeConsole = %p\n", genodeConsole); genodeConsole->init_clipboard(); /* Display object */ - ComPtr display; + static ComPtr display; rc = gConsole->COMGETTER(Display)(display.asOutParam()); if (FAILED(rc)) return rc; @@ -182,16 +182,15 @@ HRESULT setupmachine(Genode::Env &env) Assert (&*gMouse); /* request keyboard object */ - ComPtr gKeyboard; + static ComPtr gKeyboard; rc = gConsole->COMGETTER(Keyboard)(gKeyboard.asOutParam()); if (FAILED(rc)) return rc; Assert (&*gKeyboard); - genodeConsole->event_loop(gKeyboard, gMouse); + genodeConsole->init_backends(gKeyboard, gMouse); - Assert(!"return not expected"); - return E_FAIL; + return rc; } @@ -252,5 +251,4 @@ void Libc::Component::construct(Libc::Env &env) throw -2; } }); - Genode::error("VMM exiting ..."); } diff --git a/repos/ports/src/virtualbox5/frontend/console.cc b/repos/ports/src/virtualbox5/frontend/console.cc index 88aaf43099..0adf4d0013 100644 --- a/repos/ports/src/virtualbox5/frontend/console.cc +++ b/repos/ports/src/virtualbox5/frontend/console.cc @@ -124,7 +124,7 @@ void GenodeConsole::update_video_mode() 32); } -void GenodeConsole::handle_input(unsigned) +void GenodeConsole::handle_input() { static LONG64 mt_events [64]; unsigned mt_number = 0; @@ -274,7 +274,7 @@ void GenodeConsole::handle_input(unsigned) RTTimeMilliTS()); } -void GenodeConsole::handle_mode_change(unsigned) +void GenodeConsole::handle_mode_change() { IFramebuffer *pFramebuffer = NULL; HRESULT rc = i_getDisplay()->QueryFramebuffer(0, &pFramebuffer); @@ -313,7 +313,7 @@ void GenodeConsole::init_clipboard() } } -void GenodeConsole::handle_cb_rom_change(unsigned) +void GenodeConsole::handle_cb_rom_change() { if (!_clipboard_rom) return; @@ -321,7 +321,7 @@ void GenodeConsole::handle_cb_rom_change(unsigned) vboxClipboardSync(nullptr); } -void GenodeConsole::event_loop(IKeyboard * gKeyboard, IMouse * gMouse) +void GenodeConsole::init_backends(IKeyboard * gKeyboard, IMouse * gMouse) { _vbox_keyboard = gKeyboard; _vbox_mouse = gMouse; @@ -334,17 +334,6 @@ void GenodeConsole::event_loop(IKeyboard * gKeyboard, IMouse * gMouse) Genodefb *fb = dynamic_cast(pFramebuffer); fb->mode_sigh(_mode_change_signal_dispatcher); - - for (;;) { - - Genode::Signal sig = _receiver.wait_for_signal(); - Genode::Signal_dispatcher_base *dispatcher = - dynamic_cast(sig.context()); - - if (dispatcher) - dispatcher->dispatch(sig.num()); - } - } void GenodeConsole::i_onMouseCapabilityChange(BOOL supportsAbsolute, diff --git a/repos/ports/src/virtualbox5/frontend/console.h b/repos/ports/src/virtualbox5/frontend/console.h index ab77999a7d..fbedfa9c8e 100644 --- a/repos/ports/src/virtualbox5/frontend/console.h +++ b/repos/ports/src/virtualbox5/frontend/console.h @@ -111,20 +111,19 @@ class GenodeConsole : public Console { private: - Input::Connection _input; - Genode::Signal_receiver _receiver; - unsigned _ax, _ay; - bool _last_received_motion_event_was_absolute; - Report::Connection _shape_report_connection; - Genode::Attached_dataspace _shape_report_ds; - Vbox_pointer::Shape_report *_shape_report; - Genode::Reporter *_clipboard_reporter; - Genode::Attached_rom_dataspace *_clipboard_rom; - IKeyboard *_vbox_keyboard; - IMouse *_vbox_mouse; - Genode::Signal_dispatcher _input_signal_dispatcher; - Genode::Signal_dispatcher _mode_change_signal_dispatcher; - Genode::Signal_dispatcher _clipboard_signal_dispatcher; + Input::Connection _input; + unsigned _ax, _ay; + bool _last_received_motion_event_was_absolute; + Report::Connection _shape_report_connection; + Genode::Attached_dataspace _shape_report_ds; + Vbox_pointer::Shape_report *_shape_report; + Genode::Reporter *_clipboard_reporter; + Genode::Attached_rom_dataspace *_clipboard_rom; + IKeyboard *_vbox_keyboard; + IMouse *_vbox_mouse; + Genode::Signal_handler _input_signal_dispatcher; + Genode::Signal_handler _mode_change_signal_dispatcher; + Genode::Signal_handler _clipboard_signal_dispatcher; bool _key_status[Input::KEY_MAX + 1]; @@ -151,9 +150,9 @@ class GenodeConsole : public Console { _clipboard_rom(nullptr), _vbox_keyboard(0), _vbox_mouse(0), - _input_signal_dispatcher(_receiver, *this, &GenodeConsole::handle_input), - _mode_change_signal_dispatcher(_receiver, *this, &GenodeConsole::handle_mode_change), - _clipboard_signal_dispatcher(_receiver, *this, &GenodeConsole::handle_cb_rom_change) + _input_signal_dispatcher(genode_env().ep(), *this, &GenodeConsole::handle_input), + _mode_change_signal_dispatcher(genode_env().ep(), *this, &GenodeConsole::handle_mode_change), + _clipboard_signal_dispatcher(genode_env().ep(), *this, &GenodeConsole::handle_cb_rom_change) { for (unsigned i = 0; i <= Input::KEY_MAX; i++) _key_status[i] = 0; @@ -163,7 +162,7 @@ class GenodeConsole : public Console { void init_clipboard(); - void event_loop(IKeyboard * gKeyboard, IMouse * gMouse); + void init_backends(IKeyboard * gKeyboard, IMouse * gMouse); void i_onMouseCapabilityChange(BOOL supportsAbsolute, BOOL supportsRelative, BOOL supportsMT, @@ -229,7 +228,7 @@ class GenodeConsole : public Console { void update_video_mode(); - void handle_input(unsigned); - void handle_mode_change(unsigned); - void handle_cb_rom_change(unsigned); + void handle_input(); + void handle_mode_change(); + void handle_cb_rom_change(); }; diff --git a/repos/ports/src/virtualbox5/frontend/main.cc b/repos/ports/src/virtualbox5/frontend/main.cc index 2ccd801683..f21ea32dc9 100644 --- a/repos/ports/src/virtualbox5/frontend/main.cc +++ b/repos/ports/src/virtualbox5/frontend/main.cc @@ -99,13 +99,13 @@ HRESULT setupmachine(Genode::Env &env) static com::Utf8Str vm_name(c_vbox_vmname); /* Machine object */ - ComObjPtr machine; + static ComObjPtr machine; rc = machine.createObject(); if (FAILED(rc)) return rc; /* Virtualbox object */ - ComObjPtr virtualbox; + static ComObjPtr virtualbox; rc = virtualbox.createObject(); if (FAILED(rc)) return rc; @@ -125,7 +125,7 @@ HRESULT setupmachine(Genode::Env &env) return rc; // open a session - ComObjPtr session; + static ComObjPtr session; rc = session.createObject(); if (FAILED(rc)) return rc; @@ -157,17 +157,17 @@ HRESULT setupmachine(Genode::Env &env) } /* Console object */ - ComPtr gConsole; + static ComPtr gConsole; rc = session->COMGETTER(Console)(gConsole.asOutParam()); /* handle input of Genode and forward it to VMM layer */ - ComPtr genodeConsole = gConsole; + static ComPtr genodeConsole = gConsole; RTLogPrintf("genodeConsole = %p\n", genodeConsole); genodeConsole->init_clipboard(); /* Display object */ - ComPtr display; + static ComPtr display; rc = gConsole->COMGETTER(Display)(display.asOutParam()); if (FAILED(rc)) return rc; @@ -213,16 +213,15 @@ HRESULT setupmachine(Genode::Env &env) Assert (&*gMouse); /* request keyboard object */ - ComPtr gKeyboard; + static ComPtr gKeyboard; rc = gConsole->COMGETTER(Keyboard)(gKeyboard.asOutParam()); if (FAILED(rc)) return rc; Assert (&*gKeyboard); - genodeConsole->event_loop(gKeyboard, gMouse); + genodeConsole->init_backends(gKeyboard, gMouse); - Assert(!"return not expected"); - return E_FAIL; + return rc; } @@ -284,6 +283,4 @@ void Libc::Component::construct(Libc::Env &env) throw -2; } }); - - Genode::error("VMM exiting ..."); }