Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
catwm
*.o
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CFLAGS+= -Wall
LDADD+= -lX11
LDADD+= -lX11
LDFLAGS=
EXEC=catwm

Expand All @@ -17,4 +17,4 @@ install: all
install -Dm 755 catwm $(DESTDIR)$(BINDIR)/catwm

clean:
rm -f catwm *.o
rm -f $(EXEC) *.o
17 changes: 9 additions & 8 deletions catwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
*/

#include <X11/Xlib.h>
#include <X11/XKBlib.h>
#include <X11/keysym.h>
#include <X11/XF86keysym.h>
#include <stdio.h>
Expand Down Expand Up @@ -191,7 +192,7 @@ void change_desktop(const Arg arg) {
void client_to_desktop(const Arg arg) {
client *tmp = current;
int tmp2 = current_desktop;

if(arg.i == current_desktop || current == NULL)
return;

Expand Down Expand Up @@ -242,7 +243,7 @@ void destroynotify(XEvent *e) {
for(c=head;c;c=c->next)
if(ev->window == c->win)
i++;

// End of the hack
if(i == 0)
return;
Expand Down Expand Up @@ -289,7 +290,7 @@ void increase() {
void keypress(XEvent *e) {
int i;
XKeyEvent ke = e->xkey;
KeySym keysym = XKeycodeToKeysym(dis,ke.keycode,0);
KeySym keysym = XkbKeycodeToKeysym(dis,ke.keycode,0,0);

for(i=0;i<TABLENGTH(keys);++i) {
if(keys[i].keysym == keysym && keys[i].mod == ke.state) {
Expand All @@ -312,7 +313,7 @@ void kill_client() {
send_kill_signal(current->win);
}
}

void maprequest(XEvent *e) {
XMapRequestEvent *ev = &e->xmaprequest;

Expand Down Expand Up @@ -411,7 +412,7 @@ void quit() {
Window root_return, parent;
Window *children;
int i;
unsigned int nchildren;
unsigned int nchildren;
XEvent ev;

/*
Expand Down Expand Up @@ -496,7 +497,7 @@ void select_desktop(int i) {
current_desktop = i;
}

void send_kill_signal(Window w) {
void send_kill_signal(Window w) {
XEvent ke;
ke.type = ClientMessage;
ke.xclient.window = w;
Expand Down Expand Up @@ -552,7 +553,7 @@ void setup() {
const Arg arg = {.i = 1};
current_desktop = arg.i;
change_desktop(arg);

// To catch maprequest and destroynotify (if other wm running)
XSelectInput(dis,root,SubstructureNotifyMask|SubstructureRedirectMask);
}
Expand Down Expand Up @@ -656,7 +657,7 @@ void update_current() {
}

int main(int argc, char **argv) {
// Open display
// Open display
if(!(dis = XOpenDisplay(NULL)))
die("Cannot open display!");

Expand Down