diff options
| author | Ivan Kanakarakis <ivan.kanak@gmail.com> | 2011-11-26 03:31:44 +0200 |
|---|---|---|
| committer | Ivan Kanakarakis <ivan.kanak@gmail.com> | 2011-11-26 03:31:44 +0200 |
| commit | 34b02ddf0d2024d3f802ded8e7dd3f475c600656 (patch) | |
| tree | e8af99b2f17ef3ee9eec7198654866700cd01744 | |
| parent | b5aa24f3fd96b06e08832b2bdb9759d7cb2308b0 (diff) | |
| parent | c6e3b1e20bf92cbaab05a3075a3f7a78b14ad113 (diff) | |
Merge branch 'mirror'
Conflicts:
src/config.h.def
src/dminiwm.c
| -rw-r--r-- | src/ChangeLog | 3 | ||||
| -rw-r--r-- | src/Makefile | 2 | ||||
| -rw-r--r-- | src/README | 13 | ||||
| -rw-r--r-- | src/config.h.def | 5 | ||||
| -rw-r--r-- | src/dminiwm.c | 41 |
5 files changed, 47 insertions, 17 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index c960952..f3a549b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,6 @@ +26/11/11 + Added option to click on a window to focus it + 21/11/11 Fix for transient windows not being managed diff --git a/src/Makefile b/src/Makefile index 55332f9..0316713 100644 --- a/src/Makefile +++ b/src/Makefile @@ -11,7 +11,7 @@ CC=gcc all: $(EXEC) dminiwm: dminiwm.o - $(CC) $(LDFLAGS) -Os -o $@ $+ $(LDADD) + $(CC) $(LDFLAGS) -s -Os -o $@ $+ $(LDADD) install: all install -Dm 755 dminiwm $(DESTDIR)$(BINDIR)/dminiwm @@ -12,7 +12,7 @@ Screenshots and ramblings/updates at https://bbs.archlinux.org/viewtopic.php?id= **dminiwm** is a very minimal and lightweight dynamic tiling window manager. I will try to stay under 1000 SLOC. - Currently under 900 lines with the config file included. + Currently under 950 lines with the config file included. ###Modes @@ -60,9 +60,8 @@ It allows the "normal" method of tiling window managers(with the new window as t ###Recent Changes -------------- -15/10/11 - Added having applications open on specified desktop - +26/11/11 + Added a click to focus option ###Status ------ @@ -76,6 +75,7 @@ There are more options in the config file than the original catwm. * Fixed a window being destroyed on another desktop creating ghost windows. * Added ability to resize the window on the top of the stack * Added having applications open on specified desktop + * Added a click to focus option ###Installation @@ -83,7 +83,8 @@ There are more options in the config file than the original catwm. Need Xlib, then: - edit the config.h file to suit your needs + edit the config.h.def file to suit your needs + and save it as config.h. $ make # make install @@ -99,5 +100,5 @@ Need Xlib, then: ###Todo ---- - * I'll think of something + * when swithching desktops stop the mouse being in an unfocused window changing focus. diff --git a/src/config.h.def b/src/config.h.def index 8ae8f26..e50253e 100644 --- a/src/config.h.def +++ b/src/config.h.def @@ -1,6 +1,6 @@ - /* config.h for dminiwm.c [ 0.1.7 ] + /* config.h for dminiwm.c [ 0.1.8 ] * - * Started from catwm 31/12/10 + * Started from catwm 31/12/10 * Bad window error checking and numlock checking used from * 2wm at http://hg.suckless.org/2wm/ * @@ -35,6 +35,7 @@ #define DEFAULT_MODE 0 /* 0=Vertical, 1=Fullscreen 2=Horizontal 3=grid*/ #define FOLLOW_MOUSE 0 /* 1=Don't 0=Focus the window the mouse just entered */ #define FOLLOW_WINDOW 0 /* 1=Don't 0=Follow the window when moved to a different desktop */ +#define CLICK_TO_FOCUS 0 /* 1=Don't 0=Focus an unfocused window when clicked */ #define DESKTOPS 6 /* Must edit DESKTOPCHANGE keys to suit */ // Colors diff --git a/src/dminiwm.c b/src/dminiwm.c index 3c0c83b..22cbd9d 100644 --- a/src/dminiwm.c +++ b/src/dminiwm.c @@ -1,6 +1,10 @@ +<<<<<<< HEAD /* dminiwm.c [ 0.1.7 ] +======= +/* dminiwm.c [ 0.1.8 ] +>>>>>>> mirror * -* I started this from catwm 31/12/10 +* I started this from catwm 31/12/10 * Bad window error checking and numlock checking used from * 2wm at http://hg.suckless.org/2wm/ * @@ -97,6 +101,7 @@ static const AtomNode atomList[] = { // Functions static void add_window(Window w); +static void buttonpressed(XEvent *e); static void change_desktop(const Arg arg); static void client_to_desktop(const Arg arg); static void configurenotify(XEvent *e); @@ -161,6 +166,7 @@ static void (*events[LASTEvent])(XEvent *e) = { [KeyPress] = keypress, [MapRequest] = maprequest, [EnterNotify] = enternotify, + [ButtonPress] = buttonpressed, [DestroyNotify] = destroynotify, [ConfigureNotify] = configurenotify, [ConfigureRequest] = configurerequest @@ -187,7 +193,7 @@ void add_window(Window w) { else { if(ATTACH_ASIDE == 0) { for(t=head;t->next;t=t->next); - + c->next = NULL; c->prev = t; c->win = w; @@ -510,7 +516,7 @@ void tile() { wdt = sw - BORDER_WIDTH; if((n == x) && (n == 8)) wdt = 2*sw/3 - BORDER_WIDTH; - } else + } else if(x >= 5) { wdt = (sw/3) - BORDER_WIDTH; ht = (sh/2) - BORDER_WIDTH; @@ -571,9 +577,14 @@ void update_current() { XSetWindowBorder(dis,c->win,win_focus); XSetInputFocus(dis,c->win,RevertToParent,CurrentTime); XRaiseWindow(dis,c->win); + if(CLICK_TO_FOCUS == 0) + XUngrabButton(dis, AnyButton, AnyModifier, c->win); } - else + else { XSetWindowBorder(dis,c->win,win_unfocus); + if(CLICK_TO_FOCUS == 0) + XGrabButton(dis, AnyButton, AnyModifier, c->win, True, ButtonPressMask|ButtonReleaseMask, GrabModeAsync, GrabModeAsync, None, None); + } } XSync(dis, False); } @@ -805,7 +816,21 @@ void enternotify(XEvent *e) { } } -void send_kill_signal(Window w) { +void buttonpressed(XEvent *e) { + client *c; + XButtonPressedEvent *ev = &e->xbutton; + + // change focus with LMB + if(CLICK_TO_FOCUS == 0 && ev->window != current->win && ev->button == Button1) + for(c=head;c;c=c->next) + if(ev->window == c->win) { + current = c; + update_current(); + return; + } +} + +void send_kill_signal(Window w) { XEvent ke; ke.type = ClientMessage; ke.xclient.window = w; @@ -831,7 +856,7 @@ void quit() { Window root_return, parent; Window *children; int i; - unsigned int nchildren; + unsigned int nchildren; XEvent ev; /* @@ -869,7 +894,7 @@ void quit() { void logger(const char* e) { fprintf(stdout,"\n\033[0;34m:: dminiwm : %s \033[0;m\n", e); } - + void setup() { // Install a signal sigchld(0); @@ -992,7 +1017,7 @@ void start() { int main(int argc, char **argv) { - // Open display + // Open display if(!(dis = XOpenDisplay(NULL))) { logger("\033[0;31mCannot open display!"); exit(1); |
