Skip to content

Commit

Permalink
fix resolution(for users without windowmanager)
Browse files Browse the repository at this point in the history
  • Loading branch information
betacentauri committed Feb 23, 2012
1 parent d887b2d commit 5e93025
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
25 changes: 21 additions & 4 deletions enigma2/lib/gdi/gxlibdc.cpp
Expand Up @@ -49,6 +49,12 @@ static bool getConfigBool(const std::string &key, bool defaultValue)
return defaultValue;
}

static int getConfigInt(const std::string &key)
{
std::string value = getConfigString(key, "0");
return atoi(value.c_str());
}

gXlibDC::gXlibDC() : m_pump(eApp, 1)
{
double res_h, res_v;
Expand All @@ -60,6 +66,8 @@ gXlibDC::gXlibDC() : m_pump(eApp, 1)

argb_buffer = NULL;
fullscreen = getConfigBool("config.pc.default_fullscreen", false);
initialWindowWidth = getConfigInt("config.pc.initial_window_width");
initialWindowHeight = getConfigInt("config.pc.initial_window_height");
windowWidth = 720;
windowHeight = 576;
xpos = 0;
Expand Down Expand Up @@ -90,7 +98,10 @@ gXlibDC::gXlibDC() : m_pump(eApp, 1)
}

XLockDisplay(display);
window = XCreateSimpleWindow(display, XDefaultRootWindow(display), xpos, ypos, windowWidth, windowHeight, 0, 0, 0);
if (initialWindowWidth && initialWindowHeight)
window = XCreateSimpleWindow(display, XDefaultRootWindow(display), xpos, ypos, initialWindowWidth, initialWindowHeight, 0, 0, 0);
else
window = XCreateSimpleWindow(display, XDefaultRootWindow(display), xpos, ypos, windowWidth, windowHeight, 0, 0, 0);
XSelectInput (display, window, INPUT_MOTION);
XMapRaised(display, window);
res_h = (DisplayWidth(display, screen) * 1000 / DisplayWidthMM(display, screen));
Expand Down Expand Up @@ -239,16 +250,22 @@ void gXlibDC::setResolution(int xres, int yres)
m_surface.offset = 0;

m_pixmap = new gPixmap(&m_surface);

XResizeWindow(display, window, windowWidth, windowHeight);

if (initialWindowWidth == 0 || initialWindowHeight == 0)
XResizeWindow(display, window, windowWidth, windowHeight);
updateWindowState();
}

void gXlibDC::updateWindowState() {
if (fullscreen) {
width = DisplayWidth( display, screen );
height = DisplayHeight( display, screen );
} else {
} else if (initialWindowWidth && initialWindowHeight)
{
width = initialWindowWidth;
height = initialWindowHeight;
} else
{
width = windowWidth;
height = windowHeight;
}
Expand Down
1 change: 1 addition & 0 deletions enigma2/lib/gdi/gxlibdc.h
Expand Up @@ -29,6 +29,7 @@ class gXlibDC: public gMainDC, public eThread, public Object
x11_visual_t vis;
int fullscreen;
int windowWidth, windowHeight;
int initialWindowWidth, initialWindowHeight;
cXineLib *xineLib;
gSurface m_surface;
uint32_t *argb_buffer;
Expand Down

0 comments on commit 5e93025

Please sign in to comment.