GnomeScreensaver: fix #monitors calculation, added getNumMonitors()
This commit is contained in:
parent
5eafc52361
commit
15dc4f8d75
@ -43,6 +43,12 @@ GnomeScreensaver::GnomeScreensaver(int *argc, char ***argv,
|
||||
GtkStateType state;
|
||||
GError *error = NULL;
|
||||
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
m_start_msec = tv.tv_sec * 1000 + tv.tv_usec / 1000;
|
||||
|
||||
m_n_monitors = 1;
|
||||
|
||||
gtk_init_with_args (argc, argv,
|
||||
_(""),
|
||||
options, NULL, &error);
|
||||
@ -94,12 +100,6 @@ GnomeScreensaver::GnomeScreensaver(int *argc, char ***argv,
|
||||
gtk_widget_show (window);
|
||||
|
||||
gtk_timeout_add(interval_msec, update, this);
|
||||
|
||||
struct timeval tv;
|
||||
gettimeofday(&tv, NULL);
|
||||
m_start_msec = tv.tv_sec * 1000 + tv.tv_usec / 1000;
|
||||
|
||||
m_n_monitors = 1;
|
||||
}
|
||||
|
||||
uint32_t GnomeScreensaver::getTicks()
|
||||
@ -144,13 +144,14 @@ gboolean GnomeScreensaver::configureCB(GtkWidget *da, GdkEventConfigure *event)
|
||||
|
||||
m_width = da->allocation.width;
|
||||
m_height = da->allocation.height;
|
||||
m_aspect_ratio = (float)m_width / (float)m_height;
|
||||
|
||||
for (m_n_monitors = 1;
|
||||
(double)m_width/(double)m_n_monitors/(double)m_height > MAX_ASPECT;
|
||||
m_n_monitors++)
|
||||
;
|
||||
|
||||
m_aspect_ratio = (float)m_width / (float)m_n_monitors / (float)m_height;
|
||||
|
||||
gboolean rc = m_configure_callback(*this);
|
||||
|
||||
gdk_gl_drawable_gl_end(gldrawable);
|
||||
|
@ -36,6 +36,7 @@ class GnomeScreensaver
|
||||
int getWidth() { return m_width; }
|
||||
int getHeight() { return m_height; }
|
||||
float getAspectRatio() { return m_aspect_ratio; }
|
||||
int getNumMonitors() { return m_n_monitors; }
|
||||
|
||||
protected:
|
||||
GtkWidget *m_drawing_area;
|
||||
|
Loading…
x
Reference in New Issue
Block a user