event work
This commit is contained in:
parent
0be08c6a4a
commit
6886a6902a
@ -24,6 +24,25 @@ event_enternotify(XEvent *e)
|
|||||||
client_focus(c);
|
client_focus(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
event_destroynotify(XEvent *e)
|
||||||
|
{
|
||||||
|
XDestroyWindowEvent *ev = &e->xdestroywindow;
|
||||||
|
Client *c;
|
||||||
|
|
||||||
|
if((c = client_gb_win(ev->window)))
|
||||||
|
client_unmanage(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
event_focusin(XEvent *e)
|
||||||
|
{
|
||||||
|
Client *c;
|
||||||
|
|
||||||
|
if((c = W->screen->seltag->sel) && e->xfocus.window != c->win)
|
||||||
|
client_focus(c);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
event_maprequest(XEvent *e)
|
event_maprequest(XEvent *e)
|
||||||
{
|
{
|
||||||
@ -39,7 +58,101 @@ event_maprequest(XEvent *e)
|
|||||||
(Client*)client_new(ev->window, at);
|
(Client*)client_new(ev->window, at);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
event_mappingnotify(XEvent *e)
|
||||||
|
{
|
||||||
|
XMappingEvent *ev = &e->xmapping;
|
||||||
|
XRefreshKeyboardMapping(ev);
|
||||||
|
|
||||||
|
if(ev->request == MappingKeyboard)
|
||||||
|
wmfs_grab_keys();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
event_propertynotify(XEvent *e)
|
||||||
|
{
|
||||||
|
XPropertyEvent *ev = &e->xproperty;
|
||||||
|
Client *c;
|
||||||
|
|
||||||
|
if(ev->state == PropertyDelete)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if((c = client_gb_win(ev->window)))
|
||||||
|
{
|
||||||
|
switch(ev->atom)
|
||||||
|
{
|
||||||
|
case XA_WM_TRANSIENT_FOR:
|
||||||
|
break;
|
||||||
|
case XA_WM_NORMAL_HINTS:
|
||||||
|
/* client_get_size_hints(c); */
|
||||||
|
break;
|
||||||
|
case XA_WM_HINTS:
|
||||||
|
/*
|
||||||
|
XWMHints *h;
|
||||||
|
|
||||||
|
if((h = XGetWMHints(EVDPY, c->win)) && (h->flags & XUrgencyHint) && c != sel)
|
||||||
|
{
|
||||||
|
client_urgent(c, True);
|
||||||
|
XFree(h);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
if(ev->atom == XA_WM_NAME /* || ev->atom == _NET_WM_NAME */)
|
||||||
|
client_get_name(c);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
event_unmapnotify(XEvent *e)
|
||||||
|
{
|
||||||
|
XUnmapEvent *ev = &e->xunmap;
|
||||||
|
Client *c;
|
||||||
|
|
||||||
|
if((c = client_gb_win(ev->window)) && ev->send_event)
|
||||||
|
client_remove(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
event_motionnotify(XEvent *e)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
XMotionEvent *ev = &e->xmotion;
|
||||||
|
Client *c;
|
||||||
|
|
||||||
|
|
||||||
|
* Option follow mouvement
|
||||||
|
if((c = client_gb_win(ev->subwindow)) && c != c->tag->sel)
|
||||||
|
client_focus(c);
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
event_keypress(XEvent *e)
|
||||||
|
{
|
||||||
|
XKeyPressedEvent *ev = &e->xkey;
|
||||||
|
KeySym keysym;
|
||||||
|
Keybind *k;
|
||||||
|
Flags m = ~(W->numlockmask | LockMask);
|
||||||
|
|
||||||
|
keysym = XKeycodeToKeysym(EVDPY, (KeyCode)ev->keycode, 0);
|
||||||
|
|
||||||
|
SLIST_FOREACH(k, W->h.keybind, next)
|
||||||
|
if(k->keysym == keysym && (k->mod & m) == (ev->state & m))
|
||||||
|
if(k->func)
|
||||||
|
k->func(k->cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
event_expose(XEvent *e)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* XExposeEvent *ev = &e->xexpose;
|
||||||
|
*/
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
event_dummy(XEvent *e)
|
event_dummy(XEvent *e)
|
||||||
@ -55,5 +168,21 @@ event_init(void)
|
|||||||
while(i--)
|
while(i--)
|
||||||
event_handle[i] = event_dummy;
|
event_handle[i] = event_dummy;
|
||||||
|
|
||||||
|
event_handle[ButtonPress] = event_buttonpress;
|
||||||
|
/*event_handle[ClientMessage] = event_clientmessageevent;*/
|
||||||
|
/*event_handle[ConfigureRequest] = event_configureevent;*/
|
||||||
|
event_handle[DestroyNotify] = event_destroynotify;
|
||||||
|
event_handle[EnterNotify] = event_enternotify;
|
||||||
|
event_handle[Expose] = event_expose;
|
||||||
|
event_handle[FocusIn] = event_focusin;
|
||||||
|
event_handle[KeyPress] = event_keypress;
|
||||||
|
/*event_handle[MapNotify] = event_mapnotify;*/
|
||||||
|
event_handle[MapRequest] = event_maprequest;
|
||||||
|
event_handle[MappingNotify] = event_mappingnotify;
|
||||||
|
event_handle[MotionNotify] = event_motionnotify;
|
||||||
|
event_handle[PropertyNotify] = event_propertynotify;
|
||||||
|
/*event_handle[ReparentNotify] = event_reparentnotify;*/
|
||||||
|
/*event_handle[SelectionClear] = event_selectionclearevent;*/
|
||||||
|
event_handle[UnmapNotify] = event_unmapnotify;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -147,6 +147,9 @@ wmfs_init(void)
|
|||||||
/* X init */
|
/* X init */
|
||||||
wmfs_xinit();
|
wmfs_xinit();
|
||||||
|
|
||||||
|
/* Event init */
|
||||||
|
event_init();
|
||||||
|
|
||||||
/* Screen init */
|
/* Screen init */
|
||||||
screen_init();
|
screen_init();
|
||||||
|
|
||||||
@ -182,6 +185,7 @@ main(int argc, char **argv)
|
|||||||
|
|
||||||
/* Opt */
|
/* Opt */
|
||||||
|
|
||||||
|
/* Core */
|
||||||
wmfs_init();
|
wmfs_init();
|
||||||
|
|
||||||
wmfs_loop();
|
wmfs_loop();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user