summaryrefslogtreecommitdiff
path: root/src/procproperties.cpp
diff options
context:
space:
mode:
authormbkma <[email protected]>2021-04-24 18:02:25 +0200
committerraveit65 <[email protected]>2021-06-10 15:03:09 +0200
commit80640c9b70283c5ad13858d8b820302bb6d06132 (patch)
tree6abe9f3196076ff49ae8221c9c26f957861045a7 /src/procproperties.cpp
parent91a35358aed44381c9e5e249dcc081d77b4e29ee (diff)
downloadmate-system-monitor-80640c9b70283c5ad13858d8b820302bb6d06132.tar.bz2
mate-system-monitor-80640c9b70283c5ad13858d8b820302bb6d06132.tar.xz
add wayland support
therefore make libwnck optional (libwnck is x11 only) see https://gitlab.gnome.org/GNOME/gnome-system-monitor/-/commit/3705931e307e87878f205b905eaa3f5daaffcf09 and https://gitlab.gnome.org/GNOME/gnome-system-monitor/-/commit/8c4d47d625661e848643ce564f63ed3ec1e83293 and https://gitlab.gnome.org/GNOME/gnome-system-monitor/-/commit/1ea64e9965bd6f1026f1167b692e7cc83c269be3
Diffstat (limited to 'src/procproperties.cpp')
-rw-r--r--src/procproperties.cpp37
1 files changed, 27 insertions, 10 deletions
diff --git a/src/procproperties.cpp b/src/procproperties.cpp
index c8de56b..b74bbce 100644
--- a/src/procproperties.cpp
+++ b/src/procproperties.cpp
@@ -30,6 +30,10 @@
#include "proctable.h"
#include "util.h"
+#ifdef GDK_WINDOWING_X11
+#include <gdk/gdkx.h>
+#endif
+
enum
{
COL_PROP = 0,
@@ -71,24 +75,35 @@ static void
get_process_memory_info (ProcInfo *info)
{
glibtop_proc_mem procmem;
- WnckResourceUsage xresources;
- wnck_pid_read_resource_usage (gdk_screen_get_display (gdk_screen_get_default ()),
- info->pid,
- &xresources);
+#ifdef HAVE_WNCK
+ info->memxserver = 0;
+#ifdef GDK_WINDOWING_X11
+ if (GDK_IS_X11_DISPLAY (gdk_display_get_default ())) {
+ WnckResourceUsage xresources;
- glibtop_get_proc_mem(&procmem, info->pid);
+ wnck_pid_read_resource_usage (gdk_screen_get_display (gdk_screen_get_default ()),
+ info->pid,
+ &xresources);
+
+ info->memxserver = xresources.total_bytes_estimate;
+ }
+#endif // GDK_WINDOWING_X11
+#endif // HAVE_WNCK
- info->vmsize = procmem.vsize;
- info->memres = procmem.resident;
- info->memshared = procmem.share;
+ glibtop_get_proc_mem(&procmem, info->pid);
- info->memxserver = xresources.total_bytes_estimate;
+ info->vmsize = procmem.vsize;
+ info->memres = procmem.resident;
+ info->memshared = procmem.share;
get_process_memory_writable(info);
// fake the smart memory column if writable is not available
- info->mem = info->memxserver + (info->memwritable ? info->memwritable : info->memres);
+ info->mem = info->memwritable ? info->memwritable : info->memres;
+#ifdef HAVE_WNCK
+ info->mem += info->memxserver;
+#endif
}
static gchar*
@@ -129,7 +144,9 @@ fill_proc_properties (GtkWidget *tree, ProcInfo *info)
{ N_("Resident Memory"), format_memsize(info->memres)},
{ N_("Writable Memory"), format_memsize(info->memwritable)},
{ N_("Shared Memory"), format_memsize(info->memshared)},
+#ifdef HAVE_WNCK
{ N_("X Server Memory"), format_memsize(info->memxserver)},
+#endif
{ N_("Disk Read Total"), format_size(info->disk_read_bytes_total)},
{ N_("Disk Write Total"), format_size(info->disk_write_bytes_total)},
{ N_("CPU"), g_strdup_printf("%d%%", info->pcpu)},