[gnome-system-monitor/wip/waylandbug] Only use wnck on X11



commit ccbd20ad0b218eab02fc660fbec8911a08ec1676
Author: Robert Roth <robert roth off gmail com>
Date:   Tue Jun 30 01:30:49 2015 +0300

    Only use wnck on X11

 configure.ac      |    3 ++-
 src/proctable.cpp |   18 ++++++++++++------
 2 files changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index db4e203..0f3e8fa 100644
--- a/configure.ac
+++ b/configure.ac
@@ -56,7 +56,8 @@ AC_PATH_PROG(DESKTOP_FILE_VALIDATE, desktop-file-validate)
 
 AC_ARG_ENABLE(wnck, AS_HELP_STRING([--enable-wnck], [enable wnck 
support]),enable_wnck="$enableval",enable_wnck=no)
 if test "x$enable_wnck" != "xno"; then
-        PKG_CHECK_MODULES(WNCK, libwnck-3.0 >= $LIBWNCK_REQUIRED)
+        PKG_CHECK_MODULES(WNCK, gdk-x11-3.0
+                                libwnck-3.0 >= $LIBWNCK_REQUIRED)
         AC_DEFINE(HAVE_WNCK, 1, [Define if libwnck is available])
 fi
 AM_CONDITIONAL(HAVE_WNCK, [test "enable_wnck" = "yes"])
diff --git a/src/proctable.cpp b/src/proctable.cpp
index 2caeaf2..b482cb6 100644
--- a/src/proctable.cpp
+++ b/src/proctable.cpp
@@ -43,9 +43,10 @@
 #include <set>
 #include <list>
 
-#ifdef HAVE_WNCK
+#if defined(HAVE_WNCK) && defined(GDK_WINDOWING_X11)
 #define WNCK_I_KNOW_THIS_IS_UNSTABLE
 #include <libwnck/libwnck.h>
+#include <gdk/gdkx.h>
 #endif
 
 #include "application.h"
@@ -715,14 +716,19 @@ static void
 get_process_memory_info(ProcInfo *info)
 {
     glibtop_proc_mem procmem;
-#ifdef HAVE_WNCK
-    WnckResourceUsage xresources;
+    GdkDisplay *display = gdk_screen_get_display (gdk_screen_get_default ());
+
+#if defined(HAVE_WNCK) && defined(GDK_WINDOWING_X11)
+    if (GDK_IS_X11_DISPLAY (display)) {
+        WnckResourceUsage xresources;
 
-    wnck_pid_read_resource_usage (gdk_screen_get_display (gdk_screen_get_default ()),
+        wnck_pid_read_resource_usage (display,
                                   info->pid,
                                   &xresources);
 
-    info->memxserver = xresources.total_bytes_estimate;
+        info->memxserver = xresources.total_bytes_estimate;
+    }
+
 #endif
 
     glibtop_get_proc_mem(&procmem, info->pid);
@@ -732,7 +738,7 @@ get_process_memory_info(ProcInfo *info)
     info->memshared = procmem.share;
 
     info->mem = info->memres - info->memshared;
-#ifdef HAVE_WNCK
+#if defined(HAVE_WNCK) && defined(GDK_WINDOWING_X11)
     info->mem += info->memxserver;
 #endif
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]