public
Description: a tiny graphical app kit for ruby
Homepage: http://code.whytheluckystiff.net/shoes
Clone URL: git://github.com/why/shoes.git
Search Repo:
 * shoes/ruby.c: controls were being redrawn way too much.  caused cpu 
 spike under gtk+ and the open/save dialogs would freeze.
why (author)
Fri May 16 15:16:42 -0700 2008
commit  f0bc42da5a56984b541526d1e367d08e4a7fa333
tree    a8ae56d4dad3fcc4bf3c2a1607fad4a6dc292f6e
parent  61af0f9cbde84beec100e8e08b7873c59d88482e
...
34
35
36
 
 
37
38
39
...
34
35
36
37
38
39
40
41
0
@@ -34,6 +34,8 @@
0
   GtkRequisition req;
0
   VALUE c = (VALUE)data;
0
   shoes_canvas *canvas;
0
+ INFO("EXPOSE: (%d, %d) (%d, %d) %lu, %d, %d\n", event->area.x, event->area.y,
0
+ event->area.width, event->area.height, event->window, (int)event->send_event, event->count);
0
   Data_Get_Struct(c, shoes_canvas, canvas);
0
   shoes_canvas_paint(c);
0
   canvas->slot.expose = event;
...
549
550
551
552
553
 
 
 
 
554
555
556
...
582
583
584
585
586
587
 
 
 
 
 
588
589
590
...
622
623
624
625
 
 
 
626
627
628
...
549
550
551
 
 
552
553
554
555
556
557
558
...
584
585
586
 
 
 
587
588
589
590
591
592
593
594
...
626
627
628
 
629
630
631
632
633
634
0
@@ -549,8 +549,10 @@
0
 
0
 #define REPAINT_CONTROL() \
0
   PLACE_COORDS(); \
0
- gtk_layout_move(GTK_LAYOUT(canvas->slot.canvas), self_t->ref, place.ix + place.dx, place.iy + place.dy); \
0
- gtk_widget_set_size_request(self_t->ref, place.iw, place.ih); \
0
+ if (CHANGED_COORDS()) { \
0
+ gtk_layout_move(GTK_LAYOUT(canvas->slot.canvas), self_t->ref, place.ix + place.dx, place.iy + place.dy); \
0
+ gtk_widget_set_size_request(self_t->ref, place.iw, place.ih); \
0
+ } \
0
   if (canvas->slot.expose != NULL) \
0
   { \
0
     gtk_container_propagate_expose(GTK_CONTAINER(canvas->slot.canvas), self_t->ref, canvas->slot.expose); \
0
@@ -582,9 +584,11 @@
0
 #define REPAINT_CONTROL() \
0
   HIRect hr; \
0
   PLACE_COORDS(); \
0
- hr.origin.x = place.ix + place.dx; hr.origin.y = place.iy + place.dy; \
0
- hr.size.width = place.iw; hr.size.height = place.ih; \
0
- HIViewSetFrame(self_t->ref, &hr);
0
+ if (CHANGED_COORDS()) { \
0
+ hr.origin.x = place.ix + place.dx; hr.origin.y = place.iy + place.dy; \
0
+ hr.size.width = place.iw; hr.size.height = place.ih; \
0
+ HIViewSetFrame(self_t->ref, &hr); \
0
+ }
0
 
0
 static CFStringRef
0
 shoes_rb2cf(VALUE str)
0
@@ -622,7 +626,9 @@
0
 
0
 #define PLACE_CONTROL() \
0
   PLACE_COORDS(); \
0
- MoveWindow(self_t->ref, place.ix + place.dx, place.iy + place.dy, place.iw, place.ih, TRUE)
0
+ if (CHANGED_COORDS()) { \
0
+ MoveWindow(self_t->ref, place.ix + place.dx, place.iy + place.dy, place.iw, place.ih, TRUE); \
0
+ }
0
 
0
 #define REPAINT_CONTROL() \
0
   place.iy -= canvas->slot.scrolly; \

Comments

    No one has commented yet.