summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Wold <[email protected]>2019-06-18 21:54:43 +0000
committerraveit65 <[email protected]>2019-06-21 18:41:12 +0200
commit592f9c1ba5e8a1719551fe545f8f3e2d82c8b22b (patch)
treefd62c76d635663c0f135f793301fea6510f830fe
parent4703065becdb10a99dda91db6c8f68cc4486db35 (diff)
downloadmate-panel-592f9c1ba5e8a1719551fe545f8f3e2d82c8b22b.tar.bz2
mate-panel-592f9c1ba5e8a1719551fe545f8f3e2d82c8b22b.tar.xz
Make panel-background-monitor X11-only
-rw-r--r--mate-panel/Makefile.am8
-rw-r--r--mate-panel/panel-background-monitor.c12
-rw-r--r--mate-panel/panel-background-monitor.h6
3 files changed, 22 insertions, 4 deletions
diff --git a/mate-panel/Makefile.am b/mate-panel/Makefile.am
index a92190d2..209c4b6b 100644
--- a/mate-panel/Makefile.am
+++ b/mate-panel/Makefile.am
@@ -39,7 +39,6 @@ panel_sources = \
panel-applets-manager.c \
panel-shell.c \
panel-background.c \
- panel-background-monitor.c \
panel-stock-icons.c \
panel-action-button.c \
panel-menu-bar.c \
@@ -70,7 +69,8 @@ panel_sources += \
xstuff.c \
panel-xutils.c \
panel-force-quit.c \
- panel-action-protocol.c
+ panel-action-protocol.c \
+ panel-background-monitor.c
endif
panel_headers = \
@@ -94,7 +94,6 @@ panel_headers = \
panel-applets-manager.h \
panel-shell.h \
panel-background.h \
- panel-background-monitor.h \
panel-stock-icons.h \
panel-action-button.h \
panel-menu-bar.h \
@@ -129,7 +128,8 @@ panel_sources += \
xstuff.h \
panel-xutils.h \
panel-force-quit.h \
- panel-action-protocol.h
+ panel-action-protocol.h \
+ panel-background-monitor.h
endif
mate_panel_SOURCES = \
diff --git a/mate-panel/panel-background-monitor.c b/mate-panel/panel-background-monitor.c
index c2cd431d..4c33aedf 100644
--- a/mate-panel/panel-background-monitor.c
+++ b/mate-panel/panel-background-monitor.c
@@ -24,6 +24,12 @@
* Mark McLoughlin <[email protected]>
*/
+#include <config.h>
+
+#ifndef HAVE_X11
+#error file should only be compiled when HAVE_X11 is enabled
+#endif
+
#include <glib.h>
#include <glib-object.h>
#include <gdk/gdk.h>
@@ -82,6 +88,7 @@ static guint signals [LAST_SIGNAL] = { 0 };
gboolean gdk_window_check_composited_wm(GdkWindow* window)
{
+ g_return_val_if_fail (GDK_IS_X11_WINDOW (window), TRUE);
return gdk_screen_is_composited(gdk_window_get_screen(window));
}
@@ -182,6 +189,8 @@ panel_background_monitor_new (GdkScreen *screen)
PanelBackgroundMonitor *
panel_background_monitor_get_for_screen (GdkScreen *screen)
{
+ g_return_val_if_fail (GDK_IS_X11_SCREEN (screen), NULL);
+
if (!global_background_monitor) {
global_background_monitor = panel_background_monitor_new (screen);
@@ -361,6 +370,9 @@ panel_background_monitor_get_region (PanelBackgroundMonitor *monitor,
int subwidth, subheight;
int subx, suby;
+ g_return_val_if_fail (monitor, NULL);
+ g_return_val_if_fail (GDK_IS_X11_WINDOW (monitor->gdkwindow), NULL);
+
if (!monitor->gdkpixbuf)
panel_background_monitor_setup_pixbuf (monitor);
diff --git a/mate-panel/panel-background-monitor.h b/mate-panel/panel-background-monitor.h
index 29cafd66..56140bc9 100644
--- a/mate-panel/panel-background-monitor.h
+++ b/mate-panel/panel-background-monitor.h
@@ -27,6 +27,12 @@
#ifndef __PANEL_BACKGROUND_MONITOR_H__
#define __PANEL_BACKGROUND_MONITOR_H__
+#ifdef PACKAGE_NAME // only check HAVE_X11 if config.h has been included
+#ifndef HAVE_X11
+#error file should only be included when HAVE_X11 is enabled
+#endif
+#endif
+
#include <glib.h>
#include <glib-object.h>
#include <gdk/gdk.h>