event system works, some code arranging
This commit is contained in:
parent
aa5f91e0d5
commit
2f2e21c0bb
21
config.def.h
21
config.def.h
@ -35,7 +35,6 @@ static const char normbgcolor[] = "#202020";
|
|||||||
static const char normfgcolor[] = "#c0c0c0";
|
static const char normfgcolor[] = "#c0c0c0";
|
||||||
static const char selbgcolor[] = "#884400";
|
static const char selbgcolor[] = "#884400";
|
||||||
static const char selfgcolor[] = "#f0f0f0";
|
static const char selfgcolor[] = "#f0f0f0";
|
||||||
|
|
||||||
static const char *surfexec[] = { "surf", "-x" };
|
static const char *surfexec[] = { "surf", "-x" };
|
||||||
|
|
||||||
#define MODKEY ControlMask
|
#define MODKEY ControlMask
|
||||||
@ -45,15 +44,15 @@ Key keys[] = { \
|
|||||||
{ MODKEY, XK_t, newtab, { 0 } },
|
{ MODKEY, XK_t, newtab, { 0 } },
|
||||||
{ MODKEY|ShiftMask, XK_l, rotate, { .i = +1 } },
|
{ MODKEY|ShiftMask, XK_l, rotate, { .i = +1 } },
|
||||||
{ MODKEY|ShiftMask, XK_h, rotate, { .i = -1 } },
|
{ MODKEY|ShiftMask, XK_h, rotate, { .i = -1 } },
|
||||||
{ MODKEY|ShiftMask, XK_1, move, { .i = 1 } },
|
{ MODKEY, XK_1, move, { .i = 1 } },
|
||||||
{ MODKEY|ShiftMask, XK_2, move, { .i = 2 } },
|
{ MODKEY, XK_2, move, { .i = 2 } },
|
||||||
{ MODKEY|ShiftMask, XK_3, move, { .i = 3 } },
|
{ MODKEY, XK_3, move, { .i = 3 } },
|
||||||
{ MODKEY|ShiftMask, XK_4, move, { .i = 4 } },
|
{ MODKEY, XK_4, move, { .i = 4 } },
|
||||||
{ MODKEY|ShiftMask, XK_5, move, { .i = 5 } },
|
{ MODKEY, XK_5, move, { .i = 5 } },
|
||||||
{ MODKEY|ShiftMask, XK_6, move, { .i = 6 } },
|
{ MODKEY, XK_6, move, { .i = 6 } },
|
||||||
{ MODKEY|ShiftMask, XK_7, move, { .i = 7 } },
|
{ MODKEY, XK_7, move, { .i = 7 } },
|
||||||
{ MODKEY|ShiftMask, XK_8, move, { .i = 8 } },
|
{ MODKEY, XK_8, move, { .i = 8 } },
|
||||||
{ MODKEY|ShiftMask, XK_9, move, { .i = 9 } },
|
{ MODKEY, XK_9, move, { .i = 9 } },
|
||||||
{ MODKEY|ShiftMask, XK_0, move, { .i = 0 } },
|
{ MODKEY, XK_0, move, { .i = 10 } },
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
21
tabbed.c
21
tabbed.c
@ -17,7 +17,7 @@
|
|||||||
/* macros */
|
/* macros */
|
||||||
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
#define MAX(a, b) ((a) > (b) ? (a) : (b))
|
||||||
#define LENGTH(x) (sizeof x / sizeof x[0])
|
#define LENGTH(x) (sizeof x / sizeof x[0])
|
||||||
#define CLEANMASK(mask) (mask & ~(numlockmask|LockMask))
|
#define CLEANMASK(mask) (mask & ~(numlockmask|LockMask))
|
||||||
|
|
||||||
enum { ColFG, ColBG, ColLast }; /* color */
|
enum { ColFG, ColBG, ColLast }; /* color */
|
||||||
|
|
||||||
@ -50,12 +50,16 @@ typedef struct {
|
|||||||
} font;
|
} font;
|
||||||
} DC; /* draw context */
|
} DC; /* draw context */
|
||||||
|
|
||||||
typedef struct Client Client;
|
typedef struct Client {
|
||||||
struct Client {
|
|
||||||
char name[256];
|
char name[256];
|
||||||
struct Client *next;
|
struct Client *next;
|
||||||
Window win;
|
Window win;
|
||||||
};
|
} Client;
|
||||||
|
|
||||||
|
typedef struct Listener {
|
||||||
|
int fd;
|
||||||
|
struct Listener *next;
|
||||||
|
} Listener;
|
||||||
|
|
||||||
/* function declarations */
|
/* function declarations */
|
||||||
static void cleanup(void);
|
static void cleanup(void);
|
||||||
@ -209,24 +213,23 @@ keypress(XEvent *e) {
|
|||||||
|
|
||||||
void
|
void
|
||||||
move(const Arg *arg) {
|
move(const Arg *arg) {
|
||||||
|
puts("move to nth tab");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
newtab(const Arg *arg) {
|
newtab(const Arg *arg) {
|
||||||
|
puts("opening new tab");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
rotate(const Arg *arg) {
|
rotate(const Arg *arg) {
|
||||||
|
puts("next/prev tab");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
run(void) {
|
run(void) {
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
|
|
||||||
/* main event loop, also reads status text from stdin */
|
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
while(running) {
|
while(running) {
|
||||||
XNextEvent(dpy, &ev);
|
XNextEvent(dpy, &ev);
|
||||||
@ -260,7 +263,7 @@ setup(void) {
|
|||||||
|
|
||||||
win = XCreateSimpleWindow(dpy, root, wx, wy, ww, wh, 0, dc.norm[ColFG], dc.norm[ColBG]);
|
win = XCreateSimpleWindow(dpy, root, wx, wy, ww, wh, 0, dc.norm[ColFG], dc.norm[ColBG]);
|
||||||
XSelectInput(dpy, win, StructureNotifyMask|PointerMotionMask|
|
XSelectInput(dpy, win, StructureNotifyMask|PointerMotionMask|
|
||||||
ButtonReleaseMask|ButtonPressMask|ExposureMask|
|
ButtonPressMask|ExposureMask|KeyPressMask|
|
||||||
LeaveWindowMask);
|
LeaveWindowMask);
|
||||||
wmh = XAllocWMHints();
|
wmh = XAllocWMHints();
|
||||||
wmh->input = False;
|
wmh->input = False;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user