get some tinywm code in here, and kinda understand it

This commit is contained in:
hippoz 2020-10-17 15:43:33 +03:00
parent e85cc28978
commit 92751b3efd

View file

@ -1,3 +1,34 @@
// Some things taken from https://github.com/mackstann/tinywm
#include <X11/Xlib.h>
#define MODMASK Mod1Mask
int main() {
Display* display;
XWindowAttributes attr;
// Used to store the state of the cursor when resizing
XButtonEvent start;
XEvent ev;
bool isRunning = true;
if(!(dpy = XOpenDisplay(0x0))) return 1;
XGrabKey(dpy, XKeysymToKeycode(dpy, XStringToKeysym("F1")), MODMASK, DefaultRootWindow(dpy), True, GrabModeAsync, GrabModeAsync);
XGrabButton(dpy, 1, MODMASK, DefaultRootWindow(dpy), True, ButtonPressMask|ButtonReleaseMask|PointerMotionMask, GrabModeAsync, GrabModeAsync, None, None);
XGrabButton(dpy, 3, MODMASK, DefaultRootWindow(dpy), True, ButtonPressMask|ButtonReleaseMask|PointerMotionMask, GrabModeAsync, GrabModeAsync, None, None);
start.subwindow = None;
while(isRunning) {
XNextEvent(dpy, &ev);
}
return 0;
}