Implement SDL_WM_SetCaption for Nitpicker

This commit is contained in:
Emery Hemingway
2019-06-13 14:33:14 +02:00
committed by Norman Feske
parent 492ac57199
commit a2c68c5c19
2 changed files with 13 additions and 2 deletions

View File

@@ -63,7 +63,7 @@ Genode::Env &global_env()
Nitpicker::Connection &global_nitpicker() Nitpicker::Connection &global_nitpicker()
{ {
if (!_global_nitpicker.constructed()) if (!_global_nitpicker.constructed())
_global_nitpicker.construct(global_env(), "SDL"); _global_nitpicker.construct(global_env());
return *_global_nitpicker; return *_global_nitpicker;
} }

View File

@@ -118,6 +118,12 @@ extern "C" {
void refresh(int x, int y, int w, int h) { void refresh(int x, int y, int w, int h) {
_nitpicker.framebuffer()->refresh(x, y, w, h); } _nitpicker.framebuffer()->refresh(x, y, w, h); }
void title(char const *string)
{
_nitpicker.enqueue<Nitpicker::Session::Command::Title>(_view, string);
_nitpicker.execute();
}
}; };
static Genode::Constructible<Sdl_framebuffer> framebuffer; static Genode::Constructible<Sdl_framebuffer> framebuffer;
@@ -299,6 +305,11 @@ extern "C" {
} }
} }
static void Genode_Fb_SetCaption(SDL_VideoDevice *device, const char *title, const char *icon)
{
if (title && framebuffer.constructed())
framebuffer->title(title);
}
static SDL_VideoDevice *Genode_Fb_CreateDevice(int devindex) static SDL_VideoDevice *Genode_Fb_CreateDevice(int devindex)
{ {
@@ -340,7 +351,7 @@ extern "C" {
device->SetHWColorKey = 0; device->SetHWColorKey = 0;
device->SetHWAlpha = 0; device->SetHWAlpha = 0;
device->FlipHWSurface = 0; device->FlipHWSurface = 0;
device->SetCaption = 0; device->SetCaption = Genode_Fb_SetCaption;
device->SetIcon = 0; device->SetIcon = 0;
device->IconifyWindow = 0; device->IconifyWindow = 0;
device->GrabInput = 0; device->GrabInput = 0;