aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2024-02-01 03:44:35 -0500
committerB. Watson <urchlay@slackware.uk>2024-02-01 03:44:35 -0500
commita5ce3ca8d6d44053f9f6c78bb3ac1edbf06bea45 (patch)
tree5d7437f798843eecd752ee2b769ff01fda030a1e
parente4f6edddad6a9a9d948ea28e3c002e49241fa253 (diff)
downloadxdeadzone-a5ce3ca8d6d44053f9f6c78bb3ac1edbf06bea45.tar.gz
Add black/white/invisible modes.
-rw-r--r--xdeadzone.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/xdeadzone.c b/xdeadzone.c
index 6ec1e10..a0398a8 100644
--- a/xdeadzone.c
+++ b/xdeadzone.c
@@ -68,7 +68,7 @@ int main(int argc, char **argv) {
XWindowAttributes attr;
XSetWindowAttributes setattr;
- int x = -1, y = -1, gflags;
+ int x = -1, y = -1, gflags, visible = 0, black = 0;
unsigned int width, height;
set_exe_name(argv[0]);
@@ -82,6 +82,24 @@ int main(int argc, char **argv) {
}
}
+ if(argc >= 2) {
+ if(streq(argv[1], "-b")) {
+ visible = 1;
+ black = 1;
+ argv++;
+ argc--;
+ } else if(streq(argv[1], "-w")) {
+ visible = 1;
+ black = 0;
+ argv++;
+ argc--;
+ } else if(streq(argv[1], "-i")) {
+ visible = 0;
+ argv++;
+ argc--;
+ }
+ }
+
if(argc != 3)
errmsg("wrong number of arguments (try --help)");
@@ -129,7 +147,11 @@ int main(int argc, char **argv) {
right?
*/
setattr.override_redirect = True;
- setattr.background_pixel = WhitePixel(d, DefaultScreen(d));
+ if(visible) {
+ setattr.background_pixel = black ?
+ BlackPixel(d, DefaultScreen(d)) :
+ WhitePixel(d, DefaultScreen(d));
+ }
setattr.event_mask = EnterWindowMask;
w = XCreateWindow(d,
@@ -138,7 +160,7 @@ int main(int argc, char **argv) {
CopyFromParent,
InputOutput,
CopyFromParent,
- CWBackPixel | CWOverrideRedirect | CWEventMask,
+ (visible ? CWBackPixel : 0) | CWOverrideRedirect | CWEventMask,
&setattr);
DBG(printf("window created\n"));