From eb7481a73b8073a06368daa0f878f7d890cb4a7e Mon Sep 17 00:00:00 2001 From: jon Date: Sun, 20 Mar 2011 15:46:38 +0000 Subject: [PATCH] Fixed redrawing causing corruption of background. --- lib-stock-home-widget.c | 11 +++++++---- lib-stock-home-widget.h | 1 + 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib-stock-home-widget.c b/lib-stock-home-widget.c index 628d73f..3ee9f82 100644 --- a/lib-stock-home-widget.c +++ b/lib-stock-home-widget.c @@ -46,7 +46,7 @@ OnClickRefresh(GtkWidget *widget, GdkEventButton *event, StockPluginContext *psC psContext->psSettings->ppszTickers[0],fPrice,pszColour,fChange,szTime); gtk_label_set_markup(GTK_LABEL(psContext->psLabel),szBuffer); - gtk_widget_queue_draw(GTK_WIDGET(psContext->psLabel)); + gtk_widget_queue_draw(GTK_WIDGET(psContext->psParent)); } /* If it fails, leave the old price as the user can see the timestamp @@ -286,7 +286,7 @@ static GtkWidget *stock_create_gui(gchar *pszStockLabel, eventbox = gtk_event_box_new(); gtk_event_box_set_visible_window(GTK_EVENT_BOX(eventbox),FALSE); - gtk_container_set_border_width(GTK_CONTAINER(eventbox),3); + gtk_container_set_border_width(GTK_CONTAINER(eventbox),10); gtk_container_add(GTK_CONTAINER(eventbox),label); @@ -364,6 +364,7 @@ stock_plugin_init (StockPlugin *desktop_plugin) psContext->hSG = hSG; psContext->nTimerID = -1; + psContext->psParent = GTK_WIDGET(desktop_plugin); /* Assign private data to plugin */ desktop_plugin->context = psContext; @@ -443,7 +444,11 @@ stock_plugin_expose(GtkWidget* widget, GdkEventExpose *event) DebugOut(("X: %d Y: %d Width: %d Height %d",psRect->x,psRect->y,psRect->width,psRect->height)); cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.5); + #if 1 cairo_rounded_rectangle(cr, 0, 0, width, height, 10.0); + #else + cairo_rectangle(cr, 0, 0, width, height); + #endif cairo_fill(cr); cairo_destroy(cr); @@ -454,10 +459,8 @@ static void stock_plugin_class_init (StockPluginClass *klass) { GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass); - #if 1 widget_class->realize = stock_plugin_realize; widget_class->expose_event = stock_plugin_expose; - #endif G_OBJECT_CLASS(klass)->finalize = stock_plugin_finalize; } diff --git a/lib-stock-home-widget.h b/lib-stock-home-widget.h index 0c2fbf4..1f48194 100644 --- a/lib-stock-home-widget.h +++ b/lib-stock-home-widget.h @@ -36,6 +36,7 @@ typedef struct _StockPluginContext /* Used for updating when stock price changes */ GtkWidget *psLabel; GtkWidget *psEventBox; + GtkWidget *psParent; /* Stock Getter Handle */ SGHandle hSG; -- 1.7.9.5