Skip to content

Commit a441697

Browse files
authored
released at 0.0.7
1 parent c8823da commit a441697

File tree

4 files changed

+17
-10
lines changed

4 files changed

+17
-10
lines changed

CHANGELOG

+4
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4242
## [0.0.6] - 2020-11-12
4343
### Added
4444
- Window borders and color definitions.
45+
46+
## [0.0.7] - 2020-11-13
47+
### Fixed
48+
- Border focus/unfocus when leaving a window.

README

+4-4
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ FEATURES
1010
BUILD REQUIREMENTS
1111
==================
1212

13-
libxcb, along with any default or user defined utility:
13+
libxcb, along with any default or user defined utilities:
1414

1515
application launcher dmenu - https://git.suckless.org/dmenu
1616
terminal emulator st - https://git.suckless.org/st
@@ -76,9 +76,9 @@ Patching xwm (after copying the *.patch into the source dir.):
7676
DISCLAIMER
7777
==========
7878

79-
xwm ("XCB Window Manager") is an homage to the original "X Window
80-
Manager", which is now defunct and unmaintained. Both projects
81-
are unaffiliated and do not share any common source code.
79+
xwm ("XCB Window Manager") is an homage to the original and
80+
now-defunct "X Window Manager". Both projects are unaffiliated
81+
and do not share any common source code.
8282

8383
CONTACT
8484
=======

config.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
#define WINDOW_HEIGHT 400
2626
#define WINDOW_MIN_WIDTH 60
2727
#define WINDOW_MIN_HEIGHT 40
28-
#define BORDER_WIDTH 2 /* 0 = no border effect */
29-
#define BORDER_COLOR_UNFOCUSED 0x00FFFF /* 0xRRGGBB */
28+
#define BORDER_WIDTH 1 /* 0 = no border effect */
29+
#define BORDER_COLOR_UNFOCUSED 0xC0C0C0 /* 0xRRGGBB */
3030
#define BORDER_COLOR_FOCUSED 0xFFFFFF /* 0xRRGGBB */
3131

3232
/* ALIASED COMMANDS

xwm.c

+7-4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
static xcb_connection_t * dpy;
99
static xcb_screen_t * scre;
1010
static xcb_drawable_t win;
11+
static xcb_drawable_t winprev;
1112
static xcb_drawable_t root;
1213
static uint32_t values[3];
1314

@@ -102,6 +103,10 @@ static void setFocus(xcb_drawable_t window) {
102103
xcb_set_input_focus(dpy, XCB_INPUT_FOCUS_POINTER_ROOT, window,
103104
XCB_CURRENT_TIME);
104105
}
106+
setBorderColor(window, 1);
107+
if (winprev != window) {
108+
setBorderColor(winprev, 0);
109+
}
105110
}
106111

107112
static void setBorderColor(xcb_window_t window, int focus) {
@@ -148,12 +153,11 @@ static void handleKeyPress(xcb_generic_event_t * ev) {
148153
static void handleEnterNotify(xcb_generic_event_t * ev) {
149154
xcb_enter_notify_event_t * e = ( xcb_enter_notify_event_t *) ev;
150155
setFocus(e->event);
151-
setBorderColor(e->event, 1);
152156
}
153157

154158
static void handleLeaveNotify(xcb_generic_event_t * ev) {
155159
xcb_leave_notify_event_t * e = ( xcb_leave_notify_event_t *) ev;
156-
setBorderColor(e->event, 0);
160+
winprev = e->event;
157161
}
158162

159163
static void handleButtonRelease(xcb_generic_event_t * ev) {
@@ -174,7 +178,6 @@ static void handleMapRequest(xcb_generic_event_t * ev) {
174178
xcb_map_window(dpy, e->window);
175179
setWindowDimensions(e->window);
176180
setBorderWidth(e->window);
177-
setBorderColor(e->window, 0);
178181
values[0] = XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW;
179182
xcb_change_window_attributes_checked(dpy, e->window,
180183
XCB_CW_EVENT_MASK, values);
@@ -251,7 +254,7 @@ static int strcmp_c(char * str1, char * str2) {
251254
int main(int argc, char * argv[]) {
252255
int ret = 0;
253256
if ((argc == 2) && (strcmp_c("-v", argv[1]) == 0)) {
254-
ret = die("xwm-0.0.6, © 2020 Michael Czigler, see LICENSE for details\n");
257+
ret = die("xwm-0.0.7, © 2020 Michael Czigler, see LICENSE for details\n");
255258
}
256259
if ((ret == 0) && (argc != 1)) {
257260
ret = die("usage: xwm [-v]\n");

0 commit comments

Comments
 (0)