mirror of https://github.com/GNOME/gimp.git
app: add back the draw timeout
This commit is contained in:
parent
38153d7476
commit
11bc11d2f7
|
@ -55,6 +55,10 @@
|
||||||
#include "gimpdrawtool.h"
|
#include "gimpdrawtool.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define DRAW_TIMEOUT 4
|
||||||
|
#define USE_TIMEOUT 1
|
||||||
|
|
||||||
|
|
||||||
static void gimp_draw_tool_dispose (GObject *object);
|
static void gimp_draw_tool_dispose (GObject *object);
|
||||||
|
|
||||||
static gboolean gimp_draw_tool_has_display (GimpTool *tool,
|
static gboolean gimp_draw_tool_has_display (GimpTool *tool,
|
||||||
|
@ -118,6 +122,14 @@ gimp_draw_tool_init (GimpDrawTool *draw_tool)
|
||||||
static void
|
static void
|
||||||
gimp_draw_tool_dispose (GObject *object)
|
gimp_draw_tool_dispose (GObject *object)
|
||||||
{
|
{
|
||||||
|
GimpDrawTool *draw_tool = GIMP_DRAW_TOOL (object);
|
||||||
|
|
||||||
|
if (draw_tool->draw_timeout)
|
||||||
|
{
|
||||||
|
g_source_remove (draw_tool->draw_timeout);
|
||||||
|
draw_tool->draw_timeout = 0;
|
||||||
|
}
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,10 +186,24 @@ gimp_draw_tool_control (GimpTool *tool,
|
||||||
GIMP_TOOL_CLASS (parent_class)->control (tool, action, display);
|
GIMP_TOOL_CLASS (parent_class)->control (tool, action, display);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef USE_TIMEOUT
|
||||||
|
static gboolean
|
||||||
|
gimp_draw_tool_draw_timeout (GimpDrawTool *draw_tool)
|
||||||
|
{
|
||||||
|
draw_tool->draw_timeout = 0;
|
||||||
|
|
||||||
|
gimp_draw_tool_draw (draw_tool);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_draw_tool_draw (GimpDrawTool *draw_tool)
|
gimp_draw_tool_draw (GimpDrawTool *draw_tool)
|
||||||
{
|
{
|
||||||
if (draw_tool->display && draw_tool->paused_count == 0)
|
if (draw_tool->display &&
|
||||||
|
draw_tool->paused_count == 0 &&
|
||||||
|
! draw_tool->draw_timeout)
|
||||||
{
|
{
|
||||||
gimp_draw_tool_undraw (draw_tool);
|
gimp_draw_tool_undraw (draw_tool);
|
||||||
|
|
||||||
|
@ -243,6 +269,12 @@ gimp_draw_tool_stop (GimpDrawTool *draw_tool)
|
||||||
|
|
||||||
gimp_draw_tool_undraw (draw_tool);
|
gimp_draw_tool_undraw (draw_tool);
|
||||||
|
|
||||||
|
if (draw_tool->draw_timeout)
|
||||||
|
{
|
||||||
|
g_source_remove (draw_tool->draw_timeout);
|
||||||
|
draw_tool->draw_timeout = 0;
|
||||||
|
}
|
||||||
|
|
||||||
draw_tool->display = NULL;
|
draw_tool->display = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,6 +292,12 @@ gimp_draw_tool_pause (GimpDrawTool *draw_tool)
|
||||||
g_return_if_fail (GIMP_IS_DRAW_TOOL (draw_tool));
|
g_return_if_fail (GIMP_IS_DRAW_TOOL (draw_tool));
|
||||||
|
|
||||||
draw_tool->paused_count++;
|
draw_tool->paused_count++;
|
||||||
|
|
||||||
|
if (draw_tool->draw_timeout)
|
||||||
|
{
|
||||||
|
g_source_remove (draw_tool->draw_timeout);
|
||||||
|
draw_tool->draw_timeout = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -270,7 +308,16 @@ gimp_draw_tool_resume (GimpDrawTool *draw_tool)
|
||||||
|
|
||||||
draw_tool->paused_count--;
|
draw_tool->paused_count--;
|
||||||
|
|
||||||
|
#ifdef USE_TIMEOUT
|
||||||
|
if (draw_tool->paused_count == 0 && ! draw_tool->draw_timeout)
|
||||||
|
draw_tool->draw_timeout =
|
||||||
|
gdk_threads_add_timeout_full (G_PRIORITY_HIGH_IDLE,
|
||||||
|
DRAW_TIMEOUT,
|
||||||
|
(GSourceFunc) gimp_draw_tool_draw_timeout,
|
||||||
|
draw_tool, NULL);
|
||||||
|
#else
|
||||||
gimp_draw_tool_draw (draw_tool);
|
gimp_draw_tool_draw (draw_tool);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -41,6 +41,7 @@ struct _GimpDrawTool
|
||||||
*/
|
*/
|
||||||
|
|
||||||
gint paused_count; /* count to keep track of multiple pauses */
|
gint paused_count; /* count to keep track of multiple pauses */
|
||||||
|
guint draw_timeout; /* draw delay timeout ID */
|
||||||
|
|
||||||
GimpCanvasItem *item;
|
GimpCanvasItem *item;
|
||||||
GList *group_stack;
|
GList *group_stack;
|
||||||
|
|
Loading…
Reference in New Issue