/*
- * Copyright (c) 2011, Andy Spencer <andy753421@gmail.com>
+ * Copyright (c) 2011-2012, Andy Spencer <andy753421@gmail.com>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
static int (*xerrorxlib)(Display *, XErrorEvent *);
static unsigned long colors[NCOLORS];
static list_t *screens;
+static list_t *struts;
/* Conversion functions */
static event_map_t ev2sym[] = {
win->sys->strut.right = ((int*)xdata)[1];
win->sys->strut.top = ((int*)xdata)[2];
win->sys->strut.bottom = ((int*)xdata)[3];
+ struts = list_insert(struts, win);
for (list_t *cur = screens; cur; cur = cur->next)
strut_copy(cur->data, win, 1);
return strut_copy(root, win, 1);
static int strut_del(win_t *root, win_t *win)
{
+ list_t *lwin = list_find(struts, win);
+ if (lwin)
+ struts = list_remove(struts, lwin, 0);
for (list_t *cur = screens; cur; cur = cur->next)
strut_copy(cur->data, win, -1);
return strut_copy(root, win, -1);
if (wm_handle_event(win, xb2ev(xe->xbutton.button), mod, ptr))
XGrabPointer(dpy, xe->xbutton.root, True, PointerMotionMask|ButtonReleaseMask,
GrabModeAsync, GrabModeAsync, None, None, CurrentTime);
- else {
- printf("resending event\n");
- XSendEvent(win->sys->dpy, xe->xbutton.window, True, NoEventMask, xe);
- XSendEvent(win->sys->dpy, xe->xbutton.window, False, NoEventMask, xe);
- XSendEvent(win->sys->dpy, xe->xbutton.root, True, NoEventMask, xe);
- XSendEvent(win->sys->dpy, xe->xbutton.root, False, NoEventMask, xe);
- XSendEvent(win->sys->dpy, xe->xbutton.subwindow, True, NoEventMask, xe);
- XSendEvent(win->sys->dpy, xe->xbutton.subwindow, False, NoEventMask, xe);
- }
+ else
+ XAllowEvents(win->sys->dpy, ReplayPointer, CurrentTime);
}
else if (type == ButtonRelease) {
XUngrabPointer(dpy, CurrentTime);
wm_handle_ptr(win, ptr);
}
else if (type == EnterNotify || type == LeaveNotify) {
- printf("enter: %d\n", type);
+ printf("%s: %d\n", type==EnterNotify?"enter":"leave", type);
event_t ev = EnterNotify ? EV_ENTER : EV_LEAVE;
if ((win = win_find(dpy,xe->xcrossing.window,0)))
wm_handle_event(win, ev, MOD(), PTR());
{
//printf("sys_raise: %p\n", win);
XRaiseWindow(win->sys->dpy, win->sys->xid);
+ for (list_t *cur = struts; cur; cur = cur->next)
+ XRaiseWindow(((win_t*)cur->data)->sys->dpy,
+ ((win_t*)cur->data)->sys->xid);
}
void sys_focus(win_t *win)
return;
case ST_FULL:
printf("sys_show: full\n");
+ XMapWindow(win->sys->dpy, win->sys->xid);
return;
case ST_SHADE:
printf("sys_show: shade\n");
+ XMapWindow(win->sys->dpy, win->sys->xid);
return;
case ST_ICON:
printf("sys_show: icon\n");
if (EV_MOUSE0 <= ev && ev <= EV_MOUSE7)
XGrabButton(win->sys->dpy, ev2xb(ev), mod2x(mod), win->sys->xid, False,
mod.up ? ButtonReleaseMask : ButtonPressMask,
- GrabModeAsync, GrabModeAsync, None, None);
+ GrabModeSync, GrabModeAsync, None, None);
else if (ev == EV_ENTER)
XSelectInput(win->sys->dpy, win->sys->xid, EnterWindowMask|mask);
else if (ev == EV_LEAVE)