foo-wm

(Archived) Experimental Zooming IPC-based WM
git clone http://milesalan.com/git/foo-wm
Log | Files | Refs | Mirror | README | LICENSE

window.c (546B)


      1 #include <X11/Xlib.h>
      2 
      3 #include "foo-wm.h"
      4 #include "window.h"
      5 
      6 void centerPointer(Window *window) {
      7   //Get Window Attributes
      8   XWindowAttributes windowAttributes;
      9   XGetWindowAttributes(display, *window, &windowAttributes);
     10 
     11   int centerX = windowAttributes.width  / 2,
     12       centerY = windowAttributes.height / 2;
     13 
     14   //Warp to Center
     15   XWarpPointer(display, None, *window, 0, 0, 0, 0, centerX,centerY);
     16 }
     17 
     18 void setCursor(Window *window, int cursor) {
     19   cursor = XCreateFontCursor(display, cursor);
     20   XDefineCursor(display, *window, cursor);
     21 }