[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-cvs: gaf.git: branch: master updated (1.5.2-20090328-204-g9cd1955)



The branch, master has been updated
       via  9cd19557085a7ef98408e1a73aa15471a88fb5e8 (commit)
      from  8fe6bbf0757550fef6a344096166199e2e9d3303 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


=========
 Summary
=========

 gschem/src/x_event.c   |   13 +++++++++++--
 gschem/src/x_preview.c |   13 +++++++++++--
 2 files changed, 22 insertions(+), 4 deletions(-)


=================
 Commit Messages
=================

commit 9cd19557085a7ef98408e1a73aa15471a88fb5e8
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    gschem: Save cairo and pango contexts when entering expose handlers
    
    For some operations we might want to replace the renderers in order
    to do off-screen drawing (e.g. printing). As these operations could
    instantiate a sub-main-loop (which can service expose events), the
    expose event handler needs not to trample on the drawing contexts.

:100644 100644 203068a... d13255b... M	gschem/src/x_event.c
:100644 100644 b4a6653... ff27e62... M	gschem/src/x_preview.c

=========
 Changes
=========

commit 9cd19557085a7ef98408e1a73aa15471a88fb5e8
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Commit: Peter Clifton <pcjc2@xxxxxxxxx>

    gschem: Save cairo and pango contexts when entering expose handlers
    
    For some operations we might want to replace the renderers in order
    to do off-screen drawing (e.g. printing). As these operations could
    instantiate a sub-main-loop (which can service expose events), the
    expose event handler needs not to trample on the drawing contexts.

diff --git a/gschem/src/x_event.c b/gschem/src/x_event.c
index 203068a..d13255b 100644
--- a/gschem/src/x_event.c
+++ b/gschem/src/x_event.c
@@ -52,6 +52,8 @@ gint x_event_expose(GtkWidget *widget, GdkEventExpose *event,
 {
   GdkRectangle *rectangles;
   int n_rectangles;
+  cairo_t *save_cr;
+  PangoLayout *save_pl;
 
 #if DEBUG
   printf("EXPOSE\n");
@@ -61,8 +63,9 @@ gint x_event_expose(GtkWidget *widget, GdkEventExpose *event,
   /* nasty global variable */
   global_window_current = w_current;
 
-  if (w_current->pl != NULL) g_object_unref( w_current->pl );
-  if (w_current->cr != NULL) cairo_destroy( w_current->cr );
+  save_cr = w_current->cr;
+  save_pl = w_current->pl;
+
   w_current->cr = gdk_cairo_create( widget->window );
   w_current->pl = pango_cairo_create_layout (w_current->cr);
 
@@ -75,6 +78,12 @@ gint x_event_expose(GtkWidget *widget, GdkEventExpose *event,
     x_dialog_raise_all(w_current);
   }
 
+  g_object_unref (w_current->pl);
+  cairo_destroy (w_current->cr);
+
+  w_current->cr = save_cr;
+  w_current->pl = save_pl;
+
   return(0);
 }
 
diff --git a/gschem/src/x_preview.c b/gschem/src/x_preview.c
index b4a6653..ff27e62 100644
--- a/gschem/src/x_preview.c
+++ b/gschem/src/x_preview.c
@@ -123,9 +123,12 @@ preview_callback_expose (GtkWidget *widget,
   GSCHEM_TOPLEVEL *preview_w_current = preview->preview_w_current;
   GdkRectangle *rectangles;
   int n_rectangles;
+  cairo_t *save_cr;
+  PangoLayout *save_pl;
+
+  save_cr = preview_w_current->cr;
+  save_pl = preview_w_current->pl;
 
-  if (preview_w_current->cr != NULL) cairo_destroy (preview_w_current->cr);
-  if (preview_w_current->pl != NULL) g_object_unref (preview_w_current->pl);
   preview_w_current->cr = gdk_cairo_create (widget->window);
   preview_w_current->pl = pango_cairo_create_layout (preview_w_current->cr);
 
@@ -133,6 +136,12 @@ preview_callback_expose (GtkWidget *widget,
   o_redraw_rects (preview_w_current, rectangles, n_rectangles);
   g_free (rectangles);
 
+  g_object_unref (preview_w_current->pl);
+  cairo_destroy (preview_w_current->cr);
+
+  preview_w_current->cr = save_cr;
+  preview_w_current->pl = save_pl;
+
   return FALSE;
 }
 




_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs