dwss: only create modes after initializing the OpenGL rendering context

This commit is contained in:
Josh Holtrop 2010-11-25 23:26:29 -05:00
parent 12eb23e8ec
commit e2dc328996

13
dwss.cc
View File

@ -16,11 +16,11 @@ using namespace std;
#define MAX_ASPECT (16.0/9.0*1.02)
static int n_monitors = 1;
static Mode *current_mode;
static Mode *current_mode = NULL;
static bool expose (GnomeScreensaver & gs)
{
return current_mode->expose(gs);
return current_mode != NULL ? current_mode->expose(gs) : true;
}
static bool configure (GnomeScreensaver & gs, int width, int height)
@ -30,23 +30,26 @@ static bool configure (GnomeScreensaver & gs, int width, int height)
n_monitors++)
;
return current_mode->configure(gs, width, height);
return current_mode != NULL
? current_mode->configure(gs, width, height)
: true;
}
static bool update (GnomeScreensaver & gs)
{
return current_mode->update(gs);
return current_mode != NULL ? current_mode->update(gs) : true;
}
int main (int argc, char *argv[])
{
GnomeScreensaver gs(&argc, &argv, configure, expose, update, 12);
Mode *modes[] = {
new Spin()
};
current_mode = modes[0];
GnomeScreensaver gs(&argc, &argv, configure, expose, update, 12);
gs.mainloop();
for (int i = 0; i < sizeof(modes)/sizeof(modes[0]); i++)