bugfix: only catch first click to raise if we're floating

This commit is contained in:
Julien Danjou 2007-10-11 11:33:40 +02:00
parent 8401eee5f5
commit c05ed01c1a
6 changed files with 23 additions and 19 deletions

View File

@ -72,7 +72,8 @@ grabbuttons(Client * c, Bool focused, Bool raised, KeySym modkey, unsigned int n
if(focused) if(focused)
{ {
if (!raised) { if (!raised)
{
XGrabButton(c->display, Button1, NoSymbol, c->win, False, BUTTONMASK, XGrabButton(c->display, Button1, NoSymbol, c->win, False, BUTTONMASK,
GrabModeAsync, GrabModeSync, None, None); GrabModeAsync, GrabModeSync, None, None);
XGrabButton(c->display, Button1, LockMask, c->win, False, XGrabButton(c->display, Button1, LockMask, c->win, False,
@ -792,7 +793,7 @@ uicb_moveresize(Display *disp __attribute__ ((unused)),
unsigned int dui; unsigned int dui;
Window dummy; Window dummy;
if(!IS_ARRANGE(layout_floating)) if(!IS_ARRANGE(0, layout_floating))
if(!sel || !sel->isfloating || sel->isfixed || !arg) if(!sel || !sel->isfloating || sel->isfixed || !arg)
return; return;
if(sscanf(arg, "%s %s %s %s", x, y, w, h) != 4) if(sscanf(arg, "%s %s %s %s", x, y, w, h) != 4)

21
event.c
View File

@ -201,15 +201,17 @@ handle_event_buttonpress(XEvent * e, awesome_config *awesomeconf)
if((c = getclient(ev->window))) if((c = getclient(ev->window)))
{ {
focus(c->display, c, ev->same_screen, &awesomeconf[c->screen]); focus(c->display, c, ev->same_screen, &awesomeconf[c->screen]);
if(CLEANMASK(ev->state, c->screen) != awesomeconf[c->screen].modkey) { if(CLEANMASK(ev->state, c->screen) != awesomeconf[c->screen].modkey)
if (ev->button == Button1) { {
if (ev->button == Button1)
{
restack(c->display, &awesomeconf[c->screen]); restack(c->display, &awesomeconf[c->screen]);
grabbuttons(c, True, True, awesomeconf->modkey, awesomeconf->numlockmask); grabbuttons(c, True, True, awesomeconf->modkey, awesomeconf->numlockmask);
} }
} }
else if(ev->button == Button1) 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); uicb_togglefloating(e->xany.display, &awesomeconf[c->screen], NULL);
else else
restack(e->xany.display, &awesomeconf[c->screen]); restack(e->xany.display, &awesomeconf[c->screen]);
@ -217,14 +219,14 @@ handle_event_buttonpress(XEvent * e, awesome_config *awesomeconf)
} }
else if(ev->button == Button2) 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); uicb_togglefloating(e->xany.display, &awesomeconf[c->screen], NULL);
else else
uicb_zoom(e->xany.display, &awesomeconf[c->screen], NULL); uicb_zoom(e->xany.display, &awesomeconf[c->screen], NULL);
} }
else if(ev->button == Button3) 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); uicb_togglefloating(e->xany.display, &awesomeconf[c->screen], NULL);
else else
restack(e->xany.display, &awesomeconf[c->screen]); restack(e->xany.display, &awesomeconf[c->screen]);
@ -261,7 +263,7 @@ handle_event_configurerequest(XEvent * e, awesome_config *awesomeconf)
c->ismax = False; c->ismax = False;
if(ev->value_mask & CWBorderWidth) if(ev->value_mask & CWBorderWidth)
c->border = ev->border_width; 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) if(ev->value_mask & CWX)
c->x = ev->x; c->x = ev->x;
@ -345,10 +347,11 @@ handle_event_enternotify(XEvent * e, awesome_config *awesomeconf)
if(ev->mode != NotifyNormal || ev->detail == NotifyInferior) if(ev->mode != NotifyNormal || ev->detail == NotifyInferior)
return; return;
if((c = getclient(ev->window))) { if((c = getclient(ev->window)))
{
focus(c->display, c, ev->same_screen, &awesomeconf[c->screen]); focus(c->display, c, ev->same_screen, &awesomeconf[c->screen]);
if (sel) if (sel && (sel->isfloating || IS_ARRANGE(sel->screen, layout_floating)))
grabbuttons(sel, True, False, awesomeconf->modkey, awesomeconf->numlockmask); grabbuttons(sel, True, False, awesomeconf->modkey, awesomeconf->numlockmask);
} }
else else
for(screen = 0; screen < ScreenCount(e->xany.display); screen++) for(screen = 0; screen < ScreenCount(e->xany.display); screen++)

View File

@ -126,9 +126,9 @@ restack(Display * disp, awesome_config *awesomeconf)
drawstatusbar(disp, awesomeconf); drawstatusbar(disp, awesomeconf);
if(!sel) if(!sel)
return; return;
if(sel->isfloating || IS_ARRANGE(layout_floating)) if(sel->isfloating || IS_ARRANGE(0, layout_floating))
XRaiseWindow(disp, sel->win); XRaiseWindow(disp, sel->win);
if(!IS_ARRANGE(layout_floating)) if(!IS_ARRANGE(0, layout_floating))
{ {
wc.stack_mode = Below; wc.stack_mode = Below;
wc.sibling = awesomeconf->statusbar.window; wc.sibling = awesomeconf->statusbar.window;

View File

@ -25,7 +25,7 @@
#include "client.h" #include "client.h"
/** Check if current layout is arranged with a layout */ /** 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) #define AWESOMEPROPS_ATOM(disp) XInternAtom(disp, "_AWESOME_PROPERTIES", False)

View File

@ -36,7 +36,7 @@ uicb_setnmaster(Display *disp,
awesome_config *awesomeconf, awesome_config *awesomeconf,
const char * arg) 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; return;
@ -51,7 +51,7 @@ uicb_setncol(Display *disp,
awesome_config *awesomeconf, awesome_config *awesomeconf,
const char * arg) 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; return;
if((awesomeconf->ncol = (int) compute_new_value_from_arg(arg, (double) awesomeconf->ncol)) < 1) if((awesomeconf->ncol = (int) compute_new_value_from_arg(arg, (double) awesomeconf->ncol)) < 1)
@ -67,11 +67,11 @@ uicb_setmwfact(Display *disp,
{ {
char *newarg; 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; return;
newarg = a_strdup(arg); newarg = a_strdup(arg);
if(IS_ARRANGE(layout_tileleft)) if(IS_ARRANGE(0, layout_tileleft))
{ {
if(newarg[0] == '+') if(newarg[0] == '+')
newarg[0] = '-'; newarg[0] = '-';

View File

@ -134,7 +134,7 @@ drawstatusbar(Display *disp, awesome_config * awesomeconf)
sel->ismax, sel->ismax,
awesomeconf->colors_selected[ColFG]); 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]; char buf[256];
snprintf(buf, sizeof(buf), "nmaster: %d ncol: %d mwfact: %.2lf", awesomeconf->nmaster, awesomeconf->ncol, awesomeconf->mwfact); snprintf(buf, sizeof(buf), "nmaster: %d ncol: %d mwfact: %.2lf", awesomeconf->nmaster, awesomeconf->ncol, awesomeconf->mwfact);