From 81eb53df7ba59ffa5f7e31dec5277a9eb920e3df Mon Sep 17 00:00:00 2001 From: Shawn Amundson Date: Thu, 18 Dec 1997 06:30:11 +0000 Subject: [PATCH] Changes from Owen Taylor which allow GIMP to compile with new GTK changes. ChangeLog is more specific. -Shawn --- ChangeLog | 21 +++++++++++++++++++ app/about_dialog.c | 2 +- app/base/curves.c | 2 +- app/channels_dialog.c | 2 +- app/color_area.c | 4 ++++ app/core/gimpprojection.c | 10 ++++++--- app/core/gimpprojection.h | 2 ++ app/curves.c | 2 +- app/dialogs/about-dialog.c | 2 +- app/disp_callbacks.c | 23 +++++---------------- app/display/gimpdisplay-callbacks.c | 23 +++++---------------- app/display/gimpdisplay-scroll.c | 19 ++++++++++++++++- app/display/gimpdisplay.c | 10 ++++++--- app/display/gimpdisplay.h | 2 ++ app/display/gimpdisplayshell-callbacks.c | 23 +++++---------------- app/display/gimpdisplayshell-layer-select.c | 2 +- app/display/gimpdisplayshell-scroll.c | 19 ++++++++++++++++- app/gdisplay.c | 10 ++++++--- app/gdisplay.h | 2 ++ app/gradient.c | 2 +- app/gradient_editor.c | 2 +- app/gui/about-dialog.c | 2 +- app/gui/channels-dialog.c | 2 +- app/gui/color-area.c | 4 ++++ app/gui/gradient-editor.c | 2 +- app/gui/layer-select.c | 2 +- app/gui/layers-dialog.c | 4 ++-- app/layer_select.c | 2 +- app/layers_dialog.c | 4 ++-- app/scroll.c | 19 ++++++++++++++++- app/text_tool.c | 8 +++---- app/tools/curves.c | 2 +- app/tools/gimpcurvestool.c | 2 +- app/tools/gimptexttool.c | 8 +++---- app/tools/text_tool.c | 8 +++---- app/widgets/gimpgradienteditor.c | 2 +- app/widgets/gimptoolbox-color-area.c | 4 ++++ plug-ins/gfig/gfig.c | 2 +- plug-ins/ifscompose/ifscompose.c | 2 +- plug-ins/libgck/gck/gckcolor.c | 2 +- plug-ins/libgck/gck/gcknotebook.c | 2 +- 41 files changed, 165 insertions(+), 102 deletions(-) diff --git a/ChangeLog b/ChangeLog index 545dd255d6..e852ab1a04 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,24 @@ +Wed Dec 17 23:51:30 CST 1997 Shawn T. Amundson + + * All these changes are from Owen Taylor to make GIMP work + with reference changes make in GTK. This mainly affects + functions gtk_pixmap_destroy, gdk_colormap_destroy, + gdk_font(set)_free; they have disappeared and where + changed to *_unref. These simple changes affected: + app/about_dialog.c, app/channels_dialog.c, + app/curves.c, app/gradient.c, app/layer_select.c, + app/text_tool.c, plug-ins/gfig/gfig.c, + plug-ins/ifscompose/ifscompose.c, + plug-ins/libgck/gck/gckcolor.c, + plug-ins/libgck/gck/gcknotebook.c + + * app/color_area.c: check for initial expose before drawing + * app/disp_callbacks.c: gc for scrolling + * app/gdisplay.c: destroy gc, event now pointer + * app/scroll.c: use scroll_gc, make sure graphics expose events + are processed before scrolling again + * gimp/app/gdisplay.h: add scroll_gc to struct + Wed Dec 17 23:23:05 1997 Ray Lehtiniemi * app/brush_select.c (brush_popup_open): fix memory leak diff --git a/app/about_dialog.c b/app/about_dialog.c index 6ed56b2e37..e93d925465 100644 --- a/app/about_dialog.c +++ b/app/about_dialog.c @@ -155,7 +155,7 @@ about_dialog_create (int timeout) style = gtk_style_new (); - gdk_font_free (style->font); + gdk_font_unref (style->font); style->font = gdk_font_load ("-Adobe-Helvetica-Medium-R-Normal--*-140-*-*-*-*-*-*"); gtk_widget_push_style (style); diff --git a/app/base/curves.c b/app/base/curves.c index d920f634db..cdd5dd5cef 100644 --- a/app/base/curves.c +++ b/app/base/curves.c @@ -404,7 +404,7 @@ curves_free () curves_dialog->image_map = NULL; } if (curves_dialog->pixmap) - gdk_pixmap_destroy (curves_dialog->pixmap); + gdk_pixmap_unref (curves_dialog->pixmap); gtk_widget_destroy (curves_dialog->shell); } } diff --git a/app/channels_dialog.c b/app/channels_dialog.c index a2f31174f2..080b577186 100644 --- a/app/channels_dialog.c +++ b/app/channels_dialog.c @@ -1048,7 +1048,7 @@ static void channel_widget_delete (ChannelWidget *channel_widget) { if (channel_widget->channel_pixmap) - gdk_pixmap_destroy (channel_widget->channel_pixmap); + gdk_pixmap_unref (channel_widget->channel_pixmap); /* Remove the channel widget from the list */ channelsD->channel_widgets = remove_from_list (channelsD->channel_widgets, channel_widget); diff --git a/app/color_area.c b/app/color_area.c index 0c01d0562c..a7301f5f60 100644 --- a/app/color_area.c +++ b/app/color_area.c @@ -83,6 +83,10 @@ color_area_draw (void) int def_width, def_height; int swap_width, swap_height; + if (!color_area_pixmap) /* we haven't gotten initial expose yet, + * no point in drawing anything */ + return; + gdk_window_get_size (color_area_pixmap, &width, &height); win_bg = &(color_area->style->bg[GTK_STATE_NORMAL]); diff --git a/app/core/gimpprojection.c b/app/core/gimpprojection.c index e9e3884220..0b1e9cd5fe 100644 --- a/app/core/gimpprojection.c +++ b/app/core/gimpprojection.c @@ -191,6 +191,9 @@ gdisplay_delete (GDisplay *gdisp) /* free the selection structure */ selection_free (gdisp->select); + + if (gdisp->scroll_gc) + gdk_gc_destroy (gdisp->scroll_gc); /* free the area lists */ gdisplay_free_area_list (gdisp->update_areas); @@ -1084,12 +1087,13 @@ gdisplay_active () { GtkWidget *event_widget; GtkWidget *toplevel_widget; - GdkEvent event; + GdkEvent *event; GDisplay *gdisp; /* If the popup shell is valid, then get the gdisplay associated with that shell */ - gtk_get_current_event (&event); - event_widget = gtk_get_event_widget (&event); + event = gtk_get_current_event (); + event_widget = gtk_get_event_widget (event); + gdk_event_free (event); toplevel_widget = gtk_widget_get_toplevel (event_widget); gdisp = g_hash_table_lookup (display_ht, toplevel_widget); diff --git a/app/core/gimpprojection.h b/app/core/gimpprojection.h index 144e65198a..3d58342409 100644 --- a/app/core/gimpprojection.h +++ b/app/core/gimpprojection.h @@ -84,6 +84,8 @@ struct _GDisplay Selection *select; /* Selection object */ + GdkGC *scroll_gc; /* GC for scrolling */ + link_ptr update_areas; /* Update areas list */ link_ptr display_areas; /* Display areas list */ diff --git a/app/curves.c b/app/curves.c index d920f634db..cdd5dd5cef 100644 --- a/app/curves.c +++ b/app/curves.c @@ -404,7 +404,7 @@ curves_free () curves_dialog->image_map = NULL; } if (curves_dialog->pixmap) - gdk_pixmap_destroy (curves_dialog->pixmap); + gdk_pixmap_unref (curves_dialog->pixmap); gtk_widget_destroy (curves_dialog->shell); } } diff --git a/app/dialogs/about-dialog.c b/app/dialogs/about-dialog.c index 6ed56b2e37..e93d925465 100644 --- a/app/dialogs/about-dialog.c +++ b/app/dialogs/about-dialog.c @@ -155,7 +155,7 @@ about_dialog_create (int timeout) style = gtk_style_new (); - gdk_font_free (style->font); + gdk_font_unref (style->font); style->font = gdk_font_load ("-Adobe-Helvetica-Medium-R-Normal--*-140-*-*-*-*-*-*"); gtk_widget_push_style (style); diff --git a/app/disp_callbacks.c b/app/disp_callbacks.c index 557606e778..53bc996cdb 100644 --- a/app/disp_callbacks.c +++ b/app/disp_callbacks.c @@ -97,6 +97,11 @@ gdisplay_canvas_events (GtkWidget *canvas, gdisp->disp_width = gdisp->canvas->allocation.width; gdisp->disp_height = gdisp->canvas->allocation.height; + /* create GC for scrolling */ + + gdisp->scroll_gc = gdk_gc_new (gdisp->canvas->window); + gdk_gc_set_exposures (gdisp->scroll_gc, TRUE); + /* set up the scrollbar observers */ gtk_signal_connect (GTK_OBJECT (gdisp->hsbdata), "value_changed", (GtkSignalFunc) scrollbar_horz_update, @@ -257,24 +262,6 @@ gdisplay_canvas_events (GtkWidget *canvas, grab_and_scroll (gdisp, mevent); - flush = FALSE; - while (gdk_event_get (&tmp_event, expose_predicate, canvas->window)) - { - flush = TRUE; - - x1 = tmp_event.expose.area.x; - y1 = tmp_event.expose.area.y; - x2 = (x1 + tmp_event.expose.area.width); - y2 = (y1 + tmp_event.expose.area.height); - - x1 = BOUNDS (x1, 0, gdisp->disp_width); - y1 = BOUNDS (y1, 0, gdisp->disp_height); - x2 = BOUNDS (x2, 0, gdisp->disp_width); - y2 = BOUNDS (y2, 0, gdisp->disp_height); - - gdisplay_expose_area (gdisp, x1, y1, (x2 - x1), (y2 - y1)); - } - if (flush) gdisplays_flush (); } diff --git a/app/display/gimpdisplay-callbacks.c b/app/display/gimpdisplay-callbacks.c index 557606e778..53bc996cdb 100644 --- a/app/display/gimpdisplay-callbacks.c +++ b/app/display/gimpdisplay-callbacks.c @@ -97,6 +97,11 @@ gdisplay_canvas_events (GtkWidget *canvas, gdisp->disp_width = gdisp->canvas->allocation.width; gdisp->disp_height = gdisp->canvas->allocation.height; + /* create GC for scrolling */ + + gdisp->scroll_gc = gdk_gc_new (gdisp->canvas->window); + gdk_gc_set_exposures (gdisp->scroll_gc, TRUE); + /* set up the scrollbar observers */ gtk_signal_connect (GTK_OBJECT (gdisp->hsbdata), "value_changed", (GtkSignalFunc) scrollbar_horz_update, @@ -257,24 +262,6 @@ gdisplay_canvas_events (GtkWidget *canvas, grab_and_scroll (gdisp, mevent); - flush = FALSE; - while (gdk_event_get (&tmp_event, expose_predicate, canvas->window)) - { - flush = TRUE; - - x1 = tmp_event.expose.area.x; - y1 = tmp_event.expose.area.y; - x2 = (x1 + tmp_event.expose.area.width); - y2 = (y1 + tmp_event.expose.area.height); - - x1 = BOUNDS (x1, 0, gdisp->disp_width); - y1 = BOUNDS (y1, 0, gdisp->disp_height); - x2 = BOUNDS (x2, 0, gdisp->disp_width); - y2 = BOUNDS (y2, 0, gdisp->disp_height); - - gdisplay_expose_area (gdisp, x1, y1, (x2 - x1), (y2 - y1)); - } - if (flush) gdisplays_flush (); } diff --git a/app/display/gimpdisplay-scroll.c b/app/display/gimpdisplay-scroll.c index 7f909d5ecd..747d001d81 100644 --- a/app/display/gimpdisplay-scroll.c +++ b/app/display/gimpdisplay-scroll.c @@ -136,6 +136,7 @@ scroll_display (GDisplay *gdisp, int old_x, old_y; int src_x, src_y; int dest_x, dest_y; + GdkEvent *event; old_x = gdisp->offset_x; old_y = gdisp->offset_y; @@ -170,7 +171,7 @@ scroll_display (GDisplay *gdisp, gdisp->offset_y += y_offset; gdk_draw_pixmap (gdisp->canvas->window, - gdisp->select->gc_in, + gdisp->scroll_gc, gdisp->canvas->window, src_x, src_y, dest_x, dest_y, @@ -201,6 +202,22 @@ scroll_display (GDisplay *gdisp, if (x_offset || y_offset) gdisplays_flush (); + + /* Make sure graphics expose events are processed before scrolling + * again */ + + while ((event = gdk_event_get_graphics_expose (gdisp->canvas->window)) + != NULL) + { + gtk_widget_event (gdisp->canvas, event); + if (event->expose.count == 0) + { + gdk_event_free (event); + break; + } + gdk_event_free (event); + } + return 1; } diff --git a/app/display/gimpdisplay.c b/app/display/gimpdisplay.c index e9e3884220..0b1e9cd5fe 100644 --- a/app/display/gimpdisplay.c +++ b/app/display/gimpdisplay.c @@ -191,6 +191,9 @@ gdisplay_delete (GDisplay *gdisp) /* free the selection structure */ selection_free (gdisp->select); + + if (gdisp->scroll_gc) + gdk_gc_destroy (gdisp->scroll_gc); /* free the area lists */ gdisplay_free_area_list (gdisp->update_areas); @@ -1084,12 +1087,13 @@ gdisplay_active () { GtkWidget *event_widget; GtkWidget *toplevel_widget; - GdkEvent event; + GdkEvent *event; GDisplay *gdisp; /* If the popup shell is valid, then get the gdisplay associated with that shell */ - gtk_get_current_event (&event); - event_widget = gtk_get_event_widget (&event); + event = gtk_get_current_event (); + event_widget = gtk_get_event_widget (event); + gdk_event_free (event); toplevel_widget = gtk_widget_get_toplevel (event_widget); gdisp = g_hash_table_lookup (display_ht, toplevel_widget); diff --git a/app/display/gimpdisplay.h b/app/display/gimpdisplay.h index 144e65198a..3d58342409 100644 --- a/app/display/gimpdisplay.h +++ b/app/display/gimpdisplay.h @@ -84,6 +84,8 @@ struct _GDisplay Selection *select; /* Selection object */ + GdkGC *scroll_gc; /* GC for scrolling */ + link_ptr update_areas; /* Update areas list */ link_ptr display_areas; /* Display areas list */ diff --git a/app/display/gimpdisplayshell-callbacks.c b/app/display/gimpdisplayshell-callbacks.c index 557606e778..53bc996cdb 100644 --- a/app/display/gimpdisplayshell-callbacks.c +++ b/app/display/gimpdisplayshell-callbacks.c @@ -97,6 +97,11 @@ gdisplay_canvas_events (GtkWidget *canvas, gdisp->disp_width = gdisp->canvas->allocation.width; gdisp->disp_height = gdisp->canvas->allocation.height; + /* create GC for scrolling */ + + gdisp->scroll_gc = gdk_gc_new (gdisp->canvas->window); + gdk_gc_set_exposures (gdisp->scroll_gc, TRUE); + /* set up the scrollbar observers */ gtk_signal_connect (GTK_OBJECT (gdisp->hsbdata), "value_changed", (GtkSignalFunc) scrollbar_horz_update, @@ -257,24 +262,6 @@ gdisplay_canvas_events (GtkWidget *canvas, grab_and_scroll (gdisp, mevent); - flush = FALSE; - while (gdk_event_get (&tmp_event, expose_predicate, canvas->window)) - { - flush = TRUE; - - x1 = tmp_event.expose.area.x; - y1 = tmp_event.expose.area.y; - x2 = (x1 + tmp_event.expose.area.width); - y2 = (y1 + tmp_event.expose.area.height); - - x1 = BOUNDS (x1, 0, gdisp->disp_width); - y1 = BOUNDS (y1, 0, gdisp->disp_height); - x2 = BOUNDS (x2, 0, gdisp->disp_width); - y2 = BOUNDS (y2, 0, gdisp->disp_height); - - gdisplay_expose_area (gdisp, x1, y1, (x2 - x1), (y2 - y1)); - } - if (flush) gdisplays_flush (); } diff --git a/app/display/gimpdisplayshell-layer-select.c b/app/display/gimpdisplayshell-layer-select.c index 8bc9e5f048..678ee2c4c3 100644 --- a/app/display/gimpdisplayshell-layer-select.c +++ b/app/display/gimpdisplayshell-layer-select.c @@ -284,7 +284,7 @@ layer_select_set_gimage (LayerSelect *layer_select, if (layer_select->layer_pixmap) { - gdk_pixmap_destroy (layer_select->layer_pixmap); + gdk_pixmap_unref (layer_select->layer_pixmap); layer_select->layer_pixmap = NULL; } } diff --git a/app/display/gimpdisplayshell-scroll.c b/app/display/gimpdisplayshell-scroll.c index 7f909d5ecd..747d001d81 100644 --- a/app/display/gimpdisplayshell-scroll.c +++ b/app/display/gimpdisplayshell-scroll.c @@ -136,6 +136,7 @@ scroll_display (GDisplay *gdisp, int old_x, old_y; int src_x, src_y; int dest_x, dest_y; + GdkEvent *event; old_x = gdisp->offset_x; old_y = gdisp->offset_y; @@ -170,7 +171,7 @@ scroll_display (GDisplay *gdisp, gdisp->offset_y += y_offset; gdk_draw_pixmap (gdisp->canvas->window, - gdisp->select->gc_in, + gdisp->scroll_gc, gdisp->canvas->window, src_x, src_y, dest_x, dest_y, @@ -201,6 +202,22 @@ scroll_display (GDisplay *gdisp, if (x_offset || y_offset) gdisplays_flush (); + + /* Make sure graphics expose events are processed before scrolling + * again */ + + while ((event = gdk_event_get_graphics_expose (gdisp->canvas->window)) + != NULL) + { + gtk_widget_event (gdisp->canvas, event); + if (event->expose.count == 0) + { + gdk_event_free (event); + break; + } + gdk_event_free (event); + } + return 1; } diff --git a/app/gdisplay.c b/app/gdisplay.c index e9e3884220..0b1e9cd5fe 100644 --- a/app/gdisplay.c +++ b/app/gdisplay.c @@ -191,6 +191,9 @@ gdisplay_delete (GDisplay *gdisp) /* free the selection structure */ selection_free (gdisp->select); + + if (gdisp->scroll_gc) + gdk_gc_destroy (gdisp->scroll_gc); /* free the area lists */ gdisplay_free_area_list (gdisp->update_areas); @@ -1084,12 +1087,13 @@ gdisplay_active () { GtkWidget *event_widget; GtkWidget *toplevel_widget; - GdkEvent event; + GdkEvent *event; GDisplay *gdisp; /* If the popup shell is valid, then get the gdisplay associated with that shell */ - gtk_get_current_event (&event); - event_widget = gtk_get_event_widget (&event); + event = gtk_get_current_event (); + event_widget = gtk_get_event_widget (event); + gdk_event_free (event); toplevel_widget = gtk_widget_get_toplevel (event_widget); gdisp = g_hash_table_lookup (display_ht, toplevel_widget); diff --git a/app/gdisplay.h b/app/gdisplay.h index 144e65198a..3d58342409 100644 --- a/app/gdisplay.h +++ b/app/gdisplay.h @@ -84,6 +84,8 @@ struct _GDisplay Selection *select; /* Selection object */ + GdkGC *scroll_gc; /* GC for scrolling */ + link_ptr update_areas; /* Update areas list */ link_ptr display_areas; /* Display areas list */ diff --git a/app/gradient.c b/app/gradient.c index 3388abb69f..b10baeaf0e 100644 --- a/app/gradient.c +++ b/app/gradient.c @@ -2598,7 +2598,7 @@ control_update(int recalculate) if (!g_editor->control_pixmap || (cwidth != pwidth) || (cheight != pheight)) { if (g_editor->control_pixmap) - gdk_pixmap_destroy(g_editor->control_pixmap); + gdk_pixmap_unref(g_editor->control_pixmap); g_editor->control_pixmap = gdk_pixmap_new(g_editor->control->window, cwidth, cheight, -1); diff --git a/app/gradient_editor.c b/app/gradient_editor.c index 3388abb69f..b10baeaf0e 100644 --- a/app/gradient_editor.c +++ b/app/gradient_editor.c @@ -2598,7 +2598,7 @@ control_update(int recalculate) if (!g_editor->control_pixmap || (cwidth != pwidth) || (cheight != pheight)) { if (g_editor->control_pixmap) - gdk_pixmap_destroy(g_editor->control_pixmap); + gdk_pixmap_unref(g_editor->control_pixmap); g_editor->control_pixmap = gdk_pixmap_new(g_editor->control->window, cwidth, cheight, -1); diff --git a/app/gui/about-dialog.c b/app/gui/about-dialog.c index 6ed56b2e37..e93d925465 100644 --- a/app/gui/about-dialog.c +++ b/app/gui/about-dialog.c @@ -155,7 +155,7 @@ about_dialog_create (int timeout) style = gtk_style_new (); - gdk_font_free (style->font); + gdk_font_unref (style->font); style->font = gdk_font_load ("-Adobe-Helvetica-Medium-R-Normal--*-140-*-*-*-*-*-*"); gtk_widget_push_style (style); diff --git a/app/gui/channels-dialog.c b/app/gui/channels-dialog.c index a2f31174f2..080b577186 100644 --- a/app/gui/channels-dialog.c +++ b/app/gui/channels-dialog.c @@ -1048,7 +1048,7 @@ static void channel_widget_delete (ChannelWidget *channel_widget) { if (channel_widget->channel_pixmap) - gdk_pixmap_destroy (channel_widget->channel_pixmap); + gdk_pixmap_unref (channel_widget->channel_pixmap); /* Remove the channel widget from the list */ channelsD->channel_widgets = remove_from_list (channelsD->channel_widgets, channel_widget); diff --git a/app/gui/color-area.c b/app/gui/color-area.c index 0c01d0562c..a7301f5f60 100644 --- a/app/gui/color-area.c +++ b/app/gui/color-area.c @@ -83,6 +83,10 @@ color_area_draw (void) int def_width, def_height; int swap_width, swap_height; + if (!color_area_pixmap) /* we haven't gotten initial expose yet, + * no point in drawing anything */ + return; + gdk_window_get_size (color_area_pixmap, &width, &height); win_bg = &(color_area->style->bg[GTK_STATE_NORMAL]); diff --git a/app/gui/gradient-editor.c b/app/gui/gradient-editor.c index 3388abb69f..b10baeaf0e 100644 --- a/app/gui/gradient-editor.c +++ b/app/gui/gradient-editor.c @@ -2598,7 +2598,7 @@ control_update(int recalculate) if (!g_editor->control_pixmap || (cwidth != pwidth) || (cheight != pheight)) { if (g_editor->control_pixmap) - gdk_pixmap_destroy(g_editor->control_pixmap); + gdk_pixmap_unref(g_editor->control_pixmap); g_editor->control_pixmap = gdk_pixmap_new(g_editor->control->window, cwidth, cheight, -1); diff --git a/app/gui/layer-select.c b/app/gui/layer-select.c index 8bc9e5f048..678ee2c4c3 100644 --- a/app/gui/layer-select.c +++ b/app/gui/layer-select.c @@ -284,7 +284,7 @@ layer_select_set_gimage (LayerSelect *layer_select, if (layer_select->layer_pixmap) { - gdk_pixmap_destroy (layer_select->layer_pixmap); + gdk_pixmap_unref (layer_select->layer_pixmap); layer_select->layer_pixmap = NULL; } } diff --git a/app/gui/layers-dialog.c b/app/gui/layers-dialog.c index 6e033ff32e..1560a8c99d 100644 --- a/app/gui/layers-dialog.c +++ b/app/gui/layers-dialog.c @@ -1986,9 +1986,9 @@ static void layer_widget_delete (LayerWidget *layer_widget) { if (layer_widget->layer_pixmap) - gdk_pixmap_destroy (layer_widget->layer_pixmap); + gdk_pixmap_unref (layer_widget->layer_pixmap); if (layer_widget->mask_pixmap) - gdk_pixmap_destroy (layer_widget->mask_pixmap); + gdk_pixmap_unref (layer_widget->mask_pixmap); /* Remove the layer widget from the list */ layersD->layer_widgets = remove_from_list (layersD->layer_widgets, layer_widget); diff --git a/app/layer_select.c b/app/layer_select.c index 8bc9e5f048..678ee2c4c3 100644 --- a/app/layer_select.c +++ b/app/layer_select.c @@ -284,7 +284,7 @@ layer_select_set_gimage (LayerSelect *layer_select, if (layer_select->layer_pixmap) { - gdk_pixmap_destroy (layer_select->layer_pixmap); + gdk_pixmap_unref (layer_select->layer_pixmap); layer_select->layer_pixmap = NULL; } } diff --git a/app/layers_dialog.c b/app/layers_dialog.c index 6e033ff32e..1560a8c99d 100644 --- a/app/layers_dialog.c +++ b/app/layers_dialog.c @@ -1986,9 +1986,9 @@ static void layer_widget_delete (LayerWidget *layer_widget) { if (layer_widget->layer_pixmap) - gdk_pixmap_destroy (layer_widget->layer_pixmap); + gdk_pixmap_unref (layer_widget->layer_pixmap); if (layer_widget->mask_pixmap) - gdk_pixmap_destroy (layer_widget->mask_pixmap); + gdk_pixmap_unref (layer_widget->mask_pixmap); /* Remove the layer widget from the list */ layersD->layer_widgets = remove_from_list (layersD->layer_widgets, layer_widget); diff --git a/app/scroll.c b/app/scroll.c index 7f909d5ecd..747d001d81 100644 --- a/app/scroll.c +++ b/app/scroll.c @@ -136,6 +136,7 @@ scroll_display (GDisplay *gdisp, int old_x, old_y; int src_x, src_y; int dest_x, dest_y; + GdkEvent *event; old_x = gdisp->offset_x; old_y = gdisp->offset_y; @@ -170,7 +171,7 @@ scroll_display (GDisplay *gdisp, gdisp->offset_y += y_offset; gdk_draw_pixmap (gdisp->canvas->window, - gdisp->select->gc_in, + gdisp->scroll_gc, gdisp->canvas->window, src_x, src_y, dest_x, dest_y, @@ -201,6 +202,22 @@ scroll_display (GDisplay *gdisp, if (x_offset || y_offset) gdisplays_flush (); + + /* Make sure graphics expose events are processed before scrolling + * again */ + + while ((event = gdk_event_get_graphics_expose (gdisp->canvas->window)) + != NULL) + { + gtk_widget_event (gdisp->canvas, event); + if (event->expose.count == 0) + { + gdk_event_free (event); + break; + } + gdk_event_free (event); + } + return 1; } diff --git a/app/text_tool.c b/app/text_tool.c index 3ca2af8481..4e2ac78f6a 100644 --- a/app/text_tool.c +++ b/app/text_tool.c @@ -342,7 +342,7 @@ text_resize_text_widget (TextTool *text_tool) GtkStyle *style; style = gtk_style_new (); - gdk_font_free (style->font); + gdk_font_unref (style->font); style->font = text_tool->font; gdk_font_ref (style->font); @@ -1381,7 +1381,7 @@ text_load_font (TextTool *text_tool) if (font) { if (text_tool->font) - gdk_font_free (text_tool->font); + gdk_font_unref (text_tool->font); text_tool->font = font; text_resize_text_widget (text_tool); @@ -1681,13 +1681,13 @@ text_render (GImage *gimage, } /* free the pixmap */ - gdk_pixmap_destroy (pixmap); + gdk_pixmap_unref (pixmap); /* free the gc */ gdk_gc_destroy (gc); /* free the font */ - gdk_font_free (font); + gdk_font_unref (font); return layer; } diff --git a/app/tools/curves.c b/app/tools/curves.c index d920f634db..cdd5dd5cef 100644 --- a/app/tools/curves.c +++ b/app/tools/curves.c @@ -404,7 +404,7 @@ curves_free () curves_dialog->image_map = NULL; } if (curves_dialog->pixmap) - gdk_pixmap_destroy (curves_dialog->pixmap); + gdk_pixmap_unref (curves_dialog->pixmap); gtk_widget_destroy (curves_dialog->shell); } } diff --git a/app/tools/gimpcurvestool.c b/app/tools/gimpcurvestool.c index d920f634db..cdd5dd5cef 100644 --- a/app/tools/gimpcurvestool.c +++ b/app/tools/gimpcurvestool.c @@ -404,7 +404,7 @@ curves_free () curves_dialog->image_map = NULL; } if (curves_dialog->pixmap) - gdk_pixmap_destroy (curves_dialog->pixmap); + gdk_pixmap_unref (curves_dialog->pixmap); gtk_widget_destroy (curves_dialog->shell); } } diff --git a/app/tools/gimptexttool.c b/app/tools/gimptexttool.c index 3ca2af8481..4e2ac78f6a 100644 --- a/app/tools/gimptexttool.c +++ b/app/tools/gimptexttool.c @@ -342,7 +342,7 @@ text_resize_text_widget (TextTool *text_tool) GtkStyle *style; style = gtk_style_new (); - gdk_font_free (style->font); + gdk_font_unref (style->font); style->font = text_tool->font; gdk_font_ref (style->font); @@ -1381,7 +1381,7 @@ text_load_font (TextTool *text_tool) if (font) { if (text_tool->font) - gdk_font_free (text_tool->font); + gdk_font_unref (text_tool->font); text_tool->font = font; text_resize_text_widget (text_tool); @@ -1681,13 +1681,13 @@ text_render (GImage *gimage, } /* free the pixmap */ - gdk_pixmap_destroy (pixmap); + gdk_pixmap_unref (pixmap); /* free the gc */ gdk_gc_destroy (gc); /* free the font */ - gdk_font_free (font); + gdk_font_unref (font); return layer; } diff --git a/app/tools/text_tool.c b/app/tools/text_tool.c index 3ca2af8481..4e2ac78f6a 100644 --- a/app/tools/text_tool.c +++ b/app/tools/text_tool.c @@ -342,7 +342,7 @@ text_resize_text_widget (TextTool *text_tool) GtkStyle *style; style = gtk_style_new (); - gdk_font_free (style->font); + gdk_font_unref (style->font); style->font = text_tool->font; gdk_font_ref (style->font); @@ -1381,7 +1381,7 @@ text_load_font (TextTool *text_tool) if (font) { if (text_tool->font) - gdk_font_free (text_tool->font); + gdk_font_unref (text_tool->font); text_tool->font = font; text_resize_text_widget (text_tool); @@ -1681,13 +1681,13 @@ text_render (GImage *gimage, } /* free the pixmap */ - gdk_pixmap_destroy (pixmap); + gdk_pixmap_unref (pixmap); /* free the gc */ gdk_gc_destroy (gc); /* free the font */ - gdk_font_free (font); + gdk_font_unref (font); return layer; } diff --git a/app/widgets/gimpgradienteditor.c b/app/widgets/gimpgradienteditor.c index 3388abb69f..b10baeaf0e 100644 --- a/app/widgets/gimpgradienteditor.c +++ b/app/widgets/gimpgradienteditor.c @@ -2598,7 +2598,7 @@ control_update(int recalculate) if (!g_editor->control_pixmap || (cwidth != pwidth) || (cheight != pheight)) { if (g_editor->control_pixmap) - gdk_pixmap_destroy(g_editor->control_pixmap); + gdk_pixmap_unref(g_editor->control_pixmap); g_editor->control_pixmap = gdk_pixmap_new(g_editor->control->window, cwidth, cheight, -1); diff --git a/app/widgets/gimptoolbox-color-area.c b/app/widgets/gimptoolbox-color-area.c index 0c01d0562c..a7301f5f60 100644 --- a/app/widgets/gimptoolbox-color-area.c +++ b/app/widgets/gimptoolbox-color-area.c @@ -83,6 +83,10 @@ color_area_draw (void) int def_width, def_height; int swap_width, swap_height; + if (!color_area_pixmap) /* we haven't gotten initial expose yet, + * no point in drawing anything */ + return; + gdk_window_get_size (color_area_pixmap, &width, &height); win_bg = &(color_area->style->bg[GTK_STATE_NORMAL]); diff --git a/plug-ins/gfig/gfig.c b/plug-ins/gfig/gfig.c index 30084df6b5..29bd898425 100644 --- a/plug-ins/gfig/gfig.c +++ b/plug-ins/gfig/gfig.c @@ -1932,7 +1932,7 @@ gfig_obj_modified(GFIGOBJ *obj,gint stat_type) gfig_set_pixmap(obj,blank_xpm); /* Remove old */ - gdk_pixmap_destroy(gdk_pix); + gdk_pixmap_unref(gdk_pix); gtk_widget_draw(GTK_WIDGET(obj->list_item),NULL); } diff --git a/plug-ins/ifscompose/ifscompose.c b/plug-ins/ifscompose/ifscompose.c index 3293bdff4f..95acc84122 100644 --- a/plug-ins/ifscompose/ifscompose.c +++ b/plug-ins/ifscompose/ifscompose.c @@ -1557,7 +1557,7 @@ design_area_configure(GtkWidget *widget, GdkEventConfigure *event) if (ifsDesign->pixmap) { - gdk_pixmap_destroy(ifsDesign->pixmap); + gdk_pixmap_unref(ifsDesign->pixmap); } ifsDesign->pixmap = gdk_pixmap_new(widget->window, widget->allocation.width, diff --git a/plug-ins/libgck/gck/gckcolor.c b/plug-ins/libgck/gck/gckcolor.c index e4a388e7a9..c044042041 100644 --- a/plug-ins/libgck/gck/gckcolor.c +++ b/plug-ins/libgck/gck/gckcolor.c @@ -992,7 +992,7 @@ void gck_visualinfo_destroy(GckVisualInfo * visinfo) g_function_enter("gck_visualinfo_destroy"); g_assert(visinfo!=NULL); - gdk_colormap_destroy(visinfo->colormap); + gdk_colormap_unref(visinfo->colormap); free(visinfo); diff --git a/plug-ins/libgck/gck/gcknotebook.c b/plug-ins/libgck/gck/gcknotebook.c index 79a4569758..9dcf2561f0 100644 --- a/plug-ins/libgck/gck/gcknotebook.c +++ b/plug-ins/libgck/gck/gcknotebook.c @@ -423,7 +423,7 @@ void gck_notebook_destroy(GckNoteBook *notebook) if (page->tab->image!=NULL) gdk_image_destroy(page->tab->image); if (page->tab->pixmap!=NULL) - gdk_pixmap_destroy(page->tab->pixmap); + gdk_pixmap_unref(page->tab->pixmap); free(page->tab); } free(page);