You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

53 lines
1.3 KiB

/* copyright Constantin Fürst 2021, licensed under GPLv3, a copy is provided in LICENSE */
/* non-major portions of the code were taken from DWM (https://dwm.suckless.org) */
/* inspired and named after keym by Chris Willcocks (https://github.com/cwkx/keym) */
#pragma once
#include <X11/Xlib.h>
static const uint32_t KEY_RELEASE_MASK = 0b10000000000000000000000000000000;
static const uint32_t sizeof_MOUSE_BUTTONS = 5;
enum MOUSE_BUTTONS {
MB_Left, MB_Right, MB_Middle, MB_Back, MB_Forward
};
static const uint32_t sizeof_SCROLL_DIRECTION = 2;
enum SCROLL_DIRECTION {
SD_Up, SD_Down
};
enum MOUSE_MOVEMENT {
MM_Up, MM_Down, MM_Left, MM_Right
};
enum CONTROL_ACTIONS {
CA_SPEED_LOW, CA_SPEED_HIGH, CA_QUIT_APPLICATION
};
typedef struct {
unsigned int mod;
KeySym keysym;
void (*func)(const uint32_t*);
const uint32_t arg;
} Key;
typedef struct {
// X11 window access
Display* display;
Window window;
int screen;
fd_set in_fds;
int x11_fd;
// keym-settings
unsigned int speed;
int quit;
// current movement
int x;
int y;
} keym_state;
static unsigned int numlockmask = 0;
#define LENGTH(X) sizeof(X) / sizeof(X[0])
#define CLEANMASK(mask) (mask & ~(numlockmask|LockMask) & (ShiftMask|ControlMask|Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask))