Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 94661 Details for
Bug 144488
x11-misc/xscreensaver-5.00 gtk2-lock patch
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
xscreensaver-5.00-gtk2-lock.patch
xscreensaver-5.00-gtk2-lock.patch (text/plain), 38.71 KB, created by
Ahmed Ammar (RETIRED)
on 2006-08-19 23:07:26 UTC
(
hide
)
Description:
xscreensaver-5.00-gtk2-lock.patch
Filename:
MIME Type:
Creator:
Ahmed Ammar (RETIRED)
Created:
2006-08-19 23:07:26 UTC
Size:
38.71 KB
patch
obsolete
>--- xscreensaver-5.00/driver/lock.c 2006-05-18 00:35:54.000000000 +0100 >+++ xscreensaver-5.00.mine/driver/lock.c 2006-08-20 05:43:15.000000000 +0100 >@@ -23,6 +23,8 @@ > #include <X11/Xos.h> /* for time() */ > #include <time.h> > #include <sys/time.h> >+#include <errno.h> >+#include <signal.h> > #include "xscreensaver.h" > #include "resources.h" > >@@ -156,6 +158,15 @@ > Bool login_button_enabled_p; > > Pixmap save_under; >+ >+#ifdef HAVE_XSCREENSAVER_LOCK >+ /* extern passwd dialog stuff */ >+ XtInputId stdout_input_id; >+ int stdin_fd; >+ int stdout_fd; >+ Bool got_windowid; >+ FILE *input_file; >+#endif > }; > > static void draw_passwd_window (saver_info *si); >@@ -165,6 +176,175 @@ > static void undo_vp_motion (saver_info *si); > static void handle_passwd_button (saver_info *si, XEvent *event); > >+extern Atom XA_UNLOCK_RATIO; >+ >+#if defined (HAVE_XF86VMODE) || defined (HAVE_XSCREENSAVER_LOCK) >+static Bool vp_got_error = False; >+static int >+ignore_all_errors_ehandler (Display *dpy, XErrorEvent *error) >+{ >+ vp_got_error = True; >+ return 0; >+} >+#endif /* defined (HAVE_XF86VMODE) || defined (HAVE_XSCREENSAVER_LOCK) */ >+#ifdef HAVE_XSCREENSAVER_LOCK >+static int >+sane_dup2 (int fd1, int fd2) >+{ >+ int ret; >+ >+ retry: >+ ret = dup2 (fd1, fd2); >+ if (ret < 0 && errno == EINTR) >+ goto retry; >+ >+ return ret; >+} >+ >+static int >+close_and_invalidate (int *fd) >+{ >+ int ret; >+ >+ ret = close (*fd); >+ *fd = -1; >+ >+ return ret; >+} >+ >+static void >+handle_passwd_input (XtPointer data, int *fd, XtInputId *id) >+{ >+ saver_info *si = (saver_info *)data; >+ saver_preferences *p = &si->prefs; >+ char buffer[1024]; >+ char *s; >+ >+ if (si->prefs.verbose_p) >+ fprintf (stderr, "passwd input handler\n"); >+ >+ s = fgets (buffer, sizeof (buffer), si->pw_data->input_file); >+ if (!s) >+ { >+ if (si->prefs.verbose_p) >+ { >+ fprintf (stderr, "done reading...\n"); >+ fprintf (stderr, "removing input handler...\n"); >+ } >+ XtRemoveInput (*id); >+ si->pw_data->stdout_input_id = 0; >+ >+ if (si->pw_data->state == pw_read) >+ si->pw_data->state = pw_null; >+ >+ return; >+ } >+ >+ if (si->pw_data->got_windowid) >+ { >+ char *nl; >+ if (si->prefs.verbose_p) >+ fprintf (stderr, "got a password\n"); >+ nl = strchr (s, '\n'); >+ if (nl) >+ *nl = '\0'; >+ if (passwd_valid_p (s, p->verbose_p)) >+ si->pw_data->state = pw_ok; >+ else >+ si->pw_data->state = pw_fail; >+ } >+ else >+ { >+ Window window = strtoul (s, NULL, 0); >+ /* FIXME: what to revert to? */ >+ XSetInputFocus (si->dpy, window, RevertToParent, CurrentTime); >+ si->pw_data->got_windowid = True; >+ si->passwd_dialog = window; >+ if (si->prefs.verbose_p) >+ fprintf (stderr, "tried to focus: %lu\n", (unsigned long)window); >+ } >+} >+ >+/* returns successful fork/exec */ >+static Bool >+spawn_external_passwd_process (saver_info *si, passwd_dialog_data *pw) >+{ >+ saver_preferences *p = &si->prefs; >+ pid_t forked; >+ const char *command = LOCKDIR "/xscreensaver-lock"; >+ int stdin_pipe[2] = { -1, -1 }; >+ int stdout_pipe[2] = { -1, -1 }; >+ >+ si->passwd_pid = 0; >+ pw->stdin_fd = pw->stdout_fd = -1; >+ pw->got_windowid = False; >+ >+ if (pipe (stdin_pipe) < 0) >+ return False; >+ >+ if (pipe (stdout_pipe) < 0) >+ { >+ close_and_invalidate (&stdin_pipe[0]); >+ close_and_invalidate (&stdin_pipe[1]); >+ return False; >+ } >+ switch ((int) (forked = fork ())) >+ { >+ case -1: >+ fprintf (stderr, "%s: ", blurb ()); >+ perror ("couldn't fork"); >+ >+ close_and_invalidate (&stdin_pipe[0]); >+ close_and_invalidate (&stdin_pipe[1]); >+ close_and_invalidate (&stdout_pipe[0]); >+ close_and_invalidate (&stdout_pipe[1]); >+ >+ return False; >+ >+ case 0: >+ close (ConnectionNumber (si->dpy)); /* close display fd */ >+ /* limit_subproc_memory (p->inferior_memory_limit, p->verbose_p); */ >+ /* hack_subproc_environment (ssi); */ /* FIX $DISPLAY */ >+ >+ if (p->verbose_p) >+ fprintf (stderr, "%s: spawning \"%s\" in pid %lu.\n", >+ blurb(), command, (unsigned long) getpid ()); >+ >+ close_and_invalidate (&stdin_pipe[1]); >+ close_and_invalidate (&stdout_pipe[0]); >+ >+ sane_dup2 (stdin_pipe[0], 0); >+ sane_dup2 (stdout_pipe[1], 1); >+ >+ exec_command (p->shell, command, 0); >+ /* print_path_error (command); */ >+ fprintf (stderr, "%s: couldn't exec: %s\n", >+ blurb (), command); >+ abort (); >+ >+ default: >+ >+ close_and_invalidate (&stdin_pipe[0]); >+ close_and_invalidate (&stdout_pipe[1]); >+ >+ pw->stdin_fd = stdin_pipe[1]; >+ pw->stdout_fd = stdout_pipe[0]; >+ si->passwd_pid = forked; >+ >+ pw->input_file = fdopen (pw->stdout_fd, "r"); >+ >+ pw->stdout_input_id = XtAppAddInput (si->app, pw->stdout_fd, >+ (XtPointer) XtInputReadMask, >+ handle_passwd_input, >+ si); >+ return True; >+ } >+ >+ /* shouldn't reach */ >+ abort (); >+ return False; >+} >+#endif /* HAVE_XSCREENSAVER_LOCK */ > > static void > make_passwd_window (saver_info *si) >@@ -178,6 +358,20 @@ > char *f; > saver_screen_info *ssi = &si->screens [mouse_screen (si)]; > >+#ifdef HAVE_XSCREENSAVER_LOCK >+ if (spawn_external_passwd_process (si, pw)) >+ { >+ pw->ratio = 1.0; >+ si->pw_data = pw; >+ si->external_passwd = True; >+ return; >+ } >+ >+ si->external_passwd = False; >+ /* FIXME: don't abort() */ >+ abort (); >+#endif >+ > /* Display the button only if the "newLoginCommand" pref is non-null. > */ > pw->login_button_p = (si->prefs.new_login_command && >@@ -993,118 +1187,166 @@ > { > saver_preferences *p = &si->prefs; > passwd_dialog_data *pw = si->pw_data; >- saver_screen_info *ssi = pw->prompt_screen; >- Colormap cmap = DefaultColormapOfScreen (ssi->screen); >- Pixel black = BlackPixelOfScreen (ssi->screen); >- Pixel white = WhitePixelOfScreen (ssi->screen); >+ saver_screen_info *ssi; >+ Colormap cmap; >+ Pixel black, white; > XEvent event; > >- memset (pw->typed_passwd, 0, sizeof(pw->typed_passwd)); >- memset (pw->passwd_string, 0, strlen(pw->passwd_string)); >+ if (si->prefs.verbose_p) >+ fprintf (stderr, "destroy_passwd_window\n"); > > if (pw->timer) > XtRemoveTimeOut (pw->timer); > >- move_mouse_grab (si, RootWindowOfScreen (ssi->screen), >- ssi->cursor, ssi->number); >+#ifdef HAVE_XSCREENSAVER_LOCK >+ if (si->external_passwd) >+ { >+ /* kill the child etc. */ > >+ > if (pw->passwd_cursor) > XFreeCursor (si->dpy, pw->passwd_cursor); > >- if (p->verbose_p) >- fprintf (stderr, "%s: %d: moving mouse back to %d,%d.\n", >- blurb(), ssi->number, >- pw->previous_mouse_x, pw->previous_mouse_y); >- >- XWarpPointer (si->dpy, None, RootWindowOfScreen (ssi->screen), >- 0, 0, 0, 0, >- pw->previous_mouse_x, pw->previous_mouse_y); >+ if (si->passwd_dialog) >+ { >+ XErrorHandler old_handler; >+ >+ XSync (si->dpy, False); >+ old_handler = XSetErrorHandler (ignore_all_errors_ehandler); >+ >+ XDestroyWindow (si->dpy, si->passwd_dialog); >+ XSync (si->dpy, False); >+ XSetErrorHandler (old_handler); >+ si->passwd_dialog = 0; >+ } > >- XSync (si->dpy, False); >- while (XCheckMaskEvent (si->dpy, PointerMotionMask, &event)) >- if (p->verbose_p) >- fprintf (stderr, "%s: discarding MotionNotify event.\n", blurb()); >+ if (pw->stdout_input_id) >+ XtRemoveInput (pw->stdout_input_id); >+ if (pw->stdin_fd != -1) >+ close_and_invalidate (&pw->stdin_fd); >+ if (pw->input_file) >+ fclose (pw->input_file); >+ else if (pw->stdout_fd != -1) >+ close_and_invalidate (&pw->stdout_fd); > >- if (si->passwd_dialog) >- { >- XDestroyWindow (si->dpy, si->passwd_dialog); >- si->passwd_dialog = 0; >- } >+ block_sigchld (); >+ >+ if (si->passwd_pid) >+ { >+ int status = -1; >+ >+ status = kill (si->passwd_pid, SIGTERM); >+ >+ await_dying_children (si); >+ >+ si->passwd_pid = 0; >+ } >+ >+ unblock_sigchld (); >+ >+ si->external_passwd = False; >+ } > >- if (pw->save_under) >- { >- XGCValues gcv; >- GC gc; >- gcv.function = GXcopy; >- gc = XCreateGC (si->dpy, ssi->screensaver_window, GCFunction, &gcv); >- XCopyArea (si->dpy, pw->save_under, >- ssi->screensaver_window, gc, >- 0, 0, >- pw->width + (pw->border_width*2) + 1, >- pw->height + (pw->border_width*2) + 1, >- pw->x - pw->border_width, pw->y - pw->border_width); >- XFreePixmap (si->dpy, pw->save_under); >- pw->save_under = 0; >- XFreeGC (si->dpy, gc); >- } >- >- if (pw->heading_label) free (pw->heading_label); >- if (pw->body_label) free (pw->body_label); >- if (pw->user_label) free (pw->user_label); >- if (pw->passwd_label) free (pw->passwd_label); >- if (pw->date_label) free (pw->date_label); >- if (pw->login_label) free (pw->login_label); >- if (pw->user_string) free (pw->user_string); >- if (pw->passwd_string) free (pw->passwd_string); >- if (pw->uname_label) free (pw->uname_label); >- >- if (pw->heading_font) XFreeFont (si->dpy, pw->heading_font); >- if (pw->body_font) XFreeFont (si->dpy, pw->body_font); >- if (pw->label_font) XFreeFont (si->dpy, pw->label_font); >- if (pw->passwd_font) XFreeFont (si->dpy, pw->passwd_font); >- if (pw->date_font) XFreeFont (si->dpy, pw->date_font); >- if (pw->button_font) XFreeFont (si->dpy, pw->button_font); >- if (pw->uname_font) XFreeFont (si->dpy, pw->uname_font); >- >- if (pw->foreground != black && pw->foreground != white) >- XFreeColors (si->dpy, cmap, &pw->foreground, 1, 0L); >- if (pw->background != black && pw->background != white) >- XFreeColors (si->dpy, cmap, &pw->background, 1, 0L); >- if (!(pw->button_foreground == black || pw->button_foreground == white)) >- XFreeColors (si->dpy, cmap, &pw->button_foreground, 1, 0L); >- if (!(pw->button_background == black || pw->button_background == white)) >- XFreeColors (si->dpy, cmap, &pw->button_background, 1, 0L); >- if (pw->passwd_foreground != black && pw->passwd_foreground != white) >- XFreeColors (si->dpy, cmap, &pw->passwd_foreground, 1, 0L); >- if (pw->passwd_background != black && pw->passwd_background != white) >- XFreeColors (si->dpy, cmap, &pw->passwd_background, 1, 0L); >- if (pw->thermo_foreground != black && pw->thermo_foreground != white) >- XFreeColors (si->dpy, cmap, &pw->thermo_foreground, 1, 0L); >- if (pw->thermo_background != black && pw->thermo_background != white) >- XFreeColors (si->dpy, cmap, &pw->thermo_background, 1, 0L); >- if (pw->shadow_top != black && pw->shadow_top != white) >- XFreeColors (si->dpy, cmap, &pw->shadow_top, 1, 0L); >- if (pw->shadow_bottom != black && pw->shadow_bottom != white) >- XFreeColors (si->dpy, cmap, &pw->shadow_bottom, 1, 0L); >+ else >+#endif /* HAVE_XSCREENSAVER_LOCK */ >+ { > >- if (pw->logo_pixmap) >- XFreePixmap (si->dpy, pw->logo_pixmap); >- if (pw-> logo_clipmask) >- XFreePixmap (si->dpy, pw->logo_clipmask); >- if (pw->logo_pixels) >- { >- if (pw->logo_npixels) >- XFreeColors (si->dpy, cmap, pw->logo_pixels, pw->logo_npixels, 0L); >- free (pw->logo_pixels); >- pw->logo_pixels = 0; >- pw->logo_npixels = 0; >- } >+ memset (pw->typed_passwd, 0, sizeof(pw->typed_passwd)); >+ memset (pw->passwd_string, 0, strlen(pw->passwd_string)); >+ >+ ssi = pw->prompt_screen; >+ cmap = DefaultColormapOfScreen (ssi->screen); >+ black = BlackPixelOfScreen (ssi->screen); >+ white = WhitePixelOfScreen (ssi->screen); >+ >+ move_mouse_grab (si, RootWindowOfScreen (ssi->screen), >+ ssi->cursor, ssi->number); >+ >+ if (p->verbose_p) >+ fprintf (stderr, "%s: %d: moving mouse back to %d,%d.\n", >+ blurb(), ssi->number, >+ pw->previous_mouse_x, pw->previous_mouse_y); >+ >+ XWarpPointer (si->dpy, None, RootWindowOfScreen (ssi->screen), >+ 0, 0, 0, 0, >+ pw->previous_mouse_x, pw->previous_mouse_y); >+ >+ XSync (si->dpy, False); >+ while (XCheckMaskEvent (si->dpy, PointerMotionMask, &event)) >+ if (p->verbose_p) >+ fprintf (stderr, "%s: discarding MotionNotify event.\n", blurb()); >+ >+ if (si->passwd_dialog) >+ { >+ XDestroyWindow (si->dpy, si->passwd_dialog); >+ si->passwd_dialog = 0; >+ } >+ >+ if (pw->save_under) >+ { >+ XGCValues gcv; >+ GC gc; >+ gcv.function = GXcopy; >+ gc = XCreateGC (si->dpy, ssi->screensaver_window, GCFunction, &gcv); >+ XCopyArea (si->dpy, pw->save_under, >+ ssi->screensaver_window, gc, >+ 0, 0, >+ pw->width + (pw->border_width*2) + 1, >+ pw->height + (pw->border_width*2) + 1, >+ pw->x - pw->border_width, pw->y - pw->border_width); >+ XFreePixmap (si->dpy, pw->save_under); >+ pw->save_under = 0; >+ XFreeGC (si->dpy, gc); >+ } >+ >+ if (pw->heading_label) free (pw->heading_label); >+ if (pw->body_label) free (pw->body_label); >+ if (pw->user_label) free (pw->user_label); >+ if (pw->passwd_label) free (pw->passwd_label); >+ if (pw->date_label) free (pw->date_label); >+ if (pw->user_string) free (pw->user_string); >+ if (pw->passwd_string) free (pw->passwd_string); >+ >+ if (pw->heading_font) XFreeFont (si->dpy, pw->heading_font); >+ if (pw->body_font) XFreeFont (si->dpy, pw->body_font); >+ if (pw->label_font) XFreeFont (si->dpy, pw->label_font); >+ if (pw->passwd_font) XFreeFont (si->dpy, pw->passwd_font); >+ if (pw->date_font) XFreeFont (si->dpy, pw->date_font); >+ >+ if (pw->foreground != black && pw->foreground != white) >+ XFreeColors (si->dpy, cmap, &pw->foreground, 1, 0L); >+ if (pw->background != black && pw->background != white) >+ XFreeColors (si->dpy, cmap, &pw->background, 1, 0L); >+ if (pw->passwd_foreground != black && pw->passwd_foreground != white) >+ XFreeColors (si->dpy, cmap, &pw->passwd_foreground, 1, 0L); >+ if (pw->passwd_background != black && pw->passwd_background != white) >+ XFreeColors (si->dpy, cmap, &pw->passwd_background, 1, 0L); >+ if (pw->thermo_foreground != black && pw->thermo_foreground != white) >+ XFreeColors (si->dpy, cmap, &pw->thermo_foreground, 1, 0L); >+ if (pw->thermo_background != black && pw->thermo_background != white) >+ XFreeColors (si->dpy, cmap, &pw->thermo_background, 1, 0L); >+ if (pw->shadow_top != black && pw->shadow_top != white) >+ XFreeColors (si->dpy, cmap, &pw->shadow_top, 1, 0L); >+ if (pw->shadow_bottom != black && pw->shadow_bottom != white) >+ XFreeColors (si->dpy, cmap, &pw->shadow_bottom, 1, 0L); >+ >+ if (pw->logo_pixmap) >+ XFreePixmap (si->dpy, pw->logo_pixmap); >+ if (pw->logo_pixels) >+ { >+ if (pw->logo_npixels) >+ XFreeColors (si->dpy, cmap, pw->logo_pixels, pw->logo_npixels, 0L); >+ free (pw->logo_pixels); >+ pw->logo_pixels = 0; >+ pw->logo_npixels = 0; >+ } > > if (pw->save_under) >- XFreePixmap (si->dpy, pw->save_under); >+ XFreePixmap (si->dpy, pw->save_under); > > if (cmap) >- XInstallColormap (si->dpy, cmap); >+ XInstallColormap (si->dpy, cmap); >+ } > > memset (pw, 0, sizeof(*pw)); > free (pw); >@@ -1114,14 +1356,6 @@ > > static Bool error_handler_hit_p = False; > >-static int >-ignore_all_errors_ehandler (Display *dpy, XErrorEvent *error) >-{ >- error_handler_hit_p = True; >- return 0; >-} >- >- > #ifdef HAVE_XHPDISABLERESET > /* This function enables and disables the C-Sh-Reset hot-key, which > normally resets the X server (logging out the logged-in user.) >@@ -1323,8 +1557,38 @@ > if (pw->state == pw_read) > pw->state = pw_time; > } >+#ifdef HAVE_XSCREENSAVER_LOCK >+ if (si->passwd_dialog) >+ { >+ XEvent event; >+ Bool status; >+ XErrorHandler old_handler; >+ >+ event.xany.type = ClientMessage; >+ event.xclient.display = si->dpy; >+ event.xclient.window = si->passwd_dialog; >+ event.xclient.message_type = XA_UNLOCK_RATIO; >+ event.xclient.format = 32; >+ memset (&event.xclient.data, 0, sizeof (event.xclient.data)); >+ event.xclient.data.l[0] = (long)(pw->ratio * 100); >+ event.xclient.data.l[1] = 0; >+ event.xclient.data.l[2] = 0; >+ >+ XSync (si->dpy, False); >+ old_handler = XSetErrorHandler (ignore_all_errors_ehandler); >+ >+ status = XSendEvent (si->dpy, si->passwd_dialog, False, 0L, &event); >+ >+ XSync (si->dpy, False); >+ XSetErrorHandler (old_handler); > >+ if (!status) >+ fprintf (stderr, "%s: error sending ratio to lock dialog\n", blurb ()); >+ >+ } >+#else /* !HAVE_XSCREENSAVER_LOCK */ > update_passwd_window (si, 0, pw->ratio); >+#endif /* !HAVE_XSCREENSAVER_LOCK */ > > if (pw->state == pw_read) > pw->timer = XtAppAddTimeOut (si->app, tick, passwd_animate_timer, >@@ -1480,6 +1744,41 @@ > while (si->pw_data && si->pw_data->state == pw_read) > { > XtAppNextEvent (si->app, &event); >+#ifdef HAVE_XSCREENSAVER_LOCK >+ if (event.xany.type == KeyPress) >+ { >+ if (si->pw_data->got_windowid) >+ { >+ Bool status; >+ XErrorHandler old_handler; >+ >+ event.xany.window = si->passwd_dialog; >+ >+ XSync (si->dpy, False); >+ old_handler = XSetErrorHandler (ignore_all_errors_ehandler); >+ >+ status = XSendEvent (si->dpy, si->passwd_dialog, False, KeyPressMask, &event); >+ >+ XSync (si->dpy, False); >+ XSetErrorHandler (old_handler); >+ >+ if (p->verbose_p) >+ { >+ if (status) >+ fprintf (stderr, "sent key...\n"); >+ else >+ fprintf (stderr, "error sending key...\n"); >+ } >+ } >+ else >+ { >+ if (p->verbose_p) >+ fprintf (stderr, "got keypress but no window id yet :(\n"); >+ XtDispatchEvent (&event); >+ } >+ } >+#else /* !HAVE_XSCREENSAVER_LOCK */ >+ > if (event.xany.window == si->passwd_dialog && event.xany.type == Expose) > draw_passwd_window (si); > else if (event.xany.type == KeyPress) >@@ -1487,6 +1786,7 @@ > handle_passwd_key (si, &event.xkey); > caps_p = (event.xkey.state & LockMask); > } >+#endif /* !HAVE_XSCREENSAVER_LOCK */ > else if ((event.xany.type == ButtonPress || > event.xany.type == ButtonRelease) && > si->pw_data->login_button_p) >@@ -1575,8 +1875,29 @@ > > if (msg) > { >- si->pw_data->i_beam = 0; >- update_passwd_window (si, msg, 0.0); >+#ifdef HAVE_XSCREENSAVER_LOCK >+ if (si->external_passwd && si->pw_data->stdin_fd != -1) >+ { >+ ssize_t len; >+ char *nlmsg; >+ >+ nlmsg = (char *)malloc (strlen (msg) + 2); >+ sprintf (nlmsg, "%s\n", msg); >+ >+ write_msg: >+ len = write (si->pw_data->stdin_fd, nlmsg, strlen (nlmsg)); >+ if (len < 0 && errno == EINTR) >+ goto write_msg; >+ >+ free (nlmsg); >+ } >+ else >+#endif /* HAVE_XSCREENSAVER_LOCK */ >+ { >+ si->pw_data->i_beam = 0; >+ update_passwd_window (si, msg, 0.0); >+ } >+ > XSync (si->dpy, False); > sleep (1); > >@@ -1607,6 +1928,14 @@ > > memset (si->unlock_typeahead, '*', strlen(si->unlock_typeahead)); > si->unlock_typeahead[i] = 0; >+#ifdef HAVE_XSCREENSAVER_LOCK >+ /* FIXME: bugzilla.gnome.org #77077 */ >+ /* need to handle this in the external dialog case */ >+#else >+ update_passwd_window (si, si->unlock_typeahead, pw->ratio); >+#endif /* !HAVE_XSCREENSAVER_LOCK */ >+ >+ > update_passwd_window (si, si->unlock_typeahead, pw->ratio); > > free (si->unlock_typeahead); >--- xscreensaver-5.00/driver/lock-Gtk.c 1970-01-01 01:00:00.000000000 +0100 >+++ xscreensaver-5.00.mine/driver/lock-Gtk.c 2006-08-20 05:43:15.000000000 +0100 >@@ -0,0 +1,413 @@ >+/* lock-Gtk.c -- a GTK+ password dialog for xscreensaver >+ * xscreensaver, Copyright (c) 2993-1998 Jamie Zawinski <jwz@jwz.org> >+ * >+ * Permission to use, copy, modify, distribute, and sell this software and its >+ * documentation for any purpose is hereby granted without fee, provided that >+ * the above copyright notice appear in all copies and that both that >+ * copyright notice and this permission notice appear in supporting >+ * documentation. No representations are made about the suitability of this >+ * software for any purpose. It is provided "as is" without express or >+ * implied warranty. >+ */ >+ >+/* GTK+ locking code written by Jacob Berkman <jacob@ximian.com >+ * Copyright 2002 Sun Microsystems, Inc. */ >+ >+#ifdef HAVE_CONFIG_H >+# include "config.h" >+#endif >+ >+#ifdef HAVE_GTK2 /* whole file */ >+ >+#include <xscreensaver-intl.h> >+ >+#include <unistd.h> >+#include <errno.h> >+#include <string.h> >+#include <time.h> >+#include <stdlib.h> >+#include <stdio.h> >+#include <libintl.h> >+#include <locale.h> >+ >+#include <gtk/gtk.h> >+#include <gdk/gdkx.h> >+ >+#include "remote.h" >+#include "utils/images/logo-180.xpm" >+ >+static Atom XA_UNLOCK_RATIO; >+Atom XA_VROOT; >+Atom XA_SCREENSAVER, XA_SCREENSAVER_RESPONSE, XA_SCREENSAVER_VERSION; >+Atom XA_SCREENSAVER_ID, XA_SCREENSAVER_STATUS, XA_SELECT, XA_DEMO; >+Atom XA_ACTIVATE, XA_BLANK, XA_LOCK, XA_RESTART, XA_EXIT; >+ >+typedef struct { >+ GtkWidget *dialog; >+ GtkWidget *passwd_entry; >+ GtkWidget *progress; >+ GtkWidget *button; >+ GtkWidget *msg_label; >+} PasswdDialog; >+ >+char *progname = 0; >+ >+static ssize_t >+write_string (const char *s) >+{ >+ ssize_t len; >+ >+ g_return_val_if_fail (s != NULL, -1); >+ >+ do_write: >+ len = write (STDOUT_FILENO, s, strlen (s)); >+ if (len < 0 && errno == EINTR) >+ goto do_write; >+ >+ return len; >+} >+ >+static PasswdDialog * >+make_dialog (void) >+{ >+ GtkWidget *dialog; >+ GtkWidget *frame; >+ GtkWidget *vbox; >+ GtkWidget *hbox; >+ GtkWidget *bbox; >+ GtkWidget *vbox2; >+ GtkWidget *entry; >+ GtkWidget *label; >+ GtkWidget *button; >+ GtkWidget *image; >+ GtkWidget *progress; >+ GtkWidget *table; >+ GdkPixbuf *pb; >+ PasswdDialog *pwd; >+ char *version; >+ char *user; >+ char *host; >+ char *s; >+ >+ /* taken from lock.c */ >+ char buf[100]; >+ time_t now = time (NULL); >+ struct tm* tm = localtime (&now); >+ memset (buf, 0, sizeof (buf)); >+ strftime (buf, sizeof (buf) - 1, _("%d-%b-%y (%a); %I:%M %p"), tm); >+ >+ server_xscreensaver_version (GDK_DISPLAY (), &version, &user, &host); >+ >+ if (!version) >+ { >+ fprintf (stderr, "%s: no xscreensaver running on display %s, exiting.\n", progname, gdk_get_display ()); >+ exit (1); >+ } >+ >+ pwd = g_new0 (PasswdDialog, 1); >+ >+ dialog = gtk_window_new (GTK_WINDOW_POPUP); >+ pwd->dialog = dialog; >+ gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER_ALWAYS); >+ >+ /* frame */ >+ frame = g_object_new (GTK_TYPE_FRAME, >+ "shadow", GTK_SHADOW_OUT, >+ NULL); >+ gtk_container_add (GTK_CONTAINER (dialog), frame); >+ >+ /* vbox */ >+ vbox = gtk_vbox_new (FALSE, 10); >+ gtk_container_set_border_width (GTK_CONTAINER (vbox), 10); >+ gtk_container_add (GTK_CONTAINER (frame), vbox); >+ >+ /* hbox */ >+ hbox = gtk_hbox_new (FALSE, 5); >+ gtk_box_pack_start (GTK_BOX (vbox), hbox, >+ TRUE, TRUE, 0); >+ >+ /* image frame */ >+ frame = g_object_new (GTK_TYPE_FRAME, >+ "shadow", GTK_SHADOW_IN, >+ NULL); >+ gtk_box_pack_start (GTK_BOX (hbox), frame, >+ TRUE, TRUE, 0); >+ >+ /* image */ >+ pb = gdk_pixbuf_new_from_xpm_data (logo_180_xpm); >+ image = gtk_image_new_from_pixbuf (pb); >+ g_object_unref (pb); >+ gtk_container_add (GTK_CONTAINER (frame), image); >+ >+ /* progress thingie */ >+ progress = g_object_new (GTK_TYPE_PROGRESS_BAR, >+ "orientation", GTK_PROGRESS_BOTTOM_TO_TOP, >+ "fraction", 1.0, >+ NULL); >+ atk_object_set_description (gtk_widget_get_accessible (progress), >+ _("Percent of time you have to enter the password.")); >+ pwd->progress = progress; >+ gtk_box_pack_start (GTK_BOX (hbox), progress, >+ FALSE, FALSE, 0); >+ >+ /* text fields */ >+ vbox2 = gtk_vbox_new (TRUE, 0); >+ gtk_box_pack_start (GTK_BOX (hbox), vbox2, >+ TRUE, TRUE, 0); >+ >+ s = g_strdup_printf ("<span size=\"xx-large\"><b>XScreenSaver %s</b></span>", version); >+ /* XScreenSaver foo label */ >+ label = g_object_new (GTK_TYPE_LABEL, >+ "use-markup", TRUE, >+ "label", s, >+ NULL); >+ gtk_box_pack_start (GTK_BOX (vbox2), label, >+ FALSE, FALSE, 0); >+ g_free (s); >+ >+ /* This display is locked. */ >+ label = g_object_new (GTK_TYPE_LABEL, >+ "use-markup", TRUE, >+ "label", _("<b>This display is locked.</b>"), >+ NULL); >+ pwd->msg_label = label; >+ gtk_box_pack_start (GTK_BOX (vbox2), label, >+ FALSE, FALSE, 0); >+ >+ /* table with password things */ >+ table = g_object_new (GTK_TYPE_TABLE, >+ "n-rows", 2, >+ "n-columns", 2, >+ "homogeneous", FALSE, >+ "row-spacing", 5, >+ "column-spacing", 5, >+ NULL); >+ gtk_box_pack_start (GTK_BOX (vbox2), table, >+ FALSE, FALSE, 0); >+ >+ /* User: */ >+ label = g_object_new (GTK_TYPE_LABEL, >+ "label", "User:", >+ "xalign", 1.0, >+ NULL); >+ gtk_table_attach (GTK_TABLE (table), label, >+ 0, 1, 0, 1, >+ GTK_FILL, 0, >+ 0, 0); >+ >+ /* Password: */ >+ label = g_object_new (GTK_TYPE_LABEL, >+ "label", "Password:", >+ "xalign", 1.0, >+ NULL); >+ gtk_table_attach (GTK_TABLE (table), label, >+ 0, 1, 1, 2, >+ GTK_FILL, 0, >+ 0, 0); >+ >+ /* name */ >+ entry = g_object_new (GTK_TYPE_ENTRY, >+ "editable", FALSE, >+ "text", user, >+ NULL); >+ gtk_table_attach (GTK_TABLE (table), entry, >+ 1, 2, 0, 1, >+ GTK_FILL, 0, >+ 0, 0); >+ GTK_WIDGET_UNSET_FLAGS (entry, GTK_CAN_FOCUS); >+ >+ /* passwd */ >+ entry = g_object_new (GTK_TYPE_ENTRY, >+ "visibility", FALSE, >+ /* "activates-default", TRUE, */ >+ NULL); >+ pwd->passwd_entry = entry; >+ gtk_table_attach (GTK_TABLE (table), entry, >+ 1, 2, 1, 2, >+ GTK_FILL, 0, >+ 0, 0); >+ gtk_widget_grab_focus (entry); >+ >+ s = g_strdup_printf ("<small>%s</small>", buf); >+ /* date string */ >+ label = g_object_new (GTK_TYPE_LABEL, >+ "use-markup", TRUE, >+ "label", s, >+ NULL); >+ gtk_box_pack_start (GTK_BOX (vbox2), label, >+ FALSE, FALSE, 0); >+ g_free (s); >+ >+ /* button box */ >+ bbox = g_object_new (GTK_TYPE_HBUTTON_BOX, >+ "layout-style", GTK_BUTTONBOX_END, >+ "spacing", 10, >+ NULL); >+#if 0 >+ gtk_box_pack_start (GTK_BOX (vbox), bbox, >+ FALSE, FALSE, 0); >+#endif >+ >+ /* Ok button */ >+ button = gtk_button_new_from_stock (GTK_STOCK_OK); >+ pwd->button = button; >+ gtk_box_pack_end (GTK_BOX (bbox), button, >+ FALSE, TRUE, 0); >+#if 0 >+ GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); >+ gtk_widget_grab_default (button); >+#endif >+ >+ free (version); >+ free (user); >+ free (host); >+ >+ return pwd; >+} >+ >+static void >+desensitize_entry (PasswdDialog *pwd) >+{ >+ g_object_set (pwd->passwd_entry, >+ "editable", FALSE, >+ "sensitive", FALSE, >+ NULL); >+} >+ >+static void >+ok_clicked_cb (GtkWidget *button, PasswdDialog *pwd) >+{ >+ char *s; >+ >+ desensitize_entry (pwd); >+ g_object_set (pwd->msg_label, "label", _("<b>Checking...</b>"), NULL); >+ >+ s = g_strdup_printf ("%s\n", gtk_entry_get_text (GTK_ENTRY (pwd->passwd_entry))); >+ write_string (s); >+ g_free (s); >+} >+ >+static void >+connect_signals (PasswdDialog *pwd) >+{ >+ g_signal_connect (pwd->button, "clicked", >+ G_CALLBACK (ok_clicked_cb), >+ pwd); >+ >+ g_signal_connect (pwd->passwd_entry, "activate", >+ G_CALLBACK (ok_clicked_cb), >+ pwd); >+ >+ g_signal_connect (pwd->dialog, "delete-event", >+ G_CALLBACK (gtk_main_quit), >+ NULL); >+} >+ >+static GdkFilterReturn >+dialog_filter_func (GdkXEvent *xevent, GdkEvent *gevent, gpointer data) >+{ >+ PasswdDialog *pwd = data; >+ XEvent *event = xevent; >+ gdouble ratio; >+ >+ if (event->xany.type != ClientMessage || event->xclient.message_type != XA_UNLOCK_RATIO) >+ return GDK_FILTER_CONTINUE; >+ >+ ratio = event->xclient.data.l[0] / (gdouble)100.0; >+ >+ g_object_set (pwd->progress, "fraction", ratio, NULL); >+ >+ return GDK_FILTER_REMOVE; >+} >+ >+static gboolean >+handle_input (GIOChannel *source, GIOCondition cond, gpointer data) >+{ >+ PasswdDialog *pwd = data; >+ GIOStatus status; >+ char *str; >+ char *label; >+ >+ desensitize_entry (pwd); >+ >+ read_line: >+ status = g_io_channel_read_line (source, &str, NULL, NULL, NULL); >+ if (status == G_IO_STATUS_AGAIN) >+ goto read_line; >+ >+ if (str) >+ { >+ label = g_strdup_printf ("<b>%s</b>", str); >+ g_object_set (pwd->msg_label, "label", label, NULL); >+ g_free (label); >+ g_free (str); >+ } >+ >+ return (status == G_IO_STATUS_NORMAL); >+} >+ >+int >+main (int argc, char *argv[]) >+{ >+ GIOChannel *ioc; >+ PasswdDialog *pwd; >+ char *s; >+ char *real_progname = argv[0]; >+ >+#ifdef ENABLE_NLS >+ textdomain (GETTEXT_PACKAGE); >+ >+# ifdef HAVE_GTK2 >+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); >+# else /* ! HAVE_GTK2 */ >+ if (!setlocale (LC_ALL, "")) >+ fprintf (stderr, "%s: locale not supported by C library\n", real_progname); >+# endif /* ! HAVE_GTK2 */ >+ >+#endif /* ENABLE_NLS */ >+ >+ s = strrchr (real_progname, '/'); >+ if (s) real_progname = s+1; >+ progname = real_progname; >+ >+ gtk_init (&argc, &argv); >+ >+ /* Intern the atoms that xscreensaver_command() needs. >+ */ >+ XA_VROOT = XInternAtom (GDK_DISPLAY (), "__SWM_VROOT", False); >+ XA_SCREENSAVER = XInternAtom (GDK_DISPLAY (), "SCREENSAVER", False); >+ XA_SCREENSAVER_VERSION = XInternAtom (GDK_DISPLAY (), "_SCREENSAVER_VERSION",False); >+ XA_SCREENSAVER_STATUS = XInternAtom (GDK_DISPLAY (), "_SCREENSAVER_STATUS", False); >+ XA_SCREENSAVER_ID = XInternAtom (GDK_DISPLAY (), "_SCREENSAVER_ID", False); >+ XA_SCREENSAVER_RESPONSE = XInternAtom (GDK_DISPLAY (), "_SCREENSAVER_RESPONSE", False); >+ XA_SELECT = XInternAtom (GDK_DISPLAY (), "SELECT", False); >+ XA_DEMO = XInternAtom (GDK_DISPLAY (), "DEMO", False); >+ XA_ACTIVATE = XInternAtom (GDK_DISPLAY (), "ACTIVATE", False); >+ XA_BLANK = XInternAtom (GDK_DISPLAY (), "BLANK", False); >+ XA_LOCK = XInternAtom (GDK_DISPLAY (), "LOCK", False); >+ XA_EXIT = XInternAtom (GDK_DISPLAY (), "EXIT", False); >+ XA_RESTART = XInternAtom (GDK_DISPLAY (), "RESTART", False); >+ XA_UNLOCK_RATIO = XInternAtom (GDK_DISPLAY (), "UNLOCK_RATIO", False); >+ >+ pwd = make_dialog (); >+ connect_signals (pwd); >+ >+ gtk_widget_show_all (pwd->dialog); >+ gtk_window_present (GTK_WINDOW (pwd->dialog)); >+ gtk_widget_map (pwd->dialog); >+ >+ gdk_window_add_filter (pwd->dialog->window, dialog_filter_func, pwd); >+ >+ s = g_strdup_printf ("%lu\n", GDK_WINDOW_XID (pwd->dialog->window)); >+ write_string (s); >+ g_free (s); >+ >+ ioc = g_io_channel_unix_new (0); >+ g_io_add_watch (ioc, G_IO_IN, handle_input, pwd); >+ >+ gtk_main (); >+ >+ return 0; >+} >+ >+#endif /* HAVE_GTK2 */ >--- xscreensaver-5.00/driver/Makefile.in 2006-05-24 00:01:35.000000000 +0100 >+++ xscreensaver-5.00.mine/driver/Makefile.in 2006-08-20 05:43:15.000000000 +0100 >@@ -14,6 +14,7 @@ > prefix = @prefix@ > exec_prefix = @exec_prefix@ > bindir = @bindir@ >+libexecdir = $(exec_prefix)/libexec > datadir = @datadir@ > localedir = $(datadir)/locale > mandir = @mandir@ >@@ -38,6 +39,8 @@ > SUBP_DEFS = $(DEFS) -DDEFAULT_PATH_PREFIX='"@HACKDIR@"' > GTK_DEFS = $(DEFS) -DDEFAULT_ICONDIR='"$(GTK_GLADEDIR)"' > CONF_DEFS = -DHACK_CONFIGURATION_PATH='"$(HACK_CONF_DIR)"' >+LOCK_DEFS = $(DEFS) -DLOCKDIR=\"$(libexecdir)/xscreensaver\" >+ > > LIBS = @LIBS@ > INTL_LIBS = @INTLLIBS@ >@@ -95,6 +98,10 @@ > demo-Gtk-widgets.c demo-Gtk-support.c > GTK_EXTRA_OBJS = demo-Gtk-widgets.o demo-Gtk-support.o > GTK_OBJS = demo-Gtk.o demo-Gtk-conf.o @GTK_EXTRA_OBJS@ >+GTK_LOCK_SRCS = lock-Gtk.c remote.c >+GTK_LOCK_OBJS = lock-Gtk.o remote.o >+ >+ > > PWENT_SRCS = passwd-pwent.c > PWENT_OBJS = passwd-pwent.o >@@ -213,8 +220,9 @@ > $(X_PRE_LIBS) -lXt -lX11 $(XMU_LIBS) -lXext $(X_EXTRA_LIBS) > > EXES = xscreensaver xscreensaver-command xscreensaver-demo \ >- xscreensaver-getimage @EXES_OSX@ >-EXES2 = @ALL_DEMO_PROGRAMS@ >+ xscreensaver-getimage @PREFERRED_LOCK_PROGRAM@ >+EXES2 = @ALL_DEMO_PROGRAMS@ @ALL_LOCK_PROGRAMS@ >+ > EXES_OSX = pdf2jpeg > > SCRIPTS_1 = xscreensaver-getimage-file xscreensaver-getimage-video \ >@@ -269,6 +277,10 @@ > @if [ ! -d $(install_prefix)$(bindir) ]; then \ > $(INSTALL_DIRS) $(install_prefix)$(bindir) ; \ > fi >+ @if [ -n "@LOCK_PROGRAM@" -a ! -d $(install_prefix)$(libexecdir)/xscreensaver ]; then \ >+ $(INSTALL_DIRS) $(install_prefix)$(libexecdir)/xscreensaver ; \ >+ fi >+ > @inst="$(INSTALL_PROGRAM)" ; \ > if [ @NEED_SETUID@ = yes ]; then \ > me=`PATH="$$PATH:/usr/ucb" whoami` ; \ >@@ -297,7 +309,12 @@ > echo $(INSTALL_PROGRAM) $$exe $(install_prefix)$(bindir)/$$exe ; \ > $(INSTALL_PROGRAM) $$exe $(install_prefix)$(bindir)/$$exe ; \ > done >- >+ @if [ -n "@LOCK_PROGRAM@" ]; then \ >+ echo $(INSTALL_PROGRAM) xscreensaver-lock \ >+ $(install_prefix)$(libexecdir)/xscreensaver/xscreensaver-lock ; \ >+ $(INSTALL_PROGRAM) @PREFERRED_LOCK_PROGRAM@ \ >+ $(install_prefix)$(libexecdir)/xscreensaver/xscreensaver-lock ; \ >+ fi > install-ad: XScreenSaver.ad > @if [ ! -d $(install_prefix)$(AD_DIR) ]; then \ > $(INSTALL_DIRS) $(install_prefix)$(AD_DIR) ; \ >@@ -741,6 +758,12 @@ > $(CC) -c $(INCLUDES) $(SUBP_DEFS) $(CFLAGS) $(X_CFLAGS) \ > $(srcdir)/subprocs.c > >+# lock takes an extra -D option. >+lock.o: >+ $(CC) -c $(INCLUDES) $(LOCK_DEFS) $(CFLAGS) $(X_CFLAGS) \ >+ $(srcdir)/lock.c >+ >+ > # demo-Gtk takes extra -D options, and an extra -I option. > demo-Gtk.o: demo-Gtk.c > $(CC) -c $(INCLUDES) $(SUBP_DEFS) -I$(ICON_SRC) \ >@@ -782,6 +805,10 @@ > cp -p @PREFERRED_DEMO_PROGRAM@@EXEEXT@ $@@EXEEXT@ ; \ > fi > >+xscreensaver-lock: @PREFERRED_LOCK_PROGRAM@ >+ $(INSTALL_PROGRAM) @PREFERRED_LOCK_PROGRAM@ $@ >+ >+ > xscreensaver-demo-Xm: $(DEMO_OBJS) $(MOTIF_OBJS) > $(CC) $(LDFLAGS) -o $@ $(DEMO_OBJS) $(MOTIF_OBJS) $(LIBS) $(X_LIBS) \ > $(MOTIF_LIBS) $(INTL_LIBS) $(X_PRE_LIBS) -lXt -lX11 \ >@@ -795,6 +822,13 @@ > demo-Gtk.o: XScreenSaver_ad.h > demo-Xm.o: XScreenSaver_ad_Xm.h > >+xscreensaver-lock-Gtk: $(GTK_LOCK_OBJS) >+ $(CC) $(LDFLAGS) -o $@ $(GTK_LOCK_OBJS) $(LIBS) $(X_LIBS) \ >+ $(GTK_LIBS) $(XML_LIBS) $(X_PRE_LIBS) -lXt -lX11 $(XDPMS_LIBS) -lXext \ >+ $(X_EXTRA_LIBS) >+ >+ >+ > xscreensaver-getimage: $(GETIMG_OBJS) > $(CC) $(LDFLAGS) -o $@ $(GETIMG_OBJS) $(GETIMG_LIBS) -lm > >@@ -803,7 +837,7 @@ > > > TEST_PASSWD_OBJS = test-passwd.o $(LOCK_OBJS_1) $(PASSWD_OBJS) \ >- subprocs.o setuid.o splash.o prefs.o \ >+ subprocs.o setuid.o splash.o prefs.o exec.o stderr.o\ > $(SAVER_UTIL_OBJS) > test-passwd.o: XScreenSaver_ad.h > >--- xscreensaver-5.00/driver/xscreensaver.c 2006-08-20 05:42:14.000000000 +0100 >+++ xscreensaver-5.00.mine/driver/xscreensaver.c 2006-08-20 05:43:15.000000000 +0100 >@@ -189,6 +189,7 @@ > static Atom XA_RESTART, XA_SELECT; > static Atom XA_THROTTLE, XA_UNTHROTTLE; > Atom XA_DEMO, XA_PREFS, XA_EXIT, XA_LOCK, XA_BLANK; >+Atom XA_UNLOCK_RATIO; > > > static XrmOptionDescRec options [] = { >@@ -597,6 +598,7 @@ > XA_BLANK = XInternAtom (si->dpy, "BLANK", False); > XA_THROTTLE = XInternAtom (si->dpy, "THROTTLE", False); > XA_UNTHROTTLE = XInternAtom (si->dpy, "UNTHROTTLE", False); >+ XA_UNLOCK_RATIO = XInternAtom (si->dpy, "UNLOCK_RATIO", False); > > return toplevel_shell; > } >--- xscreensaver-5.00/driver/xscreensaver.h 2006-02-04 07:38:06.000000000 +0000 >+++ xscreensaver-5.00.mine/driver/xscreensaver.h 2006-08-20 05:43:15.000000000 +0100 >@@ -126,6 +126,13 @@ > privileged user. */ > > Window passwd_dialog; /* The password dialog, if its up. */ >+#ifdef HAVE_XSCREENSAVER_LOCK >+ pid_t passwd_pid; /* The pid of the password dialog if >+ we ran an external process for >+ it. */ >+ Bool external_passwd; >+#endif /* HAVE_XSCREENSAVER_LOCK */ >+ > passwd_dialog_data *pw_data; /* Other info necessary to draw it. */ > > int unlock_failures; /* Counts failed login attempts while the >--- xscreensaver-5.00/config.h.in 2006-08-20 05:42:30.000000000 +0100 >+++ xscreensaver-5.00.mine/config.h.in 2006-08-20 05:43:15.000000000 +0100 >@@ -110,6 +110,10 @@ > > /* Define this if you have Gtk 2.x. */ > #undef HAVE_GTK2 >+/* Define this to build the external lock dialog */ >+#undef HAVE_XSCREENSAVER_LOCK >+ >+ > > /* Define this if you are running HPUX with so-called ``Secure Passwords'' (if > you have /usr/include/hpsecurity.h, you probably have this.) I haven't >--- xscreensaver-5.00/driver/subprocs.c 2006-03-08 05:52:23.000000000 +0000 >+++ xscreensaver-5.00.mine/driver/subprocs.c 2006-08-20 05:43:15.000000000 +0100 >@@ -340,7 +340,7 @@ > return 0; > } > >-static void await_dying_children (saver_info *si); >+void await_dying_children (saver_info *si); > #ifndef VMS > static void describe_dead_child (saver_info *, pid_t, int wait_status); > #endif >@@ -500,7 +500,7 @@ > > #ifndef VMS > >-static void >+void > await_dying_children (saver_info *si) > { > while (1) >@@ -573,9 +573,13 @@ > mention them) if we've just killed the subprocess. But mention them > if they happen on their own. > */ >- if (!job || >+ if ((!job >+#ifdef HAVE_XSCREENSAVER_LOCK >+ && kid != si->passwd_pid >+#endif /* HAVE_XSCREENSAVER_LOCK */ >+ ) || > (exit_status != 0 && >- (p->verbose_p || job->status != job_killed))) >+ (p->verbose_p || (job && job->status != job_killed)))) > { > /* Don't call fprintf() from signal handlers, as it might malloc. > fprintf (stderr, >@@ -615,8 +619,12 @@ > else if (WIFSIGNALED (wait_status)) > { > if (p->verbose_p || >- !job || >- job->status != job_killed || >+ (!job >+#ifdef HAVE_XSCREENSAVER_LOCK >+ && kid != si->passwd_pid >+#endif /* HAVE_XSCREENSAVER_LOCK */ >+ ) || >+ (job && job->status != job_killed) || > WTERMSIG (wait_status) != SIGTERM) > { > /* Don't call fprintf() from signal handlers, as it might malloc. >@@ -684,13 +692,24 @@ > /* Clear out the pid so that screenhack_running_p() knows it's dead. > */ > if (!job || job->status == job_dead) >- for (i = 0; i < si->nscreens; i++) >- { >- saver_screen_info *ssi = &si->screens[i]; >- if (kid == ssi->pid) >- ssi->pid = 0; >- } >-} >+ { >+ for (i = 0; i < si->nscreens; i++) >+ { >+ saver_screen_info *ssi = &si->screens[i]; >+ if (kid == ssi->pid) >+ ssi->pid = 0; >+ } >+#ifdef HAVE_XSCREENSAVER_LOCK >+ if (kid == si->passwd_pid) >+ { >+ if (p->verbose_p) >+ fprintf (stderr, "passwd dialog died!\n"); >+ si->passwd_pid = 0; >+ } >+#endif >+ } >+ >+ } > > #else /* VMS */ > static void await_dying_children (saver_info *si) { return; } >--- xscreensaver-5.00/configure.in 2006-08-20 05:59:01.000000000 +0100 >+++ xscreensaver-5.00.mine/configure.in 2006-08-20 05:56:05.000000000 +0100 >@@ -118,6 +118,7 @@ > > AH_TEMPLATE([HAVE_GTK],[Define this if you have Gtk (any version.)]) > AH_TEMPLATE([HAVE_GTK2],[Define this if you have Gtk 2.x.]) >+AH_TEMPLATE([HAVE_XSCREENSAVER_LOCK], [Define this if you want Gtk2 lock widget.]) > > AH_TEMPLATE([HAVE_CRAPPLET], > [Define this if you have Gnome and want to build support for the >@@ -2423,6 +2424,7 @@ > GTK_LIBS="$GTK_LIBS $ac_gtk_config_libs" > AC_DEFINE(HAVE_GTK) > AC_DEFINE(HAVE_GTK2) >+ AC_DEFINE(HAVE_XSCREENSAVER_LOCK) > AC_DEFINE(HAVE_XML) > fi > >@@ -3406,13 +3408,19 @@ > > PREFERRED_DEMO_PROGRAM='' > ALL_DEMO_PROGRAMS= >+PREFERRED_LOCK_PROGRAM= >+ALL_LOCK_PROGRAMS= > if test "$have_motif" = yes; then > PREFERRED_DEMO_PROGRAM=xscreensaver-demo-Xm >+ PREFERRED_LOCK_PROGRAM=xscreensaver-lock-Xm > ALL_DEMO_PROGRAMS="$PREFERRED_DEMO_PROGRAM $ALL_DEMO_PROGRAMS" >+ ALL_LOCK_PROGRAMS="$PREFERRED_LOCK_PROGRAM $ALL_LOCK_PROGRAMS" > fi > if test "$have_gtk" = yes; then > PREFERRED_DEMO_PROGRAM=xscreensaver-demo-Gtk >+ PREFERRED_LOCK_PROGRAM=xscreensaver-lock-Gtk > ALL_DEMO_PROGRAMS="$PREFERRED_DEMO_PROGRAM $ALL_DEMO_PROGRAMS" >+ ALL_LOCK_PROGRAMS="$PREFERRED_LOCK_PROGRAM $ALL_LOCK_PROGRAMS" > fi > > >@@ -3557,6 +3565,8 @@ > > AC_SUBST(PREFERRED_DEMO_PROGRAM) > AC_SUBST(ALL_DEMO_PROGRAMS) >+AC_SUBST(PREFERRED_LOCK_PROGRAM) >+AC_SUBST(ALL_LOCK_PROGRAMS) > AC_SUBST(SAVER_LIBS) > AC_SUBST(MOTIF_LIBS) > AC_SUBST(GTK_LIBS)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 144488
: 94661 |
94662