calculate number of monitors; added Mode.h abstract class

This commit is contained in:
Josh Holtrop 2010-11-24 16:02:02 -05:00
parent cdfc27bfbb
commit f2aa2ff908
2 changed files with 28 additions and 0 deletions

11
dwss.cc
View File

@ -10,6 +10,12 @@
#include "GnomeScreensaver.h" #include "GnomeScreensaver.h"
using namespace std;
#define MAX_ASPECT (16.0/9.0*1.02)
static int n_monitors = 1;
static bool expose (GnomeScreensaver & gs) static bool expose (GnomeScreensaver & gs)
{ {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
@ -31,6 +37,11 @@ static bool expose (GnomeScreensaver & gs)
static bool configure (GnomeScreensaver & gs, int width, int height) static bool configure (GnomeScreensaver & gs, int width, int height)
{ {
for (n_monitors = 1;
(double)width/(double)n_monitors/(double)height > MAX_ASPECT;
n_monitors++)
;
glViewport(0, 0, width, height); glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION); glMatrixMode(GL_PROJECTION);

17
modes/Mode.h Normal file
View File

@ -0,0 +1,17 @@
#ifndef MODE_H
#define MODE_H
#include "GnomeScreensaver.h"
class Mode
{
public:
virtual bool expose (GnomeScreensaver & gs) = 0;
virtual bool configure (GnomeScreensaver & gs, int width,
int height) = 0;
virtual bool update (GnomeScreensaver & gs) = 0;
};
#endif /* MODE_H */