"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "driver/demo-Gtk.c" between
xscreensaver-6.00.tar.gz and xscreensaver-6.01.tar.gz

About: XScreenSaver is a large collection of screen savers and also the framework for blanking and locking the screen.

demo-Gtk.c  (xscreensaver-6.00):demo-Gtk.c  (xscreensaver-6.01)
skipping to change at line 4302 skipping to change at line 4302
fprintf(stderr, "%s", XrmQuarkToString (quarks[i])); fprintf(stderr, "%s", XrmQuarkToString (quarks[i]));
} }
fprintf (stderr, ": %s\n", (char *) value->addr); fprintf (stderr, ": %s\n", (char *) value->addr);
return False; return False;
} }
#endif #endif
static Window static Window
gnome_screensaver_window (Screen *screen) gnome_screensaver_window (Screen *screen, char **name_ret)
{ {
Display *dpy = DisplayOfScreen (screen); Display *dpy = DisplayOfScreen (screen);
Window root = RootWindowOfScreen (screen); Window root = RootWindowOfScreen (screen);
Window parent, *kids; Window parent, *kids;
unsigned int nkids; unsigned int nkids;
Window gnome_window = 0; Window gnome_window = 0;
int i; int i;
if (! XQueryTree (dpy, root, &root, &parent, &kids, &nkids)) if (! XQueryTree (dpy, root, &root, &parent, &kids, &nkids))
abort (); abort ();
if (name_ret)
*name_ret = 0;
for (i = 0; i < nkids; i++) for (i = 0; i < nkids; i++)
{ {
Atom type; Atom type;
int format; int format;
unsigned long nitems, bytesafter; unsigned long nitems, bytesafter;
unsigned char *name; unsigned char *name;
if (XGetWindowProperty (dpy, kids[i], XA_WM_COMMAND, 0, 128, if (XGetWindowProperty (dpy, kids[i], XA_WM_COMMAND, 0, 128,
False, XA_STRING, &type, &format, &nitems, False, XA_STRING, &type, &format, &nitems,
&bytesafter, &name) &bytesafter, &name)
== Success == Success
&& type != None && type != None
&& (!strcmp ((char *) name, "gnome-screensaver") || && (!strcmp ((char *) name, "gnome-screensaver") ||
!strcmp ((char *) name, "mate-screensaver") || !strcmp ((char *) name, "mate-screensaver") ||
!strcmp ((char *) name, "cinnamon-screensaver"))) !strcmp ((char *) name, "cinnamon-screensaver")))
{ {
gnome_window = kids[i]; gnome_window = kids[i];
if (name_ret)
*name_ret = strdup ((char *) name);
break; break;
} }
} }
if (kids) XFree ((char *) kids); if (kids) XFree ((char *) kids);
return gnome_window; return gnome_window;
} }
static Bool static Bool
gnome_screensaver_active_p (void) gnome_screensaver_active_p (char **name_ret)
{ {
Display *dpy = GDK_DISPLAY(); Display *dpy = GDK_DISPLAY();
Window w = gnome_screensaver_window (DefaultScreenOfDisplay (dpy)); Window w = gnome_screensaver_window (DefaultScreenOfDisplay (dpy), name_ret);
return (w ? True : False); return (w ? True : False);
} }
static void static void
kill_gnome_screensaver (void) kill_gnome_screensaver (void)
{ {
Display *dpy = GDK_DISPLAY(); Display *dpy = GDK_DISPLAY();
Window w = gnome_screensaver_window (DefaultScreenOfDisplay (dpy)); Window w = gnome_screensaver_window (DefaultScreenOfDisplay (dpy), NULL);
if (w) XKillClient (dpy, (XID) w); if (w) XKillClient (dpy, (XID) w);
} }
static Bool static Bool
kde_screensaver_active_p (void) kde_screensaver_active_p (void)
{ {
/* Apparently this worked in KDE 3, but not 4 or 5.
Maybe parsing the output of this would work in KDE 5:
kreadconfig5 --file kscreenlockerrc --group Daemon --key Autolock
but there's probably no way to kill the KDE saver.
Fuck it. */
FILE *p = popen ("dcop kdesktop KScreensaverIface isEnabled 2>/dev/null", FILE *p = popen ("dcop kdesktop KScreensaverIface isEnabled 2>/dev/null",
"r"); "r");
char buf[255]; char buf[255];
if (!p) return False; if (!p) return False;
if (!fgets (buf, sizeof(buf)-1, p)) return False; if (!fgets (buf, sizeof(buf)-1, p)) return False;
pclose (p); pclose (p);
if (!strcmp (buf, "true\n")) if (!strcmp (buf, "true\n"))
return True; return True;
else else
return False; return False;
skipping to change at line 4385 skipping to change at line 4394
if (system ("dcop kdesktop KScreensaverIface enable false")) {} if (system ("dcop kdesktop KScreensaverIface enable false")) {}
} }
static void static void
the_network_is_not_the_computer (state *s) the_network_is_not_the_computer (state *s)
{ {
Display *dpy = GDK_DISPLAY(); Display *dpy = GDK_DISPLAY();
char *rversion = 0, *ruser = 0, *rhost = 0; char *rversion = 0, *ruser = 0, *rhost = 0;
char *luser, *lhost; char *luser, *lhost;
char *msg = 0; char *msg = 0;
char *oname = 0;
struct passwd *p = getpwuid (getuid ()); struct passwd *p = getpwuid (getuid ());
const char *d = DisplayString (dpy); const char *d = DisplayString (dpy);
# if defined(HAVE_UNAME) # if defined(HAVE_UNAME)
struct utsname uts; struct utsname uts;
if (uname (&uts) < 0) if (uname (&uts) < 0)
lhost = "<UNKNOWN>"; lhost = "<UNKNOWN>";
else else
lhost = uts.nodename; lhost = uts.nodename;
# else /* !HAVE_UNAME */ # else /* !HAVE_UNAME */
skipping to change at line 4501 skipping to change at line 4511
if (ruser) free (ruser); if (ruser) free (ruser);
if (rhost) free (rhost); if (rhost) free (rhost);
free (msg); free (msg);
msg = 0; msg = 0;
/* Note: since these dialogs are not modal, they will stack up. /* Note: since these dialogs are not modal, they will stack up.
So we do this check *after* popping up the "xscreensaver is not So we do this check *after* popping up the "xscreensaver is not
running" dialog so that these are on top. Good enough. running" dialog so that these are on top. Good enough.
*/ */
if (gnome_screensaver_active_p ()) if (gnome_screensaver_active_p (&oname))
warning_dialog (s->toplevel_widget, {
_("Warning:\n\n" char msg [1024];
"The GNOME screensaver daemon appears to be running.\n" sprintf (msg,
"It must be stopped for XScreenSaver to work properly.\n" _("Warning:\n\n"
"\n" "The GNOME screen saver daemon (%s) appears to be running.\n"
"Stop the GNOME screen saver daemon now?\n"), "It must be stopped for XScreenSaver to work properly.\n"
D_GNOME, 1); "\n"
"Stop the \"%s\" daemon now?\n"),
oname, oname);
warning_dialog (s->toplevel_widget, msg, D_GNOME, 1);
}
if (kde_screensaver_active_p ()) if (kde_screensaver_active_p ())
warning_dialog (s->toplevel_widget, warning_dialog (s->toplevel_widget,
_("Warning:\n\n" _("Warning:\n\n"
"The KDE screen saver daemon appears to be running.\n" "The KDE screen saver daemon appears to be running.\n"
"It must be stopped for XScreenSaver to work properly.\n" "It must be stopped for XScreenSaver to work properly.\n"
"\n" "\n"
"Stop the KDE screen saver daemon now?\n"), "Stop the KDE screen saver daemon now?\n"),
D_KDE, 1); D_KDE, 1);
if (getenv ("WAYLAND_DISPLAY") || getenv ("WAYLAND_SOCKET"))
warning_dialog (s->toplevel_widget,
_("Warning:\n\n"
"You are running Wayland rather than the X Window System.\n"
"\n"
"Under Wayland, idle-detection fails when non-X11 programs\n"
"are selected, meaning the screen may blank prematurely.\n"
"Also, locking is impossible.\n"
"\n"
"See the XScreenSaver manual for instructions on\n"
"configuring your system to use X11 instead of Wayland.\n"),
D_NONE, 1);
} }
/* We use this error handler so that X errors are preceeded by the name /* We use this error handler so that X errors are preceeded by the name
of the program that generated them. of the program that generated them.
*/ */
static int static int
demo_ehandler (Display *dpy, XErrorEvent *error) demo_ehandler (Display *dpy, XErrorEvent *error)
{ {
state *s = global_state_kludge; /* I hate C so much... */ state *s = global_state_kludge; /* I hate C so much... */
fprintf (stderr, "\nX error in %s:\n", blurb()); fprintf (stderr, "\nX error in %s:\n", blurb());
 End of changes. 10 change blocks. 
12 lines changed or deleted 39 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)