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;
|
GtkStateType state;
|
||||||
GError *error = NULL;
|
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,
|
gtk_init_with_args (argc, argv,
|
||||||
_(""),
|
_(""),
|
||||||
options, NULL, &error);
|
options, NULL, &error);
|
||||||
@ -94,12 +100,6 @@ GnomeScreensaver::GnomeScreensaver(int *argc, char ***argv,
|
|||||||
gtk_widget_show (window);
|
gtk_widget_show (window);
|
||||||
|
|
||||||
gtk_timeout_add(interval_msec, update, this);
|
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()
|
uint32_t GnomeScreensaver::getTicks()
|
||||||
@ -144,13 +144,14 @@ gboolean GnomeScreensaver::configureCB(GtkWidget *da, GdkEventConfigure *event)
|
|||||||
|
|
||||||
m_width = da->allocation.width;
|
m_width = da->allocation.width;
|
||||||
m_height = da->allocation.height;
|
m_height = da->allocation.height;
|
||||||
m_aspect_ratio = (float)m_width / (float)m_height;
|
|
||||||
|
|
||||||
for (m_n_monitors = 1;
|
for (m_n_monitors = 1;
|
||||||
(double)m_width/(double)m_n_monitors/(double)m_height > MAX_ASPECT;
|
(double)m_width/(double)m_n_monitors/(double)m_height > MAX_ASPECT;
|
||||||
m_n_monitors++)
|
m_n_monitors++)
|
||||||
;
|
;
|
||||||
|
|
||||||
|
m_aspect_ratio = (float)m_width / (float)m_n_monitors / (float)m_height;
|
||||||
|
|
||||||
gboolean rc = m_configure_callback(*this);
|
gboolean rc = m_configure_callback(*this);
|
||||||
|
|
||||||
gdk_gl_drawable_gl_end(gldrawable);
|
gdk_gl_drawable_gl_end(gldrawable);
|
||||||
|
@ -36,6 +36,7 @@ class GnomeScreensaver
|
|||||||
int getWidth() { return m_width; }
|
int getWidth() { return m_width; }
|
||||||
int getHeight() { return m_height; }
|
int getHeight() { return m_height; }
|
||||||
float getAspectRatio() { return m_aspect_ratio; }
|
float getAspectRatio() { return m_aspect_ratio; }
|
||||||
|
int getNumMonitors() { return m_n_monitors; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
GtkWidget *m_drawing_area;
|
GtkWidget *m_drawing_area;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user