Commit 8c4d47d6 authored by Matthias Clasen's avatar Matthias Clasen

Work under wayland even when built with wnck

There is really no need to ask libwnck for X resource consumption
when the display we are using is not an X display. This makes
gnome-system-monitor work under Wayland, even when the X resource
support is compiled in.

https://bugzilla.gnome.org/show_bug.cgi?id=753972
parent b3be0fe0
......@@ -57,7 +57,7 @@ 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, libwnck-3.0 >= $LIBWNCK_REQUIRED gdk-x11-3.0)
AC_DEFINE(HAVE_WNCK, 1, [Define if libwnck is available])
fi
AM_CONDITIONAL(HAVE_WNCK, [test "enable_wnck" = "yes"])
......
......@@ -24,6 +24,9 @@
#include "proctable.h"
#include "util.h"
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
#endif
namespace
{
......@@ -34,11 +37,15 @@ namespace
PrettyTable::PrettyTable()
{
#ifdef HAVE_WNCK
WnckScreen* screen = wnck_screen_get_default();
g_signal_connect(G_OBJECT(screen), "application_opened",
G_CALLBACK(PrettyTable::on_application_opened), this);
g_signal_connect(G_OBJECT(screen), "application_closed",
G_CALLBACK(PrettyTable::on_application_closed), this);
#ifdef GDK_WINDOWING_X11
if (GDK_IS_X11_DISPLAY (gdk_display_get_default ())) {
WnckScreen* screen = wnck_screen_get_default();
g_signal_connect(G_OBJECT(screen), "application_opened",
G_CALLBACK(PrettyTable::on_application_opened), this);
g_signal_connect(G_OBJECT(screen), "application_closed",
G_CALLBACK(PrettyTable::on_application_closed), this);
}
#endif
#endif
// init GIO apps cache
......
......@@ -59,6 +59,10 @@
#include "treeview.h"
#include "systemd.h"
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
#endif
ProcInfo::UserMap ProcInfo::users;
ProcInfo::List ProcInfo::all;
std::map<pid_t, guint64> ProcInfo::cpu_times;
......@@ -715,14 +719,20 @@ static void
get_process_memory_info(ProcInfo *info)
{
glibtop_proc_mem procmem;
#ifdef HAVE_WNCK
WnckResourceUsage xresources;
info->memxserver = 0;
#ifdef GDK_WINDOWING_X11
if (GDK_IS_X11_DISPLAY (gdk_display_get_default ())) {
WnckResourceUsage xresources;
wnck_pid_read_resource_usage (gdk_screen_get_display (gdk_screen_get_default ()),
info->pid,
&xresources);
wnck_pid_read_resource_usage (gdk_display_get_default (),
info->pid,
&xresources);
info->memxserver = xresources.total_bytes_estimate;
info->memxserver = xresources.total_bytes_estimate;
}
#endif
#endif
glibtop_get_proc_mem(&procmem, info->pid);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment