Fix stuck statusbar messages when changing tools (bug #398913):

2007-03-14  Michael Natterer  <mitch@gimp.org>

	Fix stuck statusbar messages when changing tools (bug #398913):

	* app/tools/gimptool.[ch]: keep a list of status_displays around.
	Update the list in all status push, replace and pop functions.
	Added gimp_tool_clear_status() which removes the status messages
	from all displays in the list. Call the function from
	gimp_tool_real_control(HALT).

	* app/tools/tool_manager.c (tool_manager_control_active): if we
	can't call gimp_tool_control() because we have no display to pass,
	still call gimp_tool_clear_status() so the messages go away from
	displays the tool was only hovering.


svn path=/trunk/; revision=22123
This commit is contained in:
Michael Natterer 2007-03-14 21:33:09 +00:00 committed by Michael Natterer
parent bb6530592f
commit c16484b71c
4 changed files with 73 additions and 0 deletions

View File

@ -1,3 +1,18 @@
2007-03-14 Michael Natterer <mitch@gimp.org>
Fix stuck statusbar messages when changing tools (bug #398913):
* app/tools/gimptool.[ch]: keep a list of status_displays around.
Update the list in all status push, replace and pop functions.
Added gimp_tool_clear_status() which removes the status messages
from all displays in the list. Call the function from
gimp_tool_real_control(HALT).
* app/tools/tool_manager.c (tool_manager_control_active): if we
can't call gimp_tool_control() because we have no display to pass,
still call gimp_tool_clear_status() so the messages go away from
displays the tool was only hovering.
2007-03-14 Michael Natterer <mitch@gimp.org>
* app/plug-in/gimpplugin.c (gimp_plug_in_new): require either

View File

@ -25,6 +25,7 @@
#include "tools-types.h"
#include "core/gimp.h"
#include "core/gimpcontainer.h"
#include "core/gimpimage.h"
#include "core/gimptoolinfo.h"
@ -172,6 +173,12 @@ gimp_tool_finalize (GObject *object)
tool->control = NULL;
}
if (tool->status_displays)
{
g_list_free (tool->status_displays);
tool->status_displays = NULL;
}
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@ -263,6 +270,7 @@ gimp_tool_real_control (GimpTool *tool,
case GIMP_TOOL_ACTION_HALT:
tool->display = NULL;
gimp_tool_clear_status (tool);
break;
}
}
@ -819,6 +827,9 @@ gimp_tool_push_status (GimpTool *tool,
format, args);
va_end (args);
tool->status_displays = g_list_remove (tool->status_displays, display);
tool->status_displays = g_list_prepend (tool->status_displays, display);
}
void
@ -840,6 +851,9 @@ gimp_tool_push_status_coords (GimpTool *tool,
gimp_statusbar_push_coords (GIMP_STATUSBAR (shell->statusbar),
G_OBJECT_TYPE_NAME (tool),
title, x, separator, y, help);
tool->status_displays = g_list_remove (tool->status_displays, display);
tool->status_displays = g_list_prepend (tool->status_displays, display);
}
void
@ -860,6 +874,9 @@ gimp_tool_push_status_length (GimpTool *tool,
gimp_statusbar_push_length (GIMP_STATUSBAR (shell->statusbar),
G_OBJECT_TYPE_NAME (tool),
title, axis, value, help);
tool->status_displays = g_list_remove (tool->status_displays, display);
tool->status_displays = g_list_prepend (tool->status_displays, display);
}
void
@ -884,6 +901,9 @@ gimp_tool_replace_status (GimpTool *tool,
format, args);
va_end (args);
tool->status_displays = g_list_remove (tool->status_displays, display);
tool->status_displays = g_list_prepend (tool->status_displays, display);
}
void
@ -899,6 +919,37 @@ gimp_tool_pop_status (GimpTool *tool,
gimp_statusbar_pop (GIMP_STATUSBAR (shell->statusbar),
G_OBJECT_TYPE_NAME (tool));
tool->status_displays = g_list_remove (tool->status_displays, display);
}
void
gimp_tool_clear_status (GimpTool *tool)
{
GList *list;
g_return_if_fail (GIMP_IS_TOOL (tool));
list = tool->status_displays;
while (list)
{
GimpDisplay *display = list->data;
/* get next element early because we modify the list */
list = g_list_next (list);
if (gimp_container_have (tool->tool_info->gimp->displays,
(GimpObject *) display))
{
gimp_tool_pop_status (tool, display);
}
else
{
tool->status_displays = g_list_remove (tool->status_displays,
display);
}
}
}
void

View File

@ -62,6 +62,10 @@ struct _GimpTool
gboolean got_motion_event;
GimpCoords button_press_coords;
guint32 button_press_time;
/* private list of displays which have a status message from this tool
*/
GList *status_displays;
};
struct _GimpToolClass
@ -202,6 +206,7 @@ void gimp_tool_replace_status (GimpTool *tool,
...) G_GNUC_PRINTF(3,4);
void gimp_tool_pop_status (GimpTool *tool,
GimpDisplay *display);
void gimp_tool_clear_status (GimpTool *tool);
void gimp_tool_message (GimpTool *tool,
GimpDisplay *display,

View File

@ -267,6 +267,8 @@ tool_manager_control_active (Gimp *gimp,
{
if (gimp_tool_control_is_active (tool->control))
gimp_tool_control_halt (tool->control);
gimp_tool_clear_status (tool);
}
}
}