add config.*
This commit is contained in:
parent
0886bbbf5e
commit
0be08c6a4a
@ -28,6 +28,17 @@ client_configure(Client *c)
|
|||||||
XSendEvent(dpy, c->win, False, StructureNotifyMask, (XEvent *)&ev);
|
XSendEvent(dpy, c->win, False, StructureNotifyMask, (XEvent *)&ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Client*
|
||||||
|
client_gb_win(Window *w)
|
||||||
|
{
|
||||||
|
Client *c = SLIST_FIRST(&W->h.client);
|
||||||
|
|
||||||
|
while(c && c->win != w)
|
||||||
|
c = SLIST_NEXT(c, next);
|
||||||
|
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
/** Map a client
|
/** Map a client
|
||||||
* \param c Client pointer
|
* \param c Client pointer
|
||||||
*/
|
*/
|
||||||
@ -46,6 +57,12 @@ client_unmap(Client *c)
|
|||||||
XUnmapWindow(W->dpy, c->win);
|
XUnmapWindow(W->dpy, c->win);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
client_focus(Client *c)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/** Close a client
|
/** Close a client
|
||||||
* \param c Client pointer
|
* \param c Client pointer
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -21,8 +21,10 @@ typedef struct Client
|
|||||||
} Client;
|
} Client;
|
||||||
|
|
||||||
void client_configure(Client *c);
|
void client_configure(Client *c);
|
||||||
|
Client *client_gb_win(Window *w);
|
||||||
void client_map(Client *c);
|
void client_map(Client *c);
|
||||||
void client_unmap(Client *c);
|
void client_unmap(Client *c);
|
||||||
|
void client_focus(Client *c);
|
||||||
void client_close(Client *c);
|
void client_close(Client *c);
|
||||||
Client *client_new(Window w, XWindowAttributes *wa);
|
Client *client_new(Window w, XWindowAttributes *wa);
|
||||||
void client_remove(Client *c);
|
void client_remove(Client *c);
|
||||||
|
|||||||
10
wmfs2/src/config.c
Normal file
10
wmfs2/src/config.c
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
/*
|
||||||
|
* wmfs2 by Martin Duquesnoy <xorg62@gmail.com> { for(i = 2011; i < 2111; ++i) ©(i); }
|
||||||
|
* For license, see COPYING.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void
|
||||||
|
config_init(void)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
21
wmfs2/src/config.h
Normal file
21
wmfs2/src/config.h
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
/*
|
||||||
|
* wmfs2 by Martin Duquesnoy <xorg62@gmail.com> { for(i = 2011; i < 2111; ++i) ©(i); }
|
||||||
|
* For license, see COPYING.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef CONFIG_H
|
||||||
|
#define CONFIG_H
|
||||||
|
|
||||||
|
#include "wmfs.h"
|
||||||
|
|
||||||
|
typedef struct Keybind
|
||||||
|
{
|
||||||
|
unsigned int mod;
|
||||||
|
KeySym keysym;
|
||||||
|
void (*func)(Uicb);
|
||||||
|
Uicb cmd;
|
||||||
|
SLIST_ENTRY(Keybind) next;
|
||||||
|
} Keybind;
|
||||||
|
|
||||||
|
#endif /* CONFIG_H */
|
||||||
@ -7,6 +7,40 @@
|
|||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "wmfs.h"
|
#include "wmfs.h"
|
||||||
|
|
||||||
|
#define EVDPY(e) (e)->xany.display
|
||||||
|
|
||||||
|
static void
|
||||||
|
event_enternotify(XEvent *e)
|
||||||
|
{
|
||||||
|
XCrossingEvent *ev = &e->xcrossing;
|
||||||
|
Client *c;
|
||||||
|
int n;
|
||||||
|
|
||||||
|
if((ev->mode != NotifyNormal || ev->detail == NotifyInferior)
|
||||||
|
&& ev->window != W->root)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if((c = client_gb_win(ev->window)))
|
||||||
|
client_focus(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
event_maprequest(XEvent *e)
|
||||||
|
{
|
||||||
|
XMapRequestEvent *ev = &e->xmaprequest;
|
||||||
|
XWindowAttributes at;
|
||||||
|
|
||||||
|
/* Which windows to manage */
|
||||||
|
if(!XGetWindowAttributes(EVDPY(e), ev->window, &at)
|
||||||
|
|| at.overried_redirect
|
||||||
|
|| client_gb_win(ev->window))
|
||||||
|
return;
|
||||||
|
|
||||||
|
(Client*)client_new(ev->window, at);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
event_dummy(XEvent *e)
|
event_dummy(XEvent *e)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -108,6 +108,24 @@ wmfs_xinit(void)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
wmfs_grab_keys(void)
|
||||||
|
{
|
||||||
|
KeyCode c;
|
||||||
|
Keybind *k;
|
||||||
|
|
||||||
|
XUngrabKey(W->dpy, AnyKey, AnyModifier, W->root);
|
||||||
|
|
||||||
|
FOREACH(k, &W->h.keybind, next)
|
||||||
|
if((c = XKeysymToKeycode(dpy, k->keysym)))
|
||||||
|
{
|
||||||
|
XGrabKey(W->dpy, c, k->mod, W->root, True, GrabModeAsync, GrabModeAsync);
|
||||||
|
XGrabKey(W->dpy, c, k->mod | LockMask, W->root, True, GrabModeAsync, GrabModeAsync);
|
||||||
|
XGrabKey(W->dpy, c, k->mod | numlockmask, W->root, True, GrabModeAsync, GrabModeAsync);
|
||||||
|
XGrabKey(W->dpy, c, k->mod | LockMask | numlockmask, W->root, True, GrabModeAsync, GrabModeAsync);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
wmfs_loop(void)
|
wmfs_loop(void)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -24,10 +24,14 @@
|
|||||||
/* Local */
|
/* Local */
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#define ButtonMask (ButtonPressMask | ButtonReleaseMask | ButtonMotionMask)
|
#define ButtonMask (ButtonPressMask | ButtonReleaseMask | ButtonMotionMask)
|
||||||
#define MouseMask (ButtonMask | PointerMotionMask)
|
#define MouseMask (ButtonMask | PointerMotionMask)
|
||||||
#define KeyMask (KeyPressMask | KeyReleaseMask)
|
#define KeyMask (KeyPressMask | KeyReleaseMask)
|
||||||
|
|
||||||
|
typedef unsigned int Flags;
|
||||||
|
typedef const char* Uicb;
|
||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
@ -55,6 +59,7 @@ typedef struct
|
|||||||
{
|
{
|
||||||
SLIST_HEAD(, Screen) screen;
|
SLIST_HEAD(, Screen) screen;
|
||||||
SLIST_HEAD(, Client) client;
|
SLIST_HEAD(, Client) client;
|
||||||
|
SLIST_HEAD(, Keybind) keybind;
|
||||||
} h;
|
} h;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -65,9 +70,9 @@ typedef struct
|
|||||||
|
|
||||||
} Wmfs;
|
} Wmfs;
|
||||||
|
|
||||||
|
|
||||||
int wmfs_error_handler(Display *d, XErrorEvent *event);
|
int wmfs_error_handler(Display *d, XErrorEvent *event);
|
||||||
int wmfs_error_handler_dummy(Display *d, XErrorEvent *event);
|
int wmfs_error_handler_dummy(Display *d, XErrorEvent *event);
|
||||||
|
void wmfs_grab_keys(void);
|
||||||
void wmfs_quit(void);
|
void wmfs_quit(void);
|
||||||
|
|
||||||
/* Single global variable */
|
/* Single global variable */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user