get some tinywm code in here, and kinda understand it
This commit is contained in:
parent
e85cc28978
commit
92751b3efd
1 changed files with 31 additions and 0 deletions
31
src/main.c
31
src/main.c
|
@ -1,3 +1,34 @@
|
||||||
|
// Some things taken from https://github.com/mackstann/tinywm
|
||||||
|
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
|
||||||
|
#define MODMASK Mod1Mask
|
||||||
|
|
||||||
int main() {
|
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;
|
return 0;
|
||||||
}
|
}
|
Reference in a new issue