X-Git-Url: http://pileus.org/git/?p=grits;a=blobdiff_plain;f=src%2Fgrits-opengl.c;fp=src%2Fgrits-opengl.c;h=b2dca5eebab5922e832625d7dc6e85a45cd3369c;hp=a6eb92ca7f34126f681c6be4bd9b4f27cf513d70;hb=536c4ae84ecb423286423bd62bce106dc4a0072d;hpb=6bad3abae971c56ab313545276b3e415a8248039 diff --git a/src/grits-opengl.c b/src/grits-opengl.c index a6eb92c..b2dca5e 100644 --- a/src/grits-opengl.c +++ b/src/grits-opengl.c @@ -216,7 +216,7 @@ static gint run_picking(GritsOpenGL *opengl, GdkEvent *event, return hits; } -static gboolean on_motion_notify(GritsOpenGL *opengl, GdkEventMotion *event, gpointer _) +static gboolean run_mouse_move(GritsOpenGL *opengl, GdkEventMotion *event) { gdouble height = GTK_WIDGET(opengl)->allocation.height; gdouble gl_x = event->x; @@ -265,7 +265,7 @@ static gboolean on_motion_notify(GritsOpenGL *opengl, GdkEventMotion *event, gpo GdkCursor *topcursor = top && top->cursor ? top->cursor : cursor; gdk_window_set_cursor(window, topcursor); - g_debug("GritsOpenGL: on_motion_notify - hits=%d/%d,%d/%d ev=%.0lf,%.0lf", + g_debug("GritsOpenGL: run_mouse_move - hits=%d/%d,%d/%d ev=%.0lf,%.0lf", world_hits, world->len, ortho_hits, ortho->len, gl_x, gl_y); g_ptr_array_free(world, TRUE); @@ -289,6 +289,13 @@ static gboolean on_motion_notify(GritsOpenGL *opengl, GdkEventMotion *event, gpo return FALSE; } +static gboolean on_motion_notify(GritsOpenGL *opengl, GdkEventMotion *event, gpointer _) +{ + opengl->mouse_queue = *event; + gtk_widget_queue_draw(GTK_WIDGET(opengl)); + return FALSE; +} + static void _draw_level(gpointer _level, gpointer _opengl) { GritsOpenGL *opengl = _opengl; @@ -353,7 +360,12 @@ static gboolean on_expose(GritsOpenGL *opengl, GdkEventExpose *event, gpointer _ g_debug("GritsOpenGL: on_expose - begin"); if (opengl->pickmode) - return on_motion_notify(opengl, (GdkEventMotion*)event, NULL); + return run_mouse_move(opengl, (GdkEventMotion*)event); + + if (opengl->mouse_queue.type != GDK_NOTHING) { + run_mouse_move(opengl, &opengl->mouse_queue); + opengl->mouse_queue.type = GDK_NOTHING; + } gtk_gl_begin(GTK_WIDGET(opengl));