Commit 1a14f7fd authored by Christoffer Ackelman's avatar Christoffer Ackelman

Gtk: Removed the redraw timer since we redraw if dirty on scan.

parent 7f9c50f0
...@@ -98,7 +98,6 @@ static GdkColor flow_allocate_color( ...@@ -98,7 +98,6 @@ static GdkColor flow_allocate_color(
static void event_timer(FlowCtx* ctx, int time_ms); static void event_timer(FlowCtx* ctx, int time_ms);
static void cancel_event_timer(FlowCtx* ctx); static void cancel_event_timer(FlowCtx* ctx);
static gboolean event_timer_cb(void* ctx); static gboolean event_timer_cb(void* ctx);
static gboolean redraw_timer_cb(void* ctx);
static void flow_create_cursor(FlowDrawGtk* draw_ctx) static void flow_create_cursor(FlowDrawGtk* draw_ctx)
{ {
...@@ -336,8 +335,6 @@ FlowDrawGtk::~FlowDrawGtk() ...@@ -336,8 +335,6 @@ FlowDrawGtk::~FlowDrawGtk()
{ {
closing_down = 1; closing_down = 1;
cancel_redraw_timer();
ctx->set_nodraw(); ctx->set_nodraw();
delete ctx; delete ctx;
draw_free_gc(this); draw_free_gc(this);
...@@ -1293,28 +1290,6 @@ static void event_timer(FlowCtx* ctx, int time_ms) ...@@ -1293,28 +1290,6 @@ static void event_timer(FlowCtx* ctx, int time_ms)
draw_ctx->timer_id = g_timeout_add(time_ms, event_timer_cb, ctx); 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->redraw_timer = 0;
draw_ctx->ctx->redraw_if_dirty();
return FALSE;
}
void FlowDrawGtk::cancel_redraw_timer()
{
if (redraw_timer) {
g_source_remove(redraw_timer);
redraw_timer = 0;
}
}
void FlowDrawGtk::start_redraw_timer()
{
if (!redraw_timer) {
redraw_timer = g_timeout_add(40, redraw_timer_cb, this);
}
}
void FlowDrawGtk::set_timer(FlowCtx* ctx, int time_ms, void FlowDrawGtk::set_timer(FlowCtx* ctx, int time_ms,
void (*callback_func)(FlowCtx* ctx), void** id) void (*callback_func)(FlowCtx* ctx), void** id)
{ {
......
...@@ -75,7 +75,6 @@ public: ...@@ -75,7 +75,6 @@ public:
GdkColor color_vect[20]; GdkColor color_vect[20];
int color_vect_cnt; int color_vect_cnt;
int closing_down; int closing_down;
guint redraw_timer;
FlowDrawGtk(GtkWidget* toplevel, void** flow_ctx, FlowDrawGtk(GtkWidget* toplevel, void** flow_ctx,
int (*init_proc)(GtkWidget* w, FlowCtx* ctx, void* client_data), int (*init_proc)(GtkWidget* w, FlowCtx* ctx, void* client_data),
...@@ -93,8 +92,6 @@ public: ...@@ -93,8 +92,6 @@ public:
int begin(DrawWind *wind); int begin(DrawWind *wind);
void end(); void end();
void start_redraw_timer();
void cancel_redraw_timer();
void rect(int x, int y, int width, int height, flow_eDrawType gc_type, void rect(int x, int y, int width, int height, flow_eDrawType gc_type,
int fill, int idx, int highlight = 0, int dimmed = 0); int fill, int idx, int highlight = 0, int dimmed = 0);
......
...@@ -515,7 +515,6 @@ void FlowCtx::get_borders() ...@@ -515,7 +515,6 @@ void FlowCtx::get_borders()
void FlowCtx::set_dirty() void FlowCtx::set_dirty()
{ {
is_dirty = 1; is_dirty = 1;
fdraw->start_redraw_timer();
} }
void FlowCtx::redraw_if_dirty() void FlowCtx::redraw_if_dirty()
...@@ -525,7 +524,6 @@ void FlowCtx::redraw_if_dirty() ...@@ -525,7 +524,6 @@ void FlowCtx::redraw_if_dirty()
} }
if (is_dirty) { if (is_dirty) {
is_dirty = 0; is_dirty = 0;
fdraw->cancel_redraw_timer();
fdraw->begin(mw); fdraw->begin(mw);
fdraw->clear(); fdraw->clear();
draw(0, 0, window_width, window_height); draw(0, 0, window_width, window_height);
......
...@@ -59,8 +59,6 @@ public: ...@@ -59,8 +59,6 @@ public:
virtual int begin(DrawWind* wind); virtual int begin(DrawWind* wind);
virtual void end(); virtual void end();
virtual void start_redraw_timer() {}
virtual void cancel_redraw_timer() {}
virtual void rect(int x, int y, int width, int height, flow_eDrawType gc_type, virtual void rect(int x, int y, int width, int height, flow_eDrawType gc_type,
int fill, int idx, int highlight = 0, int dimmed = 0) = 0; int fill, int idx, int highlight = 0, int dimmed = 0) = 0;
......
...@@ -172,7 +172,6 @@ static GdkColor glow_allocate_custom_color(GlowDrawGtk* draw_ctx, ...@@ -172,7 +172,6 @@ static GdkColor glow_allocate_custom_color(GlowDrawGtk* draw_ctx,
static void event_timer(GlowDrawGtk* ctx, int time_ms); static void event_timer(GlowDrawGtk* ctx, int time_ms);
static void cancel_event_timer(GlowDrawGtk* ctx); static void cancel_event_timer(GlowDrawGtk* ctx);
static gboolean event_timer_cb(void* ctx); static gboolean event_timer_cb(void* ctx);
static gboolean redraw_timer_cb(void* ctx);
static int glow_read_color_file( static int glow_read_color_file(
const char* filename, draw_sColor** color_array, int* size); const char* filename, draw_sColor** color_array, int* size);
...@@ -531,8 +530,6 @@ GlowDrawGtk::~GlowDrawGtk() ...@@ -531,8 +530,6 @@ GlowDrawGtk::~GlowDrawGtk()
{ {
closing_down = 1; closing_down = 1;
cancel_redraw_timer();
ctx->set_nodraw(); ctx->set_nodraw();
if (ctx->type() == glow_eCtxType_Grow) if (ctx->type() == glow_eCtxType_Grow)
delete (GrowCtx*)ctx; delete (GrowCtx*)ctx;
...@@ -1633,28 +1630,6 @@ static void event_timer(GlowDrawGtk* draw_ctx, int time_ms) ...@@ -1633,28 +1630,6 @@ static void event_timer(GlowDrawGtk* draw_ctx, int time_ms)
draw_ctx->timer_id = g_timeout_add(time_ms, event_timer_cb, draw_ctx); 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->redraw_timer = 0;
draw_ctx->ctx->redraw_if_dirty();
return FALSE;
}
void GlowDrawGtk::cancel_redraw_timer()
{
if (redraw_timer) {
g_source_remove(redraw_timer);
redraw_timer = 0;
}
}
void GlowDrawGtk::start_redraw_timer()
{
if (!redraw_timer) {
redraw_timer = g_timeout_add(40, redraw_timer_cb, this);
}
}
void GlowDrawGtk::set_timer( void GlowDrawGtk::set_timer(
GlowCtx* gctx, int time_ms, void (*callback_func)(GlowCtx* ctx), void** id) GlowCtx* gctx, int time_ms, void (*callback_func)(GlowCtx* ctx), void** id)
{ {
......
...@@ -111,7 +111,6 @@ public: ...@@ -111,7 +111,6 @@ public:
int closing_down; int closing_down;
GlowCustomColorsGtk* customcolors[CUSTOMCOLORS_STACK_SIZE]; GlowCustomColorsGtk* customcolors[CUSTOMCOLORS_STACK_SIZE];
int customcolors_cnt; int customcolors_cnt;
guint redraw_timer;
void event_handler(GdkEvent event); void event_handler(GdkEvent event);
void enable_event(glow_eEvent event, glow_eEventType event_type, void enable_event(glow_eEvent event, glow_eEventType event_type,
...@@ -120,8 +119,6 @@ public: ...@@ -120,8 +119,6 @@ public:
int begin(DrawWind* wind); int begin(DrawWind* wind);
void end(bool flush = true); void end(bool flush = true);
void start_redraw_timer();
void cancel_redraw_timer();
void get_window_size(DrawWind* w, int* width, int* height); void get_window_size(DrawWind* w, int* width, int* height);
void set_window_size(DrawWind* w, int width, int height); void set_window_size(DrawWind* w, int width, int height);
......
...@@ -672,7 +672,6 @@ void GlowCtx::get_borders() ...@@ -672,7 +672,6 @@ void GlowCtx::get_borders()
void GlowCtx::set_dirty() void GlowCtx::set_dirty()
{ {
is_dirty = 1; is_dirty = 1;
gdraw->start_redraw_timer();
} }
void GlowCtx::redraw_if_dirty() void GlowCtx::redraw_if_dirty()
...@@ -682,7 +681,6 @@ void GlowCtx::redraw_if_dirty() ...@@ -682,7 +681,6 @@ void GlowCtx::redraw_if_dirty()
} }
if (is_dirty) { if (is_dirty) {
is_dirty = 0; is_dirty = 0;
gdraw->cancel_redraw_timer();
gdraw->begin(mw); gdraw->begin(mw);
gdraw->clear(); gdraw->clear();
draw(mw, 0, 0, mw->window_width, mw->window_height); draw(mw, 0, 0, mw->window_width, mw->window_height);
......
...@@ -81,8 +81,6 @@ public: ...@@ -81,8 +81,6 @@ public:
virtual int begin(DrawWind* wind) = 0; virtual int begin(DrawWind* wind) = 0;
virtual void end(bool flush = true) = 0; virtual void end(bool flush = true) = 0;
virtual void start_redraw_timer() {}
virtual void cancel_redraw_timer() {}
virtual void rect(int x, int y, int width, int height, glow_eDrawType gc_type, virtual void rect(int x, int y, int width, int height, glow_eDrawType gc_type,
int fill, int idx, int highlight = 0) = 0; int fill, int idx, int highlight = 0) = 0;
......
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