mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
commit
c44a6dd895
2
calmwm.c
2
calmwm.c
@ -34,6 +34,7 @@
|
|||||||
|
|
||||||
#include "calmwm.h"
|
#include "calmwm.h"
|
||||||
|
|
||||||
|
char **cwm_argv;
|
||||||
Display *X_Dpy;
|
Display *X_Dpy;
|
||||||
|
|
||||||
Cursor Cursor_default;
|
Cursor Cursor_default;
|
||||||
@ -67,6 +68,7 @@ main(int argc, char **argv)
|
|||||||
warnx("no locale support");
|
warnx("no locale support");
|
||||||
mbtowc(NULL, NULL, MB_CUR_MAX);
|
mbtowc(NULL, NULL, MB_CUR_MAX);
|
||||||
|
|
||||||
|
cwm_argv = argv;
|
||||||
while ((ch = getopt(argc, argv, "c:d:")) != -1) {
|
while ((ch = getopt(argc, argv, "c:d:")) != -1) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'c':
|
case 'c':
|
||||||
|
5
calmwm.h
5
calmwm.h
@ -297,7 +297,6 @@ struct conf {
|
|||||||
struct autogroupwin_q autogroupq;
|
struct autogroupwin_q autogroupq;
|
||||||
struct autostartcmd_q autostartq;
|
struct autostartcmd_q autostartq;
|
||||||
struct winmatch_q ignoreq;
|
struct winmatch_q ignoreq;
|
||||||
char conf_path[MAXPATHLEN];
|
|
||||||
struct cmd_q cmdq;
|
struct cmd_q cmdq;
|
||||||
struct mousebinding_q mousebindingq;
|
struct mousebinding_q mousebindingq;
|
||||||
#define CONF_STICKY_GROUPS 0x0001
|
#define CONF_STICKY_GROUPS 0x0001
|
||||||
@ -422,7 +421,7 @@ void kbfunc_lock(struct client_ctx *, union arg *);
|
|||||||
void kbfunc_menu_search(struct client_ctx *, union arg *);
|
void kbfunc_menu_search(struct client_ctx *, union arg *);
|
||||||
void kbfunc_moveresize(struct client_ctx *, union arg *);
|
void kbfunc_moveresize(struct client_ctx *, union arg *);
|
||||||
void kbfunc_quit_wm(struct client_ctx *, union arg *);
|
void kbfunc_quit_wm(struct client_ctx *, union arg *);
|
||||||
void kbfunc_reload(struct client_ctx *, union arg *);
|
void kbfunc_restart(struct client_ctx *, union arg *);
|
||||||
void kbfunc_ssh(struct client_ctx *, union arg *);
|
void kbfunc_ssh(struct client_ctx *, union arg *);
|
||||||
void kbfunc_term(struct client_ctx *, union arg *);
|
void kbfunc_term(struct client_ctx *, union arg *);
|
||||||
|
|
||||||
@ -456,7 +455,6 @@ void conf_grab(struct conf *, struct keybinding *);
|
|||||||
void conf_grab_mouse(struct client_ctx *);
|
void conf_grab_mouse(struct client_ctx *);
|
||||||
void conf_init(struct conf *);
|
void conf_init(struct conf *);
|
||||||
void conf_mousebind(struct conf *, char *, char *);
|
void conf_mousebind(struct conf *, char *, char *);
|
||||||
void conf_reload(struct conf *);
|
|
||||||
void conf_setup(struct conf *, const char *);
|
void conf_setup(struct conf *, const char *);
|
||||||
void conf_ungrab(struct conf *, struct keybinding *);
|
void conf_ungrab(struct conf *, struct keybinding *);
|
||||||
|
|
||||||
@ -474,7 +472,6 @@ void xev_loop(void);
|
|||||||
void xu_btn_grab(Window, int, u_int);
|
void xu_btn_grab(Window, int, u_int);
|
||||||
void xu_btn_ungrab(Window, int, u_int);
|
void xu_btn_ungrab(Window, int, u_int);
|
||||||
void xu_configure(struct client_ctx *);
|
void xu_configure(struct client_ctx *);
|
||||||
void xu_freecolor(struct screen_ctx *, unsigned long);
|
|
||||||
void xu_getatoms(void);
|
void xu_getatoms(void);
|
||||||
unsigned long xu_getcolor(struct screen_ctx *, char *);
|
unsigned long xu_getcolor(struct screen_ctx *, char *);
|
||||||
int xu_getprop(Window, Atom, Atom, long, u_char **);
|
int xu_getprop(Window, Atom, Atom, long, u_char **);
|
||||||
|
41
conf.c
41
conf.c
@ -81,31 +81,8 @@ conf_color(struct conf *c, struct screen_ctx *sc)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < CWM_COLOR_MAX; i++) {
|
for (i = 0; i < CWM_COLOR_MAX; i++)
|
||||||
xu_freecolor(sc, sc->color[i].pixel);
|
|
||||||
sc->color[i].pixel = xu_getcolor(sc, c->color[i].name);
|
sc->color[i].pixel = xu_getcolor(sc, c->color[i].name);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
conf_reload(struct conf *c)
|
|
||||||
{
|
|
||||||
struct screen_ctx *sc;
|
|
||||||
struct client_ctx *cc;
|
|
||||||
|
|
||||||
if (parse_config(c->conf_path, c) == -1) {
|
|
||||||
warnx("config file %s has errors, not reloading", c->conf_path);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
TAILQ_FOREACH(sc, &Screenq, entry) {
|
|
||||||
conf_gap(c, sc);
|
|
||||||
conf_color(c, sc);
|
|
||||||
conf_font(c, sc);
|
|
||||||
menu_init(sc);
|
|
||||||
}
|
|
||||||
TAILQ_FOREACH(cc, &Clientq, entry)
|
|
||||||
client_draw_border(cc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
@ -143,7 +120,7 @@ static struct {
|
|||||||
{ "CM-equal", "vmaximize" },
|
{ "CM-equal", "vmaximize" },
|
||||||
{ "CMS-equal", "hmaximize" },
|
{ "CMS-equal", "hmaximize" },
|
||||||
{ "CMS-f", "freeze" },
|
{ "CMS-f", "freeze" },
|
||||||
{ "CMS-r", "reload" },
|
{ "CMS-r", "restart" },
|
||||||
{ "CMS-q", "quit" },
|
{ "CMS-q", "quit" },
|
||||||
{ "M-h", "moveleft" },
|
{ "M-h", "moveleft" },
|
||||||
{ "M-j", "movedown" },
|
{ "M-j", "movedown" },
|
||||||
@ -274,6 +251,7 @@ conf_clear(struct conf *c)
|
|||||||
void
|
void
|
||||||
conf_setup(struct conf *c, const char *conf_file)
|
conf_setup(struct conf *c, const char *conf_file)
|
||||||
{
|
{
|
||||||
|
char conf_path[MAXPATHLEN];
|
||||||
char *home;
|
char *home;
|
||||||
struct stat sb;
|
struct stat sb;
|
||||||
int parse = 0;
|
int parse = 0;
|
||||||
@ -284,23 +262,22 @@ conf_setup(struct conf *c, const char *conf_file)
|
|||||||
if ((home = getenv("HOME")) == NULL)
|
if ((home = getenv("HOME")) == NULL)
|
||||||
errx(1, "No HOME directory.");
|
errx(1, "No HOME directory.");
|
||||||
|
|
||||||
(void)snprintf(c->conf_path, sizeof(c->conf_path), "%s/%s",
|
(void)snprintf(conf_path, sizeof(conf_path), "%s/%s",
|
||||||
home, CONFFILE);
|
home, CONFFILE);
|
||||||
|
|
||||||
if (stat(c->conf_path, &sb) == 0 && (sb.st_mode & S_IFREG))
|
if (stat(conf_path, &sb) == 0 && (sb.st_mode & S_IFREG))
|
||||||
parse = 1;
|
parse = 1;
|
||||||
} else {
|
} else {
|
||||||
if (stat(conf_file, &sb) == -1 || !(sb.st_mode & S_IFREG))
|
if (stat(conf_file, &sb) == -1 || !(sb.st_mode & S_IFREG))
|
||||||
errx(1, "%s: %s", conf_file, strerror(errno));
|
errx(1, "%s: %s", conf_file, strerror(errno));
|
||||||
else {
|
else {
|
||||||
(void)strlcpy(c->conf_path, conf_file,
|
(void)strlcpy(conf_path, conf_file, sizeof(conf_path));
|
||||||
sizeof(c->conf_path));
|
|
||||||
parse = 1;
|
parse = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parse && (parse_config(c->conf_path, c) == -1))
|
if (parse && (parse_config(conf_path, c) == -1))
|
||||||
warnx("config file %s has errors, not loading", c->conf_path);
|
warnx("config file %s has errors, not loading", conf_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -384,7 +361,7 @@ static struct {
|
|||||||
{ "vmaximize", kbfunc_client_vmaximize, KBFLAG_NEEDCLIENT, {0} },
|
{ "vmaximize", kbfunc_client_vmaximize, KBFLAG_NEEDCLIENT, {0} },
|
||||||
{ "hmaximize", kbfunc_client_hmaximize, KBFLAG_NEEDCLIENT, {0} },
|
{ "hmaximize", kbfunc_client_hmaximize, KBFLAG_NEEDCLIENT, {0} },
|
||||||
{ "freeze", kbfunc_client_freeze, KBFLAG_NEEDCLIENT, {0} },
|
{ "freeze", kbfunc_client_freeze, KBFLAG_NEEDCLIENT, {0} },
|
||||||
{ "reload", kbfunc_reload, 0, {0} },
|
{ "restart", kbfunc_restart, 0, {0} },
|
||||||
{ "quit", kbfunc_quit_wm, 0, {0} },
|
{ "quit", kbfunc_quit_wm, 0, {0} },
|
||||||
{ "exec", kbfunc_exec, 0, {.i = CWM_EXEC_PROGRAM} },
|
{ "exec", kbfunc_exec, 0, {.i = CWM_EXEC_PROGRAM} },
|
||||||
{ "exec_wm", kbfunc_exec, 0, {.i = CWM_EXEC_WM} },
|
{ "exec_wm", kbfunc_exec, 0, {.i = CWM_EXEC_WM} },
|
||||||
|
5
cwm.1
5
cwm.1
@ -14,7 +14,7 @@
|
|||||||
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
.\"
|
.\"
|
||||||
.Dd $Mdocdate: May 7 2012 $
|
.Dd $Mdocdate: May 9 2012 $
|
||||||
.Dt CWM 1
|
.Dt CWM 1
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -116,7 +116,8 @@ dialog; allows you to switch from
|
|||||||
.Nm
|
.Nm
|
||||||
to another window manager without restarting the X server.
|
to another window manager without restarting the X server.
|
||||||
.It Ic CMS-r
|
.It Ic CMS-r
|
||||||
Reload configuration.
|
Restart the running
|
||||||
|
.Xr cwm 1 .
|
||||||
.It Ic CMS-q
|
.It Ic CMS-q
|
||||||
Quit
|
Quit
|
||||||
.Nm .
|
.Nm .
|
||||||
|
30
cwmrc.5
30
cwmrc.5
@ -14,7 +14,7 @@
|
|||||||
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
.\"
|
.\"
|
||||||
.Dd $Mdocdate: November 6 2011 $
|
.Dd $Mdocdate: October 31 2012 $
|
||||||
.Dt CWMRC 5
|
.Dt CWMRC 5
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -41,16 +41,25 @@ The following options are accepted:
|
|||||||
.Bl -tag -width Ds -compact
|
.Bl -tag -width Ds -compact
|
||||||
.It Ic autogroup Ar group windowclass
|
.It Ic autogroup Ar group windowclass
|
||||||
.It Ic autogroup Ar group windowname,windowclass
|
.It Ic autogroup Ar group windowname,windowclass
|
||||||
Control automatic window grouping, based on the name and/or class
|
Automatically add new windows to
|
||||||
properties, where
|
.Ar group
|
||||||
|
if their class property matches
|
||||||
|
.Ar windowclass ,
|
||||||
|
or if their name and class properties match
|
||||||
|
.Ar windowname
|
||||||
|
and
|
||||||
|
.Ar windowclass ,
|
||||||
|
respectively.
|
||||||
.Ar group
|
.Ar group
|
||||||
is a number between 0 and 9.
|
is a number between 0 and 9.
|
||||||
If the group number is 0, then the window will not be grouped; this to
|
If
|
||||||
allow for
|
.Ar group
|
||||||
.Dq sticky
|
is 0, matching windows will not be added to any group; this may be
|
||||||
windows in sticky group mode.
|
used to override
|
||||||
|
.Dq sticky group mode .
|
||||||
.Pp
|
.Pp
|
||||||
The name and class of a window may be obtained using
|
The name and class values, respectively, for existing windows
|
||||||
|
may be obtained using
|
||||||
.Xr xprop 1 .
|
.Xr xprop 1 .
|
||||||
.Pp
|
.Pp
|
||||||
.It Ic bind Ar keys command
|
.It Ic bind Ar keys command
|
||||||
@ -261,8 +270,9 @@ mousebind M-3 window_resize
|
|||||||
.Ed
|
.Ed
|
||||||
.Sh BIND COMMAND LIST
|
.Sh BIND COMMAND LIST
|
||||||
.Bl -tag -width 18n -compact
|
.Bl -tag -width 18n -compact
|
||||||
.It reload
|
.It restart
|
||||||
Reload configuration.
|
Restart the running
|
||||||
|
.Xr cwm 1 .
|
||||||
.It quit
|
.It quit
|
||||||
Quit
|
Quit
|
||||||
.Xr cwm 1 .
|
.Xr cwm 1 .
|
||||||
|
5
font.c
5
font.c
@ -51,16 +51,11 @@ font_height(struct screen_ctx *sc)
|
|||||||
void
|
void
|
||||||
font_init(struct screen_ctx *sc, const char *color)
|
font_init(struct screen_ctx *sc, const char *color)
|
||||||
{
|
{
|
||||||
if (sc->xftdraw)
|
|
||||||
XftDrawDestroy(sc->xftdraw);
|
|
||||||
sc->xftdraw = XftDrawCreate(X_Dpy, sc->rootwin,
|
sc->xftdraw = XftDrawCreate(X_Dpy, sc->rootwin,
|
||||||
DefaultVisual(X_Dpy, sc->which), DefaultColormap(X_Dpy, sc->which));
|
DefaultVisual(X_Dpy, sc->which), DefaultColormap(X_Dpy, sc->which));
|
||||||
if (sc->xftdraw == NULL)
|
if (sc->xftdraw == NULL)
|
||||||
errx(1, "XftDrawCreate");
|
errx(1, "XftDrawCreate");
|
||||||
|
|
||||||
if (sc->xftcolor.pixel)
|
|
||||||
XftColorFree(X_Dpy, DefaultVisual(X_Dpy, sc->which),
|
|
||||||
DefaultColormap(X_Dpy, sc->which), &sc->xftcolor);
|
|
||||||
if (!XftColorAllocName(X_Dpy, DefaultVisual(X_Dpy, sc->which),
|
if (!XftColorAllocName(X_Dpy, DefaultVisual(X_Dpy, sc->which),
|
||||||
DefaultColormap(X_Dpy, sc->which), color, &sc->xftcolor))
|
DefaultColormap(X_Dpy, sc->which), color, &sc->xftcolor))
|
||||||
errx(1, "XftColorAllocName");
|
errx(1, "XftColorAllocName");
|
||||||
|
6
kbfunc.c
6
kbfunc.c
@ -36,6 +36,7 @@
|
|||||||
#define KNOWN_HOSTS ".ssh/known_hosts"
|
#define KNOWN_HOSTS ".ssh/known_hosts"
|
||||||
#define HASH_MARKER "|1|"
|
#define HASH_MARKER "|1|"
|
||||||
|
|
||||||
|
extern char **cwm_argv;
|
||||||
extern sig_atomic_t xev_quit;
|
extern sig_atomic_t xev_quit;
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -567,7 +568,8 @@ kbfunc_quit_wm(struct client_ctx *cc, union arg *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
kbfunc_reload(struct client_ctx *cc, union arg *arg)
|
kbfunc_restart(struct client_ctx *cc, union arg *arg)
|
||||||
{
|
{
|
||||||
conf_reload(&Conf);
|
(void)setsid();
|
||||||
|
(void)execvp(cwm_argv[0], cwm_argv);
|
||||||
}
|
}
|
||||||
|
40
menu.c
40
menu.c
@ -51,6 +51,7 @@ struct menu_ctx {
|
|||||||
int noresult;
|
int noresult;
|
||||||
int prev;
|
int prev;
|
||||||
int entry;
|
int entry;
|
||||||
|
int height;
|
||||||
int width;
|
int width;
|
||||||
int num;
|
int num;
|
||||||
int x;
|
int x;
|
||||||
@ -76,8 +77,6 @@ menu_init(struct screen_ctx *sc)
|
|||||||
{
|
{
|
||||||
XGCValues gv;
|
XGCValues gv;
|
||||||
|
|
||||||
if (sc->menuwin)
|
|
||||||
XDestroyWindow(X_Dpy, sc->menuwin);
|
|
||||||
sc->menuwin = XCreateSimpleWindow(X_Dpy, sc->rootwin, 0, 0, 1, 1,
|
sc->menuwin = XCreateSimpleWindow(X_Dpy, sc->rootwin, 0, 0, 1, 1,
|
||||||
Conf.bwidth,
|
Conf.bwidth,
|
||||||
sc->color[CWM_COLOR_FG_MENU].pixel,
|
sc->color[CWM_COLOR_FG_MENU].pixel,
|
||||||
@ -88,8 +87,6 @@ menu_init(struct screen_ctx *sc)
|
|||||||
gv.background = sc->color[CWM_COLOR_BG_MENU].pixel;
|
gv.background = sc->color[CWM_COLOR_BG_MENU].pixel;
|
||||||
gv.function = GXxor;
|
gv.function = GXxor;
|
||||||
|
|
||||||
if (sc->gc)
|
|
||||||
XFreeGC(X_Dpy, sc->gc);
|
|
||||||
sc->gc = XCreateGC(X_Dpy, sc->menuwin,
|
sc->gc = XCreateGC(X_Dpy, sc->menuwin,
|
||||||
GCForeground|GCBackground|GCFunction, &gv);
|
GCForeground|GCBackground|GCFunction, &gv);
|
||||||
}
|
}
|
||||||
@ -301,7 +298,7 @@ menu_draw(struct screen_ctx *sc, struct menu_ctx *mc, struct menu_q *menuq,
|
|||||||
struct menu *mi;
|
struct menu *mi;
|
||||||
XineramaScreenInfo *xine;
|
XineramaScreenInfo *xine;
|
||||||
int xmin, xmax, ymin, ymax;
|
int xmin, xmax, ymin, ymax;
|
||||||
int n, dy, xsave, ysave;
|
int n, xsave, ysave;
|
||||||
|
|
||||||
if (mc->list) {
|
if (mc->list) {
|
||||||
if (TAILQ_EMPTY(resultq) && mc->list) {
|
if (TAILQ_EMPTY(resultq) && mc->list) {
|
||||||
@ -317,12 +314,12 @@ menu_draw(struct screen_ctx *sc, struct menu_ctx *mc, struct menu_q *menuq,
|
|||||||
|
|
||||||
mc->num = 0;
|
mc->num = 0;
|
||||||
mc->width = 0;
|
mc->width = 0;
|
||||||
dy = 0;
|
mc->height = 0;
|
||||||
if (mc->hasprompt) {
|
if (mc->hasprompt) {
|
||||||
(void)snprintf(mc->dispstr, sizeof(mc->dispstr), "%s%s%s",
|
(void)snprintf(mc->dispstr, sizeof(mc->dispstr), "%s%s%s",
|
||||||
mc->promptstr, mc->searchstr, PROMPT_ECHAR);
|
mc->promptstr, mc->searchstr, PROMPT_ECHAR);
|
||||||
mc->width = font_width(sc, mc->dispstr, strlen(mc->dispstr));
|
mc->width = font_width(sc, mc->dispstr, strlen(mc->dispstr));
|
||||||
dy = font_height(sc);
|
mc->height = font_height(sc);
|
||||||
mc->num = 1;
|
mc->num = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -339,7 +336,7 @@ menu_draw(struct screen_ctx *sc, struct menu_ctx *mc, struct menu_q *menuq,
|
|||||||
|
|
||||||
mc->width = MAX(mc->width, font_width(sc, text,
|
mc->width = MAX(mc->width, font_width(sc, text,
|
||||||
MIN(strlen(text), MENU_MAXENTRY)));
|
MIN(strlen(text), MENU_MAXENTRY)));
|
||||||
dy += font_height(sc);
|
mc->height += font_height(sc);
|
||||||
mc->num++;
|
mc->num++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -358,24 +355,26 @@ menu_draw(struct screen_ctx *sc, struct menu_ctx *mc, struct menu_q *menuq,
|
|||||||
xsave = mc->x;
|
xsave = mc->x;
|
||||||
ysave = mc->y;
|
ysave = mc->y;
|
||||||
|
|
||||||
if (mc->x < xmin)
|
/* Never hide the top, or left side, of the menu. */
|
||||||
mc->x = xmin;
|
if (mc->x + mc->width >= xmax)
|
||||||
else if (mc->x + mc->width >= xmax)
|
|
||||||
mc->x = xmax - mc->width;
|
mc->x = xmax - mc->width;
|
||||||
|
if (mc->x < xmin) {
|
||||||
if (mc->y + dy >= ymax)
|
mc->x = xmin;
|
||||||
mc->y = ymax - dy;
|
mc->width = xmax - xmin;
|
||||||
/* never hide the top of the menu */
|
}
|
||||||
|
if (mc->y + mc->height >= ymax)
|
||||||
|
mc->y = ymax - mc->height;
|
||||||
if (mc->y < ymin) {
|
if (mc->y < ymin) {
|
||||||
mc->y = ymin;
|
mc->y = ymin;
|
||||||
dy = ymax - ymin;
|
mc->height = ymax - ymin;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mc->x != xsave || mc->y != ysave)
|
if (mc->x != xsave || mc->y != ysave)
|
||||||
xu_ptr_setpos(sc->rootwin, mc->x, mc->y);
|
xu_ptr_setpos(sc->rootwin, mc->x, mc->y);
|
||||||
|
|
||||||
XClearWindow(X_Dpy, sc->menuwin);
|
XClearWindow(X_Dpy, sc->menuwin);
|
||||||
XMoveResizeWindow(X_Dpy, sc->menuwin, mc->x, mc->y, mc->width, dy);
|
XMoveResizeWindow(X_Dpy, sc->menuwin, mc->x, mc->y,
|
||||||
|
mc->width, mc->height);
|
||||||
|
|
||||||
if (mc->hasprompt) {
|
if (mc->hasprompt) {
|
||||||
font_draw(sc, mc->dispstr, strlen(mc->dispstr), sc->menuwin,
|
font_draw(sc, mc->dispstr, strlen(mc->dispstr), sc->menuwin,
|
||||||
@ -387,9 +386,14 @@ menu_draw(struct screen_ctx *sc, struct menu_ctx *mc, struct menu_q *menuq,
|
|||||||
TAILQ_FOREACH(mi, resultq, resultentry) {
|
TAILQ_FOREACH(mi, resultq, resultentry) {
|
||||||
char *text = mi->print[0] != '\0' ?
|
char *text = mi->print[0] != '\0' ?
|
||||||
mi->print : mi->text;
|
mi->print : mi->text;
|
||||||
|
int y = n * font_height(sc) + font_ascent(sc) + 1;
|
||||||
|
|
||||||
|
/* Stop drawing when menu doesn't fit inside the screen. */
|
||||||
|
if (mc->y + y > ymax)
|
||||||
|
break;
|
||||||
|
|
||||||
font_draw(sc, text, MIN(strlen(text), MENU_MAXENTRY),
|
font_draw(sc, text, MIN(strlen(text), MENU_MAXENTRY),
|
||||||
sc->menuwin, 0, n * font_height(sc) + font_ascent(sc) + 1);
|
sc->menuwin, 0, y);
|
||||||
n++;
|
n++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
parse.y
2
parse.y
@ -529,8 +529,6 @@ parse_config(const char *filename, struct conf *xconf)
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)strlcpy(conf->conf_path, filename, sizeof(conf->conf_path));
|
|
||||||
|
|
||||||
conf_init(conf);
|
conf_init(conf);
|
||||||
|
|
||||||
yyparse();
|
yyparse();
|
||||||
|
Loading…
Reference in New Issue
Block a user