mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
hit it with the knf stick.
This commit is contained in:
parent
3a94c57afc
commit
75182c6d9c
2
README
2
README
@ -17,7 +17,7 @@ DESCRIPTION
|
|||||||
base of evilwm did not accomodate well for the new features added.
|
base of evilwm did not accomodate well for the new features added.
|
||||||
So calmwm was written from scratch.
|
So calmwm was written from scratch.
|
||||||
|
|
||||||
Its main goal is to be as efficient as possible, while providing
|
Its main goal is to be as efficient as possible, while providing
|
||||||
a very clean, simple & attractive aesthetic.
|
a very clean, simple & attractive aesthetic.
|
||||||
|
|
||||||
cwm has several novel features, including the ability to search
|
cwm has several novel features, including the ability to search
|
||||||
|
2
TODO
2
TODO
@ -9,7 +9,7 @@
|
|||||||
register handlers, with the ability to select, for example,
|
register handlers, with the ability to select, for example,
|
||||||
a window, or an event, etc. (no, maybe not...)
|
a window, or an event, etc. (no, maybe not...)
|
||||||
|
|
||||||
- ignoreq, always lower them. perhaps implement by lowering the entire
|
- ignoreq, always lower them. perhaps implement by lowering the entire
|
||||||
queue on each XLower...
|
queue on each XLower...
|
||||||
|
|
||||||
- search window should try to stay inside of the screen boundaries.
|
- search window should try to stay inside of the screen boundaries.
|
||||||
|
44
calmwm.c
44
calmwm.c
@ -38,7 +38,7 @@ struct client_ctx_q Clientq;
|
|||||||
int Doshape, Shape_ev;
|
int Doshape, Shape_ev;
|
||||||
int Starting;
|
int Starting;
|
||||||
struct conf Conf;
|
struct conf Conf;
|
||||||
struct fontdesc *DefaultFont = NULL;
|
struct fontdesc *DefaultFont = NULL;
|
||||||
|
|
||||||
/* From TWM */
|
/* From TWM */
|
||||||
#define gray_width 2
|
#define gray_width 2
|
||||||
@ -46,7 +46,7 @@ struct fontdesc *DefaultFont = NULL;
|
|||||||
static char gray_bits[] = {0x02, 0x01};
|
static char gray_bits[] = {0x02, 0x01};
|
||||||
|
|
||||||
|
|
||||||
static void _sigchld_cb(int);
|
static void _sigchld_cb(int);
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
@ -72,11 +72,11 @@ main(int argc, char **argv)
|
|||||||
argv += optind;
|
argv += optind;
|
||||||
|
|
||||||
/* Ignore a few signals. */
|
/* Ignore a few signals. */
|
||||||
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR)
|
if (signal(SIGPIPE, SIG_IGN) == SIG_ERR)
|
||||||
err(1, "signal");
|
err(1, "signal");
|
||||||
|
|
||||||
if (signal(SIGCHLD, _sigchld_cb) == SIG_ERR)
|
if (signal(SIGCHLD, _sigchld_cb) == SIG_ERR)
|
||||||
err(1, "signal");
|
err(1, "signal");
|
||||||
|
|
||||||
group_init();
|
group_init();
|
||||||
|
|
||||||
@ -176,16 +176,16 @@ x_setupscreen(struct screen_ctx *sc, u_int which)
|
|||||||
sc->redpixl = sc->redcolor.pixel;
|
sc->redpixl = sc->redcolor.pixel;
|
||||||
sc->cyanpixl = sc->cyancolor.pixel;
|
sc->cyanpixl = sc->cyancolor.pixel;
|
||||||
|
|
||||||
sc->gray = XCreatePixmapFromBitmapData(X_Dpy, sc->rootwin,
|
sc->gray = XCreatePixmapFromBitmapData(X_Dpy, sc->rootwin,
|
||||||
gray_bits, gray_width, gray_height,
|
gray_bits, gray_width, gray_height,
|
||||||
sc->blackpixl, sc->whitepixl, DefaultDepth(X_Dpy, sc->which));
|
sc->blackpixl, sc->whitepixl, DefaultDepth(X_Dpy, sc->which));
|
||||||
|
|
||||||
sc->blue = XCreatePixmapFromBitmapData(X_Dpy, sc->rootwin,
|
sc->blue = XCreatePixmapFromBitmapData(X_Dpy, sc->rootwin,
|
||||||
gray_bits, gray_width, gray_height,
|
gray_bits, gray_width, gray_height,
|
||||||
sc->bluepixl, sc->whitepixl, DefaultDepth(X_Dpy, sc->which));
|
sc->bluepixl, sc->whitepixl, DefaultDepth(X_Dpy, sc->which));
|
||||||
|
|
||||||
sc->red = XCreatePixmapFromBitmapData(X_Dpy, sc->rootwin,
|
sc->red = XCreatePixmapFromBitmapData(X_Dpy, sc->rootwin,
|
||||||
gray_bits, gray_width, gray_height,
|
gray_bits, gray_width, gray_height,
|
||||||
sc->redpixl, sc->whitepixl, DefaultDepth(X_Dpy, sc->which));
|
sc->redpixl, sc->whitepixl, DefaultDepth(X_Dpy, sc->which));
|
||||||
|
|
||||||
gv.foreground = sc->blackpixl^sc->whitepixl;
|
gv.foreground = sc->blackpixl^sc->whitepixl;
|
||||||
@ -216,7 +216,7 @@ x_setupscreen(struct screen_ctx *sc, u_int which)
|
|||||||
search_init(sc);
|
search_init(sc);
|
||||||
|
|
||||||
/* Deal with existing clients. */
|
/* Deal with existing clients. */
|
||||||
XQueryTree(X_Dpy, sc->rootwin, &w0, &w1, &wins, &nwins);
|
XQueryTree(X_Dpy, sc->rootwin, &w0, &w1, &wins, &nwins);
|
||||||
|
|
||||||
for (i = 0; i < nwins; i++) {
|
for (i = 0; i < nwins; i++) {
|
||||||
XGetWindowAttributes(X_Dpy, wins[i], &winattr);
|
XGetWindowAttributes(X_Dpy, wins[i], &winattr);
|
||||||
@ -287,11 +287,11 @@ x_errorhandler(Display *dpy, XErrorEvent *e)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (Starting &&
|
if (Starting &&
|
||||||
e->error_code == BadAccess &&
|
e->error_code == BadAccess &&
|
||||||
e->request_code == X_GrabKey)
|
e->request_code == X_GrabKey)
|
||||||
errx(1, "root window unavailable - perhaps another "
|
errx(1, "root window unavailable - perhaps another "
|
||||||
"wm is running?");
|
"wm is running?");
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
@ -302,9 +302,9 @@ _sigchld_cb(int which)
|
|||||||
pid_t pid;
|
pid_t pid;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
/* Collect dead children. */
|
/* Collect dead children. */
|
||||||
while ((pid = waitpid(-1, &status, WNOHANG)) > 0 ||
|
while ((pid = waitpid(-1, &status, WNOHANG)) > 0 ||
|
||||||
(pid < 0 && errno == EINTR))
|
(pid < 0 && errno == EINTR))
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
445
calmwm.h
445
calmwm.h
@ -44,15 +44,13 @@ struct client_ctx;
|
|||||||
|
|
||||||
TAILQ_HEAD(cycle_entry_q, client_ctx);
|
TAILQ_HEAD(cycle_entry_q, client_ctx);
|
||||||
|
|
||||||
/* #define CYCLE_FOREACH_MRU(cy, ctx) TAILQ_FOREACH((ctx), */
|
|
||||||
|
|
||||||
struct screen_ctx;
|
struct screen_ctx;
|
||||||
|
|
||||||
struct fontdesc {
|
struct fontdesc {
|
||||||
const char *name;
|
const char *name;
|
||||||
XftFont *fn;
|
XftFont *fn;
|
||||||
struct screen_ctx *sc;
|
struct screen_ctx *sc;
|
||||||
HASH_ENTRY(fontdesc) node;
|
HASH_ENTRY(fontdesc) node;
|
||||||
};
|
};
|
||||||
|
|
||||||
int fontdesc_cmp(struct fontdesc *a, struct fontdesc *b);
|
int fontdesc_cmp(struct fontdesc *a, struct fontdesc *b);
|
||||||
@ -88,9 +86,9 @@ struct screen_ctx {
|
|||||||
|
|
||||||
struct client_ctx* cycle_client;
|
struct client_ctx* cycle_client;
|
||||||
|
|
||||||
struct fonthash fonthash;
|
struct fonthash fonthash;
|
||||||
XftDraw *xftdraw;
|
XftDraw *xftdraw;
|
||||||
XftColor xftcolor;
|
XftColor xftcolor;
|
||||||
};
|
};
|
||||||
|
|
||||||
TAILQ_HEAD(screen_ctx_q, screen_ctx);
|
TAILQ_HEAD(screen_ctx_q, screen_ctx);
|
||||||
@ -108,7 +106,7 @@ TAILQ_HEAD(screen_ctx_q, screen_ctx);
|
|||||||
#define CLIENT_VMAXIMIZED 0x20
|
#define CLIENT_VMAXIMIZED 0x20
|
||||||
|
|
||||||
#define CLIENT_HIGHLIGHT_BLUE 1
|
#define CLIENT_HIGHLIGHT_BLUE 1
|
||||||
#define CLIENT_HIGHLIGHT_RED 2
|
#define CLIENT_HIGHLIGHT_RED 2
|
||||||
|
|
||||||
|
|
||||||
struct winname {
|
struct winname {
|
||||||
@ -128,7 +126,7 @@ struct client_ctx {
|
|||||||
Window win;
|
Window win;
|
||||||
XSizeHints *size;
|
XSizeHints *size;
|
||||||
|
|
||||||
Colormap cmap;
|
Colormap cmap;
|
||||||
|
|
||||||
Window pwin;
|
Window pwin;
|
||||||
|
|
||||||
@ -157,13 +155,13 @@ struct client_ctx {
|
|||||||
int highlight;
|
int highlight;
|
||||||
|
|
||||||
char *matchname;
|
char *matchname;
|
||||||
struct group_ctx *group;
|
struct group_ctx *group;
|
||||||
|
|
||||||
int stackingorder;
|
int stackingorder;
|
||||||
|
|
||||||
char *app_class;
|
char *app_class;
|
||||||
char *app_name;
|
char *app_name;
|
||||||
char *app_cliarg;
|
char *app_cliarg;
|
||||||
};
|
};
|
||||||
|
|
||||||
TAILQ_HEAD(client_ctx_q, client_ctx);
|
TAILQ_HEAD(client_ctx_q, client_ctx);
|
||||||
@ -175,14 +173,14 @@ static char *shortcut_to_name[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct group_ctx {
|
struct group_ctx {
|
||||||
TAILQ_ENTRY(group_ctx) entry;
|
TAILQ_ENTRY(group_ctx) entry;
|
||||||
struct client_ctx_q clients;
|
struct client_ctx_q clients;
|
||||||
char *name;
|
char *name;
|
||||||
int shortcut;
|
int shortcut;
|
||||||
int hidden;
|
int hidden;
|
||||||
int nhidden;
|
int nhidden;
|
||||||
int highstack;
|
int highstack;
|
||||||
};
|
};
|
||||||
|
|
||||||
TAILQ_HEAD(group_ctx_q, group_ctx);
|
TAILQ_HEAD(group_ctx_q, group_ctx);
|
||||||
|
|
||||||
@ -199,31 +197,31 @@ TAILQ_HEAD(autogroupwin_q, autogroupwin);
|
|||||||
|
|
||||||
/* NULL/0 values indicate match any. */
|
/* NULL/0 values indicate match any. */
|
||||||
struct xevent {
|
struct xevent {
|
||||||
TAILQ_ENTRY(xevent) entry;
|
TAILQ_ENTRY(xevent) entry;
|
||||||
Window *xev_win;
|
Window *xev_win;
|
||||||
Window *xev_root;
|
Window *xev_root;
|
||||||
int xev_type;
|
int xev_type;
|
||||||
void (*xev_cb)(struct xevent *, XEvent *);
|
void (*xev_cb)(struct xevent *, XEvent *);
|
||||||
void *xev_arg;
|
void *xev_arg;
|
||||||
};
|
};
|
||||||
|
|
||||||
TAILQ_HEAD(xevent_q, xevent);
|
TAILQ_HEAD(xevent_q, xevent);
|
||||||
|
|
||||||
#define CWM_BIGMOVE 0x1000
|
#define CWM_BIGMOVE 0x1000
|
||||||
enum directions {
|
enum directions {
|
||||||
CWM_UP=0, CWM_DOWN, CWM_LEFT, CWM_RIGHT,
|
CWM_UP = 0, CWM_DOWN, CWM_LEFT, CWM_RIGHT,
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Match a window.
|
* Match a window.
|
||||||
*/
|
*/
|
||||||
#define CONF_MAX_WINTITLE 256
|
#define CONF_MAX_WINTITLE 256
|
||||||
#define CONF_IGNORECASE 0x01
|
#define CONF_IGNORECASE 0x01
|
||||||
struct winmatch {
|
struct winmatch {
|
||||||
TAILQ_ENTRY(winmatch) entry;
|
TAILQ_ENTRY(winmatch) entry;
|
||||||
|
|
||||||
char title[CONF_MAX_WINTITLE];
|
char title[CONF_MAX_WINTITLE];
|
||||||
int opts;
|
int opts;
|
||||||
};
|
};
|
||||||
|
|
||||||
TAILQ_HEAD(winmatch_q, winmatch);
|
TAILQ_HEAD(winmatch_q, winmatch);
|
||||||
@ -237,21 +235,20 @@ TAILQ_HEAD(winmatch_q, winmatch);
|
|||||||
#define KBTOGROUP(X) ((X) - 1)
|
#define KBTOGROUP(X) ((X) - 1)
|
||||||
|
|
||||||
struct keybinding {
|
struct keybinding {
|
||||||
int modmask;
|
int modmask;
|
||||||
int keysym;
|
int keysym;
|
||||||
int keycode;
|
int keycode;
|
||||||
int flags;
|
int flags;
|
||||||
void (*callback)(struct client_ctx *, void *);
|
void (*callback)(struct client_ctx *, void *);
|
||||||
void *argument;
|
void *argument;
|
||||||
TAILQ_ENTRY(keybinding) entry;
|
TAILQ_ENTRY(keybinding) entry;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct cmd {
|
struct cmd {
|
||||||
TAILQ_ENTRY(cmd) entry;
|
TAILQ_ENTRY(cmd) entry;
|
||||||
int flags;
|
int flags;
|
||||||
#define CMD_STATIC 0x01 /* static configuration in conf.c */
|
char image[MAXPATHLEN];
|
||||||
char image[MAXPATHLEN];
|
char label[256];
|
||||||
char label[256];
|
|
||||||
/* (argv) */
|
/* (argv) */
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -266,15 +263,15 @@ struct conf {
|
|||||||
char conf_path[MAXPATHLEN];
|
char conf_path[MAXPATHLEN];
|
||||||
struct cmd_q cmdq;
|
struct cmd_q cmdq;
|
||||||
|
|
||||||
|
#define CONF_STICKY_GROUPS 0x0001
|
||||||
int flags;
|
int flags;
|
||||||
#define CONF_STICKY_GROUPS 0x0001
|
|
||||||
|
|
||||||
char termpath[MAXPATHLEN];
|
char termpath[MAXPATHLEN];
|
||||||
char lockpath[MAXPATHLEN];
|
char lockpath[MAXPATHLEN];
|
||||||
|
|
||||||
#define DEFAULTFONTNAME "sans-serif:pixelsize=14:bold"
|
#define DEFAULTFONTNAME "sans-serif:pixelsize=14:bold"
|
||||||
char *DefaultFontName;
|
char *DefaultFontName;
|
||||||
int gap_top, gap_bottom, gap_left, gap_right;
|
int gap_top, gap_bottom, gap_left, gap_right;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Menu stuff */
|
/* Menu stuff */
|
||||||
@ -282,13 +279,13 @@ struct conf {
|
|||||||
#define MENU_MAXENTRY 50
|
#define MENU_MAXENTRY 50
|
||||||
|
|
||||||
struct menu {
|
struct menu {
|
||||||
TAILQ_ENTRY(menu) entry;
|
TAILQ_ENTRY(menu) entry;
|
||||||
TAILQ_ENTRY(menu) resultentry;
|
TAILQ_ENTRY(menu) resultentry;
|
||||||
|
|
||||||
char text[MENU_MAXENTRY + 1];
|
char text[MENU_MAXENTRY + 1];
|
||||||
char print[MENU_MAXENTRY + 1];
|
char print[MENU_MAXENTRY + 1];
|
||||||
void *ctx;
|
void *ctx;
|
||||||
short dummy;
|
short dummy;
|
||||||
};
|
};
|
||||||
|
|
||||||
TAILQ_HEAD(menu_q, menu);
|
TAILQ_HEAD(menu_q, menu);
|
||||||
@ -302,196 +299,202 @@ enum ctltype {
|
|||||||
/* MWM hints */
|
/* MWM hints */
|
||||||
|
|
||||||
struct mwm_hints {
|
struct mwm_hints {
|
||||||
u_long flags;
|
u_long flags;
|
||||||
u_long functions;
|
u_long functions;
|
||||||
u_long decorations;
|
u_long decorations;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define MWM_NUMHINTS 3
|
#define MWM_NUMHINTS 3
|
||||||
|
|
||||||
#define PROP_MWM_HINTS_ELEMENTS 3
|
#define PROP_MWM_HINTS_ELEMENTS 3
|
||||||
#define MWM_HINTS_DECORATIONS (1 << 1)
|
#define MWM_HINTS_DECORATIONS (1 << 1)
|
||||||
#define MWM_DECOR_ALL (1 << 0)
|
#define MWM_DECOR_ALL (1 << 0)
|
||||||
#define MWM_DECOR_BORDER (1 << 1)
|
#define MWM_DECOR_BORDER (1 << 1)
|
||||||
|
|
||||||
int input_keycodetrans(KeyCode, u_int, enum ctltype *, char *, int);
|
int input_keycodetrans(KeyCode, u_int, enum ctltype *,
|
||||||
|
char *, int);
|
||||||
|
|
||||||
int x_errorhandler(Display *, XErrorEvent *);
|
int x_errorhandler(Display *, XErrorEvent *);
|
||||||
void x_setup(char *display_name);
|
void x_setup(char *display_name);
|
||||||
char *x_screenname(int);
|
char *x_screenname(int);
|
||||||
void x_setupscreen(struct screen_ctx *, u_int);
|
void x_setupscreen(struct screen_ctx *, u_int);
|
||||||
__dead void usage(void);
|
__dead void usage(void);
|
||||||
|
|
||||||
struct client_ctx *client_find(Window);
|
struct client_ctx *client_find(Window);
|
||||||
void client_setup(void);
|
void client_setup(void);
|
||||||
struct client_ctx *client_new(Window, struct screen_ctx *, int);
|
struct client_ctx *client_new(Window, struct screen_ctx *, int);
|
||||||
int client_delete(struct client_ctx *, int, int);
|
int client_delete(struct client_ctx *, int, int);
|
||||||
void client_setactive(struct client_ctx *, int);
|
void client_setactive(struct client_ctx *, int);
|
||||||
void client_gravitate(struct client_ctx *, int);
|
void client_gravitate(struct client_ctx *, int);
|
||||||
void client_resize(struct client_ctx *);
|
void client_resize(struct client_ctx *);
|
||||||
void client_lower(struct client_ctx *);
|
void client_lower(struct client_ctx *);
|
||||||
void client_raise(struct client_ctx *);
|
void client_raise(struct client_ctx *);
|
||||||
void client_move(struct client_ctx *);
|
void client_move(struct client_ctx *);
|
||||||
void client_leave(struct client_ctx *);
|
void client_leave(struct client_ctx *);
|
||||||
void client_send_delete(struct client_ctx *);
|
void client_send_delete(struct client_ctx *);
|
||||||
struct client_ctx *client_current(void);
|
struct client_ctx *client_current(void);
|
||||||
void client_hide(struct client_ctx *);
|
void client_hide(struct client_ctx *);
|
||||||
void client_unhide(struct client_ctx *);
|
void client_unhide(struct client_ctx *);
|
||||||
void client_nocurrent(void);
|
void client_nocurrent(void);
|
||||||
void client_setname(struct client_ctx *);
|
void client_setname(struct client_ctx *);
|
||||||
void client_warp(struct client_ctx *);
|
void client_warp(struct client_ctx *);
|
||||||
void client_ptrwarp(struct client_ctx *);
|
void client_ptrwarp(struct client_ctx *);
|
||||||
void client_ptrsave(struct client_ctx *);
|
void client_ptrsave(struct client_ctx *);
|
||||||
void client_draw_border(struct client_ctx *);
|
void client_draw_border(struct client_ctx *);
|
||||||
void client_update(struct client_ctx *);
|
void client_update(struct client_ctx *);
|
||||||
void client_cycle(struct client_ctx *);
|
void client_cycle(struct client_ctx *);
|
||||||
void client_placecalc(struct client_ctx *);
|
void client_placecalc(struct client_ctx *);
|
||||||
void client_maximize(struct client_ctx *);
|
void client_maximize(struct client_ctx *);
|
||||||
void client_vertmaximize(struct client_ctx *);
|
void client_vertmaximize(struct client_ctx *);
|
||||||
u_long client_bg_pixel(struct client_ctx *);
|
u_long client_bg_pixel(struct client_ctx *);
|
||||||
Pixmap client_bg_pixmap(struct client_ctx *);
|
Pixmap client_bg_pixmap(struct client_ctx *);
|
||||||
void client_map(struct client_ctx *cc);
|
void client_map(struct client_ctx *cc);
|
||||||
void client_mtf(struct client_ctx *cc);
|
void client_mtf(struct client_ctx *cc);
|
||||||
struct client_ctx *client_cyclenext(int reverse);
|
struct client_ctx *client_cyclenext(int reverse);
|
||||||
void client_altrelease();
|
void client_altrelease();
|
||||||
struct client_ctx *client_mrunext(struct client_ctx *cc);
|
struct client_ctx *client_mrunext(struct client_ctx *cc);
|
||||||
struct client_ctx *client_mruprev(struct client_ctx *cc);
|
struct client_ctx *client_mruprev(struct client_ctx *cc);
|
||||||
void client_gethints(struct client_ctx *cc);
|
void client_gethints(struct client_ctx *cc);
|
||||||
void client_freehints(struct client_ctx *cc);
|
void client_freehints(struct client_ctx *cc);
|
||||||
|
|
||||||
void xev_handle_maprequest(struct xevent *, XEvent *);
|
void xev_handle_maprequest(struct xevent *, XEvent *);
|
||||||
void xev_handle_unmapnotify(struct xevent *, XEvent *);
|
void xev_handle_unmapnotify(struct xevent *, XEvent *);
|
||||||
void xev_handle_destroynotify(struct xevent *, XEvent *);
|
void xev_handle_destroynotify(struct xevent *, XEvent *);
|
||||||
void xev_handle_configurerequest(struct xevent *, XEvent *);
|
void xev_handle_configurerequest(struct xevent *, XEvent *);
|
||||||
void xev_handle_propertynotify(struct xevent *, XEvent *);
|
void xev_handle_propertynotify(struct xevent *, XEvent *);
|
||||||
void xev_handle_enternotify(struct xevent *, XEvent *);
|
void xev_handle_enternotify(struct xevent *, XEvent *);
|
||||||
void xev_handle_leavenotify(struct xevent *, XEvent *);
|
void xev_handle_leavenotify(struct xevent *, XEvent *);
|
||||||
void xev_handle_buttonpress(struct xevent *, XEvent *);
|
void xev_handle_buttonpress(struct xevent *, XEvent *);
|
||||||
void xev_handle_buttonrelease(struct xevent *, XEvent *);
|
void xev_handle_buttonrelease(struct xevent *, XEvent *);
|
||||||
void xev_handle_keypress(struct xevent *, XEvent *);
|
void xev_handle_keypress(struct xevent *, XEvent *);
|
||||||
void xev_handle_keyrelease(struct xevent *, XEvent *);
|
void xev_handle_keyrelease(struct xevent *, XEvent *);
|
||||||
void xev_handle_expose(struct xevent *, XEvent *);
|
void xev_handle_expose(struct xevent *, XEvent *);
|
||||||
void xev_handle_clientmessage(struct xevent *, XEvent *);
|
void xev_handle_clientmessage(struct xevent *, XEvent *);
|
||||||
|
|
||||||
#define XEV_QUICK(a, b, c, d, e) do { \
|
#define XEV_QUICK(a, b, c, d, e) do { \
|
||||||
xev_register(xev_new(a, b, c, d, e)); \
|
xev_register(xev_new(a, b, c, d, e)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
void xev_reconfig(struct client_ctx *); /* XXX should be xu_ */
|
/* XXX should be xu_ */
|
||||||
|
void xev_reconfig(struct client_ctx *);
|
||||||
|
|
||||||
void xev_init(void);
|
void xev_init(void);
|
||||||
struct xevent *xev_new(Window *, Window *, int, void (*)(struct xevent *, XEvent *), void *);
|
struct xevent *xev_new(Window *, Window *, int,
|
||||||
void xev_register(struct xevent *);
|
void (*)(struct xevent *, XEvent *), void *);
|
||||||
void xev_loop(void);
|
void xev_register(struct xevent *);
|
||||||
|
void xev_loop(void);
|
||||||
|
|
||||||
int xu_ptr_grab(Window, int, Cursor);
|
int xu_ptr_grab(Window, int, Cursor);
|
||||||
int xu_btn_grab(Window, int, u_int);
|
int xu_btn_grab(Window, int, u_int);
|
||||||
int xu_ptr_regrab(int, Cursor);
|
int xu_ptr_regrab(int, Cursor);
|
||||||
void xu_btn_ungrab(Window, int, u_int);
|
void xu_btn_ungrab(Window, int, u_int);
|
||||||
void xu_ptr_ungrab(void);
|
void xu_ptr_ungrab(void);
|
||||||
void xu_ptr_setpos(Window, int, int);
|
void xu_ptr_setpos(Window, int, int);
|
||||||
void xu_ptr_getpos(Window, int *, int *);
|
void xu_ptr_getpos(Window, int *, int *);
|
||||||
void xu_key_grab(Window, int, int);
|
void xu_key_grab(Window, int, int);
|
||||||
void xu_sendmsg(struct client_ctx *, Atom, long);
|
void xu_sendmsg(struct client_ctx *, Atom, long);
|
||||||
int xu_getprop(struct client_ctx *, Atom, Atom, long, u_char **);
|
int xu_getprop(struct client_ctx *, Atom, Atom, long,
|
||||||
char *xu_getstrprop(struct client_ctx *, Atom atm);
|
u_char **);
|
||||||
void xu_setstate(struct client_ctx *, int);
|
char *xu_getstrprop(struct client_ctx *, Atom atm);
|
||||||
int xu_getstate(struct client_ctx *, int *);
|
void xu_setstate(struct client_ctx *, int);
|
||||||
void xu_key_grab_keycode(Window, int, int);
|
int xu_getstate(struct client_ctx *, int *);
|
||||||
|
void xu_key_grab_keycode(Window, int, int);
|
||||||
|
|
||||||
int dirent_exists(char *);
|
int dirent_exists(char *);
|
||||||
int dirent_isdir(char *);
|
int dirent_isdir(char *);
|
||||||
int dirent_islink(char *);
|
int dirent_islink(char *);
|
||||||
int u_spawn(char *);
|
int u_spawn(char *);
|
||||||
void exec_wm(char *);
|
void exec_wm(char *);
|
||||||
|
|
||||||
void grab_sweep(struct client_ctx *);
|
void grab_sweep(struct client_ctx *);
|
||||||
void grab_drag(struct client_ctx *);
|
void grab_drag(struct client_ctx *);
|
||||||
void grab_menuinit(struct screen_ctx *);
|
void grab_menuinit(struct screen_ctx *);
|
||||||
void *grab_menu(XButtonEvent *, struct menu_q *);
|
void *grab_menu(XButtonEvent *, struct menu_q *);
|
||||||
void grab_label(struct client_ctx *);
|
void grab_label(struct client_ctx *);
|
||||||
|
|
||||||
void xfree(void *);
|
void xfree(void *);
|
||||||
void *xmalloc(size_t);
|
void *xmalloc(size_t);
|
||||||
void *xcalloc(size_t);
|
void *xcalloc(size_t);
|
||||||
char *xstrdup(const char *);
|
char *xstrdup(const char *);
|
||||||
|
|
||||||
#define XMALLOC(p, t) ((p) = (t *)xmalloc(sizeof * (p)))
|
#define XMALLOC(p, t) ((p) = (t *)xmalloc(sizeof * (p)))
|
||||||
#define XCALLOC(p, t) ((p) = (t *)xcalloc(sizeof * (p)))
|
#define XCALLOC(p, t) ((p) = (t *)xcalloc(sizeof * (p)))
|
||||||
|
|
||||||
void screen_init(void);
|
void screen_init(void);
|
||||||
struct screen_ctx *screen_fromroot(Window);
|
struct screen_ctx *screen_fromroot(Window);
|
||||||
struct screen_ctx *screen_current(void);
|
struct screen_ctx *screen_current(void);
|
||||||
void screen_updatestackingorder(void);
|
void screen_updatestackingorder(void);
|
||||||
void screen_infomsg(char *);
|
void screen_infomsg(char *);
|
||||||
|
|
||||||
void conf_setup(struct conf *, const char *);
|
void conf_setup(struct conf *, const char *);
|
||||||
int conf_get_int(struct client_ctx *, enum conftype);
|
int conf_get_int(struct client_ctx *, enum conftype);
|
||||||
void conf_client(struct client_ctx *);
|
void conf_client(struct client_ctx *);
|
||||||
void conf_bindkey(struct conf *, void (*)(struct client_ctx *, void *),
|
void conf_bindkey(struct conf *,
|
||||||
int, int, int, void *);
|
void (*)(struct client_ctx *, void *),
|
||||||
void conf_bindname(struct conf *, char *, char *);
|
int, int, int, void *);
|
||||||
void conf_unbind(struct conf *, struct keybinding *);
|
void conf_bindname(struct conf *, char *, char *);
|
||||||
int conf_changed(char *);
|
void conf_unbind(struct conf *, struct keybinding *);
|
||||||
void conf_reload(struct conf *c);
|
int conf_changed(char *);
|
||||||
char *conf_get_str(struct client_ctx *, enum conftype);
|
void conf_reload(struct conf *);
|
||||||
|
char *conf_get_str(struct client_ctx *, enum conftype);
|
||||||
|
|
||||||
void kbfunc_client_lower(struct client_ctx *, void *);
|
void kbfunc_client_lower(struct client_ctx *, void *);
|
||||||
void kbfunc_client_raise(struct client_ctx *, void *);
|
void kbfunc_client_raise(struct client_ctx *, void *);
|
||||||
void kbfunc_client_search(struct client_ctx *, void *);
|
void kbfunc_client_search(struct client_ctx *, void *);
|
||||||
void kbfunc_client_hide(struct client_ctx *, void *);
|
void kbfunc_client_hide(struct client_ctx *, void *);
|
||||||
void kbfunc_client_cycle(struct client_ctx *, void *);
|
void kbfunc_client_cycle(struct client_ctx *, void *);
|
||||||
void kbfunc_client_rcycle(struct client_ctx *cc, void *arg);
|
void kbfunc_client_rcycle(struct client_ctx *, void *);
|
||||||
void kbfunc_cmdexec(struct client_ctx *, void *);
|
void kbfunc_cmdexec(struct client_ctx *, void *);
|
||||||
void kbfunc_client_label(struct client_ctx *, void *);
|
void kbfunc_client_label(struct client_ctx *, void *);
|
||||||
void kbfunc_client_delete(struct client_ctx *, void *);
|
void kbfunc_client_delete(struct client_ctx *, void *);
|
||||||
void kbfunc_client_group(struct client_ctx *, void *);
|
void kbfunc_client_group(struct client_ctx *, void *);
|
||||||
void kbfunc_client_nextgroup(struct client_ctx *, void *);
|
void kbfunc_client_nextgroup(struct client_ctx *, void *);
|
||||||
void kbfunc_client_prevgroup(struct client_ctx *, void *);
|
void kbfunc_client_prevgroup(struct client_ctx *, void *);
|
||||||
void kbfunc_client_nogroup(struct client_ctx *, void *);
|
void kbfunc_client_nogroup(struct client_ctx *, void *);
|
||||||
void kbfunc_client_maximize(struct client_ctx *, void *);
|
void kbfunc_client_maximize(struct client_ctx *, void *);
|
||||||
void kbfunc_client_vmaximize(struct client_ctx *, void *);
|
void kbfunc_client_vmaximize(struct client_ctx *, void *);
|
||||||
void kbfunc_quit_wm(struct client_ctx *, void *);
|
void kbfunc_quit_wm(struct client_ctx *, void *);
|
||||||
void kbfunc_client_move(struct client_ctx *, void *);
|
void kbfunc_client_move(struct client_ctx *, void *);
|
||||||
void kbfunc_client_resize(struct client_ctx *, void *);
|
void kbfunc_client_resize(struct client_ctx *, void *);
|
||||||
void kbfunc_menu_search(struct client_ctx *, void *);
|
void kbfunc_menu_search(struct client_ctx *, void *);
|
||||||
void kbfunc_exec(struct client_ctx *, void *);
|
void kbfunc_exec(struct client_ctx *, void *);
|
||||||
void kbfunc_ptrmove(struct client_ctx *, void *);
|
void kbfunc_ptrmove(struct client_ctx *, void *);
|
||||||
void kbfunc_ssh(struct client_ctx *, void *);
|
void kbfunc_ssh(struct client_ctx *, void *);
|
||||||
void kbfunc_term(struct client_ctx *cc, void *arg);
|
void kbfunc_term(struct client_ctx *, void *);
|
||||||
void kbfunc_lock(struct client_ctx *cc, void *arg);
|
void kbfunc_lock(struct client_ctx *, void *);
|
||||||
|
|
||||||
void search_init(struct screen_ctx *);
|
void search_init(struct screen_ctx *);
|
||||||
struct menu *search_start(struct menu_q *menuq,
|
struct menu *search_start(struct menu_q *menuq,
|
||||||
void (*match)(struct menu_q *, struct menu_q *, char *),
|
void (*match)(struct menu_q *, struct menu_q *, char *),
|
||||||
void (*print)(struct menu *mi, int),
|
void (*print)(struct menu *mi, int),
|
||||||
char *, int);
|
char *, int);
|
||||||
void search_match_client(struct menu_q *, struct menu_q *, char *);
|
void search_match_client(struct menu_q *, struct menu_q *,
|
||||||
void search_print_client(struct menu *mi, int list);
|
char *);
|
||||||
void search_match_text(struct menu_q *, struct menu_q *, char *);
|
void search_print_client(struct menu *mi, int list);
|
||||||
void search_match_exec(struct menu_q *, struct menu_q *, char *);
|
void search_match_text(struct menu_q *, struct menu_q *,
|
||||||
|
char *);
|
||||||
|
void search_match_exec(struct menu_q *, struct menu_q *,
|
||||||
|
char *);
|
||||||
|
|
||||||
void group_init(void);
|
void group_init(void);
|
||||||
void group_hidetoggle(int);
|
void group_hidetoggle(int);
|
||||||
void group_slide(int);
|
void group_slide(int);
|
||||||
void group_sticky(struct client_ctx *);
|
void group_sticky(struct client_ctx *);
|
||||||
void group_client_delete(struct client_ctx *);
|
void group_client_delete(struct client_ctx *);
|
||||||
void group_menu(XButtonEvent *);
|
void group_menu(XButtonEvent *);
|
||||||
void group_alltoggle(void);
|
void group_alltoggle(void);
|
||||||
void group_sticky_toggle_enter(struct client_ctx *);
|
void group_sticky_toggle_enter(struct client_ctx *);
|
||||||
void group_sticky_toggle_exit(struct client_ctx *);
|
void group_sticky_toggle_exit(struct client_ctx *);
|
||||||
void group_autogroup(struct client_ctx *);
|
void group_autogroup(struct client_ctx *);
|
||||||
|
|
||||||
void notification_init(struct screen_ctx *);
|
void font_init(struct screen_ctx *);
|
||||||
|
struct fontdesc *font_get(struct screen_ctx *, const char *);
|
||||||
void font_init(struct screen_ctx *sc);
|
int font_width(struct fontdesc *, const char *, int);
|
||||||
struct fontdesc *font_get(struct screen_ctx *sc, const char *name);
|
void font_draw(struct fontdesc *, const char *, int,
|
||||||
int font_width(struct fontdesc *fdp, const char *text, int len);
|
Drawable, int, int);
|
||||||
void font_draw(struct fontdesc *fdp, const char *text, int len,
|
int font_ascent(struct fontdesc *);
|
||||||
Drawable d, int x, int y);
|
int font_descent(struct fontdesc *);
|
||||||
int font_ascent(struct fontdesc *fdp);
|
struct fontdesc *font_getx(struct screen_ctx *, const char *);
|
||||||
int font_descent(struct fontdesc *fdp);
|
|
||||||
struct fontdesc *font_getx(struct screen_ctx *sc, const char *name);
|
|
||||||
|
|
||||||
#define CCTOSC(cc) (cc->sc)
|
#define CCTOSC(cc) (cc->sc)
|
||||||
|
|
||||||
@ -514,7 +517,7 @@ extern struct client_ctx_q Clientq;
|
|||||||
extern int Doshape, Shape_ev;
|
extern int Doshape, Shape_ev;
|
||||||
extern struct conf Conf;
|
extern struct conf Conf;
|
||||||
|
|
||||||
extern struct fontdesc *DefaultFont;
|
extern struct fontdesc *DefaultFont;
|
||||||
|
|
||||||
|
|
||||||
#endif /* _CALMWM_H_ */
|
#endif /* _CALMWM_H_ */
|
||||||
|
45
client.c
45
client.c
@ -23,11 +23,11 @@
|
|||||||
|
|
||||||
static struct client_ctx *client__cycle(struct client_ctx *cc,
|
static struct client_ctx *client__cycle(struct client_ctx *cc,
|
||||||
struct client_ctx *(*iter)(struct client_ctx *));
|
struct client_ctx *(*iter)(struct client_ctx *));
|
||||||
int _inwindowbounds(struct client_ctx *, int, int);
|
int _inwindowbounds(struct client_ctx *, int, int);
|
||||||
|
|
||||||
static char emptystring[] = "";
|
static char emptystring[] = "";
|
||||||
|
|
||||||
struct client_ctx *_curcc = NULL;
|
struct client_ctx *_curcc = NULL;
|
||||||
|
|
||||||
void
|
void
|
||||||
client_setup(void)
|
client_setup(void)
|
||||||
@ -53,7 +53,7 @@ client_new(Window win, struct screen_ctx *sc, int mapped)
|
|||||||
struct client_ctx *cc;
|
struct client_ctx *cc;
|
||||||
long tmp;
|
long tmp;
|
||||||
XSetWindowAttributes pxattr;
|
XSetWindowAttributes pxattr;
|
||||||
XWindowAttributes wattr;
|
XWindowAttributes wattr;
|
||||||
int x, y, height, width, state;
|
int x, y, height, width, state;
|
||||||
XWMHints *wmhints;
|
XWMHints *wmhints;
|
||||||
|
|
||||||
@ -67,7 +67,7 @@ client_new(Window win, struct screen_ctx *sc, int mapped)
|
|||||||
cc->state = mapped ? NormalState : IconicState;
|
cc->state = mapped ? NormalState : IconicState;
|
||||||
cc->sc = sc;
|
cc->sc = sc;
|
||||||
cc->win = win;
|
cc->win = win;
|
||||||
cc->size= XAllocSizeHints();
|
cc->size = XAllocSizeHints();
|
||||||
if (cc->size->width_inc == 0)
|
if (cc->size->width_inc == 0)
|
||||||
cc->size->width_inc = 1;
|
cc->size->width_inc = 1;
|
||||||
if (cc->size->height_inc == 0)
|
if (cc->size->height_inc == 0)
|
||||||
@ -137,7 +137,7 @@ client_new(Window win, struct screen_ctx *sc, int mapped)
|
|||||||
ExposureMask|EnterWindowMask;
|
ExposureMask|EnterWindowMask;
|
||||||
/* pxattr.border_pixel = sc->blackpix; */
|
/* pxattr.border_pixel = sc->blackpix; */
|
||||||
/* pxattr.background_pixel = sc->whitepix; */
|
/* pxattr.background_pixel = sc->whitepix; */
|
||||||
|
|
||||||
|
|
||||||
/* cc->pwin = XCreateSimpleWindow(X_Dpy, sc->rootwin, */
|
/* cc->pwin = XCreateSimpleWindow(X_Dpy, sc->rootwin, */
|
||||||
/* x, y, width, height, 1, sc->blackpix, sc->whitepix); */
|
/* x, y, width, height, 1, sc->blackpix, sc->whitepix); */
|
||||||
@ -154,7 +154,8 @@ client_new(Window win, struct screen_ctx *sc, int mapped)
|
|||||||
|
|
||||||
XShapeSelectInput(X_Dpy, cc->win, ShapeNotifyMask);
|
XShapeSelectInput(X_Dpy, cc->win, ShapeNotifyMask);
|
||||||
|
|
||||||
r = XShapeGetRectangles(X_Dpy, cc->win, ShapeBounding, &n, &tmp);
|
r = XShapeGetRectangles(X_Dpy, cc->win, ShapeBounding,
|
||||||
|
&n, &tmp);
|
||||||
if (n > 1)
|
if (n > 1)
|
||||||
XShapeCombineShape(X_Dpy, cc->pwin, ShapeBounding,
|
XShapeCombineShape(X_Dpy, cc->pwin, ShapeBounding,
|
||||||
0, 0, /* XXX border */
|
0, 0, /* XXX border */
|
||||||
@ -189,7 +190,7 @@ client_new(Window win, struct screen_ctx *sc, int mapped)
|
|||||||
|
|
||||||
client_gethints(cc);
|
client_gethints(cc);
|
||||||
client_update(cc);
|
client_update(cc);
|
||||||
|
|
||||||
if (mapped) {
|
if (mapped) {
|
||||||
group_autogroup(cc);
|
group_autogroup(cc);
|
||||||
}
|
}
|
||||||
@ -308,11 +309,11 @@ client_current(void)
|
|||||||
void
|
void
|
||||||
client_gravitate(struct client_ctx *cc, int yes)
|
client_gravitate(struct client_ctx *cc, int yes)
|
||||||
{
|
{
|
||||||
int dx = 0, dy = 0, mult = yes ? 1 : -1;
|
int dx = 0, dy = 0, mult = yes ? 1 : -1;
|
||||||
int gravity = (cc->size->flags & PWinGravity) ?
|
int gravity = (cc->size->flags & PWinGravity) ?
|
||||||
cc->size->win_gravity : NorthWestGravity;
|
cc->size->win_gravity : NorthWestGravity;
|
||||||
|
|
||||||
switch (gravity) {
|
switch (gravity) {
|
||||||
case NorthWestGravity:
|
case NorthWestGravity:
|
||||||
case SouthWestGravity:
|
case SouthWestGravity:
|
||||||
case NorthEastGravity:
|
case NorthEastGravity:
|
||||||
@ -321,10 +322,10 @@ client_gravitate(struct client_ctx *cc, int yes)
|
|||||||
case NorthGravity:
|
case NorthGravity:
|
||||||
dy = cc->bwidth;
|
dy = cc->bwidth;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
cc->geom.x += mult*dx;
|
cc->geom.x += mult*dx;
|
||||||
cc->geom.y += mult*dy;
|
cc->geom.y += mult*dy;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -419,10 +420,10 @@ client_ptrsave(struct client_ctx *cc)
|
|||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
xu_ptr_getpos(cc->pwin, &x, &y);
|
xu_ptr_getpos(cc->pwin, &x, &y);
|
||||||
if (_inwindowbounds(cc, x, y)) {
|
if (_inwindowbounds(cc, x, y)) {
|
||||||
cc->ptr.x = x;
|
cc->ptr.x = x;
|
||||||
cc->ptr.y = y;
|
cc->ptr.y = y;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -591,7 +592,7 @@ match:
|
|||||||
cc->nameqlen--;
|
cc->nameqlen--;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -635,7 +636,7 @@ client_cyclenext(int reverse)
|
|||||||
/* Do the actual warp. */
|
/* Do the actual warp. */
|
||||||
client_ptrsave(cc);
|
client_ptrsave(cc);
|
||||||
client_ptrwarp(sc->cycle_client);
|
client_ptrwarp(sc->cycle_client);
|
||||||
sc->altpersist = 1; /* This is reset when alt is let go... */
|
sc->altpersist = 1; /* This is reset when alt is let go... */
|
||||||
|
|
||||||
return (sc->cycle_client);
|
return (sc->cycle_client);
|
||||||
}
|
}
|
||||||
@ -671,7 +672,7 @@ client__cycle(struct client_ctx *cc,
|
|||||||
break;
|
break;
|
||||||
} while (cc != save);
|
} while (cc != save);
|
||||||
|
|
||||||
return cc != save ? cc : NULL;
|
return (cc != save ? cc : NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -764,8 +765,8 @@ client_vertmaximize(struct client_ctx *cc)
|
|||||||
struct screen_ctx *sc = CCTOSC(cc);
|
struct screen_ctx *sc = CCTOSC(cc);
|
||||||
int display_height = DisplayHeight(X_Dpy, sc->which) -
|
int display_height = DisplayHeight(X_Dpy, sc->which) -
|
||||||
cc->bwidth*2;
|
cc->bwidth*2;
|
||||||
|
|
||||||
if (!(cc->flags & CLIENT_MAXIMIZED))
|
if (!(cc->flags & CLIENT_MAXIMIZED))
|
||||||
cc->savegeom = cc->geom;
|
cc->savegeom = cc->geom;
|
||||||
cc->geom.y = cc->bwidth + Conf.gap_top;
|
cc->geom.y = cc->bwidth + Conf.gap_top;
|
||||||
cc->geom.height = display_height -
|
cc->geom.height = display_height -
|
||||||
@ -831,7 +832,7 @@ client_gethints(struct client_ctx *cc)
|
|||||||
break;
|
break;
|
||||||
strlcat(buf, argv[i], len);
|
strlcat(buf, argv[i], len);
|
||||||
o += strlen(buf);
|
o += strlen(buf);
|
||||||
strlcat(buf, ARG_SEP_, len);
|
strlcat(buf, ARG_SEP_, len);
|
||||||
o += strlen(ARG_SEP_);
|
o += strlen(ARG_SEP_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
29
conf.c
29
conf.c
@ -23,9 +23,9 @@
|
|||||||
|
|
||||||
#ifndef timespeccmp
|
#ifndef timespeccmp
|
||||||
#define timespeccmp(tsp, usp, cmp) \
|
#define timespeccmp(tsp, usp, cmp) \
|
||||||
(((tsp)->tv_sec == (usp)->tv_sec) ? \
|
(((tsp)->tv_sec == (usp)->tv_sec) ? \
|
||||||
((tsp)->tv_nsec cmp (usp)->tv_nsec) : \
|
((tsp)->tv_nsec cmp (usp)->tv_nsec) : \
|
||||||
((tsp)->tv_sec cmp (usp)->tv_sec))
|
((tsp)->tv_sec cmp (usp)->tv_sec))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern struct screen_ctx *Curscreen;
|
extern struct screen_ctx *Curscreen;
|
||||||
@ -88,7 +88,7 @@ conf_init(struct conf *c)
|
|||||||
|
|
||||||
TAILQ_INIT(&c->ignoreq);
|
TAILQ_INIT(&c->ignoreq);
|
||||||
TAILQ_INIT(&c->cmdq);
|
TAILQ_INIT(&c->cmdq);
|
||||||
TAILQ_INIT(&c->keybindingq);
|
TAILQ_INIT(&c->keybindingq);
|
||||||
TAILQ_INIT(&c->autogroupq);
|
TAILQ_INIT(&c->autogroupq);
|
||||||
|
|
||||||
conf_bindname(c, "CM-Return", "terminal");
|
conf_bindname(c, "CM-Return", "terminal");
|
||||||
@ -166,8 +166,7 @@ conf_setup(struct conf *c, const char *conffile)
|
|||||||
|
|
||||||
snprintf(c->conf_path, sizeof(c->conf_path), "%s/%s", home,
|
snprintf(c->conf_path, sizeof(c->conf_path), "%s/%s", home,
|
||||||
CONFFILE);
|
CONFFILE);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
snprintf(c->conf_path, sizeof(c->conf_path), "%s", conffile);
|
snprintf(c->conf_path, sizeof(c->conf_path), "%s", conffile);
|
||||||
|
|
||||||
conf_init(c);
|
conf_init(c);
|
||||||
@ -195,7 +194,7 @@ conf_get_int(struct client_ctx *cc, enum conftype ctype)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else
|
} else
|
||||||
ignore = 1;
|
ignore = 1;
|
||||||
|
|
||||||
@ -300,23 +299,23 @@ conf_bindname(struct conf *c, char *name, char *binding)
|
|||||||
current_binding->modmask |= ControlMask;
|
current_binding->modmask |= ControlMask;
|
||||||
|
|
||||||
if (strchr(name, 'M') != NULL &&
|
if (strchr(name, 'M') != NULL &&
|
||||||
strchr(name, 'M') < strchr(name, '-'))
|
strchr(name, 'M') < strchr(name, '-'))
|
||||||
current_binding->modmask |= Mod1Mask;
|
current_binding->modmask |= Mod1Mask;
|
||||||
|
|
||||||
if (strchr(name, '2') != NULL &&
|
if (strchr(name, '2') != NULL &&
|
||||||
strchr(name, '2') < strchr(name, '-'))
|
strchr(name, '2') < strchr(name, '-'))
|
||||||
current_binding->modmask |= Mod2Mask;
|
current_binding->modmask |= Mod2Mask;
|
||||||
|
|
||||||
if (strchr(name, '3') != NULL &&
|
if (strchr(name, '3') != NULL &&
|
||||||
strchr(name, '3') < strchr(name, '-'))
|
strchr(name, '3') < strchr(name, '-'))
|
||||||
current_binding->modmask |= Mod3Mask;
|
current_binding->modmask |= Mod3Mask;
|
||||||
|
|
||||||
if (strchr(name, '4') != NULL &&
|
if (strchr(name, '4') != NULL &&
|
||||||
strchr(name, '4') < strchr(name, '-'))
|
strchr(name, '4') < strchr(name, '-'))
|
||||||
current_binding->modmask |= Mod4Mask;
|
current_binding->modmask |= Mod4Mask;
|
||||||
|
|
||||||
if (strchr(name, 'S') != NULL &&
|
if (strchr(name, 'S') != NULL &&
|
||||||
strchr(name, 'S') < strchr(name, '-'))
|
strchr(name, 'S') < strchr(name, '-'))
|
||||||
current_binding->modmask |= ShiftMask;
|
current_binding->modmask |= ShiftMask;
|
||||||
|
|
||||||
substring = strchr(name, '-') + 1;
|
substring = strchr(name, '-') + 1;
|
||||||
@ -335,13 +334,13 @@ conf_bindname(struct conf *c, char *name, char *binding)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (current_binding->keysym == NoSymbol &&
|
if (current_binding->keysym == NoSymbol &&
|
||||||
current_binding->keycode == 0 ) {
|
current_binding->keycode == 0) {
|
||||||
xfree(current_binding);
|
xfree(current_binding);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We now have the correct binding, remove duplicates. */
|
/* We now have the correct binding, remove duplicates. */
|
||||||
conf_unbind(c, current_binding);
|
conf_unbind(c, current_binding);
|
||||||
|
|
||||||
if (strcmp("unmap",binding) == 0)
|
if (strcmp("unmap",binding) == 0)
|
||||||
return;
|
return;
|
||||||
@ -376,7 +375,7 @@ void conf_unbind(struct conf *c, struct keybinding *unbind)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ((key->keycode != 0 && key->keysym == NoSymbol &&
|
if ((key->keycode != 0 && key->keysym == NoSymbol &&
|
||||||
key->keycode == unbind->keycode) ||
|
key->keycode == unbind->keycode) ||
|
||||||
key->keysym == unbind->keysym)
|
key->keysym == unbind->keysym)
|
||||||
TAILQ_REMOVE(&c->keybindingq, key, entry);
|
TAILQ_REMOVE(&c->keybindingq, key, entry);
|
||||||
}
|
}
|
||||||
|
1
cwmrc
1
cwmrc
@ -25,4 +25,3 @@
|
|||||||
#bind CM-r "label"
|
#bind CM-r "label"
|
||||||
#bind CS-Return "xterm -e top"
|
#bind CS-Return "xterm -e top"
|
||||||
#bind 4-o "unmap"
|
#bind 4-o "unmap"
|
||||||
|
|
||||||
|
12
cwmrc.5
12
cwmrc.5
@ -15,7 +15,7 @@
|
|||||||
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
.\"
|
.\"
|
||||||
.\" The following requests are required for all man pages.
|
.\" The following requests are required for all man pages.
|
||||||
.Dd $Mdocdate: March 23 2008 $
|
.Dd $Mdocdate: April 15 2008 $
|
||||||
.Dt CWMRC 1
|
.Dt CWMRC 1
|
||||||
.Os
|
.Os
|
||||||
.Sh NAME
|
.Sh NAME
|
||||||
@ -90,8 +90,8 @@ will cause any instances of
|
|||||||
to not have borders.
|
to not have borders.
|
||||||
.It Ic bind Ar keys Ar command
|
.It Ic bind Ar keys Ar command
|
||||||
Cause the creation of keyboard shortcuts.
|
Cause the creation of keyboard shortcuts.
|
||||||
The default shortcuts will always be created. In case of conflict,
|
The default shortcuts will always be created.
|
||||||
user-defined shortcuts take precidence.
|
In case of conflict, user-defined shortcuts take precidence.
|
||||||
The modifier keys come first, followed by a ``-''.
|
The modifier keys come first, followed by a ``-''.
|
||||||
The following modifiers are recognised:
|
The following modifiers are recognised:
|
||||||
.Bl -tag -width Ds
|
.Bl -tag -width Ds
|
||||||
@ -116,9 +116,9 @@ The command should be either the name of a task from the
|
|||||||
structure in
|
structure in
|
||||||
.Pa conf.c ,
|
.Pa conf.c ,
|
||||||
or, alternatively it should be the commandline that is wished to be executed.
|
or, alternatively it should be the commandline that is wished to be executed.
|
||||||
A special case is the ``unmap'' keyword, which causes any bindings using the
|
A special case is the ``unmap'' keyword, which causes any bindings using the
|
||||||
named shortcut to be removed. This can be used to remove a binding which conflicts
|
named shortcut to be removed.
|
||||||
with an application.
|
This can be used to remove a binding which conflicts with an application.
|
||||||
.Pp
|
.Pp
|
||||||
For example, to cause
|
For example, to cause
|
||||||
.Ic C-M-r
|
.Ic C-M-r
|
||||||
|
31
font.c
31
font.c
@ -27,7 +27,7 @@ HASH_GENERATE(fonthash, fontdesc, node, fontdesc_cmp);
|
|||||||
int
|
int
|
||||||
fontdesc_cmp(struct fontdesc *a, struct fontdesc *b)
|
fontdesc_cmp(struct fontdesc *a, struct fontdesc *b)
|
||||||
{
|
{
|
||||||
return strcmp(a->name, b->name);
|
return (strcmp(a->name, b->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -35,24 +35,24 @@ fontdesc_cmp(struct fontdesc *a, struct fontdesc *b)
|
|||||||
* http://www.isthe.com/chongo/tech/comp/fnv/
|
* http://www.isthe.com/chongo/tech/comp/fnv/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define FNV_P_32 ((unsigned int)0x01000193) /* 16777619 */
|
#define FNV_P_32 ((unsigned int)0x01000193) /* 16777619 */
|
||||||
#define FNV_1_32 ((unsigned int)0x811c9dc5) /* 2166136261 */
|
#define FNV_1_32 ((unsigned int)0x811c9dc5) /* 2166136261 */
|
||||||
|
|
||||||
unsigned int
|
unsigned int
|
||||||
fontdesc_hash(struct fontdesc *fdp)
|
fontdesc_hash(struct fontdesc *fdp)
|
||||||
{
|
{
|
||||||
const unsigned char *p, *end, *start;
|
const unsigned char *p, *end, *start;
|
||||||
unsigned int hash = FNV_1_32;
|
unsigned int hash = FNV_1_32;
|
||||||
|
|
||||||
start = fdp->name;
|
start = fdp->name;
|
||||||
end = (const unsigned char *)fdp->name + strlen(fdp->name);
|
end = (const unsigned char *)fdp->name + strlen(fdp->name);
|
||||||
|
|
||||||
for (p = start; p < end; p++) {
|
for (p = start; p < end; p++) {
|
||||||
hash *= FNV_P_32;
|
hash *= FNV_P_32;
|
||||||
hash ^= (unsigned int)*p;
|
hash ^= (unsigned int)*p;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (hash);
|
return (hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -111,10 +111,10 @@ font_get(struct screen_ctx *sc, const char *name)
|
|||||||
int
|
int
|
||||||
font_width(struct fontdesc *fdp, const char *text, int len)
|
font_width(struct fontdesc *fdp, const char *text, int len)
|
||||||
{
|
{
|
||||||
XGlyphInfo extents;
|
XGlyphInfo extents;
|
||||||
XftTextExtents8(X_Dpy, fdp->fn, (const XftChar8*)text, len, &extents);
|
XftTextExtents8(X_Dpy, fdp->fn, (const XftChar8*)text, len, &extents);
|
||||||
|
|
||||||
return (extents.xOff);
|
return (extents.xOff);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -130,13 +130,13 @@ font_draw(struct fontdesc *fdp, const char *text, int len,
|
|||||||
int
|
int
|
||||||
font_ascent(struct fontdesc *fdp)
|
font_ascent(struct fontdesc *fdp)
|
||||||
{
|
{
|
||||||
return fdp->fn->ascent;
|
return (fdp->fn->ascent);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
font_descent(struct fontdesc *fdp)
|
font_descent(struct fontdesc *fdp)
|
||||||
{
|
{
|
||||||
return fdp->fn->descent;
|
return (fdp->fn->descent);
|
||||||
}
|
}
|
||||||
|
|
||||||
static XftFont *
|
static XftFont *
|
||||||
@ -156,4 +156,3 @@ _make_font(struct screen_ctx *sc, struct fontdesc *fdp)
|
|||||||
|
|
||||||
return (fn);
|
return (fn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
21
grab.c
21
grab.c
@ -83,7 +83,7 @@ grab_sweep(struct client_ctx *cc)
|
|||||||
break;
|
break;
|
||||||
case MotionNotify:
|
case MotionNotify:
|
||||||
if (_sweepcalc(cc, x0, y0, ev.xmotion.x, ev.xmotion.y))
|
if (_sweepcalc(cc, x0, y0, ev.xmotion.x, ev.xmotion.y))
|
||||||
/* Recompute window output */
|
/* Recompute window output */
|
||||||
grab_sweep_draw(cc, dx, dy);
|
grab_sweep_draw(cc, dx, dy);
|
||||||
|
|
||||||
XMoveResizeWindow(X_Dpy, cc->pwin,
|
XMoveResizeWindow(X_Dpy, cc->pwin,
|
||||||
@ -144,9 +144,9 @@ grab_drag(struct client_ctx *cc)
|
|||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MenuMask (ButtonMask|ButtonMotionMask|ExposureMask)
|
#define MenuMask (ButtonMask|ButtonMotionMask|ExposureMask)
|
||||||
#define MenuGrabMask (ButtonMask|ButtonMotionMask|StructureNotifyMask)
|
#define MenuGrabMask (ButtonMask|ButtonMotionMask|StructureNotifyMask)
|
||||||
#define AllButtonMask (Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask)
|
#define AllButtonMask (Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask)
|
||||||
|
|
||||||
void *
|
void *
|
||||||
grab_menu(XButtonEvent *e, struct menu_q *menuq)
|
grab_menu(XButtonEvent *e, struct menu_q *menuq)
|
||||||
@ -197,7 +197,7 @@ grab_menu(XButtonEvent *e, struct menu_q *menuq)
|
|||||||
XMoveResizeWindow(X_Dpy, sc->menuwin, x, y, width, tothigh);
|
XMoveResizeWindow(X_Dpy, sc->menuwin, x, y, width, tothigh);
|
||||||
XSelectInput(X_Dpy, sc->menuwin, MenuMask);
|
XSelectInput(X_Dpy, sc->menuwin, MenuMask);
|
||||||
XMapRaised(X_Dpy, sc->menuwin);
|
XMapRaised(X_Dpy, sc->menuwin);
|
||||||
|
|
||||||
if (xu_ptr_grab(sc->menuwin, MenuGrabMask, Cursor_select) < 0) {
|
if (xu_ptr_grab(sc->menuwin, MenuGrabMask, Cursor_select) < 0) {
|
||||||
XUnmapWindow(X_Dpy, sc->menuwin);
|
XUnmapWindow(X_Dpy, sc->menuwin);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
@ -207,7 +207,7 @@ grab_menu(XButtonEvent *e, struct menu_q *menuq)
|
|||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
XMaskEvent(X_Dpy, MenuMask, &event);
|
XMaskEvent(X_Dpy, MenuMask, &event);
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case Expose:
|
case Expose:
|
||||||
XClearWindow(X_Dpy, sc->menuwin);
|
XClearWindow(X_Dpy, sc->menuwin);
|
||||||
i = 0;
|
i = 0;
|
||||||
@ -237,7 +237,7 @@ grab_menu(XButtonEvent *e, struct menu_q *menuq)
|
|||||||
case ButtonRelease:
|
case ButtonRelease:
|
||||||
if (event.xbutton.button != e->button)
|
if (event.xbutton.button != e->button)
|
||||||
break;
|
break;
|
||||||
entry = menu_calc_entry(event.xbutton.x,
|
entry = menu_calc_entry(event.xbutton.x,
|
||||||
event.xbutton.y, width, height, no);
|
event.xbutton.y, width, height, no);
|
||||||
xu_ptr_ungrab();
|
xu_ptr_ungrab();
|
||||||
XUnmapWindow(X_Dpy, sc->menuwin);
|
XUnmapWindow(X_Dpy, sc->menuwin);
|
||||||
@ -247,7 +247,7 @@ grab_menu(XButtonEvent *e, struct menu_q *menuq)
|
|||||||
if (entry == i++)
|
if (entry == i++)
|
||||||
break;
|
break;
|
||||||
return (mi);
|
return (mi);
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -334,7 +334,8 @@ grab_label(struct client_ctx *cc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
case Expose:
|
case Expose:
|
||||||
snprintf(dispstr, sizeof(dispstr), "label>%s", labelstr);
|
snprintf(dispstr, sizeof(dispstr), "label>%s",
|
||||||
|
labelstr);
|
||||||
dx = font_width(font, dispstr, strlen(dispstr));
|
dx = font_width(font, dispstr, strlen(dispstr));
|
||||||
dy = fontheight;
|
dy = fontheight;
|
||||||
|
|
||||||
@ -397,5 +398,5 @@ menu_calc_entry(int x, int y, int width, int height, int noentries)
|
|||||||
entry < 0 || entry >= noentries)
|
entry < 0 || entry >= noentries)
|
||||||
entry = -1;
|
entry = -1;
|
||||||
|
|
||||||
return entry;
|
return (entry);
|
||||||
}
|
}
|
||||||
|
42
group.c
42
group.c
@ -24,18 +24,18 @@
|
|||||||
|
|
||||||
#define CALMWM_NGROUPS 9
|
#define CALMWM_NGROUPS 9
|
||||||
|
|
||||||
int Groupnamemode = 0;
|
int Groupnamemode = 0;
|
||||||
struct group_ctx *Group_active = NULL;
|
struct group_ctx *Group_active = NULL;
|
||||||
struct group_ctx Groups[CALMWM_NGROUPS];
|
struct group_ctx Groups[CALMWM_NGROUPS];
|
||||||
char Group_name[256];
|
char Group_name[256];
|
||||||
int Grouphideall = 0;
|
int Grouphideall = 0;
|
||||||
struct group_ctx_q Groupq;
|
struct group_ctx_q Groupq;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_group_add(struct group_ctx *gc, struct client_ctx *cc)
|
_group_add(struct group_ctx *gc, struct client_ctx *cc)
|
||||||
{
|
{
|
||||||
if (cc == NULL || gc == NULL)
|
if (cc == NULL || gc == NULL)
|
||||||
errx(1, "_group_add: a ctx is NULL");
|
errx(1, "_group_add: a ctx is NULL");
|
||||||
|
|
||||||
if (cc->group == gc)
|
if (cc->group == gc)
|
||||||
return;
|
return;
|
||||||
@ -51,7 +51,7 @@ static void
|
|||||||
_group_remove(struct client_ctx *cc)
|
_group_remove(struct client_ctx *cc)
|
||||||
{
|
{
|
||||||
if (cc == NULL || cc->group == NULL)
|
if (cc == NULL || cc->group == NULL)
|
||||||
errx(1, "_group_remove: a ctx is NULL");
|
errx(1, "_group_remove: a ctx is NULL");
|
||||||
|
|
||||||
TAILQ_REMOVE(&cc->group->clients, cc, group_entry);
|
TAILQ_REMOVE(&cc->group->clients, cc, group_entry);
|
||||||
cc->group = NULL;
|
cc->group = NULL;
|
||||||
@ -62,7 +62,7 @@ _group_remove(struct client_ctx *cc)
|
|||||||
static void
|
static void
|
||||||
_group_hide(struct group_ctx *gc)
|
_group_hide(struct group_ctx *gc)
|
||||||
{
|
{
|
||||||
struct client_ctx *cc;
|
struct client_ctx *cc;
|
||||||
|
|
||||||
screen_updatestackingorder();
|
screen_updatestackingorder();
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ _group_show(struct group_ctx *gc)
|
|||||||
void
|
void
|
||||||
group_init(void)
|
group_init(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
TAILQ_INIT(&Groupq);
|
TAILQ_INIT(&Groupq);
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ group_sticky_toggle_exit(struct client_ctx *cc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* selection list display
|
* selection list display
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* if group_hidetoggle would produce no effect, toggle the group's hidden state
|
/* if group_hidetoggle would produce no effect, toggle the group's hidden state
|
||||||
@ -166,7 +166,7 @@ group_sticky_toggle_exit(struct client_ctx *cc)
|
|||||||
void
|
void
|
||||||
_group_fix_hidden_state(struct group_ctx *gc)
|
_group_fix_hidden_state(struct group_ctx *gc)
|
||||||
{
|
{
|
||||||
struct client_ctx *cc;
|
struct client_ctx *cc;
|
||||||
int same = 0;
|
int same = 0;
|
||||||
|
|
||||||
TAILQ_FOREACH(cc, &gc->clients, group_entry) {
|
TAILQ_FOREACH(cc, &gc->clients, group_entry) {
|
||||||
@ -252,7 +252,7 @@ void
|
|||||||
group_client_delete(struct client_ctx *cc)
|
group_client_delete(struct client_ctx *cc)
|
||||||
{
|
{
|
||||||
if (cc->group == NULL)
|
if (cc->group == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
TAILQ_REMOVE(&cc->group->clients, cc, group_entry);
|
TAILQ_REMOVE(&cc->group->clients, cc, group_entry);
|
||||||
cc->group = NULL; /* he he */
|
cc->group = NULL; /* he he */
|
||||||
@ -261,10 +261,10 @@ group_client_delete(struct client_ctx *cc)
|
|||||||
void
|
void
|
||||||
group_menu(XButtonEvent *e)
|
group_menu(XButtonEvent *e)
|
||||||
{
|
{
|
||||||
struct menu_q menuq;
|
struct menu_q menuq;
|
||||||
struct menu *mi;
|
struct menu *mi;
|
||||||
int i;
|
int i;
|
||||||
struct group_ctx *gc;
|
struct group_ctx *gc;
|
||||||
|
|
||||||
TAILQ_INIT(&menuq);
|
TAILQ_INIT(&menuq);
|
||||||
|
|
||||||
@ -280,10 +280,10 @@ group_menu(XButtonEvent *e)
|
|||||||
XCALLOC(mi, struct menu);
|
XCALLOC(mi, struct menu);
|
||||||
if (gc->hidden)
|
if (gc->hidden)
|
||||||
snprintf(mi->text, sizeof(mi->text), "%d: [%s]",
|
snprintf(mi->text, sizeof(mi->text), "%d: [%s]",
|
||||||
gc->shortcut, gc->name);
|
gc->shortcut, gc->name);
|
||||||
else
|
else
|
||||||
snprintf(mi->text, sizeof(mi->text), "%d: %s",
|
snprintf(mi->text, sizeof(mi->text), "%d: %s",
|
||||||
gc->shortcut, gc->name);
|
gc->shortcut, gc->name);
|
||||||
mi->ctx = gc;
|
mi->ctx = gc;
|
||||||
TAILQ_INSERT_TAIL(&menuq, mi, entry);
|
TAILQ_INSERT_TAIL(&menuq, mi, entry);
|
||||||
}
|
}
|
||||||
@ -315,11 +315,11 @@ group_alltoggle(void)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i=0; i < CALMWM_NGROUPS; i++) {
|
for (i = 0; i < CALMWM_NGROUPS; i++) {
|
||||||
if (Grouphideall)
|
if (Grouphideall)
|
||||||
_group_show(&Groups[i]);
|
_group_show(&Groups[i]);
|
||||||
else
|
else
|
||||||
_group_hide(&Groups[i]);
|
_group_hide(&Groups[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Grouphideall)
|
if (Grouphideall)
|
||||||
|
6
hash.h
6
hash.h
@ -21,9 +21,9 @@
|
|||||||
|
|
||||||
#include <sys/tree.h>
|
#include <sys/tree.h>
|
||||||
|
|
||||||
#define HASH_ENTRY SPLAY_ENTRY
|
#define HASH_ENTRY SPLAY_ENTRY
|
||||||
|
|
||||||
#define HASH_HEAD(name, type, nbuckets) \
|
#define HASH_HEAD(name, type, nbuckets) \
|
||||||
SPLAY_HEAD(name##_HASH_TREE, type); \
|
SPLAY_HEAD(name##_HASH_TREE, type); \
|
||||||
struct name { \
|
struct name { \
|
||||||
struct name##_HASH_TREE buckets[nbuckets]; \
|
struct name##_HASH_TREE buckets[nbuckets]; \
|
||||||
@ -52,7 +52,7 @@ struct type *name##_HASH_TREE_FIND(struct name *head, struct type *find) \
|
|||||||
{ \
|
{ \
|
||||||
struct name##_HASH_TREE *bucket = \
|
struct name##_HASH_TREE *bucket = \
|
||||||
&head->buckets[(*head->hashfn)(find) % HASH_NBUCKETS(head)]; \
|
&head->buckets[(*head->hashfn)(find) % HASH_NBUCKETS(head)]; \
|
||||||
return SPLAY_FIND(name##_HASH_TREE, bucket, find); \
|
return (SPLAY_FIND(name##_HASH_TREE, bucket, find)); \
|
||||||
} \
|
} \
|
||||||
void name##_HASH_TREE_INSERT(struct name *head, struct type *insert) \
|
void name##_HASH_TREE_INSERT(struct name *head, struct type *insert) \
|
||||||
{ \
|
{ \
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
|
|
||||||
#include <X11/cursorfont.h>
|
#include <X11/cursorfont.h>
|
||||||
#include <X11/extensions/shape.h>
|
#include <X11/extensions/shape.h>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/Xutil.h>
|
#include <X11/Xutil.h>
|
||||||
#include <X11/keysym.h>
|
#include <X11/keysym.h>
|
||||||
#include <X11/Xatom.h>
|
#include <X11/Xatom.h>
|
||||||
|
40
kbfunc.c
40
kbfunc.c
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* calmwm - the calm window manager
|
* calmwm - the calm window manager
|
||||||
*
|
*
|
||||||
* Copyright (c) 2004 Martin Murray <mmurray@monkey.org>
|
* Copyright (c) 2004 Martin Murray <mmurray@monkey.org>
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and distribute this software for any
|
* Permission to use, copy, modify, and distribute this software for any
|
||||||
@ -23,11 +23,11 @@
|
|||||||
#include "headers.h"
|
#include "headers.h"
|
||||||
#include "calmwm.h"
|
#include "calmwm.h"
|
||||||
|
|
||||||
#define KNOWN_HOSTS ".ssh/known_hosts"
|
#define KNOWN_HOSTS ".ssh/known_hosts"
|
||||||
#define HASH_MARKER "|1|"
|
#define HASH_MARKER "|1|"
|
||||||
#define MOVE_AMOUNT 1
|
#define MOVE_AMOUNT 1
|
||||||
|
|
||||||
extern int _xev_quit;
|
extern int _xev_quit;
|
||||||
|
|
||||||
void
|
void
|
||||||
kbfunc_client_lower(struct client_ctx *cc, void *arg)
|
kbfunc_client_lower(struct client_ctx *cc, void *arg)
|
||||||
@ -57,11 +57,11 @@ kbfunc_client_move(struct client_ctx *cc, void *arg)
|
|||||||
amt = amt*10;
|
amt = amt*10;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(flags) {
|
switch (flags) {
|
||||||
case CWM_UP:
|
case CWM_UP:
|
||||||
my -= amt;
|
my -= amt;
|
||||||
break;
|
break;
|
||||||
case CWM_DOWN:
|
case CWM_DOWN:
|
||||||
my += amt;
|
my += amt;
|
||||||
break;
|
break;
|
||||||
case CWM_RIGHT:
|
case CWM_RIGHT:
|
||||||
@ -97,11 +97,11 @@ kbfunc_client_resize(struct client_ctx *cc, void *arg)
|
|||||||
amt = amt*10;
|
amt = amt*10;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(flags) {
|
switch (flags) {
|
||||||
case CWM_UP:
|
case CWM_UP:
|
||||||
my -= amt;
|
my -= amt;
|
||||||
break;
|
break;
|
||||||
case CWM_DOWN:
|
case CWM_DOWN:
|
||||||
my += amt;
|
my += amt;
|
||||||
break;
|
break;
|
||||||
case CWM_RIGHT:
|
case CWM_RIGHT:
|
||||||
@ -139,11 +139,11 @@ kbfunc_ptrmove(struct client_ctx *cc, void *arg)
|
|||||||
flags -= CWM_BIGMOVE;
|
flags -= CWM_BIGMOVE;
|
||||||
amt = amt * 10;
|
amt = amt * 10;
|
||||||
}
|
}
|
||||||
switch(flags) {
|
switch (flags) {
|
||||||
case CWM_UP:
|
case CWM_UP:
|
||||||
my -= amt;
|
my -= amt;
|
||||||
break;
|
break;
|
||||||
case CWM_DOWN:
|
case CWM_DOWN:
|
||||||
my += amt;
|
my += amt;
|
||||||
break;
|
break;
|
||||||
case CWM_RIGHT:
|
case CWM_RIGHT:
|
||||||
@ -167,11 +167,11 @@ void
|
|||||||
kbfunc_client_search(struct client_ctx *scratch, void *arg)
|
kbfunc_client_search(struct client_ctx *scratch, void *arg)
|
||||||
{
|
{
|
||||||
struct menu_q menuq;
|
struct menu_q menuq;
|
||||||
struct client_ctx *cc, *old_cc = client_current();
|
struct client_ctx *cc, *old_cc = client_current();
|
||||||
struct menu *mi;
|
struct menu *mi;
|
||||||
|
|
||||||
TAILQ_INIT(&menuq);
|
TAILQ_INIT(&menuq);
|
||||||
|
|
||||||
TAILQ_FOREACH(cc, &Clientq, entry) {
|
TAILQ_FOREACH(cc, &Clientq, entry) {
|
||||||
XCALLOC(mi, struct menu);
|
XCALLOC(mi, struct menu);
|
||||||
strlcpy(mi->text, cc->name, sizeof(mi->text));
|
strlcpy(mi->text, cc->name, sizeof(mi->text));
|
||||||
@ -180,8 +180,8 @@ kbfunc_client_search(struct client_ctx *scratch, void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((mi = search_start(&menuq,
|
if ((mi = search_start(&menuq,
|
||||||
search_match_client, search_print_client,
|
search_match_client, search_print_client,
|
||||||
"window", 0)) != NULL) {
|
"window", 0)) != NULL) {
|
||||||
cc = (struct client_ctx *)mi->ctx;
|
cc = (struct client_ctx *)mi->ctx;
|
||||||
if (cc->flags & CLIENT_HIDDEN)
|
if (cc->flags & CLIENT_HIDDEN)
|
||||||
client_unhide(cc);
|
client_unhide(cc);
|
||||||
@ -215,7 +215,7 @@ kbfunc_menu_search(struct client_ctx *scratch, void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((mi = search_start(&menuq,
|
if ((mi = search_start(&menuq,
|
||||||
search_match_text, NULL, "application", 0)) != NULL)
|
search_match_text, NULL, "application", 0)) != NULL)
|
||||||
u_spawn(((struct cmd *)mi->ctx)->image);
|
u_spawn(((struct cmd *)mi->ctx)->image);
|
||||||
|
|
||||||
while ((mi = TAILQ_FIRST(&menuq)) != NULL) {
|
while ((mi = TAILQ_FIRST(&menuq)) != NULL) {
|
||||||
@ -278,7 +278,7 @@ kbfunc_exec(struct client_ctx *scratch, void *arg)
|
|||||||
char *label;
|
char *label;
|
||||||
|
|
||||||
int cmd = (int)arg;
|
int cmd = (int)arg;
|
||||||
switch(cmd) {
|
switch (cmd) {
|
||||||
case CWM_EXEC_PROGRAM:
|
case CWM_EXEC_PROGRAM:
|
||||||
label = "exec";
|
label = "exec";
|
||||||
break;
|
break;
|
||||||
@ -353,7 +353,7 @@ kbfunc_exec(struct client_ctx *scratch, void *arg)
|
|||||||
xfree(path);
|
xfree(path);
|
||||||
|
|
||||||
if ((mi = search_start(&menuq,
|
if ((mi = search_start(&menuq,
|
||||||
search_match_exec, NULL, label, 1)) != NULL) {
|
search_match_exec, NULL, label, 1)) != NULL) {
|
||||||
switch (cmd) {
|
switch (cmd) {
|
||||||
case CWM_EXEC_PROGRAM:
|
case CWM_EXEC_PROGRAM:
|
||||||
u_spawn(mi->text);
|
u_spawn(mi->text);
|
||||||
@ -427,7 +427,7 @@ kbfunc_ssh(struct client_ctx *scratch, void *arg)
|
|||||||
|
|
||||||
|
|
||||||
if ((mi = search_start(&menuq,
|
if ((mi = search_start(&menuq,
|
||||||
search_match_exec, NULL, "ssh", 1)) != NULL) {
|
search_match_exec, NULL, "ssh", 1)) != NULL) {
|
||||||
conf_reload(&Conf);
|
conf_reload(&Conf);
|
||||||
l = snprintf(cmd, sizeof(cmd), "%s -e ssh %s", Conf.termpath,
|
l = snprintf(cmd, sizeof(cmd), "%s -e ssh %s", Conf.termpath,
|
||||||
mi->text);
|
mi->text);
|
||||||
|
47
parse.y
47
parse.y
@ -40,16 +40,17 @@ static struct file {
|
|||||||
int lineno;
|
int lineno;
|
||||||
int errors;
|
int errors;
|
||||||
} *file;
|
} *file;
|
||||||
struct file *pushfile(const char *);
|
|
||||||
int popfile(void);
|
struct file *pushfile(const char *);
|
||||||
int yyparse(void);
|
int popfile(void);
|
||||||
int yylex(void);
|
int yyparse(void);
|
||||||
int yyerror(const char *, ...);
|
int yylex(void);
|
||||||
int kw_cmp(const void *, const void *);
|
int yyerror(const char *, ...);
|
||||||
int lookup(char *);
|
int kw_cmp(const void *, const void *);
|
||||||
int lgetc(int);
|
int lookup(char *);
|
||||||
int lungetc(int);
|
int lgetc(int);
|
||||||
int findeol(void);
|
int lungetc(int);
|
||||||
|
int findeol(void);
|
||||||
|
|
||||||
static struct conf *conf;
|
static struct conf *conf;
|
||||||
|
|
||||||
@ -97,7 +98,7 @@ string : string STRING {
|
|||||||
yesno : YES { $$ = 1; }
|
yesno : YES { $$ = 1; }
|
||||||
| NO { $$ = 0; }
|
| NO { $$ = 0; }
|
||||||
;
|
;
|
||||||
|
|
||||||
main : FONTNAME STRING {
|
main : FONTNAME STRING {
|
||||||
if (conf->DefaultFontName != NULL &&
|
if (conf->DefaultFontName != NULL &&
|
||||||
conf->DefaultFontName != DEFAULTFONTNAME)
|
conf->DefaultFontName != DEFAULTFONTNAME)
|
||||||
@ -178,9 +179,9 @@ struct keywords {
|
|||||||
int
|
int
|
||||||
yyerror(const char *fmt, ...)
|
yyerror(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
file->errors++;
|
file->errors++;
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
fprintf(stderr, "%s:%d: ", file->name, yylval.lineno);
|
fprintf(stderr, "%s:%d: ", file->name, yylval.lineno);
|
||||||
vfprintf(stderr, fmt, ap);
|
vfprintf(stderr, fmt, ap);
|
||||||
@ -548,36 +549,42 @@ parse_config(const char *filename, struct conf *xconf)
|
|||||||
|
|
||||||
xconf->flags = conf->flags;
|
xconf->flags = conf->flags;
|
||||||
|
|
||||||
for (cmd = TAILQ_FIRST(&conf->cmdq); cmd != NULL; cmd = cmdnext) {
|
for (cmd = TAILQ_FIRST(&conf->cmdq); cmd != NULL;
|
||||||
|
cmd = cmdnext) {
|
||||||
cmdnext = TAILQ_NEXT(cmd, entry);
|
cmdnext = TAILQ_NEXT(cmd, entry);
|
||||||
|
|
||||||
TAILQ_REMOVE(&conf->cmdq, cmd, entry);
|
TAILQ_REMOVE(&conf->cmdq, cmd, entry);
|
||||||
TAILQ_INSERT_TAIL(&xconf->cmdq, cmd, entry);
|
TAILQ_INSERT_TAIL(&xconf->cmdq, cmd, entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (kb = TAILQ_FIRST(&conf->keybindingq); kb != NULL; kb = kbnext) {
|
for (kb = TAILQ_FIRST(&conf->keybindingq); kb != NULL;
|
||||||
|
kb = kbnext) {
|
||||||
kbnext = TAILQ_NEXT(kb, entry);
|
kbnext = TAILQ_NEXT(kb, entry);
|
||||||
|
|
||||||
TAILQ_REMOVE(&conf->keybindingq, kb, entry);
|
TAILQ_REMOVE(&conf->keybindingq, kb, entry);
|
||||||
TAILQ_INSERT_TAIL(&xconf->keybindingq, kb, entry);
|
TAILQ_INSERT_TAIL(&xconf->keybindingq, kb, entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (ag = TAILQ_FIRST(&conf->autogroupq); ag != NULL; ag = agnext) {
|
for (ag = TAILQ_FIRST(&conf->autogroupq); ag != NULL;
|
||||||
|
ag = agnext) {
|
||||||
agnext = TAILQ_NEXT(ag, entry);
|
agnext = TAILQ_NEXT(ag, entry);
|
||||||
|
|
||||||
TAILQ_REMOVE(&conf->autogroupq, ag, entry);
|
TAILQ_REMOVE(&conf->autogroupq, ag, entry);
|
||||||
TAILQ_INSERT_TAIL(&xconf->autogroupq, ag, entry);
|
TAILQ_INSERT_TAIL(&xconf->autogroupq, ag, entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (wm = TAILQ_FIRST(&conf->ignoreq); wm != NULL; wm = wmnext) {
|
for (wm = TAILQ_FIRST(&conf->ignoreq); wm != NULL;
|
||||||
|
wm = wmnext) {
|
||||||
wmnext = TAILQ_NEXT(wm, entry);
|
wmnext = TAILQ_NEXT(wm, entry);
|
||||||
|
|
||||||
TAILQ_REMOVE(&conf->ignoreq, wm, entry);
|
TAILQ_REMOVE(&conf->ignoreq, wm, entry);
|
||||||
TAILQ_INSERT_TAIL(&xconf->ignoreq, wm, entry);
|
TAILQ_INSERT_TAIL(&xconf->ignoreq, wm, entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
strlcpy(xconf->termpath, conf->termpath, sizeof(xconf->termpath));
|
strlcpy(xconf->termpath, conf->termpath,
|
||||||
strlcpy(xconf->lockpath, conf->lockpath, sizeof(xconf->lockpath));
|
sizeof(xconf->termpath));
|
||||||
|
strlcpy(xconf->lockpath, conf->lockpath,
|
||||||
|
sizeof(xconf->lockpath));
|
||||||
|
|
||||||
xconf->DefaultFontName = conf->DefaultFontName;
|
xconf->DefaultFontName = conf->DefaultFontName;
|
||||||
|
|
||||||
|
5
screen.c
5
screen.c
@ -21,8 +21,8 @@
|
|||||||
#include "headers.h"
|
#include "headers.h"
|
||||||
#include "calmwm.h"
|
#include "calmwm.h"
|
||||||
|
|
||||||
extern struct screen_ctx_q Screenq;
|
extern struct screen_ctx_q Screenq;
|
||||||
extern struct screen_ctx *Curscreen;
|
extern struct screen_ctx *Curscreen;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_clearwindow_cb(int sig)
|
_clearwindow_cb(int sig)
|
||||||
@ -76,7 +76,6 @@ screen_updatestackingorder(void)
|
|||||||
void
|
void
|
||||||
screen_init(void)
|
screen_init(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
struct screen_ctx *sc = screen_current();
|
struct screen_ctx *sc = screen_current();
|
||||||
|
|
||||||
sc->cycle_client = NULL;
|
sc->cycle_client = NULL;
|
||||||
|
16
search.c
16
search.c
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
#define SearchMask (KeyPressMask|ExposureMask)
|
#define SearchMask (KeyPressMask|ExposureMask)
|
||||||
|
|
||||||
static int _strsubmatch(char *, char *, int);
|
static int _strsubmatch(char *, char *, int);
|
||||||
|
|
||||||
void
|
void
|
||||||
search_init(struct screen_ctx *sc)
|
search_init(struct screen_ctx *sc)
|
||||||
@ -39,7 +39,7 @@ search_init(struct screen_ctx *sc)
|
|||||||
|
|
||||||
struct menu *
|
struct menu *
|
||||||
search_start(struct menu_q *menuq,
|
search_start(struct menu_q *menuq,
|
||||||
void (*match)(struct menu_q *, struct menu_q *, char *),
|
void (*match)(struct menu_q *, struct menu_q *, char *),
|
||||||
void (*print)(struct menu *mi, int print),
|
void (*print)(struct menu *mi, int print),
|
||||||
char *prompt, int dummy)
|
char *prompt, int dummy)
|
||||||
{
|
{
|
||||||
@ -320,16 +320,16 @@ search_match_client(struct menu_q *menuq, struct menu_q *resultq, char *search)
|
|||||||
if (cc->label != NULL && _strsubmatch(search, cc->label, 0)) {
|
if (cc->label != NULL && _strsubmatch(search, cc->label, 0)) {
|
||||||
cc->matchname = cc->label;
|
cc->matchname = cc->label;
|
||||||
tier = 0;
|
tier = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Then, on window names. */
|
/* Then, on window names. */
|
||||||
if (tier < 0) {
|
if (tier < 0) {
|
||||||
TAILQ_FOREACH_REVERSE(wn, &cc->nameq, winname_q, entry)
|
TAILQ_FOREACH_REVERSE(wn, &cc->nameq, winname_q, entry)
|
||||||
if (_strsubmatch(search, wn->name, 0)) {
|
if (_strsubmatch(search, wn->name, 0)) {
|
||||||
cc->matchname = wn->name;
|
cc->matchname = wn->name;
|
||||||
tier = 2;
|
tier = 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
38
util.c
38
util.c
@ -65,28 +65,30 @@ exec_wm(char *argstr)
|
|||||||
warn(args[0]);
|
warn(args[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
int dirent_isdir(char *filename) {
|
int
|
||||||
struct stat buffer;
|
dirent_isdir(char *filename)
|
||||||
int return_value;
|
{
|
||||||
|
struct stat buffer;
|
||||||
|
int return_value;
|
||||||
|
|
||||||
return_value = stat(filename, &buffer);
|
return_value = stat(filename, &buffer);
|
||||||
|
|
||||||
if(return_value == -1)
|
if (return_value == -1)
|
||||||
return 0;
|
return (0);
|
||||||
else
|
else
|
||||||
return S_ISDIR(buffer.st_mode);
|
return (S_ISDIR(buffer.st_mode));
|
||||||
}
|
}
|
||||||
|
|
||||||
int dirent_islink(char *filename) {
|
int
|
||||||
struct stat buffer;
|
dirent_islink(char *filename)
|
||||||
int return_value;
|
{
|
||||||
|
struct stat buffer;
|
||||||
|
int return_value;
|
||||||
|
|
||||||
return_value = lstat(filename, &buffer);
|
return_value = lstat(filename, &buffer);
|
||||||
|
|
||||||
if(return_value == -1)
|
if (return_value == -1)
|
||||||
return 0;
|
return (0);
|
||||||
else
|
else
|
||||||
return S_ISLNK(buffer.st_mode);
|
return (S_ISLNK(buffer.st_mode));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
39
xevents.c
39
xevents.c
@ -46,13 +46,12 @@ xev_handle_maprequest(struct xevent *xev, XEvent *ee)
|
|||||||
if (old_cc != NULL)
|
if (old_cc != NULL)
|
||||||
client_ptrsave(old_cc);
|
client_ptrsave(old_cc);
|
||||||
|
|
||||||
if ((cc = client_find(e->window)) == NULL) {
|
if ((cc = client_find(e->window)) == NULL) {
|
||||||
XGetWindowAttributes(X_Dpy, e->window, &xattr);
|
XGetWindowAttributes(X_Dpy, e->window, &xattr);
|
||||||
cc = client_new(e->window, screen_fromroot(xattr.root), 1);
|
cc = client_new(e->window, screen_fromroot(xattr.root), 1);
|
||||||
sc = CCTOSC(cc);
|
sc = CCTOSC(cc);
|
||||||
} else {
|
} else
|
||||||
cc->beepbeep = 1;
|
cc->beepbeep = 1;
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef notyet /* XXX - possibly, we shouldn't map if
|
#ifdef notyet /* XXX - possibly, we shouldn't map if
|
||||||
* the window is withdrawn. */
|
* the window is withdrawn. */
|
||||||
@ -80,7 +79,7 @@ xev_handle_unmapnotify(struct xevent *xev, XEvent *ee)
|
|||||||
#ifdef notyet
|
#ifdef notyet
|
||||||
/* XXX disable the ptrwarp until we handle it
|
/* XXX disable the ptrwarp until we handle it
|
||||||
* better. */
|
* better. */
|
||||||
if (!client_delete(cc, e->send_event, 0) && wascurrent)
|
if (!client_delete(cc, e->send_event, 0) && wascurrent)
|
||||||
;/* client_ptrwarp(new_cc); */
|
;/* client_ptrwarp(new_cc); */
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -121,13 +120,13 @@ xev_handle_configurerequest(struct xevent *xev, XEvent *ee)
|
|||||||
if (e->value_mask & CWY)
|
if (e->value_mask & CWY)
|
||||||
cc->geom.y = e->y;
|
cc->geom.y = e->y;
|
||||||
|
|
||||||
if (cc->geom.x == 0 &&
|
if (cc->geom.x == 0 &&
|
||||||
cc->geom.width >= DisplayWidth(X_Dpy, sc->which))
|
cc->geom.width >= DisplayWidth(X_Dpy, sc->which))
|
||||||
cc->geom.x -= cc->bwidth;
|
cc->geom.x -= cc->bwidth;
|
||||||
|
|
||||||
if (cc->geom.y == 0 &&
|
if (cc->geom.y == 0 &&
|
||||||
cc->geom.height >= DisplayHeight(X_Dpy, sc->which))
|
cc->geom.height >= DisplayHeight(X_Dpy, sc->which))
|
||||||
cc->geom.y -= cc->bwidth;
|
cc->geom.y -= cc->bwidth;
|
||||||
|
|
||||||
client_gravitate(cc, 1);
|
client_gravitate(cc, 1);
|
||||||
|
|
||||||
@ -164,7 +163,7 @@ xev_handle_propertynotify(struct xevent *xev, XEvent *ee)
|
|||||||
long tmp;
|
long tmp;
|
||||||
|
|
||||||
if ((cc = client_find(e->window)) != NULL) {
|
if ((cc = client_find(e->window)) != NULL) {
|
||||||
switch(e->atom) {
|
switch (e->atom) {
|
||||||
case XA_WM_NORMAL_HINTS:
|
case XA_WM_NORMAL_HINTS:
|
||||||
XGetWMNormalHints(X_Dpy, cc->win, cc->size, &tmp);
|
XGetWMNormalHints(X_Dpy, cc->win, cc->size, &tmp);
|
||||||
break;
|
break;
|
||||||
@ -260,7 +259,7 @@ xev_handle_buttonpress(struct xevent *xev, XEvent *ee)
|
|||||||
if (cc->label != NULL)
|
if (cc->label != NULL)
|
||||||
wname = cc->label;
|
wname = cc->label;
|
||||||
else
|
else
|
||||||
wname = cc->name;
|
wname = cc->name;
|
||||||
|
|
||||||
if (wname == NULL)
|
if (wname == NULL)
|
||||||
continue;
|
continue;
|
||||||
@ -370,8 +369,8 @@ xev_handle_keypress(struct xevent *xev, XEvent *ee)
|
|||||||
|
|
||||||
keysym = XKeycodeToKeysym(X_Dpy, e->keycode, 0);
|
keysym = XKeycodeToKeysym(X_Dpy, e->keycode, 0);
|
||||||
skeysym = XKeycodeToKeysym(X_Dpy, e->keycode, 1);
|
skeysym = XKeycodeToKeysym(X_Dpy, e->keycode, 1);
|
||||||
|
|
||||||
TAILQ_FOREACH(kb, &Conf.keybindingq, entry) {
|
TAILQ_FOREACH(kb, &Conf.keybindingq, entry) {
|
||||||
if (keysym != kb->keysym && skeysym == kb->keysym)
|
if (keysym != kb->keysym && skeysym == kb->keysym)
|
||||||
modshift = ShiftMask;
|
modshift = ShiftMask;
|
||||||
else
|
else
|
||||||
@ -381,15 +380,15 @@ xev_handle_keypress(struct xevent *xev, XEvent *ee)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ((kb->keycode != 0 && kb->keysym == NoSymbol &&
|
if ((kb->keycode != 0 && kb->keysym == NoSymbol &&
|
||||||
kb->keycode == e->keycode) || kb->keysym ==
|
kb->keycode == e->keycode) || kb->keysym ==
|
||||||
(modshift == 0 ? keysym : skeysym))
|
(modshift == 0 ? keysym : skeysym))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (kb == NULL)
|
if (kb == NULL)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
if ((kb->flags & (KBFLAG_NEEDCLIENT)) &&
|
if ((kb->flags & (KBFLAG_NEEDCLIENT)) &&
|
||||||
(cc = client_find(e->window)) == NULL &&
|
(cc = client_find(e->window)) == NULL &&
|
||||||
(cc = client_current()) == NULL)
|
(cc = client_current()) == NULL)
|
||||||
if (kb->flags & KBFLAG_NEEDCLIENT)
|
if (kb->flags & KBFLAG_NEEDCLIENT)
|
||||||
@ -416,7 +415,7 @@ xev_handle_keyrelease(struct xevent *xev, XEvent *ee)
|
|||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
sc->altpersist = 0;
|
sc->altpersist = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XXX - better interface... xevents should not know about
|
* XXX - better interface... xevents should not know about
|
||||||
* how/when to mtf.
|
* how/when to mtf.
|
||||||
@ -449,9 +448,9 @@ out:
|
|||||||
* X Event handling
|
* X Event handling
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static struct xevent_q _xevq, _xevq_putaway;
|
static struct xevent_q _xevq, _xevq_putaway;
|
||||||
static short _xev_q_lock = 0;
|
static short _xev_q_lock = 0;
|
||||||
volatile sig_atomic_t _xev_quit = 0;
|
volatile sig_atomic_t _xev_quit = 0;
|
||||||
|
|
||||||
void
|
void
|
||||||
xev_init(void)
|
xev_init(void)
|
||||||
@ -529,7 +528,7 @@ xev_loop(void)
|
|||||||
#ifdef DIAGNOSTIC
|
#ifdef DIAGNOSTIC
|
||||||
if (TAILQ_EMPTY(&_xevq))
|
if (TAILQ_EMPTY(&_xevq))
|
||||||
errx(1, "X event queue empty");
|
errx(1, "X event queue empty");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
XNextEvent(X_Dpy, &e);
|
XNextEvent(X_Dpy, &e);
|
||||||
type = e.type;
|
type = e.type;
|
||||||
|
6
xutil.c
6
xutil.c
@ -45,7 +45,7 @@ xu_ptr_ungrab(void)
|
|||||||
int
|
int
|
||||||
xu_btn_grab(Window win, int mask, u_int btn)
|
xu_btn_grab(Window win, int mask, u_int btn)
|
||||||
{
|
{
|
||||||
return (XGrabButton(X_Dpy, btn, mask, win,
|
return (XGrabButton(X_Dpy, btn, mask, win,
|
||||||
False, ButtonMask, GrabModeAsync,
|
False, ButtonMask, GrabModeAsync,
|
||||||
GrabModeSync, None, None) == GrabSuccess ? 0 : -1);
|
GrabModeSync, None, None) == GrabSuccess ? 0 : -1);
|
||||||
}
|
}
|
||||||
@ -63,7 +63,7 @@ xu_ptr_getpos(Window rootwin, int *x, int *y)
|
|||||||
u_int tmp2;
|
u_int tmp2;
|
||||||
Window w0, w1;
|
Window w0, w1;
|
||||||
|
|
||||||
XQueryPointer(X_Dpy, rootwin, &w0, &w1, &tmp0, &tmp1, x, y, &tmp2);
|
XQueryPointer(X_Dpy, rootwin, &w0, &w1, &tmp0, &tmp1, x, y, &tmp2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -82,7 +82,7 @@ xu_key_grab(Window win, int mask, int keysym)
|
|||||||
(XKeycodeToKeysym(X_Dpy, code, 1) == keysym))
|
(XKeycodeToKeysym(X_Dpy, code, 1) == keysym))
|
||||||
mask |= ShiftMask;
|
mask |= ShiftMask;
|
||||||
|
|
||||||
XGrabKey(X_Dpy, XKeysymToKeycode(X_Dpy, keysym), mask, win, True,
|
XGrabKey(X_Dpy, XKeysymToKeycode(X_Dpy, keysym), mask, win, True,
|
||||||
GrabModeAsync, GrabModeAsync);
|
GrabModeAsync, GrabModeAsync);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user