cvsimport

This commit is contained in:
okan 2012-10-29 19:46:03 +00:00
commit c42043ede7
3 changed files with 45 additions and 24 deletions

7
conf.c
View File

@ -104,8 +104,13 @@ conf_reload(struct conf *c)
conf_font(c, sc);
menu_init(sc);
}
TAILQ_FOREACH(cc, &Clientq, entry)
TAILQ_FOREACH(cc, &Clientq, entry) {
conf_client(cc);
/* XXX Does not take hmax/vmax into account. */
if ((cc->flags & CLIENT_MAXFLAGS) == CLIENT_MAXIMIZED)
cc->bwidth = 0;
client_draw_border(cc);
}
}
static struct {

26
cwmrc.5
View File

@ -14,7 +14,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: November 6 2011 $
.Dd $Mdocdate: July 6 2012 $
.Dt CWMRC 5
.Os
.Sh NAME
@ -39,18 +39,26 @@ Arguments containing whitespace should be surrounded by double quotes
The following options are accepted:
.Pp
.Bl -tag -width Ds -compact
.It Ic autogroup Ar group windowname
.It Ic autogroup Ar group windowclass
.It Ic autogroup Ar group windowname,windowclass
Control automatic window grouping, based on the name and/or class
properties, where
Automatically add new windows to
.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
is a number between 0 and 9.
If the group number is 0, then the window will not be grouped; this to
allow for
.Dq sticky
windows in sticky group mode.
If
.Ar group
is 0, matching windows will not be added to any group; this may be
used to override
.Dq sticky group mode .
.Pp
The name and class of a window may be obtained using
The name and class values for existing windows may be obtained using
.Xr xprop 1 .
.Pp
.It Ic bind Ar keys command

36
menu.c
View File

@ -51,6 +51,7 @@ struct menu_ctx {
int noresult;
int prev;
int entry;
int height;
int width;
int num;
int x;
@ -301,7 +302,7 @@ menu_draw(struct screen_ctx *sc, struct menu_ctx *mc, struct menu_q *menuq,
struct menu *mi;
XineramaScreenInfo *xine;
int xmin, xmax, ymin, ymax;
int n, dy, xsave, ysave;
int n, xsave, ysave;
if (mc->list) {
if (TAILQ_EMPTY(resultq) && mc->list) {
@ -317,12 +318,12 @@ menu_draw(struct screen_ctx *sc, struct menu_ctx *mc, struct menu_q *menuq,
mc->num = 0;
mc->width = 0;
dy = 0;
mc->height = 0;
if (mc->hasprompt) {
(void)snprintf(mc->dispstr, sizeof(mc->dispstr), "%s%s%s",
mc->promptstr, mc->searchstr, PROMPT_ECHAR);
mc->width = font_width(sc, mc->dispstr, strlen(mc->dispstr));
dy = font_height(sc);
mc->height = font_height(sc);
mc->num = 1;
}
@ -339,7 +340,7 @@ menu_draw(struct screen_ctx *sc, struct menu_ctx *mc, struct menu_q *menuq,
mc->width = MAX(mc->width, font_width(sc, text,
MIN(strlen(text), MENU_MAXENTRY)));
dy += font_height(sc);
mc->height += font_height(sc);
mc->num++;
}
@ -358,24 +359,26 @@ menu_draw(struct screen_ctx *sc, struct menu_ctx *mc, struct menu_q *menuq,
xsave = mc->x;
ysave = mc->y;
if (mc->x < xmin)
mc->x = xmin;
else if (mc->x + mc->width >= xmax)
/* Never hide the top, or left side, of the menu. */
if (mc->x + mc->width >= xmax)
mc->x = xmax - mc->width;
if (mc->y + dy >= ymax)
mc->y = ymax - dy;
/* never hide the top of the menu */
if (mc->x < xmin) {
mc->x = xmin;
mc->width = xmax - xmin;
}
if (mc->y + mc->height >= ymax)
mc->y = ymax - mc->height;
if (mc->y < ymin) {
mc->y = ymin;
dy = ymax - ymin;
mc->height = ymax - ymin;
}
if (mc->x != xsave || mc->y != ysave)
xu_ptr_setpos(sc->rootwin, mc->x, mc->y);
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) {
font_draw(sc, mc->dispstr, strlen(mc->dispstr), sc->menuwin,
@ -387,9 +390,14 @@ menu_draw(struct screen_ctx *sc, struct menu_ctx *mc, struct menu_q *menuq,
TAILQ_FOREACH(mi, resultq, resultentry) {
char *text = mi->print[0] != '\0' ?
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),
sc->menuwin, 0, n * font_height(sc) + font_ascent(sc) + 1);
sc->menuwin, 0, y);
n++;
}