mirror of
https://github.com/0intro/wmii
synced 2025-02-15 05:44:53 +03:00
Make sure that the framewin's cursor is set to CurNormal whenever the mouse is over the client
This commit is contained in:
parent
6e8664bdd0
commit
53387d3637
198
event.c
198
event.c
@ -173,6 +173,7 @@ enternotify(XEvent *e) {
|
|||||||
if(c->sel->area->mode == Colmax)
|
if(c->sel->area->mode == Colmax)
|
||||||
c = c->sel->area->sel->client;
|
c = c->sel->area->sel->client;
|
||||||
focus(c, False);
|
focus(c, False);
|
||||||
|
set_cursor(c, cursor[CurNormal]);
|
||||||
}
|
}
|
||||||
else if(ev->window == blz.root) {
|
else if(ev->window == blz.root) {
|
||||||
sel_screen = True;
|
sel_screen = True;
|
||||||
@ -190,102 +191,6 @@ leavenotify(XEvent *e) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
expose(XEvent *e) {
|
|
||||||
XExposeEvent *ev = &e->xexpose;
|
|
||||||
static Frame *f;
|
|
||||||
|
|
||||||
if(ev->count == 0) {
|
|
||||||
if(ev->window == screen->barwin)
|
|
||||||
draw_bar(screen);
|
|
||||||
else if((f = frame_of_win(ev->window)) && f->view == screen->sel)
|
|
||||||
draw_frame(f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
keypress(XEvent *e) {
|
|
||||||
XKeyEvent *ev = &e->xkey;
|
|
||||||
KeySym k = 0;
|
|
||||||
char buf[32];
|
|
||||||
int n;
|
|
||||||
static Frame *f;
|
|
||||||
|
|
||||||
|
|
||||||
ev->state &= valid_mask;
|
|
||||||
if((f = frame_of_win(ev->window))) {
|
|
||||||
buf[0] = 0;
|
|
||||||
n = XLookupString(ev, buf, sizeof(buf), &k, 0);
|
|
||||||
if(IsFunctionKey(k) || IsKeypadKey(k) || IsMiscFunctionKey(k)
|
|
||||||
|| IsPFKey(k) || IsPrivateKeypadKey(k))
|
|
||||||
return;
|
|
||||||
buf[n] = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
kpress(blz.root, ev->state, (KeyCode) ev->keycode);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
mappingnotify(XEvent *e) {
|
|
||||||
XMappingEvent *ev = &e->xmapping;
|
|
||||||
|
|
||||||
XRefreshKeyboardMapping(ev);
|
|
||||||
if(ev->request == MappingKeyboard)
|
|
||||||
update_keys();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
maprequest(XEvent *e) {
|
|
||||||
XMapRequestEvent *ev = &e->xmaprequest;
|
|
||||||
static XWindowAttributes wa;
|
|
||||||
|
|
||||||
if(!XGetWindowAttributes(blz.dpy, ev->window, &wa))
|
|
||||||
return;
|
|
||||||
if(wa.override_redirect) {
|
|
||||||
XSelectInput(blz.dpy, ev->window,
|
|
||||||
(StructureNotifyMask | PropertyChangeMask));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(!client_of_win(ev->window))
|
|
||||||
manage_client(create_client(ev->window, &wa));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
motionnotify(XEvent *e) {
|
|
||||||
XMotionEvent *ev = &e->xmotion;
|
|
||||||
Cursor cur;
|
|
||||||
Frame *f;
|
|
||||||
|
|
||||||
if((f = frame_of_win(ev->window))) {
|
|
||||||
if(!ispointinrect(ev->x, ev->y, &f->titlebar)) {
|
|
||||||
cur = cursor_of_quad(quadofcoord(&f->rect, ev->x_root, ev->y_root));
|
|
||||||
set_cursor(f->client, cur);
|
|
||||||
}else
|
|
||||||
set_cursor(f->client, cursor[CurNormal]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
propertynotify(XEvent *e) {
|
|
||||||
XPropertyEvent *ev = &e->xproperty;
|
|
||||||
Client *c;
|
|
||||||
|
|
||||||
if(ev->state == PropertyDelete)
|
|
||||||
return; /* ignore */
|
|
||||||
if((c = client_of_win(ev->window)))
|
|
||||||
prop_client(c, ev);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
unmapnotify(XEvent *e) {
|
|
||||||
Client *c;
|
|
||||||
XUnmapEvent *ev = &e->xunmap;
|
|
||||||
|
|
||||||
if((c = client_of_win(ev->window)))
|
|
||||||
if(!c->unmapped--)
|
|
||||||
destroy_client(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
focusin(XEvent *e) {
|
focusin(XEvent *e) {
|
||||||
Client *c, *old;
|
Client *c, *old;
|
||||||
@ -365,6 +270,103 @@ focusout(XEvent *e) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
expose(XEvent *e) {
|
||||||
|
XExposeEvent *ev = &e->xexpose;
|
||||||
|
static Frame *f;
|
||||||
|
|
||||||
|
if(ev->count == 0) {
|
||||||
|
if(ev->window == screen->barwin)
|
||||||
|
draw_bar(screen);
|
||||||
|
else if((f = frame_of_win(ev->window)) && f->view == screen->sel)
|
||||||
|
draw_frame(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
keypress(XEvent *e) {
|
||||||
|
XKeyEvent *ev = &e->xkey;
|
||||||
|
KeySym k = 0;
|
||||||
|
char buf[32];
|
||||||
|
int n;
|
||||||
|
static Frame *f;
|
||||||
|
|
||||||
|
|
||||||
|
ev->state &= valid_mask;
|
||||||
|
if((f = frame_of_win(ev->window))) {
|
||||||
|
buf[0] = 0;
|
||||||
|
n = XLookupString(ev, buf, sizeof(buf), &k, 0);
|
||||||
|
if(IsFunctionKey(k) || IsKeypadKey(k) || IsMiscFunctionKey(k)
|
||||||
|
|| IsPFKey(k) || IsPrivateKeypadKey(k))
|
||||||
|
return;
|
||||||
|
buf[n] = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
kpress(blz.root, ev->state, (KeyCode) ev->keycode);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
mappingnotify(XEvent *e) {
|
||||||
|
XMappingEvent *ev = &e->xmapping;
|
||||||
|
|
||||||
|
XRefreshKeyboardMapping(ev);
|
||||||
|
if(ev->request == MappingKeyboard)
|
||||||
|
update_keys();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
maprequest(XEvent *e) {
|
||||||
|
XMapRequestEvent *ev = &e->xmaprequest;
|
||||||
|
static XWindowAttributes wa;
|
||||||
|
|
||||||
|
if(!XGetWindowAttributes(blz.dpy, ev->window, &wa))
|
||||||
|
return;
|
||||||
|
if(wa.override_redirect) {
|
||||||
|
XSelectInput(blz.dpy, ev->window,
|
||||||
|
(StructureNotifyMask | PropertyChangeMask));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(!client_of_win(ev->window))
|
||||||
|
manage_client(create_client(ev->window, &wa));
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
motionnotify(XEvent *e) {
|
||||||
|
XMotionEvent *ev = &e->xmotion;
|
||||||
|
Cursor cur;
|
||||||
|
Frame *f;
|
||||||
|
|
||||||
|
if((f = frame_of_win(ev->window))) {
|
||||||
|
if(!ispointinrect(ev->x, ev->y, &f->titlebar)
|
||||||
|
&&!ispointinrect(ev->x, ev->y, &f->crect)) {
|
||||||
|
cur = cursor_of_quad(quadofcoord(&f->rect, ev->x_root, ev->y_root));
|
||||||
|
set_cursor(f->client, cur);
|
||||||
|
}else
|
||||||
|
set_cursor(f->client, cursor[CurNormal]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
propertynotify(XEvent *e) {
|
||||||
|
XPropertyEvent *ev = &e->xproperty;
|
||||||
|
Client *c;
|
||||||
|
|
||||||
|
if(ev->state == PropertyDelete)
|
||||||
|
return; /* ignore */
|
||||||
|
if((c = client_of_win(ev->window)))
|
||||||
|
prop_client(c, ev);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
unmapnotify(XEvent *e) {
|
||||||
|
Client *c;
|
||||||
|
XUnmapEvent *ev = &e->xunmap;
|
||||||
|
|
||||||
|
if((c = client_of_win(ev->window)))
|
||||||
|
if(!c->unmapped--)
|
||||||
|
destroy_client(c);
|
||||||
|
}
|
||||||
void (*handler[LASTEvent]) (XEvent *) = {
|
void (*handler[LASTEvent]) (XEvent *) = {
|
||||||
[ButtonPress] = buttonpress,
|
[ButtonPress] = buttonpress,
|
||||||
[ButtonRelease] = buttonrelease,
|
[ButtonRelease] = buttonrelease,
|
||||||
@ -387,11 +389,11 @@ void (*handler[LASTEvent]) (XEvent *) = {
|
|||||||
void
|
void
|
||||||
check_x_event(IXPConn *c) {
|
check_x_event(IXPConn *c) {
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
while(XPending(blz.dpy)) { /* main event loop */
|
while(XPending(blz.dpy)) {
|
||||||
XNextEvent(blz.dpy, &ev);
|
XNextEvent(blz.dpy, &ev);
|
||||||
if(verbose)
|
if(verbose)
|
||||||
printevent(&ev);
|
printevent(&ev);
|
||||||
if(handler[ev.type])
|
if(handler[ev.type])
|
||||||
(handler[ev.type]) (&ev); /* call handler */
|
handler[ev.type](&ev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user