fixed timekeeping, update event invalidates gdk window

This commit is contained in:
Josh Holtrop 2010-11-24 14:53:36 -05:00
parent 79df97d192
commit b9dd97e383

11
dwss.cc
View File

@ -46,6 +46,7 @@
#include "gs-theme-window.h"
static gchar *geometry = NULL;
static GtkWidget *drawing_area;
static GOptionEntry options[] = {
{"geometry", 0, 0, G_OPTION_ARG_STRING, &geometry,
@ -60,7 +61,7 @@ static uint32_t getElapsedTime()
{
struct timeval tv;
gettimeofday(&tv, NULL);
uint64_t msec = tv.tv_sec + tv.tv_usec / 1000;
uint64_t msec = tv.tv_sec * 1000 + tv.tv_usec / 1000;
return msec - start_msec;
}
@ -133,6 +134,11 @@ configure (GtkWidget *da, GdkEventConfigure *event, gpointer user_data)
static gboolean
update (void *user_data)
{
GdkRectangle rect;
GdkWindow *win = gtk_widget_get_parent_window(drawing_area);
rect.x = rect.y = 0;
gdk_window_get_geometry(win, NULL, NULL, &rect.width, &rect.height, NULL);
gdk_window_invalidate_rect(win, &rect, TRUE);
return TRUE;
}
@ -141,7 +147,6 @@ main (int argc,
char *argv[])
{
GtkWidget *window;
GtkWidget *drawing_area;
GdkGLConfig *glconfig;
GtkStateType state;
@ -207,7 +212,7 @@ main (int argc,
struct timeval tv;
gettimeofday(&tv, NULL);
start_msec = tv.tv_sec + tv.tv_usec / 1000;
start_msec = tv.tv_sec * 1000 + tv.tv_usec / 1000;
gtk_main ();