From 3c987d9a2f98e1d10cd9ab3f9baf40b59f80190a Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Sun, 14 Sep 2014 22:00:14 +0000 Subject: add default bg --- Sgraph.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'Sgraph.c') diff --git a/Sgraph.c b/Sgraph.c index d0c63f6..2b57ad6 100644 --- a/Sgraph.c +++ b/Sgraph.c @@ -49,6 +49,9 @@ static XtResource resources[] = { { XtNbackground, XtCBackground, XtRPixel, sizeof(Pixel), XtOffset(SgraphWidget, sgraph.background), XtRString, "black" }, + { XtNbackground, XtCBackground, XtRPixel, + sizeof(Pixel), XtOffset(Widget, core.background_pixel), + XtRString, "dark slate gray" }, { XtNmirror, XtCBoolean, XtRBoolean, sizeof(Boolean), XtOffset(SgraphWidget, sgraph.mirror), XtRBoolean, False }, @@ -135,7 +138,6 @@ Initialize(Widget request, Widget w, ArgList args, Cardinal *nargs) static void Resize(Widget w) { - SgraphWidget sw = (SgraphWidget)w; Dimension width, height; if (!XtIsRealized(w)) @@ -151,21 +153,28 @@ Resize(Widget w) warnx("win: %dx%d", winwidth, winheight); warnx("sub: %dx%d", width, height); - 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); } static void Redisplay(Widget w, XEvent *event, Region r) { + SgraphWidget sw = (SgraphWidget)w; + Dimension width = winwidth / 2; + Dimension height = winheight; + if (!XtIsRealized(w)) return; + warnx("Redisplay"); + Resize(w); + + 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); } static void -- cgit v1.2.3