[2228] in SIPB bug reports
RS/6000 patches to xscreensaver
daemon@ATHENA.MIT.EDU (lwvanels@Athena.MIT.EDU)
Sat Nov 2 15:31:01 1991
From: lwvanels@Athena.MIT.EDU
Date: Sat, 2 Nov 91 15:30:14 -0500
To: bug-sipb@Athena.MIT.EDU
Reply-To: lwvanels@mit.edu
Here are the changes necessary to xscreensaver to get it disable
hotkeying between hft's when the screen is locked, along with several other
minor fixes. Note that:
- unless xscreensaver is installed setgid security (7), users will
need to enter a password when they lock the screen, since to get the user's
encrypted password you need to be able to read /etc/security.
- The IBM X server doesn't deal well with having useBackground set to
True; the floater leaves a trail as it goes around the screen. For now,
I've just ifdef'd that section out for the RS/6000.
- You probably want to link against the shared X libraries; this will
result in a 73K binary instead of a 622K one. To do this, give
-DUseSharedLibs as an argument to imake.
The diffs from the sources in sipbsrc, along with two new files
"converter.c" and "hft.c" are below; these files are also in
~lwvanels/work/xscreensaver.
----------------------------------------------------------------------------
*** /tmp/,RCSt1CNQBXj Sat Nov 2 15:23:34 1991
--- Imakefile Sat Nov 2 15:14:50 1991
***************
*** 16,25 ****
# pretend that you wrote it.
#
APPCLASS = XScreensaver
BITMAPDIR = /usr/sipb/bitmaps.x11
DEFINES = -DAPPCLASS=\"$(APPCLASS)\" \
! -DXFILESEARCHPATH=\"/usr/sipb/lib/%T/%N:/afs/athena.mit.edu/contrib/sipb/lib/%T/%N:$(BITMAPDIR)/%N\"
ICONBITMAP = SigmaPiBeta
FLOATBITMAP = yinyang
ICONPIXMAP = SigmaPiBeta
--- 16,36 ----
# pretend that you wrote it.
#
+ #if defined(NeXTArchitecture)
+ MACH_DEP_FLAGS = -DCOMPILE_SETENV
+ #endif
+
+ #if defined(IBMR2Architecture)
+ MACH_DEP_FLAGS = -DCOMPILE_SETENV
+ MACH_DEP_SRCS = converter.c hft.c
+ MACH_DEP_OBJS = converter.o hft.o
+ #endif
+
APPCLASS = XScreensaver
BITMAPDIR = /usr/sipb/bitmaps.x11
DEFINES = -DAPPCLASS=\"$(APPCLASS)\" \
! -DXFILESEARCHPATH=\"/usr/sipb/lib/%T/%N:/afs/athena.mit.edu/contrib/sipb/lib/%T/%N:$(BITMAPDIR)/%N\" \
! $(MACH_DEP_FLAGS)
ICONBITMAP = SigmaPiBeta
FLOATBITMAP = yinyang
ICONPIXMAP = SigmaPiBeta
***************
*** 28,38 ****
LOCAL_LIBRARIES =
SRCS = PromptBox.c float.c getstring.c main.c\
menuIcon.c password.c savescreen.c scaling.c\
! setenv.c util.c wordwrap.c
OBJS = PromptBox.o float.o getstring.o main.o\
menuIcon.o password.o savescreen.o scaling.o\
! setenv.o util.o wordwrap.o
CDEBUGFLAGS = -g
HEADERS = PromptBox.h action.h commLine.h float.h\
getstring.h globals.h resources.h scaling.h\
wordwrap.h xsaver.h
--- 39,49 ----
LOCAL_LIBRARIES =
SRCS = PromptBox.c float.c getstring.c main.c\
menuIcon.c password.c savescreen.c scaling.c\
! setenv.c util.c wordwrap.c $(MACH_DEP_SRCS)
OBJS = PromptBox.o float.o getstring.o main.o\
menuIcon.o password.o savescreen.o scaling.o\
! setenv.o util.o wordwrap.o $(MACH_DEP_OBJS)
CDEBUGFLAGS = -g
HEADERS = PromptBox.h action.h commLine.h float.h\
getstring.h globals.h resources.h scaling.h\
wordwrap.h xsaver.h
***************
*** 44,53 ****
#if defined(VaxArchitecture) && HasGcc
/* There is a bug in gcc 1.40 on the Vax that xscreensaver tickles */
CC=cc
- #endif
-
- #if defined(NeXTArchitecture)
- CFLAGS = -DCOMPILE_SETENV
#endif
AllTarget($(TARGET) $(APPCLASS).ad $(TARGET).man)
--- 55,60 ----
*** /tmp/,RCSt1CNoAVZ Sat Nov 2 15:24:45 1991
--- main.c Fri Nov 1 15:28:48 1991
***************
*** 197,202 ****
--- 197,206 ----
signal(SIGHUP, signal_die);
signal(SIGQUIT, signal_die);
+ #ifdef _IBMR2
+ add_converter();
+ #endif
+
top_widget = XtVaAppInitialize(&app_context,
APPCLASS,
app_options,
*** /tmp/,RCSt1CN8BFe Sat Nov 2 15:24:51 1991
--- password.c Fri Nov 1 14:11:38 1991
***************
*** 29,35 ****
#include <netinet/in.h>
#include <fcntl.h>
#include <errno.h>
! #if defined(mips) || defined(sparc)
extern int sys_nerr;
extern char *sys_errlist[];
#endif
--- 29,35 ----
#include <netinet/in.h>
#include <fcntl.h>
#include <errno.h>
! #if defined(mips) || defined(sparc) || defined (_IBMR2)
extern int sys_nerr;
extern char *sys_errlist[];
#endif
*** /tmp/,RCSt1COQADV Sat Nov 2 15:25:00 1991
--- savescreen.c Sat Nov 2 15:12:50 1991
***************
*** 36,41 ****
--- 36,44 ----
extern void XtMoveWidget();
extern Dimension widget_width();
extern void exitCallback();
+ #ifdef _IBMR2
+ extern void enable_hft_hotkey(), disable_hft_hotkey();
+ #endif
void build_root(), lock_command(), unlock_command(),
ActivateClock(), ReallyLockScreen(), SaveScreen(), PasswordTimeout(),
***************
*** 84,93 ****
--- 87,99 ----
XtSetArg(arglist[i], XtNwidth, display_width); i++;
XtSetArg(arglist[i], XtNheight, display_height); i++;
XtSetArg(arglist[i], XtNgeometry, geometry); i++;
+ #ifndef _IBMR2
+ /* This doesn't work on the RS/6000 X server... */
if (defs.use_background) {
XtSetArg(arglist[i], XtNbackgroundPixmap,
ParentRelative); i++;
}
+ #endif
root_shell = XtCreatePopupShell("rootShell",
overrideShellWidgetClass,
***************
*** 214,219 ****
--- 220,228 ----
static void ReallyLockScreen()
{
+ #ifdef _IBMR2
+ disable_hft_hotkey();
+ #endif
lock_command();
XtOverrideTranslations(root_widget, lockedTrans);
XtOverrideTranslations(root_shell, lockedTrans);
***************
*** 549,554 ****
--- 558,566 ----
Cardinal *num_params;
{
is_locked = False;
+ #ifdef _IBMR2
+ enable_hft_hotkey();
+ #endif
unlock_command();
DeactivateFloat();
if (debug_file) {
*** /dev/null Sat Nov 2 11:28:20 1991
--- converter.c Fri Nov 1 15:27:25 1991
***************
*** 0 ****
--- 1,37 ----
+ /* $Header: $ */
+ /*******************************************************************
+ Copyright (C) 1990 by the Massachusetts Institute of Technology
+
+ Export of this software from the United States of America is assumed
+ to require a specific license from the United States Government.
+ It is the responsibility of any person or organization contemplating
+ export to obtain such a license before exporting.
+
+ WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
+ distribute this software and its documentation for any purpose and
+ without fee is hereby granted, provided that the above copyright
+ notice appear in all copies and that both that copyright notice and
+ this permission notice appear in supporting documentation, and that
+ the name of M.I.T. not be used in advertising or publicity pertaining
+ to distribution of the software without specific, written prior
+ permission. M.I.T. makes no representations about the suitability of
+ this software for any purpose. It is provided "as is" without express
+ or implied warranty.
+
+ ***************************************************************** */
+
+ #include <X11/IntrinsicP.h>
+ #include <X11/CoreP.h>
+ #include <X11/Xmu/Converters.h>
+
+ static XtConvertArgRec foo[] = {
+ {XtBaseOffset, (caddr_t) XtOffset(Widget, core.screen), sizeof(Screen *)}
+ };
+
+ extern void XmuCvtStringToBitmap ();
+
+ void add_converter ()
+ {
+ XtAddConverter( "String", "Bitmap", XmuCvtStringToBitmap,
+ foo, XtNumber(foo) );
+ }
*** /dev/null Sat Nov 2 11:28:20 1991
--- hft.c Sat Nov 2 15:14:16 1991
***************
*** 0 ****
--- 1,120 ----
+ /*
+ * $Source: $
+ * $Author: $
+ *
+ * This file is part of xscreensaver. It contains the code for dealing with
+ * enabling/disabling the switching of screens via HFT "hotkeys" on the
+ * IBM RS/6000.
+ *
+ * Author: Lucien Van Elsen, MIT Project Athena
+ *
+ * Coyright (c) 1989 by Jonathan Kamens. This code may be distributed
+ * freely as long as this notice is kept intact in its entirety and
+ * every effort is made to send all corrections and improvements to
+ * the code back to the author. Also, don't try to make any money off
+ * of it or pretend that you wrote it.
+ */
+
+ #ifndef lint
+ static char rcsid_hft_c[] = "$Header: ";
+ #endif
+
+ #include <sys/types.h>
+ #include <sys/hft.h>
+ #include <fcntl.h>
+
+ static struct hftqstat orig_hft_state;
+ static struct hfbuf hft_buffer;
+ static int hft_locked = 0;
+
+ /* What we're doing here:
+ Get a new hft by opening /dev/hft; this new hft will be inserted at the
+ head of the hft list, making the previously active hft the last one
+ in the list. We need this new hft to get a handle on the hft device,
+ so that we can use the nec. ioctls. We let it create a new one for us,
+ because there is no reliable way (without grunging through kernel
+ memory) to determine which hft the X server is running on.
+
+ Once we've got the hft, "hide" all the screens except the last one,
+ which is the one which was active when the routine was called,
+ which should be the one that the X server is running on.
+ Then, close the hft we got, so it drops out of the ring, and the
+ only unhidden hft becomes the active (visible) one.
+
+ To "unhide" the screens, we again get a new hft to get a handle on the
+ device, and proceed to unhide all the screens that weren't hidden when
+ we started; since we unhide the last terminal in the ring last, it will
+ become the active (visible) one.
+ */
+
+ static int
+ find_valid_hft()
+ {
+ int i, fd;
+
+ if ((fd = open("/dev/hft",O_RDONLY,0)) < 0) {
+ perror("opening hft");
+ return;
+ }
+ return fd;
+ }
+
+
+ void
+ enable_hft_hotkey()
+ {
+ int i,fd;
+ struct hftsmgrcmd hft_cmd;
+
+ if (!hft_locked)
+ return;
+
+ if ((fd = find_valid_hft()) < 0) {
+ perror("opening hft");
+ return;
+ }
+
+ for (i=0; i<orig_hft_state.hf_numvts; i++) {
+ if (orig_hft_state.hf_vtinfo[i].hf_vtstate & HFVTHIDDEN)
+ continue;
+ hft_cmd.hf_vtid = orig_hft_state.hf_vtinfo[i].hf_vtid;
+ hft_cmd.hf_cmd = SMUNHIDE;
+
+ if (ioctl(fd, HFTCSMGR, &hft_cmd) != 0)
+ perror("ioctl: HFTCSMGR failed");
+
+ }
+ close(fd);
+ }
+
+ void
+ disable_hft_hotkey()
+ {
+ int fd, i;
+ struct hftsmgrcmd hft_cmd;
+
+ hft_buffer.hf_bufp = (char *) &orig_hft_state;
+ hft_buffer.hf_buflen = sizeof(struct hftqstat);
+
+ if ((fd = find_valid_hft()) < 0) {
+ perror("opening hft");
+ return;
+ }
+
+ if (ioctl(fd, HFTQSMGR, &hft_buffer) != 0) {
+ perror("ioctl: HFTQSMGR failed");
+ close(fd);
+ return;
+ }
+
+ for (i=0; i<(orig_hft_state.hf_numvts -1); i++) {
+ hft_cmd.hf_vtid = orig_hft_state.hf_vtinfo[i].hf_vtid;
+ hft_cmd.hf_cmd = SMHIDE;
+
+ if (ioctl(fd, HFTCSMGR, &hft_cmd) != 0)
+ perror("ioctl: HFTCSMGR failed");
+
+ }
+ close(fd);
+ hft_locked = 1;
+ }