Skip to content

Commit

Permalink
Fixes #51. Also some examples and man clarifications
Browse files Browse the repository at this point in the history
  • Loading branch information
tudurom committed Sep 1, 2018
1 parent 49a075f commit e82665c
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 20 deletions.
4 changes: 3 additions & 1 deletion client.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,9 @@ fn_position(uint32_t *data, int argc, char **argv)
snap_pos = BOTTOM_LEFT;
else if (strcasecmp(pos, "bottomright") == 0)
snap_pos = BOTTOM_RIGHT;
else if (strcasecmp(pos, "middle") == 0)
else if (strcasecmp(pos, "middle") == 0 ||
strcasecmp(pos, "center") == 0 ||
strcasecmp(pos, "centre") == 0)
snap_pos = CENTER;
else if (strcasecmp(pos, "left") == 0)
snap_pos = LEFT;
Expand Down
1 change: 1 addition & 0 deletions config.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* when snapping or vertically/horizontally maximizing window */
#define GAP 0

/* gap between windows when laid in grid */
#define GRID_GAP 0

/* where to place the cursor when moving/resizing the window */
Expand Down
13 changes: 9 additions & 4 deletions examples/windowchefrc
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
#!/bin/sh

waitron wm_config border_width 5
waitron wm_config internal_border_width 2
waitron wm_config color_focused 0x97a293
waitron wm_config color_unfocused 0x393638
waitron wm_config internal_color_focused 0x393638
waitron wm_config internal_color_unfocused 0x97a293

waitron wm_config gap_width all 0
waitron wm_config grid_gap_width 0
waitron wm_config cursor_position middle
waitron wm_config groups_nr 9
waitron wm_config group_activate_specific true
waitron wm_config enable_resize_hints false

waitron wm_config cursor_position center

waitron wm_config groups_nr 10
waitron wm_config enable_sloppy_focus true
waitron wm_config enable_resize_hints false
waitron wm_config sticky_windows false
waitron wm_config enable_borders true
waitron wm_config enable_last_window_focusing true
Expand Down
9 changes: 6 additions & 3 deletions man/waitron.1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3
.\" https://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "WAITRON" "1" "August 2018" "Windowchef" "Windowchef Manual"
.TH "WAITRON" "1" "September 2018" "Windowchef" "Windowchef Manual"
.
.SH "NAME"
\fBwaitron\fR \- A client for windowchef(1)
Expand Down Expand Up @@ -49,7 +49,10 @@ false values: \fBfalse\fR | \fBf\fR | \fBno\fR | \fBn\fR | \fB0\fR
.
.TP
\fBMOUSE_BUTTON\fR
\fBany\fR | \fBnone\fR | \fBleft\fR | \fBmiddle\fR | \fBright\fR
\fBany\fR | \fBnone\fR | \fBleft\fR | \fBmiddle\fR | \fBcentre\fR | \fBcenter\fR | \fBright\fR
.
.IP
\fBmiddle\fR, \fBcentre\fR, and \fBcenter\fR are synonyms and have the same behaviour\.
.
.SH "COMMANDS"
.
Expand Down Expand Up @@ -244,7 +247,7 @@ If \fIsticky_windows\fR is true, new windows will be assigned to the last activa
.
.TP
\fBenable_borders\fR \fIBOOL\fR
If true, border colors will be set each time a window gets/loses focus\. Setting it to false is useful when using another program to draw the borders (example: \fBchwb2\fR from wmutils)\.
If true, the border will be fully managed by the window manager\. Border colors will be set each time a window gets/loses focus\. Setting it to false lets the user manage the border of every window using external tools\. (example: \fBchwb2\fR from wmutils)\.
.
.TP
\fBenable_last_window_focusing\fR \fIBOOL\fR
Expand Down
12 changes: 8 additions & 4 deletions man/waitron.1.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions man/waitron.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ anything on `stdout`.
`alt` | `super`

* `MOUSE_BUTTON`:
`any` | `none` | `left` | `middle` | `right`
`any` | `none` | `left` | `middle` | `centre` | `center` | `right`

`middle`, `centre`, and `center` are synonyms and have the same behaviour.

## COMMANDS

Expand Down Expand Up @@ -215,8 +217,10 @@ are:
workspaces over groups.

* `enable_borders` <BOOL>:
If true, border colors will be set each time a window gets/loses focus.
Setting it to false is useful when using another program to draw the borders
If true, the border will be fully managed by the window manager. Border colors will
be set each time a window gets/loses focus. Setting it to false lets
the user manage the border of every window using external
tools.
(example: `chwb2` from wmutils).

* `enable_last_window_focusing` <BOOL>:
Expand Down
19 changes: 14 additions & 5 deletions wm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1699,19 +1699,19 @@ get_geometry(xcb_window_t *win, int16_t *x, int16_t *y, uint16_t *width, uint16_
static void
set_borders(struct client *client, uint32_t color, uint32_t internal_color)
{
if (client == NULL)
if (client == NULL || conf.borders == false)
return;
uint32_t values[1];
values[0] = conf.border_width;
xcb_configure_window(conn, client->window,
XCB_CONFIG_WINDOW_BORDER_WIDTH, values);

if (conf.borders == true && conf.internal_border_width == 0) {
if (conf.internal_border_width == 0) {
values[0] = color;
xcb_change_window_attributes(conn, client->window, XCB_CW_BORDER_PIXEL, values);
}

if (conf.borders == true && conf.internal_border_width != 0) {
if (conf.internal_border_width != 0) {
uint32_t calc_iborder = conf.border_width - conf.internal_border_width;
xcb_rectangle_t rect_inner[] = {
{
Expand Down Expand Up @@ -2344,14 +2344,18 @@ event_configure_request(xcb_generic_event_t *ev)
XCB_CONFIG_WINDOW_STACK_MODE, values);
}

if (e->value_mask & XCB_CONFIG_WINDOW_BORDER_WIDTH) {
values[0] = e->border_width;
xcb_configure_window(conn, e->window,
XCB_CONFIG_WINDOW_BORDER_WIDTH, values);
}

if (!client->maxed) {
fit_on_screen(client);
}

teleport_window(client->window, client->geom.x, client->geom.y);
resize_window_absolute(client->window, client->geom.width, client->geom.height);
if (!client->maxed)
set_borders(client, conf.focus_color, conf.internal_focus_color);
} else {
if (e->value_mask & XCB_CONFIG_WINDOW_X) {
values[i] = e->x;
Expand Down Expand Up @@ -2383,6 +2387,11 @@ event_configure_request(xcb_generic_event_t *ev)
i++;
}

if (e->value_mask & XCB_CONFIG_WINDOW_BORDER_WIDTH) {
values[i] = e->border_width;
i++;
}

if (i == 0)
return;
xcb_configure_window(conn, e->window, e->value_mask, values);
Expand Down

0 comments on commit e82665c

Please sign in to comment.