Skip to content

Commit

Permalink
Merge pull request #3 from MeganerdDev/raise-window
Browse files Browse the repository at this point in the history
Raise virtual cursor over new windows as needed
  • Loading branch information
MeganerdDev authored Apr 6, 2024
2 parents 1eb75cd + b5a9ccd commit a9372a3
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 a9372a3

Please sign in to comment.