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

gEDA-cvs: branch: master updated (1.1.2.20070818-148-ga5f930d)



The branch, master has been updated
       via  a5f930da86483f05c58a92ea5ae436b25e548486 (commit)
       via  79f8378827becac265f5cd3a3327ab79a2c8befc (commit)
       via  33e12c8916f6b3bcd2d0df2246ef925e7b25b0dd (commit)
       via  ebf8dd81c398f39adcdbe4801d4a624ab1f73241 (commit)
      from  20f61e1aaebcf565e5d7dcf111b1c07cd8483fd1 (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/include/prototype.h |    3 +-
 gschem/src/a_zoom.c        |   18 ++++++-
 gschem/src/i_callbacks.c   |    4 +-
 gschem/src/o_arc.c         |   20 +++++---
 gschem/src/o_basic.c       |  103 +++++++++++++++++++++++++++++++++-----
 gschem/src/o_box.c         |   18 ++-----
 gschem/src/o_bus.c         |   72 ++++++++-------------------
 gschem/src/o_circle.c      |   20 +++-----
 gschem/src/o_cue.c         |   82 ++++++++++++-------------------
 gschem/src/o_grips.c       |   34 ++++++++-----
 gschem/src/o_line.c        |   15 ++---
 gschem/src/o_net.c         |  118 ++++++++++++++------------------------------
 gschem/src/o_picture.c     |   23 ++-------
 gschem/src/o_pin.c         |   22 +++++---
 gschem/src/o_select.c      |   24 +++++++--
 gschem/src/o_text.c        |   35 +------------
 gschem/src/x_basic.c       |    7 +--
 gschem/src/x_compselect.c  |    3 +
 gschem/src/x_event.c       |   54 --------------------
 gschem/src/x_grid.c        |   19 -------
 gschem/src/x_stroke.c      |    7 ++-
 21 files changed, 300 insertions(+), 401 deletions(-)


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

commit a5f930da86483f05c58a92ea5ae436b25e548486
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sat Dec 15 13:42:55 2007 +0000

    Remove unused functions o_{net,bus}_xorrubber()

:100644 100644 0e844b9... 78a085c... M	gschem/include/prototype.h
:100644 100644 cdbc959... 8090004... M	gschem/src/o_bus.c
:100644 100644 33233ce... 25d8ec3... M	gschem/src/o_net.c

commit 79f8378827becac265f5cd3a3327ab79a2c8befc
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sat Dec 15 13:31:39 2007 +0000

    Always redraw the screen using a blit from the backbuffer.
    
    The previous redraw scheme which would draw to the screen concurrently
    with drawing to the backbuffer is proving to be a bottle-neck to recent
    desktops using compositing. Every draw we make forces the X server to
    compute a damaged region and re-composite the window.
    
    We now draw only into the backbuffer, and then invalidate the extents of
    the region we've drawn.

:100644 100644 1f54e69... 0e844b9... M	gschem/include/prototype.h
:100644 100644 81d25de... 804250f... M	gschem/src/a_zoom.c
:100644 100644 9d03941... 3fc6ee4... M	gschem/src/o_arc.c
:100644 100644 152cb34... 4a89849... M	gschem/src/o_basic.c
:100644 100644 ada62e1... 7b96b83... M	gschem/src/o_box.c
:100644 100644 e4203ef... cdbc959... M	gschem/src/o_bus.c
:100644 100644 f094899... 0a87db4... M	gschem/src/o_circle.c
:100644 100644 7e75248... 99c5fec... M	gschem/src/o_cue.c
:100644 100644 97c7c97... 7edefa8... M	gschem/src/o_grips.c
:100644 100644 daf09ca... 567fdf6... M	gschem/src/o_line.c
:100644 100644 a213222... 33233ce... M	gschem/src/o_net.c
:100644 100644 1f70671... a4829f1... M	gschem/src/o_picture.c
:100644 100644 44267bf... b9516c5... M	gschem/src/o_pin.c
:100644 100644 6fe46a3... 9be226d... M	gschem/src/o_select.c
:100644 100644 1bd7efe... 4ec45ad... M	gschem/src/o_text.c
:100644 100644 adfd031... 92948a4... M	gschem/src/x_basic.c
:100644 100644 c0d1558... d2680ee... M	gschem/src/x_event.c
:100644 100644 29aba56... 8074bc1... M	gschem/src/x_grid.c
:100644 100644 3ee3b8e... a557761... M	gschem/src/x_stroke.c

commit 33e12c8916f6b3bcd2d0df2246ef925e7b25b0dd
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sat Dec 15 13:31:38 2007 +0000

    XOR draw to remove component ghost when cancelling component placement.
    
    Changes previous full-screen redraw when cancelling component placement
    to use XOR drawing. Adds similar code to remove the ghost which exists
    (usually underneath the dialog) when the component selection dialog is
    closed. Don't rely on an expose event to re-paint it for us.

:100644 100644 1c962cd... c404790... M	gschem/src/i_callbacks.c
:100644 100644 00fe0d7... 2180df6... M	gschem/src/x_compselect.c

commit ebf8dd81c398f39adcdbe4801d4a624ab1f73241
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sat Dec 15 13:31:36 2007 +0000

    Remove unused toplevel variable in o_grips_motion()

:100644 100644 8d9835a... 97c7c97... M	gschem/src/o_grips.c

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

commit a5f930da86483f05c58a92ea5ae436b25e548486
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sat Dec 15 13:42:55 2007 +0000

    Remove unused functions o_{net,bus}_xorrubber()

diff --git a/gschem/include/prototype.h b/gschem/include/prototype.h
index 0e844b9..78a085c 100644
--- a/gschem/include/prototype.h
+++ b/gschem/include/prototype.h
@@ -521,7 +521,6 @@ void o_bus_start(GSCHEM_TOPLEVEL *w_current, int x, int y);
 int o_bus_end(GSCHEM_TOPLEVEL *w_current, int x, int y);
 void o_bus_rubberbus(GSCHEM_TOPLEVEL *w_current, int x, int y);
 void o_bus_eraserubber(GSCHEM_TOPLEVEL *w_current);
-void o_bus_xorrubber(GSCHEM_TOPLEVEL *w_current);
 /* o_circle.c */
 void o_circle_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
 void o_circle_fill_hollow(GdkDrawable *w, GdkGC *gc, GdkColor *color, gint x, gint y, gint radius, gint width, gint angle1, gint pitch1, gint angle2, gint pitch2);
@@ -649,7 +648,6 @@ void o_net_start(GSCHEM_TOPLEVEL *w_current, int x, int y);
 int o_net_end(GSCHEM_TOPLEVEL *w_current, int x, int y);
 void o_net_rubbernet(GSCHEM_TOPLEVEL *w_current, int x, int y);
 void o_net_eraserubber(GSCHEM_TOPLEVEL *w_current);
-void o_net_xorrubber(GSCHEM_TOPLEVEL *w_current);
 int o_net_add_busrippers(GSCHEM_TOPLEVEL *w_current, OBJECT *net_obj, GList *other_objects);
 /* o_picture.c */
 void o_picture_start(GSCHEM_TOPLEVEL *w_current, int x, int y);
diff --git a/gschem/src/o_bus.c b/gschem/src/o_bus.c
index cdbc959..8090004 100644
--- a/gschem/src/o_bus.c
+++ b/gschem/src/o_bus.c
@@ -463,40 +463,3 @@ void o_bus_eraserubber(GSCHEM_TOPLEVEL *w_current)
                                GDK_JOIN_MITER);
   }
 }
-
-/*! \todo Finish function documentation!!!
- *  \brief
- *  \par Function Description
- *
- *  \note
- *  used in button cancel code in x_events.c
- */
-void o_bus_xorrubber(GSCHEM_TOPLEVEL *w_current)
-{
-  TOPLEVEL *toplevel = w_current->toplevel;
-  int size;
-
-  if (toplevel->bus_style == THICK ) {
-
-    size = SCREENabs(toplevel, BUS_WIDTH);
-
-    if (size < 0)
-      size=0;
-
-    gdk_gc_set_line_attributes(w_current->gc, size,
-                               GDK_LINE_SOLID,
-                               GDK_CAP_NOT_LAST,
-                               GDK_JOIN_MITER);
-  }
-
-  gdk_gc_set_foreground(w_current->gc,
-			x_get_darkcolor(w_current->select_color) );
-  gdk_draw_line(w_current->window, w_current->gc, w_current->start_x, w_current->start_y, w_current->last_x, w_current->last_y);
-
-  if (toplevel->bus_style == THICK ) {
-    gdk_gc_set_line_attributes(w_current->gc, 0,
-                               GDK_LINE_SOLID,
-                               GDK_CAP_NOT_LAST,
-                               GDK_JOIN_MITER);
-  }
-}
diff --git a/gschem/src/o_net.c b/gschem/src/o_net.c
index 33233ce..25d8ec3 100644
--- a/gschem/src/o_net.c
+++ b/gschem/src/o_net.c
@@ -659,47 +659,6 @@ void o_net_eraserubber(GSCHEM_TOPLEVEL *w_current)
   }
 }
 
-/*! \todo Finish function documentation!!!
- *  \brief
- *  \par Function Description
- *
- *  \note
- *  used in x_event_expose() in x_events.c
- */
-void o_net_xorrubber(GSCHEM_TOPLEVEL *w_current)
-{
-  TOPLEVEL *toplevel = w_current->toplevel;
-  int size;
-
-  if (toplevel->net_style == THICK ) {
-
-    size = SCREENabs(toplevel, NET_WIDTH);
-
-    if (size < 0)
-      size=0;
-
-    gdk_gc_set_line_attributes(w_current->gc, size,
-                               GDK_LINE_SOLID,
-                               GDK_CAP_NOT_LAST,
-                               GDK_JOIN_MITER);
-  }
-
-  gdk_gc_set_foreground(w_current->gc,
-			x_get_darkcolor(w_current->select_color) );
-  gdk_draw_line(w_current->window, w_current->gc, 
-		w_current->start_x, w_current->start_y, 
-		w_current->last_x, w_current->last_y);
-  gdk_draw_line(w_current->window, w_current->gc, 
-		w_current->second_x, w_current->second_y, 
-		w_current->last_x, w_current->last_y);
-
-  if (toplevel->net_style == THICK ) {
-    gdk_gc_set_line_attributes(w_current->gc, 0,
-                               GDK_LINE_SOLID,
-                               GDK_CAP_NOT_LAST,
-                               GDK_JOIN_MITER);
-  }
-}
 
 /*! \todo Finish function documentation!!!
  *  \brief

commit 79f8378827becac265f5cd3a3327ab79a2c8befc
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sat Dec 15 13:31:39 2007 +0000

    Always redraw the screen using a blit from the backbuffer.
    
    The previous redraw scheme which would draw to the screen concurrently
    with drawing to the backbuffer is proving to be a bottle-neck to recent
    desktops using compositing. Every draw we make forces the X server to
    compute a damaged region and re-composite the window.
    
    We now draw only into the backbuffer, and then invalidate the extents of
    the region we've drawn.

diff --git a/gschem/include/prototype.h b/gschem/include/prototype.h
index 1f54e69..0e844b9 100644
--- a/gschem/include/prototype.h
+++ b/gschem/include/prototype.h
@@ -483,6 +483,7 @@ int o_redraw_cleanstates(GSCHEM_TOPLEVEL *w_current);
 void o_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *object);
 void o_list_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *list);
 void o_glist_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, GList *list);
+void o_invalidate_rect(GSCHEM_TOPLEVEL *w_current, int x1, int y1, int x2, int y2);
 /* o_box.c */
 void o_box_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current);
 void o_box_draw_solid(GdkDrawable *w, GdkGC *gc, GdkColor *color, GdkCapStyle cap, gint filled, gint x, gint y, gint width, gint height, gint line_width, gint length, gint space);
diff --git a/gschem/src/a_zoom.c b/gschem/src/a_zoom.c
index 81d25de..804250f 100644
--- a/gschem/src/a_zoom.c
+++ b/gschem/src/a_zoom.c
@@ -70,7 +70,7 @@
 
 /*! \brief */
 #define XOR_DRAW_BOX(w, x, y, wd, ht)				\
-	gdk_draw_rectangle((w)->window, (w)->xor_gc, FALSE,	\
+	gdk_draw_rectangle((w)->backingstore, (w)->xor_gc, FALSE,	\
 			   (x), (y), (wd), (ht));
 
 /*! \brief */
@@ -292,6 +292,10 @@ void a_zoom_box_start(GSCHEM_TOPLEVEL *w_current, int x, int y)
   /* draw the box (1st XOR) */
   XOR_SETUP(w_current);
   XOR_DRAW_BOX(w_current, box_left, box_top, box_width, box_height);
+  o_invalidate_rect(w_current, box_left,
+                               box_top,
+                               box_left + box_width,
+                               box_top + box_height);
 }
 
 /*! \todo Finish function documentation!!!
@@ -314,6 +318,10 @@ void a_zoom_box_end(GSCHEM_TOPLEVEL *w_current, int x, int y)
   /* erase the box (2nd XOR) */
   XOR_SETUP(w_current);
   XOR_DRAW_BOX(w_current, box_left, box_top, box_width, box_height);
+  o_invalidate_rect(w_current, box_left,
+                               box_top,
+                               box_left + box_width,
+                               box_top + box_height);
 
   a_zoom_box(w_current, 0);
 
@@ -342,6 +350,10 @@ void a_zoom_box_rubberband(GSCHEM_TOPLEVEL *w_current, int x, int y)
   /* erase the old box (2nd XOR) */
   XOR_SETUP(w_current);
   XOR_DRAW_BOX(w_current, box_left, box_top, box_width, box_height);
+  o_invalidate_rect(w_current, box_left,
+                               box_top,
+                               box_left + box_width,
+                               box_top + box_height);
 
   w_current->last_x = (int) x;
   w_current->last_y = (int) y;
@@ -353,6 +365,10 @@ void a_zoom_box_rubberband(GSCHEM_TOPLEVEL *w_current, int x, int y)
 
   /* draw a new box (1st XOR) */
   XOR_DRAW_BOX(w_current, box_left, box_top, box_width, box_height);
+  o_invalidate_rect(w_current, box_left,
+                               box_top,
+                               box_left + box_width,
+                               box_top + box_height);
 }
 
 /*! \todo Finish function documentation!!!
diff --git a/gschem/src/o_arc.c b/gschem/src/o_arc.c
index 9d03941..3fc6ee4 100644
--- a/gschem/src/o_arc.c
+++ b/gschem/src/o_arc.c
@@ -184,10 +184,6 @@ void o_arc_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
   if((length == 0) || (space == 0))
     draw_func =  o_arc_draw_solid;
 
-  (*draw_func)(w_current->window, w_current->gc, color,
-               arc_end,
-               x, y, radius, start_angle, end_angle,
-               arc_width, length, space);
   (*draw_func)(w_current->backingstore, w_current->gc, color,
                arc_end,
                x, y, radius, start_angle, end_angle,
@@ -888,7 +884,7 @@ void o_arc_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *o_curren
   gdk_gc_set_foreground(w_current->outline_xor_gc,
 			x_get_darkcolor(color));
   /* better to set the line attributes here ? */
-  gdk_draw_arc(w_current->window, w_current->outline_xor_gc, FALSE,
+  gdk_draw_arc(w_current->backingstore, w_current->outline_xor_gc, FALSE,
 	       x + dx, y + dy, width, height,
 	       start_angle * 64, end_angle * 64);
 
@@ -1266,7 +1262,7 @@ void o_arc_rubberarc_xor(GSCHEM_TOPLEVEL *w_current)
 			     GDK_LINE_SOLID, GDK_CAP_NOT_LAST, 
 			     GDK_JOIN_MITER);
   /* draw the arc from the w_current variables */
-  gdk_draw_arc(w_current->window, w_current->xor_gc, FALSE,
+  gdk_draw_arc(w_current->backingstore, w_current->xor_gc, FALSE,
 	       w_current->start_x - w_current->distance,
 	       w_current->start_y - w_current->distance,
 	       w_current->distance * 2,
@@ -1277,10 +1273,18 @@ void o_arc_rubberarc_xor(GSCHEM_TOPLEVEL *w_current)
   tmp = ((double) w_current->loc_x) * M_PI / 180;
   x1 = w_current->start_x + w_current->distance*cos(tmp);
   y1 = w_current->start_y - w_current->distance*sin(tmp);
-  gdk_draw_line(w_current->window, w_current->xor_gc,
+  gdk_draw_line(w_current->backingstore, w_current->xor_gc,
 		w_current->start_x, w_current->start_y,
 		x1, y1);
-	
+  /* FIXME: This isn't a tight bounding box for now, but the code
+   *        to compute a better bounds it complex, and might wait
+   *        until we're considered having real OBJECT data during
+   *        rubberbanding and using world_get_arc_bounds().
+   */
+  o_invalidate_rect(w_current, w_current->start_x - w_current->distance,
+                               w_current->start_y - w_current->distance,
+                               w_current->start_x + w_current->distance,
+                               w_current->start_y + w_current->distance);
 }
 
 /*! \brief Draw grip marks on arc.
diff --git a/gschem/src/o_basic.c b/gschem/src/o_basic.c
index 152cb34..4a89849 100644
--- a/gschem/src/o_basic.c
+++ b/gschem/src/o_basic.c
@@ -30,6 +30,8 @@
 #include <dmalloc.h>
 #endif
 
+#define INVALIDATE_MARGIN 1
+
 /*! \todo Lots of Gross code... needs lots of cleanup - mainly
  * readability issues
  */
@@ -94,11 +96,13 @@ void o_redraw_all(GSCHEM_TOPLEVEL *w_current)
  *  \par Function Description
  *
  */
-void o_redraw(GSCHEM_TOPLEVEL *w_current, OBJECT *object_list, gboolean draw_selected)
+void o_redraw(GSCHEM_TOPLEVEL *w_current, OBJECT *list, gboolean draw_selected)
 {
   TOPLEVEL *toplevel = w_current->toplevel;
-  OBJECT *o_current = object_list;
+  OBJECT *o_current = list;
   int redraw_state = toplevel->DONT_REDRAW;
+  int left, top, bottom, right;
+  int s_left, s_top, s_bottom, s_right;
 
   w_current->inside_redraw = 1;
   while (o_current != NULL) {
@@ -113,6 +117,11 @@ void o_redraw(GSCHEM_TOPLEVEL *w_current, OBJECT *object_list, gboolean draw_sel
   }
   w_current->inside_redraw = 0;
   toplevel->DONT_REDRAW = redraw_state;
+
+  world_get_object_list_bounds(toplevel, list, &left, &top, &right, &bottom);
+  WORLDtoSCREEN( toplevel, left, top, &s_left, &s_top );
+  WORLDtoSCREEN( toplevel, right, bottom, &s_right, &s_bottom );
+  o_invalidate_rect( w_current, s_left, s_top, s_right, s_bottom );
 }
 
 /*! \brief Redraw an object on the screen.
@@ -125,10 +134,14 @@ void o_redraw(GSCHEM_TOPLEVEL *w_current, OBJECT *object_list, gboolean draw_sel
  */
 void o_redraw_single(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
 {
+  TOPLEVEL *toplevel = w_current->toplevel;
+  int left, top, right, bottom;
+  int s_left, s_top, s_right, s_bottom;
+
   if (o_current == NULL)
   return;
 
-  if (w_current->toplevel->DONT_REDRAW) /* highly experimental */
+  if (toplevel->DONT_REDRAW) /* highly experimental */
   return;
 
   if (o_current->draw_func != NULL && o_current->type != OBJ_HEAD) {
@@ -136,6 +149,13 @@ void o_redraw_single(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
     (*o_current->draw_func)(w_current, o_current);
     w_current->inside_redraw = 0;
   }
+
+  world_get_single_object_bounds(toplevel, o_current,
+                                 &left, &top, &right, &bottom);
+  WORLDtoSCREEN(toplevel, left, top, &s_left, &s_top);
+  WORLDtoSCREEN(toplevel, right, bottom, &s_right, &s_bottom);
+  o_invalidate_rect (w_current, s_left,  s_bottom, s_right, s_top);
+
 }
 
 /*! \todo Finish function documentation!!!
@@ -200,24 +220,32 @@ void o_draw_selected(GSCHEM_TOPLEVEL *w_current)
 void o_erase_selected(GSCHEM_TOPLEVEL *w_current)
 {
   TOPLEVEL *toplevel = w_current->toplevel;
-  GList* s_current;
+  GList *list;
+  GList *iter;
   OBJECT* o_current;
+  int left, top, right, bottom;
+  int s_left, s_top, s_right, s_bottom;
+
   if (w_current->inside_redraw) {
     return;
   }
 
-  s_current = geda_list_get_glist( toplevel->page_current->selection_list );
-  while (s_current != NULL) {
-    o_current = (OBJECT *) s_current->data;
+  list = iter = geda_list_get_glist( toplevel->page_current->selection_list );
+  while (iter != NULL) {
+    o_current = iter->data;
 
     if (o_current) {
       o_cue_erase_single(w_current, o_current);
       o_erase_single(w_current, o_current);
     }
-    
-    s_current=g_list_next(s_current);
+
+    iter = g_list_next( iter );
   }
 
+  world_get_object_glist_bounds(toplevel, list, &left, &top, &right, &bottom);
+  WORLDtoSCREEN(toplevel, left, top, &s_left, &s_top);
+  WORLDtoSCREEN(toplevel, right, bottom, &s_right, &s_bottom);
+  o_invalidate_rect (w_current, s_left,  s_bottom, s_right, s_top);
 }
 
 /*! \todo Finish function documentation!!!
@@ -229,6 +257,8 @@ void o_erase_single(GSCHEM_TOPLEVEL *w_current, OBJECT *object)
 {
   TOPLEVEL *toplevel = w_current->toplevel;
   OBJECT *o_current;
+  int left, top, right, bottom;
+  int s_left, s_top, s_right, s_bottom;
 
   if (w_current->inside_redraw) {
     return;
@@ -244,6 +274,12 @@ void o_erase_single(GSCHEM_TOPLEVEL *w_current, OBJECT *object)
     }
   }
   toplevel->override_color = -1;
+
+  world_get_single_object_bounds(toplevel, o_current,
+                                 &left, &top, &right, &bottom);
+  WORLDtoSCREEN(toplevel, left, top, &s_left, &s_top);
+  WORLDtoSCREEN(toplevel, right, bottom, &s_right, &s_bottom);
+  o_invalidate_rect (w_current, s_left,  s_bottom, s_right, s_top);
 }
 
 /*! \todo Finish function documentation!!!
@@ -342,14 +378,16 @@ void o_drawbounding(GSCHEM_TOPLEVEL *w_current, GList *o_glist,
   diff_x = w_current->last_x - w_current->start_x;
   diff_y = w_current->last_y - w_current->start_y;
 
+  /* Find the bounds of the drawing to be done */
+  world_get_object_glist_bounds(toplevel, o_glist,
+                                &left, &top, &right, &bottom);
+  WORLDtoSCREEN( toplevel, left, top, &s_left, &s_top );
+  WORLDtoSCREEN( toplevel, right, bottom, &s_right, &s_bottom );
+
   /* XOR draw with the appropriate mode */
   if (w_current->last_drawb_mode == BOUNDINGBOX) {
-    world_get_object_glist_bounds(toplevel, o_glist,
-                                  &left, &top, &right, &bottom);
     gdk_gc_set_foreground(w_current->bounding_xor_gc, color);
-    WORLDtoSCREEN( toplevel, left, top, &s_left, &s_top );
-    WORLDtoSCREEN( toplevel, right, bottom, &s_right, &s_bottom );
-    gdk_draw_rectangle(w_current->window,
+    gdk_draw_rectangle(w_current->backingstore,
                        w_current->bounding_xor_gc, FALSE,
                        s_left + diff_x, s_bottom + diff_y,
                        s_right - s_left, s_top - s_bottom);
@@ -357,6 +395,10 @@ void o_drawbounding(GSCHEM_TOPLEVEL *w_current, GList *o_glist,
     o_glist_draw_xor (w_current, diff_x, diff_y, o_glist);
   }
 
+  /* Invalidate the screen buffer where we drew */
+  o_invalidate_rect(w_current, s_left + diff_x, s_top + diff_y,
+                               s_right + diff_x, s_bottom + diff_y);
+
   /* Save movement constraints and drawing method for any
    * corresponding undraw operation. */
   w_current->last_drawb_mode = w_current->actionfeedback_mode;
@@ -595,3 +637,36 @@ void o_glist_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, GList *list)
     iter = g_list_next(iter);
   }
 }
+
+
+/*! \brief Invalidates a rectangular region of the on screen drawing area
+ *  \par Function Description
+ *
+ *  Given a pair of (x,y) coordinates in SCREEN units, invalidate the
+ *  rectangular on-screen drawing area which has those two coordinate
+ *  pairs as opposite corners of its region. This will cause that region
+ *  to be blitted from the back-buffer once the mainloop reaches idle.
+ *
+ *  A margin, INVALIDATE_MARGIN is added to the invalidated region as
+ *  a hacky workaround for rounding errors which may occur in the
+ *  WORLD -> SCREEN coordinate transform. This margin may also be used
+ *  to expand the invalidated region if anti-aliased drawing is ever
+ *  used.
+ *
+ *  \param [in] w_current  The GSCHEM_TOPLEVEL who's drawing area is being invalidated.
+ *  \param [in] x1         X coord for corner 1 (SCREEN units)
+ *  \param [in] y1         Y coord for corner 1 (SCREEN units)
+ *  \param [in] x2         X coord for corner 2 (SCREEN units)
+ *  \param [in] y2         Y coord for corner 2 (SCREEN units)
+ */
+void o_invalidate_rect( GSCHEM_TOPLEVEL *w_current,
+                        int x1, int y1, int x2, int y2 )
+{
+  GdkRectangle rect;
+
+  rect.x = MIN(x1, x2) - INVALIDATE_MARGIN;
+  rect.y = MIN(y1, y2) - INVALIDATE_MARGIN;
+  rect.width = 1 + abs( x1 - x2 ) + 2 * INVALIDATE_MARGIN;
+  rect.height = 1 + abs( y1 - y2 ) + 2 * INVALIDATE_MARGIN;
+  gdk_window_invalidate_rect( w_current->window, &rect, FALSE );
+}
diff --git a/gschem/src/o_box.c b/gschem/src/o_box.c
index ada62e1..7b96b83 100644
--- a/gschem/src/o_box.c
+++ b/gschem/src/o_box.c
@@ -192,12 +192,6 @@ void o_box_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
   WORLDtoSCREEN( toplevel, o_current->box->lower_x, o_current->box->lower_y,
                  &s_lower_x, &s_lower_y );
 	
-  (*draw_func)(w_current->window, w_current->gc, color, box_end,
-               FALSE,
-               s_upper_x, s_upper_y,
-               abs(s_lower_x - s_upper_x),
-               abs(s_lower_y - s_upper_y),
-               line_width, length, space);
   (*draw_func)(w_current->backingstore, w_current->gc, color, box_end,
                FALSE,
                s_upper_x, s_upper_y,
@@ -277,11 +271,6 @@ void o_box_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
     fill_func = o_box_fill_fill;
   }
 
-  (*fill_func)(w_current->window, w_current->gc, color,
-               s_upper_x, s_upper_y,
-               abs(s_lower_x - s_upper_x),
-               abs(s_lower_y - s_upper_y),
-               fill_width, angle1, pitch1, angle2, pitch2);
   (*fill_func)(w_current->backingstore, w_current->gc, color,
                s_upper_x, s_upper_y,
                abs(s_lower_x - s_upper_x),
@@ -883,7 +872,7 @@ void o_box_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *o_curren
 
   gdk_gc_set_foreground(w_current->outline_xor_gc,
                         x_get_darkcolor(color));
-  gdk_draw_rectangle(w_current->window,
+  gdk_draw_rectangle(w_current->backingstore,
                      w_current->outline_xor_gc, FALSE,
                      screen_x1 + dx,
                      screen_y1 + dy,
@@ -1070,9 +1059,10 @@ void o_box_rubberbox_xor(GSCHEM_TOPLEVEL *w_current)
 	gdk_gc_set_line_attributes(w_current->xor_gc, 0, 
 				   GDK_LINE_SOLID, GDK_CAP_NOT_LAST, 
 				   GDK_JOIN_MITER);
-	gdk_draw_rectangle(w_current->window, w_current->xor_gc,
+	gdk_draw_rectangle(w_current->backingstore, w_current->xor_gc,
 			   FALSE, box_left, box_top, box_width, box_height);
-	
+	o_invalidate_rect(w_current, box_left, box_top,
+	                  box_left + box_width, box_top + box_height);
 }
 
 /*! \brief Draw grip marks on box.
diff --git a/gschem/src/o_bus.c b/gschem/src/o_bus.c
index e4203ef..cdbc959 100644
--- a/gschem/src/o_bus.c
+++ b/gschem/src/o_bus.c
@@ -74,15 +74,11 @@ void o_bus_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
   if (toplevel->override_color != -1 ) {
     gdk_gc_set_foreground(w_current->gc,
                           x_get_color(toplevel->override_color));
-    gdk_draw_line(w_current->window, w_current->gc,
-                  x1, y1, x2, y2);
     gdk_draw_line(w_current->backingstore, w_current->gc,
                   x1, y1, x2, y2);
   } else {
     gdk_gc_set_foreground(w_current->gc,
                           x_get_color(o_current->color));
-    gdk_draw_line(w_current->window, w_current->gc,
-                  x1, y1, x2, y2);
     gdk_draw_line(w_current->backingstore, w_current->gc,
                   x1, y1, x2, y2);
   }
@@ -161,7 +157,7 @@ void o_bus_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *o_curren
   WORLDtoSCREEN( toplevel, o_current->line->x[0], o_current->line->y[0], &sx[0], &sy[0] );
   WORLDtoSCREEN( toplevel, o_current->line->x[1], o_current->line->y[1], &sx[1], &sy[1] );
   
-  gdk_draw_line(w_current->window, w_current->outline_xor_gc,
+  gdk_draw_line(w_current->backingstore, w_current->outline_xor_gc,
                 sx[0]+dx, sy[0]+dy,
                 sx[1]+dx, sy[1]+dy);
 
@@ -218,11 +214,11 @@ void o_bus_draw_xor_single(GSCHEM_TOPLEVEL *w_current,
   WORLDtoSCREEN( toplevel, o_current->line->x[0], o_current->line->y[0], &sx[0], &sy[0] );
   WORLDtoSCREEN( toplevel, o_current->line->x[1], o_current->line->y[1], &sx[1], &sy[1] );
 
-  gdk_draw_line(w_current->window, w_current->outline_xor_gc,
+  gdk_draw_line(w_current->backingstore, w_current->outline_xor_gc,
                 sx[0]+dx1, sy[0]+dy1,
                 sx[1]+dx2, sy[1]+dy2);
-
-  /* backing store ? not approriate here */
+  o_invalidate_rect(w_current,
+                    sx[0] + dx1, sy[0] + dy1, sx[1] + dx2, sy[1] + dy2);
 }
 
 /*! \todo Finish function documentation!!!
@@ -248,7 +244,9 @@ void o_bus_start(GSCHEM_TOPLEVEL *w_current, int x, int y)
 
   gdk_gc_set_foreground(w_current->xor_gc,
 			x_get_darkcolor(w_current->select_color) );
-  gdk_draw_line(w_current->window, w_current->xor_gc, w_current->start_x, w_current->start_y, w_current->last_x, w_current->last_y);
+  gdk_draw_line(w_current->backingstore, w_current->xor_gc, w_current->start_x, w_current->start_y, w_current->last_x, w_current->last_y);
+  o_invalidate_rect(w_current, w_current->start_x, w_current->start_y,
+                    w_current->last_x, w_current->last_y);
 
   if (toplevel->bus_style == THICK ) {
     gdk_gc_set_line_attributes(w_current->xor_gc, 0,
@@ -291,9 +289,11 @@ int o_bus_end(GSCHEM_TOPLEVEL *w_current, int x, int y)
 
   gdk_gc_set_foreground(w_current->xor_gc,
 			x_get_darkcolor(w_current->select_color) );
-  gdk_draw_line(w_current->window, w_current->xor_gc, 
+  gdk_draw_line(w_current->backingstore, w_current->xor_gc,
 		w_current->start_x, w_current->start_y, 
 		w_current->last_x, w_current->last_y);
+  o_invalidate_rect(w_current, w_current->start_x, w_current->start_y,
+                    w_current->last_x, w_current->last_y);
 
   if (toplevel->bus_style == THICK ) {
     gdk_gc_set_line_attributes(w_current->xor_gc, 0,
@@ -322,8 +322,9 @@ int o_bus_end(GSCHEM_TOPLEVEL *w_current, int x, int y)
 
   gdk_gc_set_foreground(w_current->gc,
 			x_get_color(color));
-  gdk_draw_line(w_current->window, w_current->gc, w_current->start_x, w_current->start_y, w_current->last_x, w_current->last_y);
   gdk_draw_line(w_current->backingstore, w_current->gc, w_current->start_x, w_current->start_y, w_current->last_x, w_current->last_y);
+  o_invalidate_rect(w_current, w_current->start_x, w_current->start_y,
+                    w_current->last_x, w_current->last_y);
 
   if (toplevel->bus_style == THICK ) {
     gdk_gc_set_line_attributes(w_current->gc, 0,
@@ -388,7 +389,9 @@ void o_bus_rubberbus(GSCHEM_TOPLEVEL *w_current, int x, int y)
 
   gdk_gc_set_foreground(w_current->xor_gc, 
 			x_get_darkcolor(w_current->select_color) );
-  gdk_draw_line(w_current->window, w_current->xor_gc, w_current->start_x, w_current->start_y, w_current->last_x, w_current->last_y);
+  gdk_draw_line(w_current->backingstore, w_current->xor_gc, w_current->start_x, w_current->start_y, w_current->last_x, w_current->last_y);
+  o_invalidate_rect(w_current, w_current->start_x, w_current->start_y,
+                    w_current->last_x, w_current->last_y);
 
   /* going into ortho mode (control key not pressed) */
   /* erase non-ortho line */
@@ -413,7 +416,9 @@ void o_bus_rubberbus(GSCHEM_TOPLEVEL *w_current, int x, int y)
 
   gdk_gc_set_foreground(w_current->xor_gc,
 			x_get_darkcolor(w_current->select_color) );
-  gdk_draw_line(w_current->window, w_current->xor_gc, w_current->start_x, w_current->start_y, w_current->last_x, w_current->last_y);
+  gdk_draw_line(w_current->backingstore, w_current->xor_gc, w_current->start_x, w_current->start_y, w_current->last_x, w_current->last_y);
+  o_invalidate_rect(w_current, w_current->start_x, w_current->start_y,
+                    w_current->last_x, w_current->last_y);
 
   if (toplevel->bus_style == THICK ) {
     gdk_gc_set_line_attributes(w_current->xor_gc, 0,
@@ -447,7 +452,9 @@ void o_bus_eraserubber(GSCHEM_TOPLEVEL *w_current)
                                GDK_JOIN_MITER);
   }
 
-  gdk_draw_line(w_current->window, w_current->xor_gc, w_current->start_x, w_current->start_y, w_current->last_x, w_current->last_y);
+  gdk_draw_line(w_current->backingstore, w_current->xor_gc, w_current->start_x, w_current->start_y, w_current->last_x, w_current->last_y);
+  o_invalidate_rect(w_current, w_current->start_x, w_current->start_y,
+                    w_current->last_x, w_current->last_y);
 
   if (toplevel->bus_style == THICK ) {
     gdk_gc_set_line_attributes(w_current->xor_gc, 0,
diff --git a/gschem/src/o_circle.c b/gschem/src/o_circle.c
index f094899..0a87db4 100644
--- a/gschem/src/o_circle.c
+++ b/gschem/src/o_circle.c
@@ -182,12 +182,6 @@ void o_circle_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
   WORLDtoSCREEN( toplevel, o_current->circle->center_x, o_current->circle->center_y,
                  &s_x, &s_y );
 	
-  (*draw_func)(w_current->window, w_current->gc, color,
-               circle_end,
-               s_x, s_y,
-               radius,
-               0, FULL_CIRCLE / 64,
-               circle_width, length, space);
   (*draw_func)(w_current->backingstore, w_current->gc, color,
                circle_end,
                s_x, s_y,
@@ -266,10 +260,6 @@ void o_circle_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
     fill_func = o_circle_fill_fill;
   }
 
-  (*fill_func)(w_current->window, w_current->gc, color,
-               s_x, s_y,
-               radius,
-               fill_width, angle1, pitch1, angle2, pitch2);
   (*fill_func)(w_current->backingstore, w_current->gc, color,
                s_x, s_y,
                radius,
@@ -586,7 +576,7 @@ void o_circle_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *o_cur
   /* To draw be sure to setup width height */
   gdk_gc_set_foreground(w_current->outline_xor_gc,
 			x_get_darkcolor(color));
-  gdk_draw_arc(w_current->window, w_current->outline_xor_gc,
+  gdk_draw_arc(w_current->backingstore, w_current->outline_xor_gc,
 	       FALSE,
 	       x, y,
 	       2 * radius, 2 * radius,
@@ -777,16 +767,20 @@ void o_circle_rubbercircle_xor(GSCHEM_TOPLEVEL *w_current)
   /* draw the circle from the w_current variables */
   gdk_gc_set_foreground(w_current->xor_gc, 
 			x_get_darkcolor(w_current->select_color));
-  gdk_draw_line(w_current->window, w_current->xor_gc,
+  gdk_draw_line(w_current->backingstore, w_current->xor_gc,
 		w_current->start_x, w_current->start_y,
 		w_current->start_x + w_current->distance,
 		w_current->start_y);
-  gdk_draw_arc(w_current->window, w_current->xor_gc, FALSE,
+  gdk_draw_arc(w_current->backingstore, w_current->xor_gc, FALSE,
 	       w_current->start_x - w_current->distance,
 	       w_current->start_y - w_current->distance,
 	       w_current->distance * 2,
 	       w_current->distance * 2,
 	       0, FULL_CIRCLE);
+  o_invalidate_rect(w_current, w_current->start_x - w_current->distance,
+                               w_current->start_y - w_current->distance,
+                               w_current->start_x + w_current->distance,
+                               w_current->start_y + w_current->distance);
 }
 
 /*! \brief Draw grip marks on circle.
diff --git a/gschem/src/o_cue.c b/gschem/src/o_cue.c
index 7e75248..99c5fec 100644
--- a/gschem/src/o_cue.c
+++ b/gschem/src/o_cue.c
@@ -168,40 +168,34 @@ void o_cue_draw_lowlevel(GSCHEM_TOPLEVEL *w_current, OBJECT *object, int whichon
         if (count < 1) { /* Didn't find anything connected there */
 	  if (toplevel->DONT_REDRAW == 0) {
 	    o_cue_set_color(w_current, toplevel->net_endpoint_color);
-	    gdk_draw_rectangle(w_current->window,
-			       w_current->gc, TRUE,
-			       screen_x - size,
-			       screen_y - size,
-			       x2size,
-			       x2size);
 	    gdk_draw_rectangle(w_current->backingstore,
 			       w_current->gc, TRUE,
 			       screen_x - size,
 			       screen_y - size,
 			       x2size,
 			       x2size);
+	    o_invalidate_rect(w_current, screen_x - size, screen_y - size,
+	                                 screen_x + size, screen_y + size);
 	  }
         
         } else if (count >= 2) {
           /* draw circle */
 
           if (bus_involved) {
-            size = SCREENabs(toplevel, CUE_CIRCLE_SMALL_SIZE);
+            size = SCREENabs(toplevel, CUE_CIRCLE_SMALL_SIZE) / 2;
           } else {
-            size = SCREENabs(toplevel, CUE_CIRCLE_LARGE_SIZE);
+            size = SCREENabs(toplevel, CUE_CIRCLE_LARGE_SIZE) / 2;
           }
+          x2size = 2 * size;
 	  if (toplevel->DONT_REDRAW == 0) {
 	    o_cue_set_color(w_current, toplevel->junction_color);
-	    gdk_draw_arc(w_current->window, w_current->gc,
-			 TRUE,
-			 screen_x - size / 2,
-			 screen_y - size / 2,
-			 size, size, 0, FULL_CIRCLE);
 	    gdk_draw_arc(w_current->backingstore,
 			 w_current->gc, TRUE,
-                       screen_x - size / 2,
-			 screen_y - size / 2,
-			 size, size, 0, FULL_CIRCLE);
+                       screen_x - size,
+			 screen_y - size,
+			 x2size, x2size, 0, FULL_CIRCLE);
+	    o_invalidate_rect(w_current, screen_x - size, screen_y - size,
+                                   screen_x + size, screen_y + size);
 	  }
         }
       } else if (object->type == OBJ_PIN) {
@@ -218,31 +212,25 @@ void o_cue_draw_lowlevel(GSCHEM_TOPLEVEL *w_current, OBJECT *object, int whichon
                                        GDK_JOIN_MITER);
           }
 
+    /* No need to invalidate the PIN end CUE, as the
+     * whole pin region is already invalidated. */
 	  if (toplevel->DONT_REDRAW == 0) {
 	    o_cue_set_color(w_current, toplevel->net_endpoint_color);
 	    if (object->line->y[whichone] == object->line->y[otherone]) {
 	      /* horizontal line */
 	      if (object->line->x[whichone] <= object->line->x[otherone]) {
-		gdk_draw_line(w_current->window, w_current->gc,
-			      screen_x, screen_y, screen_x + size, screen_y);
 		gdk_draw_line(w_current->backingstore, w_current->gc,
 			      screen_x, screen_y, screen_x + size, screen_y);
 	      } else {
-		gdk_draw_line(w_current->window, w_current->gc,
-			      screen_x, screen_y, screen_x - size, screen_y);
 		gdk_draw_line(w_current->backingstore, w_current->gc,
 			      screen_x, screen_y, screen_x - size, screen_y);
 	      }
 	    } else if (object->line->x[0] == object->line->x[1]) {
 	      /* vertical line */
 	      if (object->line->y[whichone] <= object->line->y[otherone]) {
-		gdk_draw_line(w_current->window, w_current->gc,
-			      screen_x, screen_y, screen_x, screen_y - size);
 		gdk_draw_line(w_current->backingstore, w_current->gc,
 			      screen_x, screen_y, screen_x, screen_y - size);
 	      } else {
-		gdk_draw_line(w_current->window, w_current->gc,
-			      screen_x, screen_y, screen_x, screen_y + size);
 		gdk_draw_line(w_current->backingstore, w_current->gc,
 			      screen_x, screen_y, screen_x, screen_y + size);
 	      }
@@ -266,23 +254,21 @@ void o_cue_draw_lowlevel(GSCHEM_TOPLEVEL *w_current, OBJECT *object, int whichon
   
       /* draw circle */
       if (bus_involved) {
-        size = SCREENabs(toplevel, CUE_CIRCLE_SMALL_SIZE);
+        size = SCREENabs(toplevel, CUE_CIRCLE_SMALL_SIZE) / 2;
       } else {
-        size = SCREENabs(toplevel, CUE_CIRCLE_LARGE_SIZE);
+        size = SCREENabs(toplevel, CUE_CIRCLE_LARGE_SIZE) / 2;
       }
+      x2size = size * 2;
 
       if (toplevel->DONT_REDRAW == 0) {
 	o_cue_set_color(w_current, toplevel->junction_color);
-	gdk_draw_arc(w_current->window, w_current->gc,
-		     TRUE,
-		     screen_x - size / 2,
-		     screen_y - size / 2,
-		     size, size, 0, FULL_CIRCLE);
 	gdk_draw_arc(w_current->backingstore,
 		     w_current->gc, TRUE,
-		     screen_x - size / 2,
-		     screen_y - size / 2,
-		     size, size, 0, FULL_CIRCLE);
+		     screen_x - size,
+		     screen_y - size,
+		     x2size, x2size, 0, FULL_CIRCLE);
+	    o_invalidate_rect(w_current, screen_x - size, screen_y - size,
+                                   screen_x + size, screen_y + size);
       }
       break;
 
@@ -318,18 +304,14 @@ void o_cue_erase_lowlevel(GSCHEM_TOPLEVEL *w_current, OBJECT *object, int whicho
   WORLDtoSCREEN(toplevel, x, y, &screen_x, &screen_y);
   
   if (toplevel->DONT_REDRAW == 0) {
-    gdk_draw_rectangle(w_current->window,
-		       w_current->gc, TRUE,
-		       screen_x - size,
-		       screen_y - size,
-		       x2size,
-		       x2size);
     gdk_draw_rectangle(w_current->backingstore,
 		       w_current->gc, TRUE,
 		       screen_x - size,
 		       screen_y - size,
 		       x2size,
 		       x2size);
+	    o_invalidate_rect(w_current, screen_x - size, screen_y - size,
+                                   screen_x + size, screen_y + size);
   }
 
 }
@@ -345,7 +327,7 @@ void o_cue_draw_lowlevel_midpoints(GSCHEM_TOPLEVEL *w_current, OBJECT *object)
   int x, y, screen_x, screen_y;
   GList *cl_current;
   CONN *conn;
-  int size;
+  int size, x2size;
 
   if (toplevel->override_color != -1 ) {
     gdk_gc_set_foreground(w_current->gc,
@@ -373,22 +355,20 @@ void o_cue_draw_lowlevel_midpoints(GSCHEM_TOPLEVEL *w_current, OBJECT *object)
                conn->other_object->type == OBJ_NET) ||
               (object->type == OBJ_NET &&
                conn->other_object->type == OBJ_BUS))) {
-          size = SCREENabs(toplevel, CUE_CIRCLE_SMALL_SIZE);
+          size = SCREENabs(toplevel, CUE_CIRCLE_SMALL_SIZE) / 2;
         } else {
-          size = SCREENabs(toplevel, CUE_CIRCLE_LARGE_SIZE);
+          size = SCREENabs(toplevel, CUE_CIRCLE_LARGE_SIZE) / 2;
         }
+        x2size = size * 2;
 
 	if (toplevel->DONT_REDRAW == 0) {
-	  gdk_draw_arc(w_current->window, w_current->gc,
-		       TRUE,
-		       screen_x - size / 2,
-		       screen_y - size / 2,
-		       size, size, 0, FULL_CIRCLE);
 	  gdk_draw_arc(w_current->backingstore,
 		       w_current->gc, TRUE,
-		       screen_x - size / 2,
-		       screen_y - size / 2,
-		       size, size, 0, FULL_CIRCLE);
+		       screen_x - size,
+		       screen_y - size,
+		       x2size, x2size, 0, FULL_CIRCLE);
+	  o_invalidate_rect(w_current, screen_x - size, screen_y - size,
+                                 screen_x + size, screen_y + size);
 	}
         break;
     }
diff --git a/gschem/src/o_grips.c b/gschem/src/o_grips.c
index 97c7c97..7edefa8 100644
--- a/gschem/src/o_grips.c
+++ b/gschem/src/o_grips.c
@@ -538,9 +538,11 @@ int o_grips_start(GSCHEM_TOPLEVEL *w_current, int x, int y)
       o_net_erase(w_current, object);
       gdk_gc_set_foreground(w_current->xor_gc,
                             x_get_darkcolor(w_current->select_color) );
-      gdk_draw_line(w_current->window, w_current->xor_gc,
+      gdk_draw_line(w_current->backingstore, w_current->xor_gc,
                     w_current->start_x, w_current->start_y,
                     w_current->last_x, w_current->last_y);
+      o_invalidate_rect(w_current, w_current->start_x, w_current->start_y,
+                        w_current->last_x, w_current->last_y);
       o_line_erase_grips(w_current, object);
 
       gdk_gc_set_foreground(w_current->gc,
@@ -557,9 +559,11 @@ int o_grips_start(GSCHEM_TOPLEVEL *w_current, int x, int y)
       o_pin_erase(w_current, object);
       gdk_gc_set_foreground(w_current->xor_gc,
                             x_get_darkcolor(w_current->select_color) );
-      gdk_draw_line(w_current->window, w_current->xor_gc,
+      gdk_draw_line(w_current->backingstore, w_current->xor_gc,
                     w_current->start_x, w_current->start_y,
                     w_current->last_x, w_current->last_y);
+      o_invalidate_rect(w_current, w_current->start_x, w_current->start_y,
+                        w_current->last_x, w_current->last_y);
       o_line_erase_grips(w_current, object);
       return(TRUE);
 
@@ -573,9 +577,11 @@ int o_grips_start(GSCHEM_TOPLEVEL *w_current, int x, int y)
       o_bus_erase(w_current, object);
       gdk_gc_set_foreground(w_current->xor_gc,
                             x_get_darkcolor(w_current->select_color) );
-      gdk_draw_line(w_current->window, w_current->xor_gc,
+      gdk_draw_line(w_current->backingstore, w_current->xor_gc,
                     w_current->start_x, w_current->start_y,
                     w_current->last_x, w_current->last_y);
+      o_invalidate_rect(w_current, w_current->start_x, w_current->start_y,
+                        w_current->last_x, w_current->last_y);
       o_line_erase_grips(w_current, object);
 
       gdk_gc_set_foreground(w_current->gc,
@@ -1128,9 +1134,11 @@ void o_grips_end(GSCHEM_TOPLEVEL *w_current)
     /* erase xor line */
     gdk_gc_set_foreground(w_current->xor_gc,
                           x_get_darkcolor(w_current->select_color));
-    gdk_draw_line(w_current->window, w_current->xor_gc,
+    gdk_draw_line(w_current->backingstore, w_current->xor_gc,
                   w_current->start_x, w_current->start_y,
                   w_current->last_x, w_current->last_y);
+    o_invalidate_rect(w_current, w_current->start_x, w_current->start_y,
+                      w_current->last_x, w_current->last_y);
     o_line_erase_grips(w_current, object);
 
     other_objects = s_conn_return_others(other_objects, object);
@@ -1164,9 +1172,11 @@ void o_grips_end(GSCHEM_TOPLEVEL *w_current)
 
       gdk_gc_set_foreground(w_current->gc,
                           x_get_color(toplevel->background_color));
-      gdk_draw_line(w_current->window, w_current->gc,
+      gdk_draw_line(w_current->backingstore, w_current->gc,
                     w_current->start_x, w_current->start_y,
                     w_current->last_x, w_current->last_y);
+      o_invalidate_rect(w_current, w_current->start_x, w_current->start_y,
+                        w_current->last_x, w_current->last_y);
 
       o_cue_undraw(w_current, object);
       o_net_draw(w_current, object);
@@ -1230,9 +1240,11 @@ void o_grips_end(GSCHEM_TOPLEVEL *w_current)
     /* erase xor line */
     gdk_gc_set_foreground(w_current->xor_gc,
                           x_get_darkcolor(w_current->select_color));
-    gdk_draw_line(w_current->window, w_current->xor_gc,
+    gdk_draw_line(w_current->backingstore, w_current->xor_gc,
                   w_current->start_x, w_current->start_y,
                   w_current->last_x, w_current->last_y);
+    o_invalidate_rect(w_current, w_current->start_x, w_current->start_y,
+                      w_current->last_x, w_current->last_y);
     o_line_erase_grips(w_current, object);
 
     other_objects = s_conn_return_others(other_objects, object);
@@ -1286,9 +1298,11 @@ void o_grips_end(GSCHEM_TOPLEVEL *w_current)
     /* erase xor line */
     gdk_gc_set_foreground(w_current->xor_gc,
                           x_get_darkcolor(w_current->select_color));
-    gdk_draw_line(w_current->window, w_current->xor_gc,
+    gdk_draw_line(w_current->backingstore, w_current->xor_gc,
                   w_current->start_x, w_current->start_y,
                   w_current->last_x, w_current->last_y);
+    o_invalidate_rect(w_current, w_current->start_x, w_current->start_y,
+                      w_current->last_x, w_current->last_y);
     o_line_erase_grips(w_current, object);
 
     other_objects = s_conn_return_others(other_objects, object);
@@ -1695,12 +1709,10 @@ void o_grips_draw(GSCHEM_TOPLEVEL *w_current, int x, int y)
    * width/height of <B>x2size</B>.
    */
   if (toplevel->DONT_REDRAW == 0) {
-    /* draw the grip in window */
-    gdk_draw_rectangle(w_current->window, w_current->gc, FALSE,
-                       x - size, y - size, x2size, x2size);
     /* draw the grip in backingstore */
     gdk_draw_rectangle(w_current->backingstore, w_current->gc, FALSE,
                        x - size, y - size, x2size, x2size);
+    o_invalidate_rect(w_current, x - size, y - size, x + size, y + size);
   }
 }
 
diff --git a/gschem/src/o_line.c b/gschem/src/o_line.c
index daf09ca..567fdf6 100644
--- a/gschem/src/o_line.c
+++ b/gschem/src/o_line.c
@@ -161,8 +161,6 @@ void o_line_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
   if((length == 0) || (space == 0))
   draw_func = o_line_draw_solid;
 
-  (*draw_func)(w_current->window, w_current->gc, color, line_end,
-               x1, y1, x2, y2, line_width, length, space);
   (*draw_func)(w_current->backingstore, w_current->gc, color, line_end,
                x1, y1, x2, y2, line_width, length, space);
 
@@ -758,7 +756,7 @@ void o_line_eraserubber(GSCHEM_TOPLEVEL *w_current)
   TOPLEVEL *toplevel = w_current->toplevel;
   gdk_gc_set_foreground(w_current->gc,
 			x_get_color(toplevel->background_color) );
-  gdk_draw_line(w_current->window, w_current->gc, w_current->start_x,
+  gdk_draw_line(w_current->backingstore, w_current->gc, w_current->start_x,
                 w_current->start_y, w_current->last_x, w_current->last_y);
 }
 
@@ -797,11 +795,8 @@ void o_line_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *o_curre
   WORLDtoSCREEN( toplevel, o_current->line->x[0], o_current->line->y[0], &sx[0], &sy[0] );
   WORLDtoSCREEN( toplevel, o_current->line->x[1], o_current->line->y[1], &sx[1], &sy[1] );
 
-  gdk_draw_line(w_current->window, w_current->outline_xor_gc,
-                sx[0]+dx, sy[0]+dy,
-                sx[1]+dx, sy[1]+dy);
-
-  /* backing store? nope not here */
+  gdk_draw_line(w_current->backingstore, w_current->outline_xor_gc,
+                sx[0] + dx, sy[0] + dy, sx[1] + dx, sy[1] + dy);
 }
 
 /*! \brief Start process to input a new line.
@@ -980,9 +975,11 @@ void o_line_rubberline_xor(GSCHEM_TOPLEVEL *w_current)
   gdk_gc_set_line_attributes(w_current->xor_gc, 0,
 			     GDK_LINE_SOLID, GDK_CAP_NOT_LAST, 
 			     GDK_JOIN_MITER);
-  gdk_draw_line(w_current->window, w_current->xor_gc,
+  gdk_draw_line(w_current->backingstore, w_current->xor_gc,
 		w_current->start_x, w_current->start_y,
 		w_current->last_x,  w_current->last_y);  
+  o_invalidate_rect(w_current,w_current->start_x, w_current->start_y,
+                              w_current->last_x,  w_current->last_y);
 }
 
 /*! \brief Draw grip marks on line.
diff --git a/gschem/src/o_net.c b/gschem/src/o_net.c
index a213222..33233ce 100644
--- a/gschem/src/o_net.c
+++ b/gschem/src/o_net.c
@@ -88,30 +88,19 @@ void o_net_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
     gdk_gc_set_foreground(w_current->gc,
                           x_get_color(toplevel->override_color));
 
-    gdk_draw_line(w_current->window, w_current->gc,
-                  x1, y1, x2, y2);
     gdk_draw_line(w_current->backingstore, w_current->gc,
                   x1, y1, x2, y2);
   } else {
 
     gdk_gc_set_foreground(w_current->gc,
                           x_get_color(o_current->color));
-    gdk_draw_line(w_current->window, w_current->gc,
-                  x1, y1, x2, y2);
     gdk_draw_line(w_current->backingstore, w_current->gc,
                   x1, y1, x2, y2);
 
-
 #if NET_DEBUG
     /* temp debug only */
     font = gdk_fontset_load ("10x20");
     tempstring = g_strdup_printf("%s", o_current->name);
-    gdk_draw_text (w_current->window,
-                   font,
-                   w_current->gc,
-                   x1+20, y1+20,
-                   tempstring,
-                   strlen(tempstring));
     gdk_draw_text (w_current->backingstore,
                    font,
                    w_current->gc,
@@ -205,13 +194,10 @@ void o_net_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *o_curren
   WORLDtoSCREEN( toplevel, o_current->line->x[0], o_current->line->y[0], &sx[0], &sy[0] );
   WORLDtoSCREEN( toplevel, o_current->line->x[1], o_current->line->y[1], &sx[1], &sy[1] );
 
-  gdk_draw_line(w_current->window, w_current->outline_xor_gc,
+  gdk_draw_line(w_current->backingstore, w_current->outline_xor_gc,
                 sx[0]+dx, sy[0]+dy,
                 sx[1]+dx, sy[1]+dy);
 
-
-  /* backing store ? not approriate here */
-
   if (toplevel->net_style == THICK ) {
     gdk_gc_set_line_attributes(w_current->outline_xor_gc, 0,
                                GDK_LINE_SOLID,
@@ -263,11 +249,11 @@ void o_net_draw_xor_single(GSCHEM_TOPLEVEL *w_current, int dx, int dy, int which
   WORLDtoSCREEN( toplevel, o_current->line->x[0], o_current->line->y[0], &sx[0], &sy[0] );
   WORLDtoSCREEN( toplevel, o_current->line->x[1], o_current->line->y[1], &sx[1], &sy[1] );
 
-   gdk_draw_line(w_current->window, w_current->outline_xor_gc,
-                sx[0]+dx1, sy[0]+dy1,
-                sx[1]+dx2, sy[1]+dy2);
+  gdk_draw_line(w_current->backingstore, w_current->outline_xor_gc,
+                sx[0] + dx1, sy[0] + dy1, sx[1] + dx2, sy[1] + dy2);
+  o_invalidate_rect(w_current,
+                    sx[0] + dx1, sy[0] + dy1, sx[1] + dx2, sy[1] + dy2);
 
-  /* backing store ? not approriate here */
 }
 
 /*! \todo Finish function documentation!!!
@@ -296,10 +282,11 @@ void o_net_start(GSCHEM_TOPLEVEL *w_current, int x, int y)
 
   gdk_gc_set_foreground(w_current->xor_gc,
 			x_get_darkcolor(w_current->select_color) );
-  gdk_draw_line(w_current->window, w_current->xor_gc, 
+  gdk_draw_line(w_current->backingstore, w_current->xor_gc,
 		w_current->start_x, w_current->start_y, 
 		w_current->last_x, w_current->last_y);
-
+  o_invalidate_rect(w_current, w_current->start_x, w_current->start_y,
+                               w_current->last_x, w_current->last_y);
   if (toplevel->net_style == THICK ) {
     gdk_gc_set_line_attributes(w_current->xor_gc, 0,
                                GDK_LINE_SOLID,
@@ -351,14 +338,19 @@ int o_net_end(GSCHEM_TOPLEVEL *w_current, int x, int y)
 			x_get_darkcolor(w_current->select_color) );
 
   /* Erase primary rubber net line */
-  gdk_draw_line(w_current->window, w_current->xor_gc,
+  gdk_draw_line(w_current->backingstore, w_current->xor_gc,
 		w_current->start_x, w_current->start_y,
 		w_current->last_x, w_current->last_y);
+  o_invalidate_rect(w_current, w_current->start_x, w_current->start_y,
+                               w_current->last_x, w_current->last_y);
+
 
   /* Erase secondary rubber net line */
-  gdk_draw_line(w_current->window, w_current->xor_gc,
+  gdk_draw_line(w_current->backingstore, w_current->xor_gc,
 		 w_current->last_x, w_current->last_y,
 		 w_current->second_x, w_current->second_y);
+  o_invalidate_rect(w_current, w_current->last_x, w_current->last_y,
+                               w_current->second_x, w_current->second_y);
 
   if (toplevel->net_style == THICK) {
     gdk_gc_set_line_attributes(w_current->xor_gc, 0,
@@ -439,12 +431,9 @@ int o_net_end(GSCHEM_TOPLEVEL *w_current, int x, int y)
       WORLDtoSCREEN( toplevel, new_net->line->x[1], new_net->line->y[1], &sx[1], &sy[1] );
 
       gdk_gc_set_foreground(w_current->gc, x_get_color(color));
-      gdk_draw_line(w_current->window, w_current->gc,
-                    sx[0], sy[0],
-                    sx[1], sy[1]);
       gdk_draw_line(w_current->backingstore, w_current->gc,
-                    sx[0], sy[0],
-                    sx[1], sy[1]);
+                    sx[0], sy[0], sx[1], sy[1]);
+      o_invalidate_rect(w_current, sx[0], sy[0], sx[1], sy[1]);
 
       if (toplevel->net_style == THICK) {
 	  gdk_gc_set_line_attributes(w_current->gc, 0,
@@ -502,12 +491,9 @@ int o_net_end(GSCHEM_TOPLEVEL *w_current, int x, int y)
       WORLDtoSCREEN( toplevel, new_net->line->x[1], new_net->line->y[1], &sx[1], &sy[1] );
 
       gdk_gc_set_foreground(w_current->gc, x_get_color(color));
-      gdk_draw_line(w_current->window, w_current->gc,
-                    sx[0], sy[0],
-                    sx[1], sy[1]);
       gdk_draw_line(w_current->backingstore, w_current->gc,
-                    sx[0], sy[0],
-                    sx[1], sy[1]);
+                    sx[0], sy[0], sx[1], sy[1]);
+      o_invalidate_rect(w_current, sx[0], sy[0], sx[1], sy[1]);
       
       if (toplevel->net_style == THICK) {
 	  gdk_gc_set_line_attributes(w_current->gc, 0,
@@ -563,14 +549,19 @@ void o_net_rubbernet(GSCHEM_TOPLEVEL *w_current, int x, int y)
   ortho = !w_current->CONTROLKEY;
 
   /* Erase primary line */
-  gdk_draw_line(w_current->window, w_current->xor_gc,
+  gdk_draw_line(w_current->backingstore, w_current->xor_gc,
 		w_current->start_x, w_current->start_y,
 		w_current->last_x, w_current->last_y);
+  o_invalidate_rect(w_current, w_current->start_x, w_current->start_y,
+                    w_current->last_x, w_current->last_y);
+
   /* Erase secondary line*/
   if ( w_current->second_x != -1 && w_current->second_y != -1 ) {
-      gdk_draw_line(w_current->window, w_current->xor_gc,
+      gdk_draw_line(w_current->backingstore, w_current->xor_gc,
 		    w_current->last_x, w_current->last_y,
 		    w_current->second_x, w_current->second_y);
+    o_invalidate_rect(w_current, w_current->last_x, w_current->last_y,
+                      w_current->second_x, w_current->second_y);
   }
  
   /* In orthogonal mode secondary line is the same as the first */
@@ -605,14 +596,18 @@ void o_net_rubbernet(GSCHEM_TOPLEVEL *w_current, int x, int y)
 			x_get_darkcolor(w_current->select_color));
   
   /* draw primary line */
-  gdk_draw_line(w_current->window, w_current->xor_gc,
+  gdk_draw_line(w_current->backingstore, w_current->xor_gc,
 		w_current->start_x, w_current->start_y,
 		w_current->last_x, w_current->last_y);
+  o_invalidate_rect(w_current, w_current->start_x, w_current->start_y,
+                    w_current->last_x, w_current->last_y);
 
   /* Draw secondary line */
-  gdk_draw_line(w_current->window, w_current->xor_gc,
+  gdk_draw_line(w_current->backingstore, w_current->xor_gc,
 		w_current->last_x, w_current->last_y,
 		w_current->second_x, w_current->second_y);
+  o_invalidate_rect(w_current, w_current->last_x, w_current->last_y,
+                    w_current->second_x, w_current->second_y);
 
   if (toplevel->net_style == THICK) {
     gdk_gc_set_line_attributes(w_current->xor_gc, 0,
@@ -645,13 +640,17 @@ void o_net_eraserubber(GSCHEM_TOPLEVEL *w_current)
   }
 
   /* Erase primary primary rubber net line */
-  gdk_draw_line(w_current->window, w_current->xor_gc, w_current->start_x,
+  gdk_draw_line(w_current->backingstore, w_current->xor_gc, w_current->start_x,
 		w_current->start_y, w_current->last_x, w_current->last_y);
+  o_invalidate_rect(w_current, w_current->start_x, w_current->start_y,
+                               w_current->last_x, w_current->last_y);
 
   /* Erase secondary rubber net line */
-  gdk_draw_line(w_current->window, w_current->xor_gc,
+  gdk_draw_line(w_current->backingstore, w_current->xor_gc,
 		w_current->last_x, w_current->last_y,
 		w_current->second_x, w_current->second_y);
+  o_invalidate_rect(w_current, w_current->last_x, w_current->last_y,
+                               w_current->second_x, w_current->second_y);
 
   if (toplevel->net_style == THICK) {
     gdk_gc_set_line_attributes(w_current->xor_gc, 0,
diff --git a/gschem/src/o_picture.c b/gschem/src/o_picture.c
index 1f70671..a4829f1 100644
--- a/gschem/src/o_picture.c
+++ b/gschem/src/o_picture.c
@@ -328,9 +328,11 @@ void o_picture_rubberbox_xor(GSCHEM_TOPLEVEL *w_current)
   gdk_gc_set_line_attributes(w_current->xor_gc, 0, 
 			     GDK_LINE_SOLID, GDK_CAP_NOT_LAST, 
 			     GDK_JOIN_MITER);
-  gdk_draw_rectangle(w_current->window, w_current->xor_gc,
+  gdk_draw_rectangle(w_current->backingstore, w_current->xor_gc,
 		     FALSE, picture_left, picture_top,
 		     picture_width, picture_height);
+  o_invalidate_rect(w_current, picture_left, picture_top,
+                    picture_left + picture_width, picture_top + picture_height);
 }
 
 /*! \brief Draw a picture on the screen.
@@ -424,10 +426,6 @@ void o_picture_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
     }
 
     if (toplevel->DONT_REDRAW == 0) {
-      gdk_draw_pixbuf(w_current->window, w_current->gc,
-		      o_current->picture->displayed_picture, 
-		      0, 0, s_upper_x, s_upper_y, 
-		      -1, -1, GDK_RGB_DITHER_NONE, 0, 0);
       gdk_draw_pixbuf(w_current->backingstore, w_current->gc,
 		      o_current->picture->displayed_picture, 
 		      0, 0, s_upper_x, s_upper_y, 
@@ -439,10 +437,6 @@ void o_picture_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
       /* Erase the picture, drawing a rectangle with the background color */
       gdk_gc_set_foreground(w_current->gc, 
 			    x_get_color(toplevel->background_color));
-      gdk_draw_rectangle(w_current->window, w_current->gc, TRUE, 
-			 s_upper_x, s_upper_y,
-			 abs(s_lower_x - s_upper_x), 
-			 abs(s_lower_y - s_upper_y));
       gdk_draw_rectangle(w_current->backingstore, w_current->gc, TRUE, 
 			 s_upper_x, s_upper_y,
 			 abs(s_lower_x -s_upper_x),
@@ -505,10 +499,6 @@ void o_picture_draw_grips(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
   o_grips_draw(w_current, s_lower_x, s_lower_y);
   
   /* Box surrounding the picture */
-  gdk_draw_rectangle(w_current->window, w_current->gc, FALSE, 
-		     s_upper_x, s_upper_y,
-		     abs(s_upper_x - s_lower_x),
-		     abs(s_upper_y - s_lower_y));
   gdk_draw_rectangle(w_current->backingstore, w_current->gc, FALSE, 
 		     s_upper_x, s_upper_y,
 		     abs(s_upper_x - s_lower_x),
@@ -552,10 +542,6 @@ void o_picture_erase_grips(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
   o_grips_erase(w_current, s_lower_x, s_lower_y);
   
   /* Box surrounding the picture */
-  gdk_draw_rectangle(w_current->window, w_current->gc, FALSE, 
-		     s_upper_x, s_upper_y,
-		     abs(s_upper_x - s_lower_x),
-		     abs(s_upper_y - s_lower_y));
   gdk_draw_rectangle(w_current->backingstore, w_current->gc, FALSE, 
 		     s_upper_x, s_upper_y,
 		     abs(s_upper_x - s_lower_x),
@@ -629,8 +615,7 @@ void o_picture_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *o_cu
   
   gdk_gc_set_foreground(w_current->outline_xor_gc,
                         x_get_darkcolor(color));
-  
-  gdk_draw_rectangle(w_current->window,
+  gdk_draw_rectangle(w_current->backingstore,
                      w_current->outline_xor_gc, FALSE,
                      screen_x1 + dx,
                      screen_y1 + dy,
diff --git a/gschem/src/o_pin.c b/gschem/src/o_pin.c
index 44267bf..b9516c5 100644
--- a/gschem/src/o_pin.c
+++ b/gschem/src/o_pin.c
@@ -69,16 +69,12 @@ void o_pin_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
     gdk_gc_set_foreground(w_current->gc,
 			  x_get_color(toplevel->override_color));
     if (toplevel->DONT_REDRAW == 0) {
-      gdk_draw_line(w_current->window, w_current->gc,
-		    x1, y1, x2, y2);
       gdk_draw_line(w_current->backingstore, w_current->gc,
 		    x1, y1, x2, y2);
     }
   } else {
     if (toplevel->DONT_REDRAW == 0) {
       gdk_gc_set_foreground(w_current->gc, x_get_color(o_current->color));
-      gdk_draw_line(w_current->window, w_current->gc,
-		    x1, y1, x2, y2);
       gdk_draw_line(w_current->backingstore, w_current->gc,
 		    x1, y1, x2, y2);
     }
@@ -160,7 +156,7 @@ void o_pin_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *o_curren
   WORLDtoSCREEN( toplevel, o_current->line->x[0], o_current->line->y[0], &sx[0], &sy[0] );
   WORLDtoSCREEN( toplevel, o_current->line->x[1], o_current->line->y[1], &sx[1], &sy[1] );
 
-  gdk_draw_line(w_current->window, w_current->xor_gc,
+  gdk_draw_line(w_current->backingstore, w_current->xor_gc,
                 sx[0]+dx, sy[0]+dy,
                 sx[1]+dx, sy[1]+dy);
 
@@ -194,9 +190,11 @@ void o_pin_start(GSCHEM_TOPLEVEL *w_current, int x, int y)
 
   gdk_gc_set_foreground(w_current->xor_gc, 
 			x_get_darkcolor(w_current->select_color) );
-  gdk_draw_line(w_current->window, w_current->xor_gc, 
+  gdk_draw_line(w_current->backingstore, w_current->xor_gc,
 		w_current->start_x, w_current->start_y, 
 		w_current->last_x, w_current->last_y);
+  o_invalidate_rect(w_current, w_current->start_x, w_current->start_y,
+                               w_current->last_x, w_current->last_y);
 
   if (toplevel->pin_style == THICK ) {
     gdk_gc_set_line_attributes(w_current->xor_gc, 0,
@@ -305,9 +303,11 @@ void o_pin_rubberpin(GSCHEM_TOPLEVEL *w_current, int x, int y)
 
   gdk_gc_set_foreground(w_current->xor_gc, 
 			x_get_darkcolor(w_current->select_color) );
-  gdk_draw_line(w_current->window, w_current->xor_gc, 
+  gdk_draw_line(w_current->backingstore, w_current->xor_gc,
 		w_current->start_x, w_current->start_y, 
 		w_current->last_x, w_current->last_y);
+  o_invalidate_rect(w_current, w_current->start_x, w_current->start_y,
+                    w_current->last_x, w_current->last_y);
 
   w_current->last_x = fix_x(toplevel, x);
   w_current->last_y = fix_y(toplevel, y);
@@ -323,9 +323,11 @@ void o_pin_rubberpin(GSCHEM_TOPLEVEL *w_current, int x, int y)
 
   gdk_gc_set_foreground(w_current->xor_gc, 
 			x_get_darkcolor(w_current->select_color) );
-  gdk_draw_line(w_current->window, w_current->xor_gc, 
+  gdk_draw_line(w_current->backingstore, w_current->xor_gc,
 		w_current->start_x, w_current->start_y, 
 		w_current->last_x, w_current->last_y);
+  o_invalidate_rect(w_current, w_current->start_x, w_current->start_y,
+                    w_current->last_x, w_current->last_y);
 
   if (toplevel->pin_style == THICK ) {
     gdk_gc_set_line_attributes(w_current->xor_gc, 0,
@@ -359,7 +361,9 @@ void o_pin_eraserubber(GSCHEM_TOPLEVEL *w_current)
                                GDK_JOIN_MITER);
   }
 
-  gdk_draw_line(w_current->window, w_current->xor_gc, w_current->start_x, w_current->start_y, w_current->last_x, w_current->last_y);
+  gdk_draw_line(w_current->backingstore, w_current->xor_gc, w_current->start_x, w_current->start_y, w_current->last_x, w_current->last_y);
+  o_invalidate_rect(w_current, w_current->start_x, w_current->start_y,
+                    w_current->last_x, w_current->last_y);
 
   if (toplevel->net_style == THICK ) {
     gdk_gc_set_line_attributes(w_current->xor_gc, 0,
diff --git a/gschem/src/o_select.c b/gschem/src/o_select.c
index 6fe46a3..9be226d 100644
--- a/gschem/src/o_select.c
+++ b/gschem/src/o_select.c
@@ -255,12 +255,16 @@ void o_select_box_start(GSCHEM_TOPLEVEL *w_current, int x, int y)
 
   gdk_gc_set_foreground(w_current->xor_gc,
                         x_get_darkcolor(w_current->select_color));
-  gdk_draw_rectangle(w_current->window, w_current->xor_gc,
+  gdk_draw_rectangle(w_current->backingstore, w_current->xor_gc,
                      FALSE,
                      w_current->start_x,
                      w_current->start_y,
                      box_width,
                      box_height);
+  o_invalidate_rect(w_current, w_current->start_x,
+                               w_current->start_y,
+                               w_current->start_x + box_width,
+                               w_current->start_y + box_height);
 }
 
 /*! \todo Finish function documentation!!!
@@ -288,12 +292,16 @@ void o_select_box_end(GSCHEM_TOPLEVEL *w_current, int x, int y)
 
   gdk_gc_set_foreground(w_current->xor_gc,
                         x_get_darkcolor(w_current->select_color));
-  gdk_draw_rectangle(w_current->window, w_current->xor_gc,
+  gdk_draw_rectangle(w_current->backingstore, w_current->xor_gc,
                      FALSE,
                      box_left,
                      box_top,
                      box_width,
                      box_height);
+  o_invalidate_rect(w_current, box_left,
+                               box_top,
+                               box_left + box_width,
+                               box_top  + box_height);
 
   o_select_box_search(w_current);
 }
@@ -324,12 +332,16 @@ void o_select_box_rubberband(GSCHEM_TOPLEVEL *w_current, int x, int y)
 
   gdk_gc_set_foreground(w_current->xor_gc,
                         x_get_darkcolor(w_current->select_color));
-  gdk_draw_rectangle(w_current->window, w_current->xor_gc,
+  gdk_draw_rectangle(w_current->backingstore, w_current->xor_gc,
                      FALSE,
                      box_left  ,
                      box_top   ,
                      box_width ,
                      box_height);
+  o_invalidate_rect(w_current, box_left,
+                               box_top,
+                               box_left + box_width,
+                               box_top  + box_height);
 
 
   /* removed fix_x, fix_y to unrestrict sels */
@@ -349,12 +361,16 @@ void o_select_box_rubberband(GSCHEM_TOPLEVEL *w_current, int x, int y)
   else
   box_left = w_current->start_x;
 
-  gdk_draw_rectangle(w_current->window, w_current->xor_gc,
+  gdk_draw_rectangle(w_current->backingstore, w_current->xor_gc,
                      FALSE,
                      box_left,
                      box_top,
                      box_width,
                      box_height);
+  o_invalidate_rect(w_current, box_left,
+                               box_top,
+                               box_left + box_width,
+                               box_top  + box_height);
 
 }
 
diff --git a/gschem/src/o_text.c b/gschem/src/o_text.c
index 1bd7efe..4ec45ad 100644
--- a/gschem/src/o_text.c
+++ b/gschem/src/o_text.c
@@ -105,13 +105,6 @@ void o_text_draw_rectangle(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
   gdk_gc_set_foreground(w_current->gc, color);
 
   if (toplevel->DONT_REDRAW == 0) {
-    gdk_draw_rectangle( w_current->window,
-                        w_current->gc,
-                        FALSE,
-                        left,
-                        top,
-                        right - left,
-                        bottom - top );
     gdk_draw_rectangle( w_current->backingstore,
                         w_current->gc,
                         FALSE,
@@ -163,33 +156,18 @@ void o_text_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
       screen_y1 += offset;
       if (toplevel->DONT_REDRAW == 0) {
 	/* Top part of the I */
-	gdk_draw_line(w_current->window, w_current->gc,
-		      screen_x1,
-		      screen_y1,
-		      screen_x1+small_dist,
-		      screen_y1);
 	gdk_draw_line(w_current->backingstore, w_current->gc, 
 		      screen_x1,
 		      screen_y1,
 		      screen_x1+small_dist,
 		      screen_y1);
 	/* Middle part of the I */
-	gdk_draw_line(w_current->window, w_current->gc,
-		      screen_x1+small_dist/2,
-		      screen_y1,
-		      screen_x1+small_dist/2,
-		      screen_y1+small_dist);
 	gdk_draw_line(w_current->backingstore, w_current->gc, 
 		      screen_x1+small_dist/2,
 		      screen_y1,
 		      screen_x1+small_dist/2,
 		      screen_y1+small_dist);
 	/* Bottom part of the I */
-	gdk_draw_line(w_current->window, w_current->gc,
-		      screen_x1,
-		      screen_y1+small_dist,
-		      screen_x1+small_dist,
-		      screen_y1+small_dist);
 	gdk_draw_line(w_current->backingstore, w_current->gc, 
 		      screen_x1,
 		      screen_y1+small_dist,
@@ -231,22 +209,12 @@ void o_text_draw(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
   }
 
   if (toplevel->DONT_REDRAW == 0) {
-    gdk_draw_line(w_current->window, w_current->gc, 
-		  screen_x1-small_dist, 
-		  screen_y1+small_dist, 
-		  screen_x1+small_dist, 
-		  screen_y1-small_dist);
     gdk_draw_line(w_current->backingstore, w_current->gc, 
 		  screen_x1-small_dist, 
 		  screen_y1+small_dist, 
 		  screen_x1+small_dist, 
 		  screen_y1-small_dist);
     
-    gdk_draw_line(w_current->window, w_current->gc, 
-		  screen_x1+small_dist, 
-		  screen_y1+small_dist, 
-		  screen_x1-small_dist, 
-		  screen_y1-small_dist);
     gdk_draw_line(w_current->backingstore, w_current->gc, 
 		  screen_x1+small_dist, 
 		  screen_y1+small_dist, 
@@ -306,13 +274,14 @@ void o_text_draw_xor(GSCHEM_TOPLEVEL *w_current, int dx, int dy, OBJECT *o_curre
     gdk_gc_set_foreground(w_current->outline_xor_gc,
                           x_get_darkcolor(color));
 
-    gdk_draw_rectangle( w_current->window,
+    gdk_draw_rectangle( w_current->backingstore,
                         w_current->outline_xor_gc,
                         FALSE,
                         left+dx,
                         top+dy,
                         right - left,
                         bottom - top );
+
   }
 }
 
diff --git a/gschem/src/x_basic.c b/gschem/src/x_basic.c
index adfd031..92948a4 100644
--- a/gschem/src/x_basic.c
+++ b/gschem/src/x_basic.c
@@ -49,15 +49,12 @@ void x_repaint_background(GSCHEM_TOPLEVEL *w_current)
                           w_current->gc,
                           x_get_color(toplevel->background_color));
 
-    gdk_draw_rectangle(w_current->window,
-                       w_current->gc, TRUE, 0, 0,
-                       w_current->win_width,
-                       w_current->win_height);
-
     gdk_draw_rectangle(w_current->backingstore,
                        w_current->gc, TRUE, 0, 0,
                        w_current->win_width,
                        w_current->win_height);
+    o_invalidate_rect(w_current,
+                      0, 0, w_current->win_width, w_current->win_height);
 
     x_grid_draw(w_current);
 
diff --git a/gschem/src/x_event.c b/gschem/src/x_event.c
index c0d1558..d2680ee 100644
--- a/gschem/src/x_event.c
+++ b/gschem/src/x_event.c
@@ -65,7 +65,6 @@ int stroke_trans (char *sequence);
 gint x_event_expose(GtkWidget *widget, GdkEventExpose *event,
 		    GSCHEM_TOPLEVEL *w_current)
 {
-  TOPLEVEL *toplevel = w_current->toplevel;
 #if DEBUG
   printf("EXPOSE\n");
 #endif
@@ -81,59 +80,6 @@ gint x_event_expose(GtkWidget *widget, GdkEventExpose *event,
                   event->area.x, event->area.y,
                   event->area.width, event->area.height);
 
-  /* either this or put xor's and friends into backingstore */
-  /* take care of ghosting when you get an expose event */
-  if (w_current->inside_action) {
-    switch(w_current->event_state) {
-      case(MOVE):
-      case(ENDMOVE):
-      case(COPY): 
-      case(ENDCOPY):
-      case(ENDMCOPY):
-        o_drawbounding(w_current,
-                       geda_list_get_glist( toplevel->page_current->selection_list ),
-                       x_get_darkcolor(w_current->bb_color), TRUE);
-        break;
-      case(DRAWCOMP):
-      case(ENDCOMP):
-      case(ENDPASTE):
-        o_drawbounding(w_current,
-                       toplevel->page_current->complex_place_list,
-                       x_get_darkcolor(w_current->bb_color), TRUE);
-        break;
-
-      case(BUSCONT):
-      case(DRAWBUS):
-	 o_bus_xorrubber(w_current);  
-        break;
-      case(DRAWNET):   
-      case(NETCONT):
-	 o_net_xorrubber(w_current); 
-        break;
-      case(ENDARC): 
-	 o_arc_rubberarc_xor(w_current); 
-        break;
-      case(ENDBOX):
-	 o_box_rubberbox_xor(w_current); 
-        break;
-      case(ENDCIRCLE):
-	 o_circle_rubbercircle_xor(w_current); 
-        break;
-      case(ENDLINE): 
-	 o_line_rubberline_xor(w_current); 
-        break;
-      case(ENDPIN): /*! \todo (no function in o_pin.nw available) */
-        break;
-      case(ENDTEXT): 
-	 o_text_rubberattrib(w_current);
-        break;
-      case(GRIPS): /*! \todo (larger changes in o_grips.nw necessary) */
-        break;
-      case(ZOOMBOXEND): /*! \todo (not realy a problem as zoom will redraw) */
-        break;
-    }
-  }
-
   /* raise the dialog boxes if this feature is enabled */
   if (w_current->raise_dialog_boxes) {
     x_dialog_raise_all(w_current);
diff --git a/gschem/src/x_grid.c b/gschem/src/x_grid.c
index 29aba56..8074bc1 100644
--- a/gschem/src/x_grid.c
+++ b/gschem/src/x_grid.c
@@ -124,9 +124,6 @@ void x_grid_draw(GSCHEM_TOPLEVEL *w_current)
 
           /* get out of loop if more than 1000 points */
           if (count == 5000) {
-            gdk_draw_points(w_current->window,
-                            w_current->gc,
-                            points, count);
             gdk_draw_points(
                             w_current->backingstore,
                             w_current->gc, points, count);
@@ -135,10 +132,6 @@ void x_grid_draw(GSCHEM_TOPLEVEL *w_current)
         }
         else
         {
-          gdk_draw_arc(w_current->window, w_current->gc,
-                       TRUE, x, y,
-                       w_current->grid_dot_size,
-                       w_current->grid_dot_size, 0, FULL_CIRCLE);
           gdk_draw_arc(w_current->backingstore, w_current->gc,
                        TRUE, x, y,
                        w_current->grid_dot_size,
@@ -150,8 +143,6 @@ void x_grid_draw(GSCHEM_TOPLEVEL *w_current)
 
   /* now draw all the points in one step */
   if(count != 0) {
-    gdk_draw_points(w_current->window,
-                    w_current->gc, points, count);
     gdk_draw_points(w_current->backingstore,
                     w_current->gc, points, count);
   }
@@ -199,22 +190,12 @@ void x_draw_tiles(GSCHEM_TOPLEVEL *w_current)
       printf("x, y: %d %d\n", screen_x, screen_y);
       printf("w x h: %d %d\n", width, height);
 #endif
-      gdk_draw_rectangle(w_current->window, 
-                         w_current->gc, 
-                         FALSE, screen_x, screen_y,
-                         width, height);
       gdk_draw_rectangle(w_current->backingstore, 
                          w_current->gc, 
                          FALSE, screen_x, screen_y,
                          width, height);
 
       tempstring = g_strdup_printf("%d %d", i, j);
-      gdk_draw_text (w_current->window,
-                     font,
-                     w_current->gc,
-                     screen_x+10, screen_y+10, 
-                     tempstring,
-                     strlen(tempstring));
 
       gdk_draw_text (w_current->backingstore,
                      font,
diff --git a/gschem/src/x_stroke.c b/gschem/src/x_stroke.c
index 3ee3b8e..a557761 100644
--- a/gschem/src/x_stroke.c
+++ b/gschem/src/x_stroke.c
@@ -65,7 +65,8 @@ void x_stroke_add_point(GSCHEM_TOPLEVEL *w_current, int x, int y)
   gdk_gc_set_foreground(w_current->gc,
                         x_get_color(w_current->stroke_color));
 
-  gdk_draw_point(w_current->window, w_current->gc, x, y);
+  gdk_draw_point(w_current->backingstore, w_current->gc, x, y);
+  o_invalidate_rect (w_current, x, y, x, y);
 }
 
 /*! \todo Finish function documentation!!!
@@ -90,8 +91,10 @@ void x_stroke_erase_all(GSCHEM_TOPLEVEL *w_current)
                           w_current->gc,
                           x_get_color(w_current->toplevel->background_color));
 
-    gdk_draw_point(w_current->window, w_current->gc,
+    gdk_draw_point(w_current->backingstore, w_current->gc,
                    stroke_points->x, stroke_points->y);
+    o_invalidate_rect (w_current, stroke_points->x, stroke_points->y,
+                                  stroke_points->x, stroke_points->y);
 
     temp = stroke_points;
     stroke_points = stroke_points->next;

commit 33e12c8916f6b3bcd2d0df2246ef925e7b25b0dd
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sat Dec 15 13:31:38 2007 +0000

    XOR draw to remove component ghost when cancelling component placement.
    
    Changes previous full-screen redraw when cancelling component placement
    to use XOR drawing. Adds similar code to remove the ghost which exists
    (usually underneath the dialog) when the component selection dialog is
    closed. Don't rely on an expose event to re-paint it for us.

diff --git a/gschem/src/i_callbacks.c b/gschem/src/i_callbacks.c
index 1c962cd..c404790 100644
--- a/gschem/src/i_callbacks.c
+++ b/gschem/src/i_callbacks.c
@@ -3420,11 +3420,13 @@ DEFINE_I_CALLBACK(cancel)
       w_current->cswindow) {
     /* user hit escape key when placing components */
 
+    /* Undraw any XOR outline of the place list */
+    o_complex_rubbercomplex(w_current);
+
     /* Free the complex place list and its contents */
     s_delete_object_glist(w_current->toplevel,
                           w_current->toplevel->page_current->complex_place_list);
     w_current->toplevel->page_current->complex_place_list = NULL;
-    o_redraw_all(w_current); 
 
     /* Present the component selector again */
     g_value_init (&value, G_TYPE_BOOLEAN);
diff --git a/gschem/src/x_compselect.c b/gschem/src/x_compselect.c
index 00fe0d7..2180df6 100644
--- a/gschem/src/x_compselect.c
+++ b/gschem/src/x_compselect.c
@@ -152,6 +152,9 @@ x_compselect_callback_response (GtkDialog *dialog,
         gtk_widget_destroy (GTK_WIDGET (dialog));
         w_current->cswindow = NULL;
 
+        /* Undraw any XOR outline of the place list */
+        o_complex_rubbercomplex(w_current);
+
         /* Free the complex place list and its contents */
         s_delete_object_glist(toplevel,
                               toplevel->page_current->complex_place_list);

commit ebf8dd81c398f39adcdbe4801d4a624ab1f73241
Author: Peter Clifton <pcjc2@xxxxxxxxx>
Date:   Sat Dec 15 13:31:36 2007 +0000

    Remove unused toplevel variable in o_grips_motion()

diff --git a/gschem/src/o_grips.c b/gschem/src/o_grips.c
index 8d9835a..97c7c97 100644
--- a/gschem/src/o_grips.c
+++ b/gschem/src/o_grips.c
@@ -881,8 +881,6 @@ void o_grips_start_line(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current,
  */
 void o_grips_motion(GSCHEM_TOPLEVEL *w_current, int x, int y)
 {
-  TOPLEVEL *toplevel = w_current->toplevel;
-
   g_assert( w_current->inside_action != 0 );
   g_return_if_fail( object_changing != NULL );
 




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