zzogl-pg: A quick persistant window hack.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2924 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
arcum42 2010-04-28 02:56:40 +00:00
parent d2c63c7bbc
commit 5c20358c19
4 changed files with 26 additions and 2 deletions

View File

@ -60,6 +60,9 @@ bool GLWindow::ReleaseWindow()
void GLWindow::CloseWindow()
{
conf.x = x;
conf.y = y;
SaveConfig();
if ( glDisplay != NULL )
{
XCloseDisplay(glDisplay);
@ -79,6 +82,9 @@ bool GLWindow::DisplayWindow(int _width, int _height)
Window winDummy;
unsigned int borderDummy;
x = conf.x;
y = conf.y;
// attributes for a single buffered visual in RGBA format with at least
// 8 bits per color and a 24 bit depth buffer
int attrListSgl[] = {GLX_RGBA, GLX_RED_SIZE, 8,
@ -200,6 +206,7 @@ bool GLWindow::DisplayWindow(int _width, int _height)
XSetWMProtocols(glDisplay, glWindow, &wmDelete, 1);
XSetStandardProperties(glDisplay, glWindow, "ZZOgl-PG", "ZZOgl-PG", None, NULL, 0, NULL);
XMapRaised(glDisplay, glWindow);
XMoveWindow(glDisplay, glWindow, x, y);
}
// connect the glx-context to the window
@ -240,11 +247,17 @@ void GLWindow::ResizeCheck()
while(XCheckTypedEvent(glDisplay, ConfigureNotify, &event))
{
if ((event.xconfigure.width != width) || (event.xconfigure.height != height)) {
if ((event.xconfigure.width != width) || (event.xconfigure.height != height))
{
ZeroGS::ChangeWindowSize(event.xconfigure.width, event.xconfigure.height);
width = event.xconfigure.width;
height = event.xconfigure.height;
}
if ((event.xconfigure.x != x) || (event.xconfigure.y != y))
{
x = event.xconfigure.x;
y = event.xconfigure.y;
}
}
}

View File

@ -43,6 +43,8 @@ void SaveConfig()
fprintf(f, "gamesettings = %x\n", conf.gamesettings); //u32
fprintf(f, "width = %x\n", conf.width); //u32
fprintf(f, "height = %x\n", conf.height); //u32
fprintf(f, "x = %x\n", conf.x); //u32
fprintf(f, "y = %x\n", conf.y); //u32
fprintf(f, "log = %x\n", conf.log); //u32
fclose(f);
}
@ -57,6 +59,8 @@ void LoadConfig()
conf.bilinear = 1;
conf.width = 640;
conf.height = 480;
conf.x = 0;
conf.y = 0;
conf.aa = 0;
conf.log = 1;
@ -76,6 +80,8 @@ void LoadConfig()
err = fscanf(f, "gamesettings = %x\n", &conf.gamesettings);//u32
err = fscanf(f, "width = %x\n", &conf.width);//u32
err = fscanf(f, "height = %x\n", &conf.height);//u32
err = fscanf(f, "x = %x\n", &conf.x);//u32
err = fscanf(f, "y = %x\n", &conf.y);//u32
err = fscanf(f, "log = %x\n", &conf.log);//u32
fclose(f);
@ -112,5 +118,10 @@ void LoadConfig()
conf.width = 640;
conf.height = 480;
}
if( conf.x <= 0 || conf.y <= 0 )
{
conf.x = 0;
conf.y = 0;
}
}

View File

@ -160,6 +160,7 @@ typedef struct
u32 options; // game options -- different hacks.
u32 gamesettings;// default game settings
int width, height; // View target size, has no impact towards speed
int x, y; // Lets try for a persistant window position.
bool isWideScreen; // Widescreen support
u32 log;
} GSconf;

View File

@ -194,7 +194,6 @@ ZeroGS::Create_Window(int _width, int _height) {
nBackbufferHeight = _height;
fiRendWidth = 1.0f / nBackbufferWidth;
fiRendHeight = 1.0f / nBackbufferHeight;
if (!GLWin.DisplayWindow(_width, _height)) return false;
s_nFullscreen = (conf.options & GSOPTION_FULLSCREEN) ? 1 : 0;