fixed timekeeping, update event invalidates gdk window
This commit is contained in:
parent
79df97d192
commit
b9dd97e383
11
dwss.cc
11
dwss.cc
@ -46,6 +46,7 @@
|
|||||||
#include "gs-theme-window.h"
|
#include "gs-theme-window.h"
|
||||||
|
|
||||||
static gchar *geometry = NULL;
|
static gchar *geometry = NULL;
|
||||||
|
static GtkWidget *drawing_area;
|
||||||
|
|
||||||
static GOptionEntry options[] = {
|
static GOptionEntry options[] = {
|
||||||
{"geometry", 0, 0, G_OPTION_ARG_STRING, &geometry,
|
{"geometry", 0, 0, G_OPTION_ARG_STRING, &geometry,
|
||||||
@ -60,7 +61,7 @@ static uint32_t getElapsedTime()
|
|||||||
{
|
{
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
gettimeofday(&tv, NULL);
|
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;
|
return msec - start_msec;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,6 +134,11 @@ configure (GtkWidget *da, GdkEventConfigure *event, gpointer user_data)
|
|||||||
static gboolean
|
static gboolean
|
||||||
update (void *user_data)
|
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;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -141,7 +147,6 @@ main (int argc,
|
|||||||
char *argv[])
|
char *argv[])
|
||||||
{
|
{
|
||||||
GtkWidget *window;
|
GtkWidget *window;
|
||||||
GtkWidget *drawing_area;
|
|
||||||
GdkGLConfig *glconfig;
|
GdkGLConfig *glconfig;
|
||||||
|
|
||||||
GtkStateType state;
|
GtkStateType state;
|
||||||
@ -207,7 +212,7 @@ main (int argc,
|
|||||||
|
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
gettimeofday(&tv, NULL);
|
gettimeofday(&tv, NULL);
|
||||||
start_msec = tv.tv_sec + tv.tv_usec / 1000;
|
start_msec = tv.tv_sec * 1000 + tv.tv_usec / 1000;
|
||||||
|
|
||||||
gtk_main ();
|
gtk_main ();
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user