fb_sdl: set size from config

Issue #1414
This commit is contained in:
Emery Hemingway 2015-02-18 16:15:36 -05:00 committed by Christian Helmuth
parent c68828519e
commit f2d6e38cb4
2 changed files with 16 additions and 6 deletions

View File

@ -22,16 +22,27 @@
#include <framebuffer_session/framebuffer_session.h> #include <framebuffer_session/framebuffer_session.h>
#include <cap_session/connection.h> #include <cap_session/connection.h>
#include <input/root.h> #include <input/root.h>
#include <os/config.h>
/* local includes */ /* local includes */
#include <input.h> #include <input.h>
/**
* Read integer value from config attribute
*/
void config_arg(const char *attr, long *value)
{
try { Genode::config()->xml_node().attribute(attr).value(value); }
catch (...) { }
}
/* /*
* Variables for the libSDL output window * Variables for the libSDL output window
*/ */
static SDL_Surface *screen; static SDL_Surface *screen;
static int scr_width = 1024, scr_height = 768; static long scr_width = 1024, scr_height = 768;
static Framebuffer::Mode::Format scr_format = Framebuffer::Mode::RGB565; static Framebuffer::Mode::Format scr_format = Framebuffer::Mode::RGB565;
/* /*
@ -113,9 +124,8 @@ extern "C" int main(int, char**)
using namespace Genode; using namespace Genode;
using namespace Framebuffer; using namespace Framebuffer;
/* config_arg("width", &scr_width);
* FIXME: Read configuration (screen parameters) config_arg("height", &scr_height);
*/
/* /*
* Initialize libSDL window * Initialize libSDL window
@ -130,7 +140,7 @@ extern "C" int main(int, char**)
screen = SDL_SetVideoMode(scr_width, scr_height, bpp*8, SDL_SWSURFACE); screen = SDL_SetVideoMode(scr_width, scr_height, bpp*8, SDL_SWSURFACE);
SDL_ShowCursor(0); SDL_ShowCursor(0);
Genode::printf("creating virtual framebuffer for mode %dx%d@%zd\n", Genode::printf("creating virtual framebuffer for mode %ldx%ld@%zd\n",
scr_width, scr_height, bpp*8); scr_width, scr_height, bpp*8);
/* /*

View File

@ -1,5 +1,5 @@
TARGET = fb_sdl TARGET = fb_sdl
LIBS = lx_hybrid LIBS = lx_hybrid config
REQUIRES = linux sdl REQUIRES = linux sdl
SRC_CC = fb_sdl.cc input.cc SRC_CC = fb_sdl.cc input.cc
LX_LIBS = sdl LX_LIBS = sdl