--- sjog-0.5.orig/Makefile.in
+++ sjog-0.5/Makefile.in
@@ -69,7 +69,7 @@
 PACKAGE_PIXMAPS_DIR = @PACKAGE_PIXMAPS_DIR@
 VERSION = @VERSION@
 
-SUBDIRS = src setbrightness images
+SUBDIRS = src images
 
 MAINTAINERCLEANFILES = Makefile.in configure aclocal.m4 config.guess                        install-sh ltconfig ltmain.sh missing mkinstalldirs                        stamp-h.in config.h.in
 
--- sjog-0.5.orig/configure
+++ sjog-0.5/configure
@@ -3054,7 +3054,6 @@
            Makefile
            src/Makefile
            images/Makefile
-                      setbrightness/Makefile
            sjog.spec
            config.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
 EOF
@@ -3156,7 +3155,6 @@
 CONFIG_FILES=\${CONFIG_FILES-"Makefile
            src/Makefile
            images/Makefile
-                      setbrightness/Makefile
            sjog.spec
           "}
 EOF
--- sjog-0.5.orig/sjogrc
+++ sjog-0.5/sjogrc
@@ -4,15 +4,17 @@
 # The command is the path of the program to launch when the item is clicked or
 # one of the 2 special keyword (brightness | volume) that will launch a setting
 # window. And as you can see you can put comments on line beginning with a #.
+# The redo keyword reruns the last command.
 #
 
 Brightness  brightness
 Volume      volume
 X-Chat      xchat
-Netscape    netscape
+Mozilla     mozilla
 KCalc       kcalc
 Konsole     konsole
 Eterm       Eterm
 Konqueror   kfmclient openProfile webbrowsing
 Xmms        xmms
+Popdown     echo
 
--- sjog-0.5.orig/src/Makefile.in
+++ sjog-0.5/src/Makefile.in
@@ -1,6 +1,6 @@
-# Makefile.in generated automatically by automake 1.4 from Makefile.am
+# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
 
-# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -74,10 +74,10 @@
 
 bin_PROGRAMS = sjog
 
-sjog_SOURCES =                  sjog.c                 sjog.h                 sjog_config.c                 sjog_config.h                 sjog_spic.c                 sjog_spic.h                 sjog_sonypi.h                 sjog_sonypi.c                 sjog_list.c                 sjog_list.h                 sjog_list_callbacks.c                 sjog_list_callbacks.h                 sjog_brightness.c                 sjog_brightness.h                 sjog_brightness_callbacks.c                 sjog_brightness_callbacks.h                 sjog_volume.c                 sjog_volume.h                 sjog_volume_callbacks.c                 sjog_volume_callbacks.h                 sjog_scroll.c                 sjog_scroll.h
+sjog_SOURCES =                  sjog.c                 sjog.h                 sjog_config.c                 sjog_config.h                 sjog_spic.c                 sjog_spic.h                 sjog_sonypi.h                 sjog_sonypi.c                 sjog_list.c                 sjog_list.h                 sjog_list_callbacks.c                 sjog_list_callbacks.h                 sjog_brightness.c                 sjog_brightness.h                 sjog_brightness_callbacks.c                 sjog_brightness_callbacks.h                 sjog_volume.c                 sjog_volume.h                 sjog_volume_callbacks.c                 sjog_volume_callbacks.h                 sjog_scroll.c                 sjog_scroll.h 		sjog_ext.c
 
 
-sjog_LDADD = @GTK_LIBS@ @GLIB_LIBS@ @X_LIBS@
+sjog_LDADD = @GTK_LIBS@ @GLIB_LIBS@ @X_LIBS@ -lXxf86vm -lXext
 
 MAINTAINERCLEANFILES = Makefile.in Makefile
 mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
@@ -97,7 +97,7 @@
 sjog_OBJECTS =  sjog.o sjog_config.o sjog_spic.o sjog_sonypi.o \
 sjog_list.o sjog_list_callbacks.o sjog_brightness.o \
 sjog_brightness_callbacks.o sjog_volume.o sjog_volume_callbacks.o \
-sjog_scroll.o
+sjog_scroll.o sjog_ext.o
 sjog_DEPENDENCIES = 
 sjog_LDFLAGS = 
 CFLAGS = @CFLAGS@
@@ -210,30 +210,13 @@
 	@for file in $(DISTFILES); do \
 	  d=$(srcdir); \
 	  if test -d $$d/$$file; then \
-	    cp -pr $$/$$file $(distdir)/$$file; \
+	    cp -pr $$d/$$file $(distdir)/$$file; \
 	  else \
 	    test -f $(distdir)/$$file \
 	    || ln $$d/$$file $(distdir)/$$file 2> /dev/null \
 	    || cp -p $$d/$$file $(distdir)/$$file || :; \
 	  fi; \
 	done
-sjog.o: sjog.c sjog.h sjog_config.h sjog_list.h sjog_brightness.h \
-	sjog_volume.h sjog_scroll.h sjog_spic.h sjog_sonypi.h
-sjog_brightness.o: sjog_brightness.c sjog.h sjog_brightness.h \
-	sjog_brightness_callbacks.h
-sjog_brightness_callbacks.o: sjog_brightness_callbacks.c sjog.h \
-	sjog_brightness.h
-sjog_config.o: sjog_config.c sjog.h sjog_config.h sjog_list.h
-sjog_list.o: sjog_list.c sjog.h sjog_list.h sjog_list_callbacks.h
-sjog_list_callbacks.o: sjog_list_callbacks.c sjog_list_callbacks.h \
-	sjog_list.h sjog.h
-sjog_scroll.o: sjog_scroll.c sjog_scroll.h sjog.h
-sjog_sonypi.o: sjog_sonypi.c sjog_sonypi.h sjog.h
-sjog_spic.o: sjog_spic.c sjog_spic.h sjog.h
-sjog_volume.o: sjog_volume.c sjog.h sjog_volume.h \
-	sjog_volume_callbacks.h
-sjog_volume_callbacks.o: sjog_volume_callbacks.c sjog.h sjog_volume.h
-
 info-am:
 info: info-am
 dvi-am:
--- sjog-0.5.orig/src/Makefile.am
+++ sjog-0.5/src/Makefile.am
@@ -28,8 +28,9 @@
                 sjog_volume_callbacks.c \
                 sjog_volume_callbacks.h \
                 sjog_scroll.c \
-                sjog_scroll.h
+                sjog_scroll.h \
+		sjog_ext.c
 
-sjog_LDADD = @GTK_LIBS@ @GLIB_LIBS@ @X_LIBS@
+sjog_LDADD = @GTK_LIBS@ @GLIB_LIBS@ @X_LIBS@ -lXxf86vm -lXext
 
 MAINTAINERCLEANFILES = Makefile.in Makefile
--- sjog-0.5.orig/src/sjog.c
+++ sjog-0.5/src/sjog.c
@@ -13,6 +13,8 @@
 gboolean useSpic = FALSE;
 gboolean mousewheelFakeKeys = FALSE;
 gboolean centerWindow = TRUE;
+gboolean startMenu = TRUE;
+gboolean resetMenu = FALSE;
 
 /* -------------------------------------------------------------------------- */
 
@@ -109,6 +111,12 @@
       else if (!strcmp(argv[i], "-nc") || !strcmp(argv[i], "--no-center"))
          centerWindow = FALSE;
 
+      else if (!strcmp(argv[i], "-ns") || !strcmp(argv[i], "--no-startmenu"))
+         startMenu = FALSE;
+ 
+      else if (!strcmp(argv[i], "-r") || !strcmp(argv[i], "--reset-menu"))
+	 resetMenu = TRUE;
+      
       /* usage information */
       else
       {
@@ -129,6 +137,12 @@
                 "  -s ,  --spic                    "
                 "use the legacy spic driver\n"
 
+		"  -ns,  --no-startmenu            "
+		"do not display the menu on startup\n"
+
+		"  -r,   --reset-menu              "
+		"reset scroll bar to top of menu each time\n"
+		
                 "  -h ,  --help                    "
                 "display this message\n" "\n",
                 argv[0]);
@@ -169,7 +183,10 @@
    }
 
    /* show initial window */
-   sjog_list_show();
+   if (startMenu)
+      sjog_list_show();
+   else
+      sjog_set_mode(SJOG_MODE_SCROLL);
 
    /* main event loop */
    gtk_main();
--- sjog-0.5.orig/src/sjog.h
+++ sjog-0.5/src/sjog.h
@@ -27,6 +27,7 @@
 extern gboolean reverseBrightness;
 extern gboolean useSpic;
 extern gboolean mousewheelFakeKeys;
+extern gboolean resetMenu;
 
 /* modes */
 guint currentMode;
--- sjog-0.5.orig/src/sjog_sonypi.h
+++ sjog-0.5/src/sjog_sonypi.h
@@ -35,6 +35,12 @@
 #define SONYPI_EVENT_FNKEY_B            30
 #define SONYPI_EVENT_BLUETOOTH_PRESSED      31
 
+#define SONYPI_EVENT_BACK_PRESSED		35
+#define SONYPI_EVENT_LID_CLOSED			36
+#define SONYPI_EVENT_LID_OPENED			37
+#define SONYPI_EVENT_FNKEY_ZOOM			40
+#define SONYPI_EVENT_FNKEY_THUMBPHRASE		41
+
 gint sonypi_fd;
 fd_set sonypi_fdset;
 
--- sjog-0.5.orig/src/sjog_sonypi.c
+++ sjog-0.5/src/sjog_sonypi.c
@@ -106,6 +106,24 @@
            case SONYPI_EVENT_BLUETOOTH_PRESSED:
            break;
          */
+    case SONYPI_EVENT_BACK_PRESSED:
+      sjog_button_fakepress(1);      
+      //fprintf(stderr, "back pressed\n");
+      break;
+    case SONYPI_EVENT_LID_OPENED:
+      fprintf(stderr, "lid opened\n");
+      break;
+    case SONYPI_EVENT_LID_CLOSED:
+      fprintf(stderr, "lid close\n");
+      break;
+    case SONYPI_EVENT_FNKEY_THUMBPHRASE:
+      sjog_button_fakepress(2);
+      //fprintf(stderr, "thumb pressed\n");
+      break;
+    case SONYPI_EVENT_FNKEY_ZOOM:
+      sjog_zoom_handler();
+      //fprintf(stderr, "zoom pressed\n");
+      break;
    }
 
 }
--- sjog-0.5.orig/src/sjog_list.c
+++ sjog-0.5/src/sjog_list.c
@@ -96,6 +96,12 @@
       sjog_list_set_list(list);
    }
 
+   if (resetMenu == TRUE)
+   {
+   	/* select the 1st item */
+	gtk_clist_select_row(GTK_CLIST(cmdListUI), 0, 0);
+   }
+
    if (!GTK_WIDGET_VISIBLE(listWindow))
    {
       /* change the mode */
@@ -181,6 +187,7 @@
 sjog_list_exec_cmd()
 {
    sjog_cmd_t *sjog_cmd;     /* sjog_cmd to execute */
+   static sjog_cmd_t *prev_cmd = NULL; /* previously executed command */
    GList *list_element;      /* glib element that contains the cmd */
    gchar *cmd;               /* cmd string to execute */
 
@@ -199,6 +206,21 @@
            sjog_cmd->path);
 #endif
 
+   /* redo allows execution of the last executed command  */
+   if (strcmp(sjog_cmd->path, "redo") == 0) {
+      if (prev_cmd == NULL) /* no previous command */
+	 return;
+      sjog_cmd = prev_cmd;
+   }
+   else {
+      prev_cmd = sjog_cmd;
+   }
+
+   /* hide does nothing and makes the menu disappear */
+   if (strcmp(sjog_cmd->path, "hide") == 0) {
+     return;
+   }
+
    /* enter brightness mode */
    if (strcmp(sjog_cmd->path, "brightness") == 0)
    {
--- sjog-0.5.orig/src/sjog_brightness.c
+++ sjog-0.5/src/sjog_brightness.c
@@ -72,7 +72,7 @@
    int brightness = 50;
    char buf[10];
 
-   if ((pin = popen("setbrightness --read", "r")))
+   if ((pin = popen("spicctrl -B", "r")))
    {
       if (fgets(buf, sizeof(buf) - 1, pin) != NULL)
       {
@@ -115,7 +115,7 @@
    brightness = (brightness < 0 ? 0 : (brightness > 255 ? 255 : brightness));
 
    /* setup the command line, setbrightness must be in PATH */
-   cmd = g_strdup_printf("setbrightness %d", brightness);
+   cmd = g_strdup_printf("spicctrl -b %d", brightness);
 
 #ifdef DEBUG
    fprintf(stdout, "sjog_set_brightness: cmd=%s\n", cmd);
--- sjog-0.5.orig/src/sjog_scroll.c
+++ sjog-0.5/src/sjog_scroll.c
@@ -166,3 +166,21 @@
    XTestGrabControl(disp, False);
 
 }
+
+
+/* Added for U1 */
+void
+sjog_button_fakepress(int no)
+{
+   if (disp == NULL)
+      sjog_scroll_init();
+
+   XTestGrabControl(disp, True);
+
+   XTestFakeButtonEvent(disp, no, True, CurrentTime);
+   XTestFakeButtonEvent(disp, no, False, 30);
+
+   XSync(disp, False);
+   XTestGrabControl(disp, False);
+
+}
--- sjog-0.5.orig/src/sjog_ext.c
+++ sjog-0.5/src/sjog_ext.c
@@ -0,0 +1,22 @@
+#include <X11/X.h>
+#include <X11/Xlib.h>
+#include <X11/extensions/xf86vmode.h>
+
+#include <stdio.h>
+
+extern Display *disp;        /* X11 display sjog is running on */
+
+sjog_zoom_handler()
+{
+   Display * d;
+   int ret;
+   
+   d = XOpenDisplay(":0");
+   if (!d) {
+      fprintf(stderr, "zoom: cant open display\n");
+      return -1;
+   }
+   ret = XF86VidModeSelectNextMode(d, 0);
+   fprintf(stderr, "zoom: mode=%d\n", ret);
+   XCloseDisplay(d);
+}
--- sjog-0.5.orig/debian/README.Debian
+++ sjog-0.5/debian/README.Debian
@@ -0,0 +1,31 @@
+This is the Debianized version of S-Jog.
+
+The original version of S-Jog uses its own setbrightness utility to
+set the LCD backlight brightness.
+
+The Debian packaged version uses spicctrl, which is packaged by
+Joey Hess <joeyh@debian.org>.
+
+S-Jog uses the sonypi interface provided by /dev/sonypi and the linux
+kernel. Build your kernel with CONFIG_SONYPI set to make the program work.
+
+You can create /dev/sonypi by running, as root:
+
+	mknod /dev/sonypi c 10 63
+
+See also the README.Debian file of the spicctrl package at
+`/usr/share/doc/spicctrl/README.Debian'.
+
+This package is based on S-Jog 0.5 with the following add-ons:
+- --no-startmenu option.
+- --reset-menu option.
+- redo keyword.
+- hide keyword.
+- sjog man page.
+
+Those features will be available in the upcoming version. See:
+
+  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=128234&repeatmerged=yes
+
+-- 
+Hugo Haas <hugo@debian.org> - 21 January 2001
--- sjog-0.5.orig/debian/changelog
+++ sjog-0.5/debian/changelog
@@ -0,0 +1,67 @@
+sjog (0.5-9) unstable; urgency=low
+
+  * fill this blank 
+
+ -- Francois Gurin <matrix@nancy.spic.net>  Mon, 26 Aug 2002 05:26:29 -0400
+
+sjog (0.5-8) unstable; urgency=low
+
+  * u1 support 
+
+ -- Francois Gurin <matrix@nancy.spic.net>  Mon, 26 Aug 2002 05:25:17 -0400
+
+sjog (0.5-7) unstable; urgency=low
+
+  * Removed previous patch, wrong fix: breaks mouse wheel. Reopened #146566.
+
+ -- Hugo Haas <hugo@debian.org>  Sun, 23 Jun 2002 08:40:13 -0400
+
+sjog (0.5-6) unstable; urgency=low
+
+  * Applied patch from Mike Hommey <mh@glandium.org> fixing a crash
+    (Closes: #146566).
+
+ -- Hugo Haas <hugo@debian.org>  Mon, 17 Jun 2002 12:45:02 -0400
+
+sjog (0.5-5) unstable; urgency=low
+
+  * Changed priority to extra.
+
+ -- Hugo Haas <hugo@debian.org>  Mon, 21 Jan 2002 16:52:38 -0500
+
+sjog (0.5-4) unstable; urgency=low
+
+  * Added a hide keyword which hides the menu as requested in #128234.
+
+ -- Hugo Haas <hugo@debian.org>  Sun, 13 Jan 2002 13:09:20 -0500
+
+sjog (0.5-3) unstable; urgency=low
+
+  * Replacing Netscape by Mozilla in sjogrc as requested in #128234.
+  * Added a pop down entry by Joey Hess <joeyh@debian.org> as requested
+    in #128234.
+  * Added example of sjogrc incluing XMMS control from Joey Hess
+    <joeyh@debian.org> sent in #128234.
+  * Applied no-show-on-startup patch from Joey Hess <joeyh@debian.org> as
+    submitted in #128234.
+  * Applied reset-menu patch from Joey Hess <joeyh@debian.org> as
+    submitted in #128234.
+  * Applied redo patch from Joey Hess <joeyh@debian.org> as
+    submitted in #128234.
+  * Modified man page to include new options.
+  * Documented all that in README.Debian.
+
+ -- Hugo Haas <hugo@debian.org>  Sat, 12 Jan 2002 22:23:25 -0500
+
+sjog (0.5-2) unstable; urgency=low
+
+  * Architecture is i386 only.
+  * Using DH_COMPAT=3 in debian/rules.
+
+ -- Hugo Haas <hugo@debian.org>  Mon, 31 Dec 2001 11:56:42 -0500
+
+sjog (0.5-1) unstable; urgency=low
+
+  * Initial Release (Closes: #126798).
+
+ -- Hugo Haas <hugo@debian.org>  Fri, 28 Dec 2001 15:44:30 -0500
--- sjog-0.5.orig/debian/control
+++ sjog-0.5/debian/control
@@ -0,0 +1,19 @@
+Source: sjog
+Section: x11
+Priority: extra
+Maintainer: Hugo Haas <hugo@debian.org>
+Standards-Version: 3.5.6.0
+Build-Depends: autoconf (>= 2.53-2), automake (>= 1.4-p4-1.1), debhelper (>= 3), libglib1.2-dev (>= 1.2.10-4), libgtk1.2-dev (>= 1.2.10-11), xlibs-dev (>= 4.1.0-16), xutils (>= 4.1.0-16)
+
+Package: sjog
+Architecture: i386
+Depends: ${shlibs:Depends}, spicctrl
+Description: A program to use the "Jog Dial" on Sony Vaio Laptops
+ S-Jog is a program that uses the Sony Vaio laptops Jog Wheel to do various
+ things:
+     * Launch applications
+     * Adjust screen brightness
+     * Adjust volume
+     * Act like a mousewheel
+ S-Jog pops up when you click the Jog Wheel then disappears after 3 seconds
+ of idle time. The mousewheel feature is turned on when S-Jog is hidden.
--- sjog-0.5.orig/debian/copyright
+++ sjog-0.5/debian/copyright
@@ -0,0 +1,15 @@
+This is the Debian package of S-Jog:
+
+   http://sjog.sourceforge.net/
+
+This package was put together by Hugo Haas <hugo@debian.org> with
+sources obtained from:
+
+   http://sourceforge.net/project/showfiles.php?group_id=24012
+
+This software is available under the GNU General Public License. On this
+system, the complete text of the GNU General Public License (GPL) version
+2 can be found at `/usr/share/common-licenses/GPL'.
+
+-- 
+Hugo Haas <hugo@debian.org>
--- sjog-0.5.orig/debian/rules
+++ sjog-0.5/debian/rules
@@ -0,0 +1,74 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses debhelper.
+# This file is public domain software, originally written by Joey Hess. 
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+# This is the debhelper compatibility version to use.
+export DH_COMPAT=3
+
+build: build-stamp
+build-stamp:
+	dh_testdir
+
+	./configure --prefix=/usr --sysconfdir=/etc
+	$(MAKE)
+
+	touch build-stamp
+
+clean:
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp
+
+	# Add here commands to clean up after the build process.
+	-$(MAKE) distclean
+
+	dh_clean
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_clean -k
+	dh_installdirs
+
+	$(MAKE) prefix=`pwd`/debian/sjog/usr sysconfdir=`pwd`/debian/sjog/etc install
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+#	dh_testversion
+	dh_testdir
+	dh_testroot
+#	dh_installdebconf	
+	dh_installdocs AUTHORS README TODO
+	dh_installexamples debian/sjogrc.xmms
+#	dh_installmenu
+#	dh_installemacsen
+#	dh_installpam
+#	dh_installmime
+#	dh_installinit
+#	dh_installcron
+	dh_installman debian/sjog.1
+#	dh_installinfo
+#	dh_undocumented
+	dh_installchangelogs
+	dh_link
+	dh_strip
+	dh_compress
+	dh_fixperms
+#	dh_suidregister
+#	dh_makeshlibs
+	dh_installdeb
+#	dh_perl
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
--- sjog-0.5.orig/debian/sjogrc.xmms
+++ sjog-0.5/debian/sjogrc.xmms
@@ -0,0 +1,11 @@
+# Configuration file with XMMS control
+# by Joey Hess <joeyh@debian.org>
+
+Volume          volume
+Xmms            xmms -p
+"    Next"      xmms -f
+"    Prev"      xmms -r
+Xterm           xterm
+Brightness      brightness
+Popdown         echo
+
--- sjog-0.5.orig/debian/sjog.1
+++ sjog-0.5/debian/sjog.1
@@ -0,0 +1,81 @@
+.TH SJOG 1 "13 January 2002"
+.SH NAME
+sjog \- Sony Vaio Jog Dial Control Utility
+.SH SYNOPSIS
+.B sjog
+[OPTIONS]
+.SH DESCRIPTION
+.PP
+S-Jog is utility that can use the Sony Programmable I/O Control
+device (SPIC), which is part of Sony Vaio's, to do various things:
+.TP
+Launch applications
+.TP
+Adjust screen brightness
+.TP
+Adjust volume
+.TP
+Act like a mouse wheel
+.P
+S-Jog pops up when you click the Jog Wheel then disappears after 3 seconds
+of idle time. The mouse wheel feature is turned on when S-Jog is hidden.
+
+.SH OPTIONS
+.TP
+.B \-rb, --reverse-brightness
+Reverse brightness setting behavior.
+.TP
+.B \-fk, --fake-keys
+Send page up/down instead of buttons 4/5.
+.TP
+.B \-nc, --no-center
+Do not center windows on screen.
+.TP
+.B \-s, --spic
+Use the legacy spic driver.
+.B \-ns, --no-startmenu
+Do not display the menu on startup.
+.B \-r,  --reset-menu
+Reset scroll bar to top of menu each time
+.TP
+.B \-h, --help
+Display a help message.
+.SH CONFIGURATION
+S-Jog reads its configuration from
+.I /etc/sjogrc
+or
+.I $HOME/.sjogrc
+if it exists.
+
+An entry is defined by a name and a command. The name can contain
+spaces if it is put between double-quotes ("name").
+
+The command is the path of the program to launch when the item is
+clicked or one of the 4 special keywords:
+.I brightness 
+and
+.I volume
+will launch a setting window for the screen brightness and the
+speakers' volume,
+.I redo
+will rerun the last command launched, and
+.I hide
+does nothing and makes the menu disappear.
+
+Lines beginning with a # are comment.
+
+.SH FILES
+.TP
+.B /etc/sjogrc, $HOME/.sjogrc
+Configuration files read by sjog at startup. See
+.I /etc/sjogrc
+and
+.I /etc/share/doc/sjog/examples
+for examples.
+.TP 
+.B /dev/sonypi
+sonypi interface device file. You must be able to read the file to use
+this program.
+.SH AUTHOR
+S-Jog was written by Sylvain Gil <sjog@tootella.org>, and 
+this man page was written by Hugo Haas <hugo@debian.org>.
--- sjog-0.5.orig/debian/redo-joeyh.patch
+++ sjog-0.5/debian/redo-joeyh.patch
@@ -0,0 +1,27 @@
+--- ../../old/sjog-0.5/src/sjog_list.c	Sun Aug 12 11:31:27 2001
++++ sjog_list.c	Tue Jan  8 01:09:50 2002
+@@ -181,6 +187,7 @@
+ sjog_list_exec_cmd()
+ {
+    sjog_cmd_t *sjog_cmd;     /* sjog_cmd to execute */
++   static sjog_cmd_t *prev_cmd = NULL; /* previously executed command */
+    GList *list_element;      /* glib element that contains the cmd */
+    gchar *cmd;               /* cmd string to execute */
+ 
+@@ -199,6 +206,16 @@
+            sjog_cmd->path);
+ #endif
+ 
++   /* redo allows execution of the last executed command  */
++   if (strcmp(sjog_cmd->path, "redo") == 0) {
++      if (prev_cmd == NULL) /* no previous command */
++	 return;
++      sjog_cmd = prev_cmd;
++   }
++   else {
++      prev_cmd = sjog_cmd;
++   }
++      
+    /* enter brightness mode */
+    if (strcmp(sjog_cmd->path, "brightness") == 0)
+    {
--- sjog-0.5.orig/debian/no-show-on-startup-joeyh.patch
+++ sjog-0.5/debian/no-show-on-startup-joeyh.patch
@@ -0,0 +1,42 @@
+--- ../../old/sjog-0.5/src/sjog.c	Mon Aug 13 15:52:02 2001
++++ sjog.c	Tue Jan  8 00:32:41 2002
+@@ -13,6 +13,7 @@
+ gboolean useSpic = FALSE;
+ gboolean mousewheelFakeKeys = FALSE;
+ gboolean centerWindow = TRUE;
++gboolean startMenu = TRUE;
+ 
+ /* -------------------------------------------------------------------------- */
+ 
+@@ -109,6 +110,9 @@
+       else if (!strcmp(argv[i], "-nc") || !strcmp(argv[i], "--no-center"))
+          centerWindow = FALSE;
+ 
++      else if (!strcmp(argv[i], "-ns") || !strcmp(argv[i], "--no-startmenu"))
++         startMenu = FALSE;
++      
+       /* usage information */
+       else
+       {
+@@ -129,6 +133,9 @@
+                 "  -s ,  --spic                    "
+                 "use the legacy spic driver\n"
+ 
++		"  -ns,  --no-startmenu            "
++		"do not display the menu on startup\n"
++		
+                 "  -h ,  --help                    "
+                 "display this message\n" "\n",
+                 argv[0]);
+@@ -169,7 +176,10 @@
+    }
+ 
+    /* show initial window */
+-   sjog_list_show();
++   if (startMenu)
++      sjog_list_show();
++   else
++      sjog_set_mode(SJOG_MODE_SCROLL);
+ 
+    /* main event loop */
+    gtk_main();
--- sjog-0.5.orig/debian/reset-menu-joeyh.patch
+++ sjog-0.5/debian/reset-menu-joeyh.patch
@@ -0,0 +1,55 @@
+--- ../../old/sjog-0.5/src/sjog.c	Tue Jan  8 01:02:44 2002
++++ sjog.c	Tue Jan  8 00:58:31 2002
+@@ -14,6 +14,7 @@
+ gboolean mousewheelFakeKeys = FALSE;
+ gboolean centerWindow = TRUE;
+ gboolean startMenu = TRUE;
++gboolean resetMenu = FALSE;
+ 
+ /* -------------------------------------------------------------------------- */
+ 
+@@ -112,6 +113,9 @@
+ 
+       else if (!strcmp(argv[i], "-ns") || !strcmp(argv[i], "--no-startmenu"))
+          startMenu = FALSE;
++ 
++      else if (!strcmp(argv[i], "-r") || !strcmp(argv[i], "--reset-menu"))
++	 resetMenu = TRUE;
+       
+       /* usage information */
+       else
+@@ -135,6 +139,9 @@
+ 
+ 		"  -ns,  --no-startmenu            "
+ 		"do not display the menu on startup\n"
++
++		"  -r,   --reset-menu              "
++		"reset scroll bar to top of menu each time\n"
+ 		
+                 "  -h ,  --help                    "
+                 "display this message\n" "\n",
+--- ../../old/sjog-0.5/src/sjog_list.c	Sun Aug 12 11:31:27 2001
++++ sjog_list.c	Tue Jan  8 01:00:50 2002
+@@ -96,6 +96,12 @@
+       sjog_list_set_list(list);
+    }
+ 
++   if (resetMenu == TRUE)
++   {
++   	/* select the 1st item */
++	gtk_clist_select_row(GTK_CLIST(cmdListUI), 0, 0);
++   }
++
+    if (!GTK_WIDGET_VISIBLE(listWindow))
+    {
+       /* change the mode */
+--- ../../old/sjog-0.5/src/sjog.h	Sun Aug 12 11:45:31 2001
++++ sjog.h	Tue Jan  8 00:51:45 2002
+@@ -27,6 +27,7 @@
+ extern gboolean reverseBrightness;
+ extern gboolean useSpic;
+ extern gboolean mousewheelFakeKeys;
++extern gboolean resetMenu;
+ 
+ /* modes */
+ guint currentMode;
--- sjog-0.5.orig/debian/hide-hugo.patch
+++ sjog-0.5/debian/hide-hugo.patch
@@ -0,0 +1,17 @@
+diff -ur /tmp/sjog-0.5/src/sjog_list.c src/sjog_list.c
+--- /tmp/sjog-0.5/src/sjog_list.c	Sun Jan 13 13:03:19 2002
++++ src/sjog_list.c	Sun Jan 13 13:07:20 2002
+@@ -215,7 +215,12 @@
+    else {
+       prev_cmd = sjog_cmd;
+    }
+-      
++
++   /* hide does nothing and makes the menu disappear */
++   if (strcmp(sjog_cmd->path, "hide") == 0) {
++     return;
++   }
++
+    /* enter brightness mode */
+    if (strcmp(sjog_cmd->path, "brightness") == 0)
+    {
