mirror of
https://github.com/dylanaraps/sowm.git
synced 2025-05-19 09:30:24 -07:00
sowm: Add header file
This commit is contained in:
parent
f558535e19
commit
1d249a96ef
56
sowm.c
56
sowm.c
@ -8,45 +8,7 @@
|
|||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
typedef union {
|
#include "sowm.h"
|
||||||
const char** com;
|
|
||||||
const int i;
|
|
||||||
const Window w;
|
|
||||||
} Arg;
|
|
||||||
|
|
||||||
struct key {
|
|
||||||
unsigned int mod;
|
|
||||||
KeySym keysym;
|
|
||||||
void (*function)(const Arg arg);
|
|
||||||
const Arg arg;
|
|
||||||
};
|
|
||||||
|
|
||||||
typedef struct client {
|
|
||||||
struct client *next, *prev;
|
|
||||||
int f, wx, wy;
|
|
||||||
unsigned int ww, wh;
|
|
||||||
Window w;
|
|
||||||
} client;
|
|
||||||
|
|
||||||
static void button_press(XEvent *e);
|
|
||||||
static void button_release();
|
|
||||||
static void configure_request(XEvent *e);
|
|
||||||
static void key_press(XEvent *e);
|
|
||||||
static void map_request(XEvent *e);
|
|
||||||
static void notify_destroy(XEvent *e);
|
|
||||||
static void notify_enter(XEvent *e);
|
|
||||||
static void notify_motion(XEvent *e);
|
|
||||||
static void run(const Arg arg);
|
|
||||||
static void win_add(Window w);
|
|
||||||
static void win_center();
|
|
||||||
static void win_del(Window w);
|
|
||||||
static void win_fs();
|
|
||||||
static void win_kill();
|
|
||||||
static void win_prev();
|
|
||||||
static void win_next();
|
|
||||||
static void win_to_ws(const Arg arg);
|
|
||||||
static void ws_go(const Arg arg);
|
|
||||||
static int xerror() { return 0;}
|
|
||||||
|
|
||||||
static client *list = {0}, *ws_list[10] = {0}, *cur;
|
static client *list = {0}, *ws_list[10] = {0}, *cur;
|
||||||
static int ws = 1, sw, sh, wx, wy, numlock = 0;
|
static int ws = 1, sw, sh, wx, wy, numlock = 0;
|
||||||
@ -68,18 +30,6 @@ static void (*events[LASTEvent])(XEvent *e) = {
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#define win (client *t=0, *c=list; c && t!=list->prev; t=c, c=c->next)
|
|
||||||
#define ws_save(W) ws_list[W] = list
|
|
||||||
#define ws_sel(W) list = ws_list[ws = W]
|
|
||||||
|
|
||||||
#define win_size(W, gx, gy, gw, gh) \
|
|
||||||
XGetGeometry(d, W, &(Window){0}, gx, gy, gw, gh, \
|
|
||||||
&(unsigned int){0}, &(unsigned int){0})
|
|
||||||
|
|
||||||
// Taken from DWM. Many thanks. https://git.suckless.org/dwm
|
|
||||||
#define mod_clean(mask) (mask & ~(numlock|LockMask) & \
|
|
||||||
(ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask))
|
|
||||||
|
|
||||||
void win_focus(client *c) {
|
void win_focus(client *c) {
|
||||||
cur = c;
|
cur = c;
|
||||||
XSetInputFocus(d, cur->w, RevertToParent, CurrentTime);
|
XSetInputFocus(d, cur->w, RevertToParent, CurrentTime);
|
||||||
@ -284,8 +234,8 @@ void input_grab(Window root) {
|
|||||||
KeyCode code;
|
KeyCode code;
|
||||||
|
|
||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < 8; i++)
|
||||||
for (j=0; j < modmap->max_keypermod; j++)
|
for (int k = 0; k < modmap->max_keypermod; k++)
|
||||||
if (modmap->modifiermap[i * modmap->max_keypermod + j]
|
if (modmap->modifiermap[i * modmap->max_keypermod + k]
|
||||||
== XKeysymToKeycode(d, 0xff7f))
|
== XKeysymToKeycode(d, 0xff7f))
|
||||||
numlock = (1 << i);
|
numlock = (1 << i);
|
||||||
|
|
||||||
|
55
sowm.h
Normal file
55
sowm.h
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
#include <X11/Xlib.h>
|
||||||
|
|
||||||
|
#define win (client *t=0, *c=list; c && t!=list->prev; t=c, c=c->next)
|
||||||
|
#define ws_save(W) ws_list[W] = list
|
||||||
|
#define ws_sel(W) list = ws_list[ws = W]
|
||||||
|
|
||||||
|
#define win_size(W, gx, gy, gw, gh) \
|
||||||
|
XGetGeometry(d, W, &(Window){0}, gx, gy, gw, gh, \
|
||||||
|
&(unsigned int){0}, &(unsigned int){0})
|
||||||
|
|
||||||
|
// Taken from DWM. Many thanks. https://git.suckless.org/dwm
|
||||||
|
#define mod_clean(mask) (mask & ~(numlock|LockMask) & \
|
||||||
|
(ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask))
|
||||||
|
|
||||||
|
typedef union {
|
||||||
|
const char** com;
|
||||||
|
const int i;
|
||||||
|
const Window w;
|
||||||
|
} Arg;
|
||||||
|
|
||||||
|
struct key {
|
||||||
|
unsigned int mod;
|
||||||
|
KeySym keysym;
|
||||||
|
void (*function)(const Arg arg);
|
||||||
|
const Arg arg;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef struct client {
|
||||||
|
struct client *next, *prev;
|
||||||
|
int f, wx, wy;
|
||||||
|
unsigned int ww, wh;
|
||||||
|
Window w;
|
||||||
|
} client;
|
||||||
|
|
||||||
|
void button_press(XEvent *e);
|
||||||
|
void button_release();
|
||||||
|
void configure_request(XEvent *e);
|
||||||
|
void input_grab(Window root);
|
||||||
|
void key_press(XEvent *e);
|
||||||
|
void map_request(XEvent *e);
|
||||||
|
void notify_destroy(XEvent *e);
|
||||||
|
void notify_enter(XEvent *e);
|
||||||
|
void notify_motion(XEvent *e);
|
||||||
|
void run(const Arg arg);
|
||||||
|
void win_add(Window w);
|
||||||
|
void win_center();
|
||||||
|
void win_del(Window w);
|
||||||
|
void win_fs();
|
||||||
|
void win_focus(client *c);
|
||||||
|
void win_kill();
|
||||||
|
void win_prev();
|
||||||
|
void win_next();
|
||||||
|
void win_to_ws(const Arg arg);
|
||||||
|
void ws_go(const Arg arg);
|
||||||
|
int xerror() { return 0;}
|
Loading…
x
Reference in New Issue
Block a user