aboutsummaryrefslogtreecommitdiff
path: root/Sgraph.c
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2014-09-14 22:00:14 +0000
committerDimitri Sokolyuk <demon@dim13.org>2014-09-14 22:00:14 +0000
commit3c987d9a2f98e1d10cd9ab3f9baf40b59f80190a (patch)
tree23ee50af62cf8bfb83c1c2b9d526c9b107387c67 /Sgraph.c
parentfb2b511cb071b44dbfdf26dac9bb0a50d26f13f5 (diff)
add default bg
Diffstat (limited to 'Sgraph.c')
-rw-r--r--Sgraph.c23
1 files changed, 16 insertions, 7 deletions
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