aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2014-09-14 23:02:46 +0000
committerDimitri Sokolyuk <demon@dim13.org>2014-09-14 23:02:46 +0000
commit43ee45790a18bad360384b27ba91eaa73dfa76d6 (patch)
treee5e36b94aed73cdd83013e866cdf75be5588799a
parent04dfbe4e1b0470ef59c9e414baadc77f11aacbf6 (diff)
expand worker proc
-rw-r--r--Sgraph.c6
-rw-r--r--spectrogram.c16
2 files changed, 16 insertions, 6 deletions
diff --git a/Sgraph.c b/Sgraph.c
index 5e304ac..427f376 100644
--- a/Sgraph.c
+++ b/Sgraph.c
@@ -194,11 +194,12 @@ Redisplay(Widget w, XEvent *event, Region r)
SgraphWidget sw = (SgraphWidget)w;
Dimension width = winwidth / 2;
Dimension height = winheight;
+ static Dimension n;
if (!XtIsRealized(w))
return;
- warnx("Redisplay");
+ //warnx("Redisplay");
XFillRectangle(XtDisplay(sw), XtWindow(sw), sw->sgraph.backGC,
BORDER, BORDER,
@@ -206,8 +207,9 @@ Redisplay(Widget w, XEvent *event, Region r)
XFillRectangle(XtDisplay(sw), XtWindow(sw), sw->sgraph.backGC,
width + BORDER, BORDER,
width - 2 * BORDER, height - 2 * BORDER);
+ n = (n + 1) % width;
XCopyArea(XtDisplay(sw), sw->sgraph.bg, XtWindow(sw), sw->sgraph.foreGC,
- 0, 0, width, height / 4, BORDER, BORDER);
+ 0, 0, width, height / 4, BORDER + n, BORDER);
}
static void
diff --git a/spectrogram.c b/spectrogram.c
index 9677be6..4156210 100644
--- a/spectrogram.c
+++ b/spectrogram.c
@@ -71,10 +71,18 @@ static XtActionsRec actionsList[] = {
};
static Boolean
-worker(XtPointer client_data)
+worker(XtPointer data)
{
- warnx("Worker");
- return True; /* remove the work procedure from the list */
+ XEvent event;
+
+ 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 */
}
int
@@ -85,7 +93,6 @@ main(int argc, char **argv)
toplevel = XtInitialize(__progname, "Spectrograph",
options, XtNumber(options), &argc, argv);
XtAddActions(actionsList, XtNumber(actionsList));
- XtAddWorkProc(worker, NULL);
if (argc != 1)
usage();
@@ -94,6 +101,7 @@ main(int argc, char **argv)
toplevel, NULL, 0);
XtOverrideTranslations(sgraph,
XtParseTranslationTable("<Key>q: quit()"));
+ XtAddWorkProc(worker, sgraph);
XtRealizeWidget(toplevel);
XtMainLoop();