Remove Closure->drawGC

This commit is contained in:
Paul Dicker
2025-04-03 22:12:26 +02:00
committed by Stéphane Lesimple
parent 5da5fa54dc
commit ce64c57c49
3 changed files with 4 additions and 7 deletions

View File

@@ -683,9 +683,6 @@ void FreeClosure()
if(Closure->rawEditorContext)
GuiFreeRawEditorContext(Closure->rawEditorContext);
if(Closure->drawGC)
g_object_unref(Closure->drawGC);
cond_free(Closure->background);
cond_free(Closure->foreground);
cond_free(Closure->grid);

View File

@@ -393,7 +393,7 @@ typedef struct _GlobalClosure
/*** Common stuff for drawing curves and spirals */
GdkGC *drawGC;
gboolean colors_initialized;
GdkColor *background,*foreground,*grid;
GdkColor *redText;
char *redMarkup;

View File

@@ -43,12 +43,10 @@ static void toggle_cb(GtkWidget *widget, gpointer data)
static gboolean expose_cb(GtkWidget *widget, GdkEventExpose *event, gpointer data)
{ GtkWidget *box = (GtkWidget*)data;
if(!Closure->drawGC)
if(!Closure->colors_initialized)
{ GdkColor *bg = &widget->style->bg[0];
GdkColormap *cmap = gdk_colormap_get_system();
Closure->drawGC = gdk_gc_new(gtk_widget_get_window(widget));
memcpy(Closure->background, bg, sizeof(GdkColor));
gdk_colormap_alloc_color(cmap, Closure->foreground, FALSE, TRUE);
@@ -72,6 +70,8 @@ static gboolean expose_cb(GtkWidget *widget, GdkEventExpose *event, gpointer dat
gdk_colormap_alloc_color(cmap, Closure->whiteSector, FALSE, TRUE);
gdk_colormap_alloc_color(cmap, Closure->darkSector, FALSE, TRUE);
Closure->colors_initialized = TRUE;
/* Dirty trick for indenting the list:
draw an invisible dash before each indented line */