aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2024-02-04 13:03:03 -0500
committerB. Watson <urchlay@slackware.uk>2024-02-04 13:03:03 -0500
commit4b2687afb6ebb1bd288292f578a057ab175fc02e (patch)
tree048c097f495e94455de522406be844831bd13306
parent484a141ecb3e57ca925ab652a049b0c5b4c783c5 (diff)
downloadxdeadzone-4b2687afb6ebb1bd288292f578a057ab175fc02e.tar.gz
Remove redundant -i option, remove -abs (make absolute positioning the default).
-rw-r--r--xdeadzone.153
-rw-r--r--xdeadzone.c24
-rw-r--r--xdeadzone.rst51
3 files changed, 61 insertions, 67 deletions
diff --git a/xdeadzone.1 b/xdeadzone.1
index 74505d4..115b9d9 100644
--- a/xdeadzone.1
+++ b/xdeadzone.1
@@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
-.TH "XDEADZONE" 1 "2024-02-03" "0.1" "Urchlay's Misc Stuff"
+.TH "XDEADZONE" 1 "2024-02-04" "0.1" "Urchlay's Misc Stuff"
.SH NAME
xdeadzone \- keep the mouse pointer out of the dead zone, on mismatched multihead displays.
.\" RST source for xdeadzone(1) man page. Convert with:
@@ -36,7 +36,7 @@ xdeadzone \- keep the mouse pointer out of the dead zone, on mismatched multihea
.
.SH SYNOPSIS
.sp
-xdeadzone <[\fB\-i\fP \fB\-b\fP | \fB\-w\fP ]> <\fB\-n*> [\fP\-nw** | \fB\-ne\fP | \fB\-sw\fP | \fB\-se\fP | \fB\-abs\fP] \fIgeometry\fP
+xdeadzone [\fB\-b\fP | \fB\-w\fP ] [\fB\-n*] [\fP\-nw** | \fB\-ne\fP | \fB\-sw\fP | \fB\-se\fP ] \fIgeometry\fP
.sp
xdeadzone \fB\-\-help\fP | \fB\-\-version\fP
.SH DESCRIPTION
@@ -50,8 +50,9 @@ resolution.
.sp
It could also be useful for covering annoying parts of the screen,
e.g. advertisements in ad\-driven software like the Opera browser, or
-Adobe Reader. Use \fB\-abs\fP (absolute positioning) mode for this,
-and either \fB\-b\fP or \fB\-w\fP to make the window visible.
+Adobe Reader. Use absolute positioning (no \fB\-nw\fP, \fB\-ne\fP, \fB\-sw\fP,
+\fB\-se\fP) for this, and either \fB\-b\fP or \fB\-w\fP to make the window
+visible.
.sp
By default, \fBxdeadzone\fP doesn\(aqt display a visible window. It stays
on top of other windows, and is present on every virtual desktop.
@@ -72,9 +73,23 @@ mouse from the wrong part of the screen.
.SH OPTIONS
.sp
Options can appear in any order on the command line.
+.SS Required argument
+.INDENT 0.0
+.TP
+.B \fBgeometry\fP
+This is a standard X11 geometry specification. Its format is
+<\fIwidth\fP>x<\fIheight\fP> for \fB\-nw\fP, \fB\-ne\fP, \fB\-sw\fP, \fB\-se\fP modes. For
+absolute positioning,
+it\(aqs <\fIwidth\fP>x<\fIheight\fP>[\fI+\-\fP]<\fIxpos\fP>[\fI+\-\fP]<\fIypos\fP>.
+Negative xpos and ypos will be
+treated as offsets from the right/bottom of the display.
+.sp
+Examples: \fB200x100\fP, \fB64x64\-0\-0\fP, \fB50x60+100+100\fP\&.
+.UNINDENT
.SS Modes
.sp
-One (and only one) mode option is required.
+One (and only one) mode option is allowed. If none is given,
+absolute positioning is used.
.INDENT 0.0
.TP
.B \fB\-nw\fP
@@ -88,31 +103,14 @@ Place window at southwest (bottom left) corner of display.
.TP
.B \fB\-se\fP
Place window at southeast (bottom right) corner of display.
-.TP
-.B \fB\-abs\fP
-Place window at the coordinates given by \fBgeometry\fP\&.
-.UNINDENT
-.SS Required argument
-.INDENT 0.0
-.TP
-.B \fBgeometry\fP
-This is a standard X11 geometry specification. Its format is
-<\fIwidth\fP>x<\fIheight\fP> for all modes other than \fB\-abs\fP\&. For \fB\-abs\fP,
-it\(aqs <\fIwidth\fP>x<\fIheight\fP>[\fI+\-\fP]<\fIxpos\fP>[\fI+\-\fP]<\fIypos\fP>.
-Negative xpos and ypos will be
-treated as offsets from the right/bottom of the display.
-.sp
-Examples: \fB200x100\fP, \fB64x64\-0\-0\fP, \fB50x60+100+100\fP\&.
.UNINDENT
.SS Appearance options
.sp
-These are optional, and control how \fBxdeadzone\fP\(aqs window will
-look and behave.
+These are optional, and control how \fBxdeadzone\fP\(aqs window will look
+and behave. By default, the window is invisible (\fIInputOnly\fP in Xlib
+terms).
.INDENT 0.0
.TP
-.B \fB\-i\fP
-Make window invisible. This is the default.
-.TP
.B \fB\-b\fP
Make window visible, display as a black rectangle.
.TP
@@ -122,7 +120,10 @@ Make window visible, display as a white rectangle.
.B \fB\-n\fP
Create window as a normal window, with titlebar and without
appearing on all desktops. Implies \fB\-w\fP, but can be followed
-by \fB\-b\fP for a black rectangle. Cannot be combined with \fB\-i\fP\&.
+by \fB\-b\fP for a black rectangle.
+In this mode, the window will have a titlebar (but no close button),
+will be movable and resizable, and will not appear on all virtual
+desktops. However, it will still be "always on top".
.UNINDENT
.SS Informational options
.INDENT 0.0
diff --git a/xdeadzone.c b/xdeadzone.c
index 2b38b5e..70d57cd 100644
--- a/xdeadzone.c
+++ b/xdeadzone.c
@@ -47,8 +47,8 @@ void usage(const int ret) {
banner();
printf(
"Usage:\n %s "
- "<-b | -w | -i> <-n> [-nw | -ne | -sw | -se | -abs] [geometry]\n\n"
- " <geometry> is WxH for all modes but -abs, or\n WxH[+-]xpos[+-]ypos for -abs\n",
+ "[-b | -w ] [ -n ] [ -nw | -ne | -sw | -se ] [geometry]\n\n"
+ " <geometry> is WxH with -nw/-ne/-sw/-se, or\n WxH[+-]xpos[+-]ypos\n",
exe_name);
exit(ret);
}
@@ -59,8 +59,8 @@ void errmsg(const char *msg) {
}
void check_mode(int mode) {
- if(mode != M_UNSET)
- errmsg("multiple modes given, only one of -abs -ne -nw -se -sw is allowed");
+ if(mode != M_ABS)
+ errmsg("multiple modes given, only one of -ne -nw -se -sw is allowed");
}
int streq(const char *s1, const char *s2) {
@@ -84,7 +84,7 @@ int main(int argc, char **argv) {
XSetWindowAttributes setattr;
XSizeHints hints;
- int x = -1, y = -1, gflags = -1, visible = 0, black = 0, mode = M_UNSET, normal_window = 0;
+ int x = -1, y = -1, gflags = -1, visible = 0, black = 0, mode = M_ABS, normal_window = 0;
unsigned int width, height;
int new_x, new_y;
@@ -105,14 +105,9 @@ int main(int argc, char **argv) {
} else if(streq(a, "-w")) {
visible = 1;
black = 0;
- } else if(streq(a, "-i")) {
- visible = 0;
} else if(streq(a, "-n")) {
visible = 1;
normal_window = 1;
- } else if(streq(a, "-abs")) {
- check_mode(mode);
- mode = M_ABS;
} else if(streq(a, "-ne")) {
check_mode(mode);
mode = M_NE;
@@ -142,12 +137,12 @@ int main(int argc, char **argv) {
DBG(printf("XParseGeometry got %d %d %d %d\n", x, y, width, height));
if(mode != M_ABS && (gflags & (XValue | YValue)))
- errmsg("bad geometry: X and Y position not allowed without -abs");
+ errmsg("bad geometry: X and Y position not allowed with -ne -nw -se -sw");
switch(mode) {
case M_ABS:
if(!(gflags & (XValue | YValue)))
- errmsg("bad geometry: -abs requires X and Y position");
+ errmsg("bad geometry: requires X and Y position or -ne -nw -se -sw");
break;
case M_NW:
x = 0; y = 0; break;
@@ -158,15 +153,12 @@ int main(int argc, char **argv) {
case M_SE:
x = -width; y = -height; break;
default:
- errmsg("no mode given, one of -abs -ne -nw -se -sw is required");
+ errmsg("invalid mode (internal logic error, this should never happen)");
}
if(width == 0 || height == 0)
errmsg("bad geometry: width and height must be non-zero");
- if(normal_window && !visible)
- errmsg("cannot combine -i (invisible) with -n (normal window)");
-
if(!(d = XOpenDisplay(NULL)))
errmsg("can't open X display");
diff --git a/xdeadzone.rst b/xdeadzone.rst
index 5b77573..58114ac 100644
--- a/xdeadzone.rst
+++ b/xdeadzone.rst
@@ -20,7 +20,7 @@ keep the mouse pointer out of the dead zone, on mismatched multihead displays.
SYNOPSIS
========
-xdeadzone <[**-i** **-b** | **-w** ]> <**-n*> [**-nw** | **-ne** | **-sw** | **-se** | **-abs**] *geometry*
+xdeadzone [**-b** | **-w** ] [**-n*] [**-nw** | **-ne** | **-sw** | **-se** ] *geometry*
xdeadzone **--help** | **--version**
@@ -36,8 +36,9 @@ resolution.
It could also be useful for covering annoying parts of the screen,
e.g. advertisements in ad-driven software like the Opera browser, or
-Adobe Reader. Use **-abs** (absolute positioning) mode for this,
-and either **-b** or **-w** to make the window visible.
+Adobe Reader. Use absolute positioning (no **-nw**, **-ne**, **-sw**,
+**-se**) for this, and either **-b** or **-w** to make the window
+visible.
By default, **xdeadzone** doesn't display a visible window. It stays
on top of other windows, and is present on every virtual desktop.
@@ -61,10 +62,24 @@ OPTIONS
Options can appear in any order on the command line.
+Required argument
+-----------------
+
+**geometry**
+ This is a standard X11 geometry specification. Its format is
+ <*width*>x<*height*> for **-nw**, **-ne**, **-sw**, **-se** modes. For
+ absolute positioning,
+ it's <*width*>x<*height*>[*+-*]<*xpos*>[*+-*]<*ypos*>.
+ Negative xpos and ypos will be
+ treated as offsets from the right/bottom of the display.
+
+ Examples: **200x100**, **64x64-0-0**, **50x60+100+100**.
+
Modes
-----
-One (and only one) mode option is required.
+One (and only one) mode option is allowed. If none is given,
+absolute positioning is used.
**-nw**
Place window at northwest (top left) corner of display.
@@ -78,29 +93,12 @@ One (and only one) mode option is required.
**-se**
Place window at southeast (bottom right) corner of display.
-**-abs**
- Place window at the coordinates given by **geometry**.
-
-Required argument
------------------
-
-**geometry**
- This is a standard X11 geometry specification. Its format is
- <*width*>x<*height*> for all modes other than **-abs**. For **-abs**,
- it's <*width*>x<*height*>[*+-*]<*xpos*>[*+-*]<*ypos*>.
- Negative xpos and ypos will be
- treated as offsets from the right/bottom of the display.
-
- Examples: **200x100**, **64x64-0-0**, **50x60+100+100**.
-
Appearance options
------------------
-These are optional, and control how **xdeadzone**'s window will
-look and behave.
-
-**-i**
- Make window invisible. This is the default.
+These are optional, and control how **xdeadzone**'s window will look
+and behave. By default, the window is invisible (*InputOnly* in Xlib
+terms).
**-b**
Make window visible, display as a black rectangle.
@@ -111,7 +109,10 @@ look and behave.
**-n**
Create window as a normal window, with titlebar and without
appearing on all desktops. Implies **-w**, but can be followed
- by **-b** for a black rectangle. Cannot be combined with **-i**.
+ by **-b** for a black rectangle.
+ In this mode, the window will have a titlebar (but no close button),
+ will be movable and resizable, and will not appear on all virtual
+ desktops. However, it will still be "always on top".
Informational options
---------------------