Commit 05b57d00 authored by Christoffer Ackelman's avatar Christoffer Ackelman

GTK: Added a redraw timer, since GTK doesn't generate exposure/redraw events...

GTK: Added a redraw timer, since GTK doesn't generate exposure/redraw events every 1 ms like QT does.
parent 34d5ef7e
......@@ -98,6 +98,7 @@ static GdkColor flow_allocate_color(
static void event_timer(FlowCtx* ctx, int time_ms);
static void cancel_event_timer(FlowCtx* ctx);
static gboolean event_timer_cb(void* ctx);
static gboolean redraw_timer_cb(void* ctx);
static void flow_create_cursor(FlowDrawGtk* draw_ctx)
{
......@@ -335,6 +336,9 @@ FlowDrawGtk::~FlowDrawGtk()
{
closing_down = 1;
if (redraw_timer)
g_source_remove(redraw_timer);
ctx->set_nodraw();
delete ctx;
draw_free_gc(this);
......@@ -462,6 +466,8 @@ FlowDrawGtk::FlowDrawGtk(GtkWidget* x_toplevel, void** flow_ctx,
flow_create_cursor(this);
init_proc(toplevel, ctx, client_data);
redraw_timer = g_timeout_add(40, redraw_timer_cb, this);
}
void FlowDrawGtk::init_nav(GtkWidget* nav_widget, void* flow_ctx)
......@@ -1290,6 +1296,12 @@ static void event_timer(FlowCtx* ctx, int time_ms)
draw_ctx->timer_id = g_timeout_add(time_ms, event_timer_cb, ctx);
}
static gboolean redraw_timer_cb(void* data) {
FlowDrawGtk* draw_ctx = (FlowDrawGtk*)data;
draw_ctx->ctx->redraw_if_dirty();
return TRUE;
}
void FlowDrawGtk::set_timer(FlowCtx* ctx, int time_ms,
void (*callback_func)(FlowCtx* ctx), void** id)
{
......
......@@ -75,6 +75,7 @@ public:
GdkColor color_vect[20];
int color_vect_cnt;
int closing_down;
guint redraw_timer;
FlowDrawGtk(GtkWidget* toplevel, void** flow_ctx,
int (*init_proc)(GtkWidget* w, FlowCtx* ctx, void* client_data),
......
......@@ -172,6 +172,7 @@ static GdkColor glow_allocate_custom_color(GlowDrawGtk* draw_ctx,
static void event_timer(GlowDrawGtk* ctx, int time_ms);
static void cancel_event_timer(GlowDrawGtk* ctx);
static gboolean event_timer_cb(void* ctx);
static gboolean redraw_timer_cb(void* ctx);
static int glow_read_color_file(
const char* filename, draw_sColor** color_array, int* size);
......@@ -532,6 +533,9 @@ GlowDrawGtk::~GlowDrawGtk()
{
closing_down = 1;
if (redraw_timer)
g_source_remove(redraw_timer);
ctx->set_nodraw();
if (ctx->type() == glow_eCtxType_Grow)
delete (GrowCtx*)ctx;
......@@ -620,6 +624,8 @@ GlowDrawGtk::GlowDrawGtk(GtkWidget* toplevel, void** glow_ctx,
get_window_size(ctx->mw, &ctx->mw->window_width, &ctx->mw->window_height);
create_buffer(&m_wind);
init_proc(toplevel, ctx, client_data);
redraw_timer = g_timeout_add(40, redraw_timer_cb, this);
}
void GlowDrawGtk::event_handler(GdkEvent event)
......@@ -1635,6 +1641,12 @@ static void event_timer(GlowDrawGtk* draw_ctx, int time_ms)
draw_ctx->timer_id = g_timeout_add(time_ms, event_timer_cb, draw_ctx);
}
static gboolean redraw_timer_cb(void* data) {
GlowDrawGtk* draw_ctx = (GlowDrawGtk*)data;
draw_ctx->ctx->redraw_if_dirty();
return TRUE;
}
void GlowDrawGtk::set_timer(
GlowCtx* gctx, int time_ms, void (*callback_func)(GlowCtx* ctx), void** id)
{
......
......@@ -112,6 +112,7 @@ public:
int closing_down;
GlowCustomColorsGtk* customcolors[CUSTOMCOLORS_STACK_SIZE];
int customcolors_cnt;
guint redraw_timer;
void event_handler(GdkEvent event);
void enable_event(glow_eEvent event, glow_eEventType event_type,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment