Commit 51537fd6 authored by Manish Singh's avatar Manish Singh Committed by Manish Singh
Browse files

use a low priority idle handler to queue redraws, since we really want

2002-11-09  Manish Singh  <yosh@gimp.org>

        * app/widgets/gimppreview.[ch]: use a low priority idle handler to
        queue redraws, since we really want updates when nothing else is
        going on.
parent 3ad08f00
2002-11-09 Manish Singh <yosh@gimp.org>
* app/widgets/gimppreview.[ch]: use a low priority idle handler to
queue redraws, since we really want updates when nothing else is
going on.
2002-11-09 Sven Neumann <sven@gimp.org>
 
* app/widgets/gimpselectioneditor.c
......
......@@ -85,6 +85,7 @@ static gboolean gimp_preview_enter_notify_event (GtkWidget *widget,
static gboolean gimp_preview_leave_notify_event (GtkWidget *widget,
GdkEventCrossing *event);
static gboolean gimp_preview_idle_update (GimpPreview *preview);
static void gimp_preview_render (GimpPreview *preview);
static void gimp_preview_real_render (GimpPreview *preview);
static void gimp_preview_get_size (GimpPreview *preview,
......@@ -235,6 +236,7 @@ gimp_preview_init (GimpPreview *preview)
preview->size = -1;
preview->in_button = FALSE;
preview->idle_id = 0;
preview->needs_render = TRUE;
preview->popup_id = 0;
preview->popup_x = 0;
......@@ -250,6 +252,12 @@ gimp_preview_destroy (GtkObject *object)
preview = GIMP_PREVIEW (object);
if (preview->idle_id)
{
g_source_remove (preview->idle_id);
preview->idle_id = 0;
}
gimp_preview_popup_hide (preview);
if (preview->viewable)
......@@ -659,8 +667,7 @@ gimp_preview_set_viewable (GimpPreview *preview,
preview->border_width);
}
preview->needs_render = TRUE;
gtk_widget_queue_draw (GTK_WIDGET (preview));
gimp_preview_update (preview);
}
}
......@@ -738,8 +745,7 @@ gimp_preview_set_dot_for_dot (GimpPreview *preview,
preview->border_width);
}
preview->needs_render = TRUE;
gtk_widget_queue_draw (GTK_WIDGET (preview));
gimp_preview_update (preview);
}
}
......@@ -754,8 +760,7 @@ gimp_preview_set_border_color (GimpPreview *preview,
{
preview->border_color = *color;
preview->needs_render = TRUE;
gtk_widget_queue_draw (GTK_WIDGET (preview));
gimp_preview_update (preview);
}
}
......@@ -764,13 +769,34 @@ gimp_preview_update (GimpPreview *preview)
{
g_return_if_fail (GIMP_IS_PREVIEW (preview));
preview->needs_render = TRUE;
gtk_widget_queue_draw (GTK_WIDGET (preview));
if (preview->idle_id)
{
g_source_remove (preview->idle_id);
}
preview->idle_id =
g_idle_add_full (G_PRIORITY_LOW,
(GSourceFunc) gimp_preview_idle_update, preview,
NULL);
}
/* private functions */
static gboolean
gimp_preview_idle_update (GimpPreview *preview)
{
preview->idle_id = 0;
if (! preview->viewable)
return FALSE;
preview->needs_render = TRUE;
gtk_widget_queue_draw (GTK_WIDGET (preview));
return FALSE;
}
static void
gimp_preview_render (GimpPreview *preview)
{
......@@ -963,8 +989,7 @@ gimp_preview_size_changed (GimpPreview *preview,
}
else
{
preview->needs_render = TRUE;
gtk_widget_queue_draw (GTK_WIDGET (preview));
gimp_preview_update (preview);
}
}
......
......@@ -66,6 +66,7 @@ struct _GimpPreview
gint size;
gboolean in_button;
guint press_state;
guint idle_id;
gboolean needs_render;
guint popup_id;
gint popup_x;
......
......@@ -85,6 +85,7 @@ static gboolean gimp_preview_enter_notify_event (GtkWidget *widget,
static gboolean gimp_preview_leave_notify_event (GtkWidget *widget,
GdkEventCrossing *event);
static gboolean gimp_preview_idle_update (GimpPreview *preview);
static void gimp_preview_render (GimpPreview *preview);
static void gimp_preview_real_render (GimpPreview *preview);
static void gimp_preview_get_size (GimpPreview *preview,
......@@ -235,6 +236,7 @@ gimp_preview_init (GimpPreview *preview)
preview->size = -1;
preview->in_button = FALSE;
preview->idle_id = 0;
preview->needs_render = TRUE;
preview->popup_id = 0;
preview->popup_x = 0;
......@@ -250,6 +252,12 @@ gimp_preview_destroy (GtkObject *object)
preview = GIMP_PREVIEW (object);
if (preview->idle_id)
{
g_source_remove (preview->idle_id);
preview->idle_id = 0;
}
gimp_preview_popup_hide (preview);
if (preview->viewable)
......@@ -659,8 +667,7 @@ gimp_preview_set_viewable (GimpPreview *preview,
preview->border_width);
}
preview->needs_render = TRUE;
gtk_widget_queue_draw (GTK_WIDGET (preview));
gimp_preview_update (preview);
}
}
......@@ -738,8 +745,7 @@ gimp_preview_set_dot_for_dot (GimpPreview *preview,
preview->border_width);
}
preview->needs_render = TRUE;
gtk_widget_queue_draw (GTK_WIDGET (preview));
gimp_preview_update (preview);
}
}
......@@ -754,8 +760,7 @@ gimp_preview_set_border_color (GimpPreview *preview,
{
preview->border_color = *color;
preview->needs_render = TRUE;
gtk_widget_queue_draw (GTK_WIDGET (preview));
gimp_preview_update (preview);
}
}
......@@ -764,13 +769,34 @@ gimp_preview_update (GimpPreview *preview)
{
g_return_if_fail (GIMP_IS_PREVIEW (preview));
preview->needs_render = TRUE;
gtk_widget_queue_draw (GTK_WIDGET (preview));
if (preview->idle_id)
{
g_source_remove (preview->idle_id);
}
preview->idle_id =
g_idle_add_full (G_PRIORITY_LOW,
(GSourceFunc) gimp_preview_idle_update, preview,
NULL);
}
/* private functions */
static gboolean
gimp_preview_idle_update (GimpPreview *preview)
{
preview->idle_id = 0;
if (! preview->viewable)
return FALSE;
preview->needs_render = TRUE;
gtk_widget_queue_draw (GTK_WIDGET (preview));
return FALSE;
}
static void
gimp_preview_render (GimpPreview *preview)
{
......@@ -963,8 +989,7 @@ gimp_preview_size_changed (GimpPreview *preview,
}
else
{
preview->needs_render = TRUE;
gtk_widget_queue_draw (GTK_WIDGET (preview));
gimp_preview_update (preview);
}
}
......
......@@ -66,6 +66,7 @@ struct _GimpPreview
gint size;
gboolean in_button;
guint press_state;
guint idle_id;
gboolean needs_render;
guint popup_id;
gint popup_x;
......
......@@ -85,6 +85,7 @@ static gboolean gimp_preview_enter_notify_event (GtkWidget *widget,
static gboolean gimp_preview_leave_notify_event (GtkWidget *widget,
GdkEventCrossing *event);
static gboolean gimp_preview_idle_update (GimpPreview *preview);
static void gimp_preview_render (GimpPreview *preview);
static void gimp_preview_real_render (GimpPreview *preview);
static void gimp_preview_get_size (GimpPreview *preview,
......@@ -235,6 +236,7 @@ gimp_preview_init (GimpPreview *preview)
preview->size = -1;
preview->in_button = FALSE;
preview->idle_id = 0;
preview->needs_render = TRUE;
preview->popup_id = 0;
preview->popup_x = 0;
......@@ -250,6 +252,12 @@ gimp_preview_destroy (GtkObject *object)
preview = GIMP_PREVIEW (object);
if (preview->idle_id)
{
g_source_remove (preview->idle_id);
preview->idle_id = 0;
}
gimp_preview_popup_hide (preview);
if (preview->viewable)
......@@ -659,8 +667,7 @@ gimp_preview_set_viewable (GimpPreview *preview,
preview->border_width);
}
preview->needs_render = TRUE;
gtk_widget_queue_draw (GTK_WIDGET (preview));
gimp_preview_update (preview);
}
}
......@@ -738,8 +745,7 @@ gimp_preview_set_dot_for_dot (GimpPreview *preview,
preview->border_width);
}
preview->needs_render = TRUE;
gtk_widget_queue_draw (GTK_WIDGET (preview));
gimp_preview_update (preview);
}
}
......@@ -754,8 +760,7 @@ gimp_preview_set_border_color (GimpPreview *preview,
{
preview->border_color = *color;
preview->needs_render = TRUE;
gtk_widget_queue_draw (GTK_WIDGET (preview));
gimp_preview_update (preview);
}
}
......@@ -764,13 +769,34 @@ gimp_preview_update (GimpPreview *preview)
{
g_return_if_fail (GIMP_IS_PREVIEW (preview));
preview->needs_render = TRUE;
gtk_widget_queue_draw (GTK_WIDGET (preview));
if (preview->idle_id)
{
g_source_remove (preview->idle_id);
}
preview->idle_id =
g_idle_add_full (G_PRIORITY_LOW,
(GSourceFunc) gimp_preview_idle_update, preview,
NULL);
}
/* private functions */
static gboolean
gimp_preview_idle_update (GimpPreview *preview)
{
preview->idle_id = 0;
if (! preview->viewable)
return FALSE;
preview->needs_render = TRUE;
gtk_widget_queue_draw (GTK_WIDGET (preview));
return FALSE;
}
static void
gimp_preview_render (GimpPreview *preview)
{
......@@ -963,8 +989,7 @@ gimp_preview_size_changed (GimpPreview *preview,
}
else
{
preview->needs_render = TRUE;
gtk_widget_queue_draw (GTK_WIDGET (preview));
gimp_preview_update (preview);
}
}
......
......@@ -66,6 +66,7 @@ struct _GimpPreview
gint size;
gboolean in_button;
guint press_state;
guint idle_id;
gboolean needs_render;
guint popup_id;
gint popup_x;
......
......@@ -85,6 +85,7 @@ static gboolean gimp_preview_enter_notify_event (GtkWidget *widget,
static gboolean gimp_preview_leave_notify_event (GtkWidget *widget,
GdkEventCrossing *event);
static gboolean gimp_preview_idle_update (GimpPreview *preview);
static void gimp_preview_render (GimpPreview *preview);
static void gimp_preview_real_render (GimpPreview *preview);
static void gimp_preview_get_size (GimpPreview *preview,
......@@ -235,6 +236,7 @@ gimp_preview_init (GimpPreview *preview)
preview->size = -1;
preview->in_button = FALSE;
preview->idle_id = 0;
preview->needs_render = TRUE;
preview->popup_id = 0;
preview->popup_x = 0;
......@@ -250,6 +252,12 @@ gimp_preview_destroy (GtkObject *object)
preview = GIMP_PREVIEW (object);
if (preview->idle_id)
{
g_source_remove (preview->idle_id);
preview->idle_id = 0;
}
gimp_preview_popup_hide (preview);
if (preview->viewable)
......@@ -659,8 +667,7 @@ gimp_preview_set_viewable (GimpPreview *preview,
preview->border_width);
}
preview->needs_render = TRUE;
gtk_widget_queue_draw (GTK_WIDGET (preview));
gimp_preview_update (preview);
}
}
......@@ -738,8 +745,7 @@ gimp_preview_set_dot_for_dot (GimpPreview *preview,
preview->border_width);
}
preview->needs_render = TRUE;
gtk_widget_queue_draw (GTK_WIDGET (preview));
gimp_preview_update (preview);
}
}
......@@ -754,8 +760,7 @@ gimp_preview_set_border_color (GimpPreview *preview,
{
preview->border_color = *color;
preview->needs_render = TRUE;
gtk_widget_queue_draw (GTK_WIDGET (preview));
gimp_preview_update (preview);
}
}
......@@ -764,13 +769,34 @@ gimp_preview_update (GimpPreview *preview)
{
g_return_if_fail (GIMP_IS_PREVIEW (preview));
preview->needs_render = TRUE;
gtk_widget_queue_draw (GTK_WIDGET (preview));
if (preview->idle_id)
{
g_source_remove (preview->idle_id);
}
preview->idle_id =
g_idle_add_full (G_PRIORITY_LOW,
(GSourceFunc) gimp_preview_idle_update, preview,
NULL);
}
/* private functions */
static gboolean
gimp_preview_idle_update (GimpPreview *preview)
{
preview->idle_id = 0;
if (! preview->viewable)
return FALSE;
preview->needs_render = TRUE;
gtk_widget_queue_draw (GTK_WIDGET (preview));
return FALSE;
}
static void
gimp_preview_render (GimpPreview *preview)
{
......@@ -963,8 +989,7 @@ gimp_preview_size_changed (GimpPreview *preview,
}
else
{
preview->needs_render = TRUE;
gtk_widget_queue_draw (GTK_WIDGET (preview));
gimp_preview_update (preview);
}
}
......
......@@ -66,6 +66,7 @@ struct _GimpPreview
gint size;
gboolean in_button;
guint press_state;
guint idle_id;
gboolean needs_render;
guint popup_id;
gint popup_x;
......
Supports Markdown
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