Event buttonpress: Fix bug #9 opened by Cheaterman.

This commit is contained in:
Martin Duquesnoy 2009-03-28 19:17:46 +01:00
parent 0faf031150
commit a3f144f642
4 changed files with 22 additions and 8 deletions

View File

@ -62,12 +62,22 @@ buttonpress(XButtonEvent *ev)
mouse_resize(c);
/* Client */
if((c = client_gb_win(ev->window)))
if((c = client_gb_win(ev->window)) && c == sel)
for(i = 0; i < conf.client.nmouse; ++i)
if(ev->button == conf.client.mouse[i].button)
if(conf.client.mouse[i].func)
conf.client.mouse[i].func(conf.client.mouse[i].cmd);
/* If the mouse is on a client that is not selected
and you click on it. */
if((c = client_gb_win(ev->window)) && c != sel
&& ev->button == Button1)
{
client_focus(c);
if(conf.raisefocus)
client_raise(c);
}
/* Root */
if(ev->window == ROOT)
for(i = 0; i < conf.root.nmouse; ++i)
@ -315,9 +325,9 @@ enternotify(XCrossingEvent *ev)
Client *c;
int n;
if((ev->mode != NotifyNormal
|| ev->detail == NotifyInferior)
&& ev->window != ROOT)
if((ev->mode != NotifyNormal))
// || ev->detail == NotifyInferior)
// && ev->window != ROOT)
return;
if((c = client_gb_win(ev->window))

View File

@ -136,10 +136,11 @@ init_root(void)
XSetWindowAttributes at;
at.event_mask = KeyMask | ButtonMask | MouseMask
| SubstructureRedirectMask | SubstructureNotifyMask |StructureNotifyMask;
| SubstructureRedirectMask | SubstructureNotifyMask | StructureNotifyMask;
at.cursor = cursor[CurNormal];
XChangeWindowAttributes(dpy, ROOT, CWEventMask | CWCursor, &at);
if(conf.root.background_command)
uicb_spawn(conf.root.background_command);

View File

@ -217,10 +217,12 @@ spawn(const char *format, ...)
vsprintf(cmd, format, ap);
va_end(ap);
if(!(sh = getenv("SHELL")))
sh = "/bin/sh";
if(!strlen(cmd))
return;
if(!(sh = getenv("SHELL")))
sh = "/bin/sh";
if(fork() == 0)
{
if(fork() == 0)
@ -229,7 +231,7 @@ spawn(const char *format, ...)
close(ConnectionNumber(dpy));
setsid();
execl(sh, sh, "-c", cmd, (char*)NULL);
exit(EXIT_FAILURE);
exit(EXIT_SUCCESS);
}
exit(EXIT_SUCCESS);
}

View File

@ -234,6 +234,7 @@ char* alias_to_str(char *conf_choice);
/* }}} */
XRectangle get_mouse_pos(void);
void spawn(const char *str, ...);
Pixmap get_root_pixmap(void);
void uicb_spawn(uicb_t);
/* tag.c */