vbox: adapt to framebuffer mode on startup

This works only if guest additions are installed and those report
"graphics=yes".

Related to #1554
This commit is contained in:
Christian Helmuth 2015-06-02 15:58:10 +02:00
parent e1896e3b44
commit 93f0cde72f
4 changed files with 31 additions and 2 deletions

View File

@ -122,7 +122,6 @@ append config_of_app {
<service name="Framebuffer" />
<service name="Input" />
</provides>
<config width="1024" height="768" />
</start>
<start name="vbox" priority="-2">

View File

@ -5,10 +5,13 @@
#include "ConsoleImpl.h"
#include "MachineImpl.h"
#include "MouseImpl.h"
#include "DisplayImpl.h"
#include "GuestImpl.h"
#include "dummy/macros.h"
#include "console.h"
#include "fb.h"
static const bool debug = false;
@ -72,7 +75,6 @@ HRESULT Console::RestoreSnapshot(ISnapshot*, IProgress**)
HRESULT Console::Teleport(IN_BSTR, ULONG, IN_BSTR, ULONG, IProgress **) DUMMY(E_FAIL)
HRESULT Console::setDiskEncryptionKeys(const Utf8Str &strCfg) DUMMY(E_FAIL)
void Console::onAdditionsStateChange() TRACE()
void Console::onAdditionsOutdated() DUMMY()
void Console::onKeyboardLedsChange(bool, bool, bool) TRACE()
@ -112,6 +114,28 @@ void fireRuntimeErrorEvent(IEventSource* aSource, BOOL a_fatal,
TRACE();
}
void Console::onAdditionsStateChange()
{
dynamic_cast<GenodeConsole *>(this)->update_video_mode();
}
void GenodeConsole::update_video_mode()
{
Display *d = getDisplay();
Guest *g = getGuest();
Genodefb *fb = dynamic_cast<Genodefb *>(d->getFramebuffer());
LONG64 ignored = 0;
AdditionsFacilityType_T is_graphics;
g->GetFacilityStatus(AdditionsFacilityType_Graphics, &ignored, &is_graphics);
if (fb && is_graphics)
d->SetVideoModeHint(0 /*=display*/,
true /*=enabled*/, false /*=changeOrigin*/,
0 /*=originX*/, 0 /*=originY*/,
fb->w(), fb->h(), fb->depth());
}
void GenodeConsole::eventWait(IKeyboard * gKeyboard, IMouse * gMouse)
{
static LONG64 mt_events [64];

View File

@ -207,4 +207,6 @@ class GenodeConsole : public Console {
_shape_report_connection.submit(sizeof(Vbox_pointer::Shape_report));
}
void update_video_mode();
};

View File

@ -47,6 +47,10 @@ class Genodefb :
Assert(rc == VINF_SUCCESS);
}
int w() const { return _fb_mode.width(); }
int h() const { return _fb_mode.height(); }
int depth() const { return 16; /* XXX */ }
STDMETHODIMP COMGETTER(Width)(ULONG *width)
{
if (!width)