aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDimitri Sokolyuk <demon@dim13.org>2014-09-29 15:38:24 +0000
committerDimitri Sokolyuk <demon@dim13.org>2014-09-29 15:38:24 +0000
commit11819eb2b7b08c8e0cd0863cdfeb030537d2a257 (patch)
tree39e918339237010715687b382d413c4ced3ac6ee
parentaa11dfe12708fb6a797b345573fd1b8cc71c3233 (diff)
fix resize
-rw-r--r--Display.c33
-rw-r--r--Sgraph.c17
-rw-r--r--spectrogram.c4
3 files changed, 34 insertions, 20 deletions
diff --git a/Display.c b/Display.c
index 1e73179..b2025e3 100644
--- a/Display.c
+++ b/Display.c
@@ -5,8 +5,8 @@
#include <X11/StringDefs.h>
#include "DisplayP.h"
-#define Printd(w, s) do { \
- warnx("Class %s: %s", XtClass(w)->core_class.class_name, s); \
+#define Trace(w) do { \
+ warnx("%s.%s", XtClass(w)->core_class.class_name, __func__); \
} while (0)
static void Initialize(Widget, Widget, ArgList, Cardinal *);
@@ -87,7 +87,7 @@ WidgetClass displayWidgetClass = (WidgetClass) & displayClassRec;
static void
Initialize(Widget req, Widget new, ArgList args, Cardinal *num_args)
{
- warnx("Display initialize");
+ Trace(new);
new->core.width = 800;
new->core.height = 600;
}
@@ -95,7 +95,7 @@ Initialize(Widget req, Widget new, ArgList args, Cardinal *num_args)
static XtGeometryResult
GeometryManager(Widget w, XtWidgetGeometry *request, XtWidgetGeometry *reply)
{
- warnx("Geometry Manager");
+ Trace(w);
return XtGeometryYes;
}
@@ -109,7 +109,7 @@ ChangeManaged(Widget w)
int i;
Arg arg;
- warnx("Change Managed %s", XtClass(w)->core_class.class_name);
+ Trace(w);
width = w->core.width;
height = w->core.height;
@@ -140,24 +140,27 @@ static void
Resize(Widget w)
{
DisplayWidget dw = (DisplayWidget)w;
- Dimension x, y, width, height, border;
+ Dimension x, y, width, height;
Widget child;
int n = dw->composite.num_children;
int i;
- width = w->core.width / n - (n + 1) * dw->display.space;
+ Trace(w);
+
+ width = w->core.width / n - 2 * dw->display.space;
height = w->core.height - 2 * dw->display.space;
- Printd(w, "Resize");
for (i = 0; i < dw->composite.num_children; i++) {
child = dw->composite.children[i];
if (XtIsManaged(child)) {
- border = child->core.border_width;
- x = dw->display.space;
- x += i * (width + 2 * border);
+ x = i * (width + dw->display.space
+ + child->core.border_width)
+ + dw->display.space;
y = dw->display.space;
- XtConfigureWidget(child, x, y, width - 2 * border,
- height - 2 * border, border);
+ XtConfigureWidget(child, x, y,
+ width - 2 * child->core.border_width,
+ height - 2 * child->core.border_width,
+ child->core.border_width);
}
}
}
@@ -169,6 +172,8 @@ Redisplay(Widget w, XEvent *event, Region region)
Widget child;
int i;
+ //Trace(w);
+
for (i = 0; i < dw->composite.num_children; i++) {
child = dw->composite.children[i];
if (XtIsManaged(child))
@@ -181,6 +186,8 @@ SetValues(Widget old, Widget req, Widget new, ArgList args, Cardinal *n)
{
XExposeEvent xeev;
+ //Trace(new);
+
xeev.type = Expose;
xeev.display = XtDisplay(new);
xeev.window = XtWindow(new);
diff --git a/Sgraph.c b/Sgraph.c
index 0db2a78..704583f 100644
--- a/Sgraph.c
+++ b/Sgraph.c
@@ -25,8 +25,8 @@
#include <err.h>
#include <stdint.h>
-#define Printd(w, s) do { \
- warnx("Class %s: %s", XtClass(w)->core_class.class_name, s); \
+#define Trace(w) do { \
+ warnx("%s.%s", XtClass(w)->core_class.class_name, __func__); \
} while (0)
static void Initialize(Widget request, Widget w, ArgList args, Cardinal *nargs);
@@ -121,6 +121,8 @@ GetGC(Widget w)
XGCValues xgcv;
XtGCMask gc_mask = GCForeground|GCBackground|GCPlaneMask;
+ Trace(w);
+
xgcv.plane_mask = AllPlanes;
xgcv.background = sw->sgraph.background;
@@ -148,6 +150,8 @@ Initialize(Widget request, Widget w, ArgList args, Cardinal *nargs)
int major, minor;
Status ret;
+ Trace(w);
+
ret = XdbeQueryExtension(XtDisplay(w), &major, &minor);
if (!ret)
errx(1, "Xdbe %d.%d error %d", major, minor, ret);
@@ -159,7 +163,6 @@ Initialize(Widget request, Widget w, ArgList args, Cardinal *nargs)
sw->sgraph.data = (int *)XtCalloc(sw->sgraph.size, sizeof(int));
- Printd(w, "Initialize");
GetGC(w);
}
@@ -168,6 +171,8 @@ Realize(Widget w, XtValueMask *mask, XSetWindowAttributes *attr)
{
SgraphWidget sw = (SgraphWidget)w;
+ Trace(w);
+
if (XtIsRealized(w))
return;
@@ -181,11 +186,11 @@ Resize(Widget w)
{
SgraphWidget sw = (SgraphWidget)w;
+ Trace(w);
+
if (!XtIsRealized(w))
return;
- Printd(w, "Resize");
-
sw->sgraph.size = w->core.width;
warnx("win: %dx%d", w->core.width, w->core.height);
warnx("size: %d", sw->sgraph.size);
@@ -210,6 +215,8 @@ Redisplay(Widget w, XEvent *event, Region r)
Dimension x, y;
XdbeSwapInfo swap;
+ //Trace(w);
+
if (!XtIsRealized(w))
return;
diff --git a/spectrogram.c b/spectrogram.c
index 4cfef4c..ec95a0d 100644
--- a/spectrogram.c
+++ b/spectrogram.c
@@ -98,8 +98,8 @@ worker(XtPointer p)
String fallback[] = {
"*foreground: Gold",
"*background: RoyalBlue4",
- "*borderColor: Red",
- "*borderWidth: 1",
+ "*borderColor: RoyalBlue",
+ "*borderWidth: 2",
NULL,
};