fix some bugs with padding

This commit is contained in:
speedie 2023-03-12 21:03:35 +01:00
parent 1d4dd4ccfa
commit 14075e00a3
7 changed files with 15 additions and 22 deletions

View file

@ -46,8 +46,7 @@ spmenu.col_sgrcolor14: #00ffff
spmenu.col_sgrcolor15: #ffffff
spmenu.alpha: 1
spmenu.accuratewidth: 1
spmenu.bordercentered: 1
spmenu.borderwidth: 2
spmenu.borderwidth: 0
spmenu.lineheight: 5
spmenu.lines: 0
spmenu.columns: 10

View file

@ -152,7 +152,6 @@ readargs(int argc, char *argv[])
} else if (!strcmp(argv[i], "-m")) /* monitor */
mon = atoi(argv[++i]);
else if (!strcmp(argv[i], "-bw")) { /* border width */
bordercentered = 0;
borderwidth = atoi(argv[++i]);
} else if (!strcmp(argv[i], "-H")) /* hist file location */
histfile = argv[++i];

View file

@ -15,22 +15,11 @@ create_window(int x, int y, int w, int h)
swa.colormap = cmap;
swa.event_mask = ExposureMask | KeyPressMask | VisibilityChangeMask | ButtonPressMask | PointerMotionMask;
if (!bordercentered) {
win = XCreateWindow(dpy, parentwin, x, y, w, h, borderwidth,
depth, InputOutput, visual,
CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWColormap|CWEventMask, &swa);
} else {
if (!centered) {
win = XCreateWindow(dpy, parentwin, x, y, w, h, 0,
depth, InputOutput, visual,
CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWColormap|CWEventMask, &swa);
} else {
win = XCreateWindow(dpy, parentwin, x, y, w, h, borderwidth,
depth, InputOutput, visual,
CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWColormap|CWEventMask, &swa);
}
// create client
win = XCreateWindow(dpy, parentwin, x, y, w, h, borderwidth,
depth, InputOutput, visual,
CWOverrideRedirect|CWBackPixel|CWBorderPixel|CWColormap|CWEventMask, &swa);
}
return;
}

View file

@ -204,6 +204,14 @@ drawmenu(void)
if (!hidematchcount) {
recalculatenumbers();
numberWidth = TEXTW(numbers);
// mode indicator is always going to be at the right
if (hidemode) {
numberWidth += 2 * sp + borderwidth;
} else {
modeWidth += 2 * sp + borderwidth;
}
}
// draw items and image

View file

@ -112,7 +112,6 @@ ResourcePref resources[] = {
{ "rightarrow", STRING, &rightarrow },
{ "normtext", STRING, &normtext },
{ "instext", STRING, &instext },
{ "bordercentered", INTEGER, &bordercentered },
{ "borderwidth", INTEGER, &borderwidth },
{ "lines", INTEGER, &lines },
{ "lineheight", INTEGER, &lineheight },

View file

@ -30,8 +30,7 @@ static char normtext[] = "Normal"; /* Text to display for normal
static char instext[] = "Insert"; /* Text to display for insert mode */
/* Window border options */
static int borderwidth = 2; /* Width of the border */
static int bordercentered = 1; /* Draw border only when centered */
static int borderwidth = 0; /* Width of the border */
/* Font options */
static char *font[] = {

View file

@ -972,7 +972,7 @@ setup(void)
match();
/* create menu window */
create_window(x + sp, y + vp, mw - 2 * sp, mh);
create_window(x + sp, y + vp - (menuposition ? 0 : borderwidth * 2), mw - 2 * sp - borderwidth * 2, mh);
set_window();
set_prop();