about summary refs log tree commit diff
diff options
context:
space:
mode:
authorxyz <gky44px1999@gmail.com>2022-05-02 18:39:49 -0700
committerxyz <gky44px1999@gmail.com>2022-05-02 18:39:49 -0700
commitf72d718e9d72bcd8fbefd46552a4bb9bb8b3b600 (patch)
treeec6c0e9625d9dbcfa98ad8e1de65223d695e2ff2
parentf2705405d77cae15fb41b10daef4416257ee17f0 (diff)
refactor
-rw-r--r--xcross.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/xcross.c b/xcross.c
index 0532c21..0f7f989 100644
--- a/xcross.c
+++ b/xcross.c
@@ -1,10 +1,12 @@
 // edit source code from: https://github.com/gvalkov/xrectsel
+
 //#include <stdio.h>
 #include <X11/Xlib.h>
 
 //int main (int argc, char *argv[])
 int main (void)
 {
+	// useless trash vars
     int int_tmp;
     unsigned int uint_tmp;
 	Window window_tmp;
@@ -26,20 +28,17 @@ int main (void)
                       &gcval);
 
 	XQueryPointer(disp, root, &window_tmp, &window_tmp, &rootx, &rooty, &int_tmp, &int_tmp, &uint_tmp);
-	//printf("%d\n", scr->width);
-	//printf("%d\n\n", scr->height);
-	// XGetGeometry() maybe better, instead of DisplayHeight() and DisplayWidth()
+	//printf("pointer coordinates x: %d, y: %d\n", rootx, rooty);
+	//printf("screen width: %d, height: %d\n", scr->width, scr->height);
 	XDrawLine(disp, root, gc, rootx, 0, rootx, scr->height);
 	XDrawLine(disp, root, gc, 0, rooty, scr->width, rooty);
-	//XDrawRectangle(disp, root, gc, 1000, 1000, 1000, 1000);
-	XFlush(disp);
 
-    XUngrabPointer(disp, CurrentTime);
-    XUngrabKeyboard(disp, CurrentTime);
-	//XFreeCursor(disp, cursor);
-    XFreeGC(disp, gc);
-    XSync(disp, True);
+	// not sure if useful
+	//XFlush(disp);
+    //XFreeGC(disp, gc);
+    //XSync(disp, True);
 
+	// man XCloseDisplay says: "Before exiting, you should call XCloseDisplay explicitly so that any pending errors are reported as XCloseDisplay performs a final XSync operation."
     XCloseDisplay(disp);
 
 	return 0;