Skip to content

Commit

Permalink
sloppy focus flag in config.h and license-related changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Tudor committed Sep 3, 2016
1 parent 7e76b1b commit b91d836
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.o
windowchef
waitron
1 change: 1 addition & 0 deletions BUGS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- If compiled with -O2 fullscreen does not work as expected.
4 changes: 2 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all
copies.

THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ NAME_DEFINES = -D__NAME__=\"$(__NAME__)\" \
SRC = list.c wm.c client.c
OBJ = $(SRC:.c=.o)
BIN = $(__NAME__) $(__NAME_CLIENT__)
CFLAGS += $(NAME_DEFINES) -DD
CFLAGS += $(NAME_DEFINES)

all: $(BIN)

Expand Down
2 changes: 2 additions & 0 deletions client.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* See the LICENSE file for copyright and license details. */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand Down
4 changes: 3 additions & 1 deletion common.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
/* See the LICENSE file for copyright and license details. */

#ifndef _COMMON_H
#define _COMMON_H

#ifdef D
#define DMSG(fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__)
#else
#define DMSG
#define DMSG(fmt, ...)
#endif

#endif
3 changes: 3 additions & 0 deletions config.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* See the LICENSE file for copyright and license details. */

#ifndef _CONFIG_H
#define _CONFIG_H

Expand All @@ -7,5 +9,6 @@
#define GAP 20
#define CURSOR_POSITION CENTER
#define GROUPS 4
#define SLOPPY_FOCUS true

#endif
2 changes: 1 addition & 1 deletion config.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ PREFIX = /usr/local
MANPREFIX = /usr/local/share
MANDIR = $(MANPREFIX)/man/man1

CFLAGS += -std=c99 -Wextra -g
CFLAGS += -std=c99 -Wextra
LDFLAGS += -lxcb -lxcb-ewmh -lxcb-icccm -lxcb-randr
2 changes: 2 additions & 0 deletions ipc.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* See the LICENSE file for copyright and license details. */

#ifndef _WM_IPC_H
#define _WM_IPC_H

Expand Down
2 changes: 2 additions & 0 deletions list.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* See the LICENSE file for copyright and license details. */

#include <stdlib.h>

#include "list.h"
Expand Down
2 changes: 2 additions & 0 deletions list.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* See the LICENSE file for copyright and license details. */

#ifndef _LIST_H
#define _LIST_H

Expand Down
3 changes: 3 additions & 0 deletions types.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* See the LICENSE file for copyright and license details. */

#ifndef _TYPES_H
#define _TYPES_H

Expand Down Expand Up @@ -41,6 +43,7 @@ struct conf {
uint32_t focus_color, unfocus_color;
enum cursor_position cursor_position;
uint32_t groups;
bool sloppy_focus;
};

#endif
9 changes: 8 additions & 1 deletion wm.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* See the LICENSE file for copyright and license details. */

#include <xcb/xcb.h>
#include <xcb/xcb_icccm.h>
#include <xcb/xcb_ewmh.h>
Expand Down Expand Up @@ -218,6 +220,7 @@ setup(void)
conf.gap = GAP;
conf.cursor_position = CURSOR_POSITION;
conf.groups = GROUPS;
conf.sloppy_focus = SLOPPY_FOCUS;

group_in_use = malloc(conf.groups * sizeof(bool));
for (uint32_t i = 0; i < conf.groups; i++)
Expand Down Expand Up @@ -1434,6 +1437,8 @@ event_enter_notify(xcb_generic_event_t *ev)
xcb_enter_notify_event_t *e = (xcb_enter_notify_event_t *)ev;
struct client *client;

if (conf.sloppy_focus == false)
return;
if (e->mode == XCB_NOTIFY_MODE_NORMAL ||
e->mode == XCB_NOTIFY_MODE_UNGRAB) {
if (focused_win != NULL && e->event == focused_win->window)
Expand Down Expand Up @@ -1501,8 +1506,10 @@ event_map_notify(xcb_generic_event_t *ev)
xcb_map_notify_event_t *e = (xcb_map_notify_event_t *)ev;
struct client *client = find_client(&e->window);

if (client != NULL)
if (client != NULL) {
client->mapped = true;
set_focused(client);
}
}

/*
Expand Down

0 comments on commit b91d836

Please sign in to comment.