Package: xtrlock
Version: 2.0-14
Severity: wishlist
xtrlock is one of the best lightweight alternatives for bloated software
like xscreensaver and gnome-screensaver. One thing it seriously lacks is
blank screen support. Stock xtrlock allows anyone to see what's going on
at screen (while blocking its control). This can be considered as
security issue.
The patch is borrowed from [1] (by @aragon). Hopefully, this will be
useful for other people too.
As I understand, this will require adding new cmdline option and
updating documentation. Please tell me if you're interested in getting
this patch applied for Debian package.
[1]: http://forums.freebsd.org/showthread.php?t=15678
/Ihar Hrachyshka
--- work/xtrlock-2.0/xtrlock.c Mon Jan 17 12:43:05 2005
+++ xtrlock.c Thu May 10 17:30:13 2007
@@ -80,8 +78,8 @@
XSetWindowAttributes attrib;
Cursor cursor;
Pixmap csr_source,csr_mask;
- XColor csr_fg, csr_bg, dummy;
- int ret;
+ XColor csr_fg, csr_bg, dummy, black;
+ int ret, screen;
#ifdef SHADOW_PWD
struct spwd *sp;
#endif
@@ -120,10 +118,15 @@
exit(1);
}
+ screen = DefaultScreen(display);
attrib.override_redirect= True;
+ attrib.background_pixel = BlackPixel(display, screen);
window= XCreateWindow(display,DefaultRootWindow(display),
- 0,0,1,1,0,CopyFromParent,InputOnly,CopyFromParent,
- CWOverrideRedirect,&attrib);
+ 0,0,DisplayWidth(display,
screen),DisplayHeight(display, screen),
+ 0,DefaultDepth(display, screen), CopyFromParent,
DefaultVisual(display, screen),
+ CWOverrideRedirect|CWBackPixel,&attrib);
+
+ XAllocNamedColor(display, DefaultColormap(display, screen), "black", &black,
&dummy);
XSelectInput(display,window,KeyPressMask|KeyReleaseMask);
@@ -151,7 +154,6 @@
&dummy, &csr_bg);
-
cursor= XCreatePixmapCursor(display,csr_source,csr_mask,&csr_fg,&csr_bg,
lock_x_hot,lock_y_hot);
@@ -166,6 +168,7 @@
XUngrabKeyboard(display,CurrentTime);
exit(1);
}
+ XSync(display, False);
for (;;) {
XNextEvent(display,&ev);