Fix animation
[xboard.git] / xoptions.c
index c213bbc..888fb65 100644 (file)
@@ -546,6 +546,22 @@ ICSKeyEvent(GtkWidget *widget, GdkEventKey *event)
     }
 }
 
+void
+HighlightText (Option *opt, int from, int to, Boolean highlight)
+{
+#   define INIT 0x8000
+    static GtkTextIter start, end;
+
+    if(!(opt->min & INIT)) {
+       opt->min |= INIT; // each memo its own init flag!
+       gtk_text_buffer_create_tag(opt->handle, "highlight", "background", "yellow", NULL);
+       gtk_text_buffer_create_tag(opt->handle, "normal", "background", "white", NULL);
+    }
+    gtk_text_buffer_get_iter_at_offset(opt->handle, &start, from);
+    gtk_text_buffer_get_iter_at_offset(opt->handle, &end, to);
+    gtk_text_buffer_apply_tag_by_name(opt->handle, highlight ? "highlight" : "normal", &start, &end);
+}
+
 static gboolean
 MemoEvent(GtkWidget *widget, GdkEvent *event, gpointer gdata)
 {   // handle mouse clicks on text widgets that need it
@@ -848,11 +864,15 @@ GraphEventProc(GtkWidget *widget, GdkEvent *event, gpointer gdata)
 void
 GraphExpose (Option *opt, int x, int y, int w, int h)
 {
+#if 0
+  GdkRectangle r;
+  r.x = x; r.y = y; r.width = w; r.height = h;
+  gdk_window_invalidate_rect(((GtkWidget *)(opt->handle))->window, &r, FALSE);
+#endif
   GdkEventExpose e;
   if(!opt->handle) return;
   e.area.x = x; e.area.y = y; e.area.width = w; e.area.height = h; e.count = -1; e.type = GDK_EXPOSE; // count = -1: kludge to suppress sizing
-  GraphEventProc(opt->handle, (GdkEvent//        gtk_check_menu_item_set_active((GtkCheckMenuItem *) item->handle, state);
- *) &e, (gpointer) opt); // fake expose event
+  GraphEventProc(opt->handle, (GdkEvent *) &e, (gpointer) opt); // fake expose event
 }
 
 void GenericCallback(GtkWidget *widget, gpointer gdata)