diff options
Diffstat (limited to 'main.c')
-rw-r--r-- | main.c | 53 |
1 files changed, 53 insertions, 0 deletions
@@ -0,0 +1,53 @@ +#include <stdio.h> +#include <X11/X.h> +#include <X11/Xlib.h> +#include <X11/extensions/Xrandr.h> + + +int main(void) { + union { + XEvent xev; + XRRScreenChangeNotifyEvent xrrev; + } result; + //XRRScreenChangeNotifyEvent xev; + //XWindowAttributes focus_attrs, root_attrs; + + Display *display = XOpenDisplay(NULL); + + Window focus; + int revert_to; + XGetInputFocus(display, &focus, &revert_to); + + printf("focus: %lx\n", focus); + + //Window root = XDefaultRootWindow(display); + + int xrr_event_base; + int xrr_error_base; + // TODO int hasXrandR = + XRRQueryExtension(display, &xrr_event_base, &xrr_error_base); + + // TODO if has RR + XRRSelectInput(display, XDefaultRootWindow(display), RRScreenChangeNotifyMask); + + + for (;;) { + + //XGetWindowAttributes(display, focus, &focus_attrs); + + //printf("a\n"); + + //XWindowEvent(display, root, RRScreenChangeNotifyMask, (XEvent *)&xev); + XNextEvent(display, &result.xev); + + if (result.xev.type == (xrr_event_base + RRScreenChangeNotify)) { + XMoveResizeWindow(display, focus, 0, 0, result.xrrev.width, result.xrrev.height); + } + + //printf("derp\n"); + + //XFlush(display); + } + + //XFlush(display); +} |