From c05ed01c1a4996d9682362e4741abaa255f93755 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Thu, 11 Oct 2007 11:33:40 +0200 Subject: [PATCH] bugfix: only catch first click to raise if we're floating --- client.c | 5 +++-- event.c | 21 ++++++++++++--------- layout.c | 4 ++-- layout.h | 2 +- layouts/tile.c | 8 ++++---- statusbar.c | 2 +- 6 files changed, 23 insertions(+), 19 deletions(-) diff --git a/client.c b/client.c index cd130603..915c01d9 100644 --- a/client.c +++ b/client.c @@ -72,7 +72,8 @@ grabbuttons(Client * c, Bool focused, Bool raised, KeySym modkey, unsigned int n if(focused) { - if (!raised) { + if (!raised) + { XGrabButton(c->display, Button1, NoSymbol, c->win, False, BUTTONMASK, GrabModeAsync, GrabModeSync, None, None); XGrabButton(c->display, Button1, LockMask, c->win, False, @@ -792,7 +793,7 @@ uicb_moveresize(Display *disp __attribute__ ((unused)), unsigned int dui; Window dummy; - if(!IS_ARRANGE(layout_floating)) + if(!IS_ARRANGE(0, layout_floating)) if(!sel || !sel->isfloating || sel->isfixed || !arg) return; if(sscanf(arg, "%s %s %s %s", x, y, w, h) != 4) diff --git a/event.c b/event.c index 5d7994b3..10706f53 100644 --- a/event.c +++ b/event.c @@ -201,15 +201,17 @@ handle_event_buttonpress(XEvent * e, awesome_config *awesomeconf) if((c = getclient(ev->window))) { focus(c->display, c, ev->same_screen, &awesomeconf[c->screen]); - if(CLEANMASK(ev->state, c->screen) != awesomeconf[c->screen].modkey) { - if (ev->button == Button1) { + if(CLEANMASK(ev->state, c->screen) != awesomeconf[c->screen].modkey) + { + if (ev->button == Button1) + { restack(c->display, &awesomeconf[c->screen]); grabbuttons(c, True, True, awesomeconf->modkey, awesomeconf->numlockmask); } } else if(ev->button == Button1) { - if(!IS_ARRANGE(layout_floating) && !c->isfloating) + if(!IS_ARRANGE(c->screen, layout_floating) && !c->isfloating) uicb_togglefloating(e->xany.display, &awesomeconf[c->screen], NULL); else restack(e->xany.display, &awesomeconf[c->screen]); @@ -217,14 +219,14 @@ handle_event_buttonpress(XEvent * e, awesome_config *awesomeconf) } else if(ev->button == Button2) { - if(!IS_ARRANGE(layout_floating) && !c->isfixed && c->isfloating) + if(!IS_ARRANGE(c->screen, layout_floating) && !c->isfixed && c->isfloating) uicb_togglefloating(e->xany.display, &awesomeconf[c->screen], NULL); else uicb_zoom(e->xany.display, &awesomeconf[c->screen], NULL); } else if(ev->button == Button3) { - if(!IS_ARRANGE(layout_floating) && !c->isfloating) + if(!IS_ARRANGE(c->screen, layout_floating) && !c->isfloating) uicb_togglefloating(e->xany.display, &awesomeconf[c->screen], NULL); else restack(e->xany.display, &awesomeconf[c->screen]); @@ -261,7 +263,7 @@ handle_event_configurerequest(XEvent * e, awesome_config *awesomeconf) c->ismax = False; if(ev->value_mask & CWBorderWidth) c->border = ev->border_width; - if(c->isfixed || c->isfloating || IS_ARRANGE(layout_floating)) + if(c->isfixed || c->isfloating || IS_ARRANGE(c->screen, layout_floating)) { if(ev->value_mask & CWX) c->x = ev->x; @@ -345,10 +347,11 @@ handle_event_enternotify(XEvent * e, awesome_config *awesomeconf) if(ev->mode != NotifyNormal || ev->detail == NotifyInferior) return; - if((c = getclient(ev->window))) { + if((c = getclient(ev->window))) + { focus(c->display, c, ev->same_screen, &awesomeconf[c->screen]); - if (sel) - grabbuttons(sel, True, False, awesomeconf->modkey, awesomeconf->numlockmask); + if (sel && (sel->isfloating || IS_ARRANGE(sel->screen, layout_floating))) + grabbuttons(sel, True, False, awesomeconf->modkey, awesomeconf->numlockmask); } else for(screen = 0; screen < ScreenCount(e->xany.display); screen++) diff --git a/layout.c b/layout.c index 4c4576c4..a7725333 100644 --- a/layout.c +++ b/layout.c @@ -126,9 +126,9 @@ restack(Display * disp, awesome_config *awesomeconf) drawstatusbar(disp, awesomeconf); if(!sel) return; - if(sel->isfloating || IS_ARRANGE(layout_floating)) + if(sel->isfloating || IS_ARRANGE(0, layout_floating)) XRaiseWindow(disp, sel->win); - if(!IS_ARRANGE(layout_floating)) + if(!IS_ARRANGE(0, layout_floating)) { wc.stack_mode = Below; wc.sibling = awesomeconf->statusbar.window; diff --git a/layout.h b/layout.h index 9d22812c..d05b8440 100644 --- a/layout.h +++ b/layout.h @@ -25,7 +25,7 @@ #include "client.h" /** Check if current layout is arranged with a layout */ -#define IS_ARRANGE(layout) (layout == awesomeconf->current_layout->arrange) +#define IS_ARRANGE(screen, layout) (layout == awesomeconf[screen].current_layout->arrange) #define AWESOMEPROPS_ATOM(disp) XInternAtom(disp, "_AWESOME_PROPERTIES", False) diff --git a/layouts/tile.c b/layouts/tile.c index 0d1372aa..43f82d7e 100644 --- a/layouts/tile.c +++ b/layouts/tile.c @@ -36,7 +36,7 @@ uicb_setnmaster(Display *disp, awesome_config *awesomeconf, const char * arg) { - if(!arg || (!IS_ARRANGE(layout_tile) && !IS_ARRANGE(layout_tileleft))) + if(!arg || (!IS_ARRANGE(0, layout_tile) && !IS_ARRANGE(0, layout_tileleft))) return; @@ -51,7 +51,7 @@ uicb_setncol(Display *disp, awesome_config *awesomeconf, const char * arg) { - if(!arg || (!IS_ARRANGE(layout_tile) && !IS_ARRANGE(layout_tileleft))) + if(!arg || (!IS_ARRANGE(0, layout_tile) && !IS_ARRANGE(0, layout_tileleft))) return; if((awesomeconf->ncol = (int) compute_new_value_from_arg(arg, (double) awesomeconf->ncol)) < 1) @@ -67,11 +67,11 @@ uicb_setmwfact(Display *disp, { char *newarg; - if((!IS_ARRANGE(layout_tile) && !IS_ARRANGE(layout_tileleft)) || !arg) + if((!IS_ARRANGE(0, layout_tile) && !IS_ARRANGE(0, layout_tileleft)) || !arg) return; newarg = a_strdup(arg); - if(IS_ARRANGE(layout_tileleft)) + if(IS_ARRANGE(0, layout_tileleft)) { if(newarg[0] == '+') newarg[0] = '-'; diff --git a/statusbar.c b/statusbar.c index 3e99f6bd..124d0014 100644 --- a/statusbar.c +++ b/statusbar.c @@ -134,7 +134,7 @@ drawstatusbar(Display *disp, awesome_config * awesomeconf) sel->ismax, awesomeconf->colors_selected[ColFG]); } - else if(IS_ARRANGE(layout_tile) || IS_ARRANGE(layout_tileleft)) + else if(IS_ARRANGE(0, layout_tile) || IS_ARRANGE(0, layout_tileleft)) { char buf[256]; snprintf(buf, sizeof(buf), "nmaster: %d ncol: %d mwfact: %.2lf", awesomeconf->nmaster, awesomeconf->ncol, awesomeconf->mwfact);