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); conf_font(c, sc);
menu_init(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); client_draw_border(cc);
}
} }
static struct { static struct {

26
cwmrc.5
View File

@ -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: July 6 2012 $
.Dt CWMRC 5 .Dt CWMRC 5
.Os .Os
.Sh NAME .Sh NAME
@ -39,18 +39,26 @@ Arguments containing whitespace should be surrounded by double quotes
The following options are accepted: The following options are accepted:
.Pp .Pp
.Bl -tag -width Ds -compact .Bl -tag -width Ds -compact
.It Ic autogroup Ar group windowname .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 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

36
menu.c
View File

@ -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;
@ -301,7 +302,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 +318,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 +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, 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 +359,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 +390,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++;
} }