aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2014-09-14 23:58:44 +0000
committerDimitri Sokolyuk <demon@dim13.org>2014-09-14 23:58:44 +0000
commita02ae8d65ea7f18b9052ee0c8580de9d110b3065 (patch)
treeabd4c21c54c7e942317029871ad1426187acb09a
parent43ee45790a18bad360384b27ba91eaa73dfa76d6 (diff)
add redisplay func
-rw-r--r--Sgraph.c3
-rw-r--r--aux.c13
-rw-r--r--aux.h1
-rw-r--r--spectrogram.c8
4 files changed, 18 insertions, 7 deletions
diff --git a/Sgraph.c b/Sgraph.c
index 427f376..3c26fef 100644
--- a/Sgraph.c
+++ b/Sgraph.c
@@ -201,12 +201,15 @@ Redisplay(Widget w, XEvent *event, Region r)
//warnx("Redisplay");
+ /*
XFillRectangle(XtDisplay(sw), XtWindow(sw), sw->sgraph.backGC,
BORDER, BORDER,
width - 2 * BORDER, height - 2 * BORDER);
XFillRectangle(XtDisplay(sw), XtWindow(sw), sw->sgraph.backGC,
width + BORDER, BORDER,
width - 2 * BORDER, height - 2 * BORDER);
+ */
+ XClearWindow(XtDisplay(sw), XtWindow(sw));
n = (n + 1) % width;
XCopyArea(XtDisplay(sw), sw->sgraph.bg, XtWindow(sw), sw->sgraph.foreGC,
0, 0, width, height / 4, BORDER + n, BORDER);
diff --git a/aux.c b/aux.c
index 1f9ed0e..6a62db7 100644
--- a/aux.c
+++ b/aux.c
@@ -115,3 +115,16 @@ copy(Display *d, Drawable from, Drawable to, GC gc, XRectangle r, Drawable mask)
XCopyArea(d, from, to, gc, 0, 0, r.width, r.height, 0, 0);
XSetClipMask(d, gc, None);
}
+
+void
+redisplay(Display *d, Window w)
+{
+ XEvent event;
+
+ memset(&event, 0, sizeof(XEvent));
+ event.type = Expose;
+ event.xexpose.window = w;
+ XSendEvent(d, w, False, ExposureMask, &event);
+
+ XFlush(d);
+}
diff --git a/aux.h b/aux.h
index 11b1f65..f38a2c7 100644
--- a/aux.h
+++ b/aux.h
@@ -26,6 +26,7 @@ void restrictsize(Display *, Window, int, int, int, int);
void blit(Display *, Drawable, GC, XRectangle);
void clear(Display *, Drawable, GC, XRectangle);
void copy(Display *, Drawable, Drawable, GC, XRectangle, Drawable);
+void redisplay(Display *, Window);
__END_DECLS
#endif
diff --git a/spectrogram.c b/spectrogram.c
index 4156210..2fa1b29 100644
--- a/spectrogram.c
+++ b/spectrogram.c
@@ -73,15 +73,9 @@ static XtActionsRec actionsList[] = {
static Boolean
worker(XtPointer data)
{
- XEvent event;
+ redisplay(XtDisplay(data), XtWindow(data));
- memset(&event, 0, sizeof(XEvent));
- event.type = Expose;
- event.xexpose.window = XtWindow(data);
- XSendEvent(XtDisplay(data), XtWindow(data), False, ExposureMask, &event);
- XFlush(XtDisplay(data));
usleep(200);
-
return False; /* don't remove the work procedure from the list */
}