Bug 1433703 - Remove the libxss-based code from the screenshot tool. r?build draft
authorMike Hommey <mh+mozilla@glandium.org>
Tue, 30 Jan 2018 13:49:26 +0900
changeset 748654 63e06e4eb8c3b1816fb72d785e1fdd118feeb2b7
parent 748653 ae61f9ccfea3199f3171b20590f83b017df9587b
push id97217
push userbmo:mh+mozilla@glandium.org
push dateTue, 30 Jan 2018 04:50:45 +0000
reviewersbuild
bugs1433703
milestone60.0a1
Bug 1433703 - Remove the libxss-based code from the screenshot tool. r?build It hasn't been used for a long while, and the screenshot tool is only used for tests. So keeping the code essentially always disabled doesn't have much value.
old-configure.in
testing/tools/screenshot/gdk-screenshot.cpp
testing/tools/screenshot/moz.build
--- a/old-configure.in
+++ b/old-configure.in
@@ -1291,34 +1291,25 @@ if test -n "$MOZ_X11"; then
     dnl ========================================================
     AC_CHECK_LIB(xcb, xcb_connect, [XLIBS="-lxcb $XLIBS"],
         [MISSING_X="$MISSING_X -lxcb"], $XLIBS)
     AC_CHECK_LIB(xcb-shm, xcb_shm_query_version, [XLIBS="-lxcb-shm $XLIBS"],
         [MISSING_X="$MISSING_X -lxcb-shm"], $XLIBS)
     AC_CHECK_LIB(X11-xcb, XGetXCBConnection, [XLIBS="-lX11-xcb $XLIBS"],
         [MISSING_X="$MISSING_X -lX11-xcb"], $XLIBS)
 
-    dnl ========================================================
-    dnl = Check for Xss
-    dnl ========================================================
-    MOZ_CHECK_HEADER(X11/extensions/scrnsaver.h,
-        AC_CHECK_LIB(Xss, XScreenSaverQueryInfo,
-            [XSS_LIBS="-lXss $XEXT_LIBS $XLIBS"
-             AC_DEFINE(HAVE_LIBXSS)],, $XEXT_LIBS $XLIBS))
-
     LDFLAGS="$_SAVE_LDFLAGS"
     LIBS="$_SAVE_LIBS"
 fi # $MOZ_X11
 
 AC_SUBST_LIST(XCFLAGS)
 AC_SUBST_LIST(XLDFLAGS)
 AC_SUBST_LIST(XLIBS)
 AC_SUBST_LIST(XEXT_LIBS)
 AC_SUBST_LIST(XT_LIBS)
-AC_SUBST_LIST(XSS_LIBS)
 
 dnl ========================================================
 dnl = pthread support
 dnl = Start by checking whether the system support pthreads
 dnl ========================================================
 case "$target_os" in
 darwin*)
     MOZ_USE_PTHREADS=1
--- a/testing/tools/screenshot/gdk-screenshot.cpp
+++ b/testing/tools/screenshot/gdk-screenshot.cpp
@@ -31,19 +31,16 @@
 /*
  * gdk-screenshot.cpp: Save a screenshot of the root window in .png format.
  *  If a filename is specified as the first argument on the commandline,
  *  then the image will be saved to that filename. Otherwise, the image will
  *  be written to stdout.
  */
 #include <gdk/gdk.h>
 #include <gdk/gdkx.h>
-#ifdef HAVE_LIBXSS
-#include <X11/extensions/scrnsaver.h>
-#endif
 
 #include <errno.h>
 #include <stdio.h>
 
 gboolean save_to_stdout(const gchar *buf, gsize count,
                         GError **error, gpointer data)
 {
   size_t written = fwrite(buf, 1, count, stdout);
@@ -55,83 +52,16 @@ gboolean save_to_stdout(const gchar *buf
 
   return TRUE;
 }
 
 int main(int argc, char** argv)
 {
   gdk_init(&argc, &argv);
 
-#if defined(HAVE_LIBXSS) && defined(MOZ_WIDGET_GTK)
-  int event_base, error_base;
-  Bool have_xscreensaver =
-    XScreenSaverQueryExtension(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()),
-                               &event_base, &error_base);
-
-  if (!have_xscreensaver) {
-    fprintf(stderr, "No XScreenSaver extension on display\n");
-  } else {
-    XScreenSaverInfo* info = XScreenSaverAllocInfo();
-    if (!info) {
-      fprintf(stderr, "%s: Out of memory\n", argv[0]);
-      return 1;
-    }
-    XScreenSaverQueryInfo(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()),
-                          GDK_ROOT_WINDOW(), info);
-
-    const char* state;
-    const char* til_or_since = nullptr;
-    switch (info->state) {
-    case ScreenSaverOff:
-      state = "Off";
-      til_or_since = "XScreenSaver will activate after another %lu seconds idle time\n";
-      break;
-    case ScreenSaverOn:
-      state = "On";
-      if (info->til_or_since) {
-        til_or_since = "XScreenSaver idle timer activated %lu seconds ago\n";
-      } else {
-        til_or_since = "XScreenSaver idle activation is disabled\n";
-      }
-      break;
-    case ScreenSaverDisabled:
-      state = "Disabled";
-      break;
-    default:
-      state = "unknown";
-    }
-
-    const char* kind;
-    switch (info->kind) {
-    case ScreenSaverBlanked:
-      kind = "Blanked";
-      break;
-    case ScreenSaverInternal:
-      state = "Internal";
-      break;
-    case ScreenSaverExternal:
-      state = "External";
-      break;
-    default:
-      state = "unknown";
-    }
-
-    fprintf(stderr, "XScreenSaver state: %s\n", state);
-
-    if (til_or_since) {
-      fprintf(stderr, "XScreenSaver kind: %s\n", kind);
-      fprintf(stderr, til_or_since, info->til_or_since / 1000);
-    }
-
-    fprintf(stderr, "User input has been idle for %lu seconds\n", info->idle / 1000);
-
-    XFree(info);
-  }
-#endif
-
   GdkPixbuf* screenshot = nullptr;
   GdkWindow* window = gdk_get_default_root_window();
   screenshot = gdk_pixbuf_get_from_window(window, 0, 0,
                                           gdk_window_get_width(window),
                                           gdk_window_get_height(window));
   if (!screenshot) {
     fprintf(stderr, "%s: failed to create screenshot GdkPixbuf\n", argv[0]);
     return 1;
--- a/testing/tools/screenshot/moz.build
+++ b/testing/tools/screenshot/moz.build
@@ -7,17 +7,16 @@
 if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT'] and CONFIG['MOZ_X11']:
     Program('screentopng')
     SOURCES += [
         'gdk-screenshot.cpp',
     ]
     CXXFLAGS += CONFIG['TK_CFLAGS']
     LDFLAGS += CONFIG['XLDFLAGS']
     OS_LIBS += CONFIG['TK_LIBS']
-    OS_LIBS += CONFIG['XSS_LIBS']
 elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
     Program('screenshot')
     SOURCES += [
         'win32-screenshot.cpp',
     ]
     USE_STATIC_LIBS = True
     if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
         WIN32_EXE_LDFLAGS += ['-municode']