Skip to content

Commit

Permalink
Raise window as needed. Closes #1.
Browse files Browse the repository at this point in the history
  • Loading branch information
meganerd committed Apr 6, 2024
1 parent 1eb75cd commit b5a9ccd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions night-vision.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ int main(int argc, char* argv[]) {
}

int lastX = -1, lastY = -1; // Variables to track the last known mouse position
int minHeight = 0; // TODO: User-defined via dotfile settings

while (true) {
Window dummy;
Expand All @@ -55,6 +56,13 @@ int main(int argc, char* argv[]) {
XDrawLine(display, window, gc, 12 + offset, 4, 12 + offset, 20);
XDrawLine(display, window, gc, 4, 12 + offset, 20, 12 + offset);
}
//XRaiseWindow(display, window) // Expensive to call constantly
XWindowAttributes winAttrs;
if (XGetWindowAttributes(display, root, &winAttrs)) {
if (winAttrs.height >= minHeight) {
XRaiseWindow(display, window); // Conditionally raise the cursor window
}
}
XFlush(display);
}
}
Expand Down

0 comments on commit b5a9ccd

Please sign in to comment.