diff --git a/dwss.cc b/dwss.cc index e1b6593..fa8790b 100644 --- a/dwss.cc +++ b/dwss.cc @@ -10,6 +10,12 @@ #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) { 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) { + for (n_monitors = 1; + (double)width/(double)n_monitors/(double)height > MAX_ASPECT; + n_monitors++) + ; + glViewport(0, 0, width, height); glMatrixMode(GL_PROJECTION); diff --git a/modes/Mode.h b/modes/Mode.h new file mode 100644 index 0000000..4cfc95a --- /dev/null +++ b/modes/Mode.h @@ -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 */ +