summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mate-panel/Makefile.am8
-rw-r--r--mate-panel/panel-struts.c14
-rw-r--r--mate-panel/panel-struts.h6
3 files changed, 24 insertions, 4 deletions
diff --git a/mate-panel/Makefile.am b/mate-panel/Makefile.am
index 0702c17e..e4bc90ac 100644
--- a/mate-panel/Makefile.am
+++ b/mate-panel/Makefile.am
@@ -47,7 +47,6 @@ panel_sources = \
panel-separator.c \
panel-recent.c \
panel-toplevel.c \
- panel-struts.c \
panel-frame.c \
panel-multimonitor.c \
panel-a11y.c \
@@ -70,7 +69,8 @@ panel_sources += \
panel-xutils.c \
panel-force-quit.c \
panel-action-protocol.c \
- panel-background-monitor.c
+ panel-background-monitor.c \
+ panel-struts.c
endif
panel_headers = \
@@ -102,7 +102,6 @@ panel_headers = \
panel-separator.h \
panel-recent.h \
panel-toplevel.h \
- panel-struts.h \
panel-frame.h \
panel-multimonitor.h \
panel-a11y.h \
@@ -129,7 +128,8 @@ panel_sources += \
panel-xutils.h \
panel-force-quit.h \
panel-action-protocol.h \
- panel-background-monitor.h
+ panel-background-monitor.h \
+ panel-struts.h
endif
mate_panel_SOURCES = \
diff --git a/mate-panel/panel-struts.c b/mate-panel/panel-struts.c
index 8e7fc874..f371f9b3 100644
--- a/mate-panel/panel-struts.c
+++ b/mate-panel/panel-struts.c
@@ -22,6 +22,11 @@
*/
#include <config.h>
+
+#ifndef HAVE_X11
+#error file should only be compiled when HAVE_X11 is enabled
+#endif
+
#include <gdk/gdkx.h>
#include "panel-struts.h"
@@ -259,6 +264,8 @@ panel_struts_set_window_hint (PanelToplevel *toplevel)
widget = GTK_WIDGET (toplevel);
+ g_return_if_fail (GDK_IS_X11_DISPLAY (gtk_widget_get_display (widget)));
+
if (!gtk_widget_get_realized (widget))
return;
@@ -321,6 +328,8 @@ panel_struts_set_window_hint (PanelToplevel *toplevel)
void
panel_struts_unset_window_hint (PanelToplevel *toplevel)
{
+ g_return_if_fail (GDK_IS_X11_DISPLAY (gtk_widget_get_display (GTK_WIDGET (toplevel))));
+
if (!gtk_widget_get_realized (GTK_WIDGET (toplevel)))
return;
@@ -410,6 +419,8 @@ panel_struts_register_strut (PanelToplevel *toplevel,
gboolean new_strut = FALSE;
int monitor_x, monitor_y, monitor_width, monitor_height;
+ g_return_val_if_fail (GDK_IS_X11_DISPLAY (gtk_widget_get_display (GTK_WIDGET (toplevel))), FALSE);
+
if (!(strut = panel_struts_find_strut (toplevel))) {
strut = g_new0 (PanelStrut, 1);
new_strut = TRUE;
@@ -486,6 +497,8 @@ panel_struts_unregister_strut (PanelToplevel *toplevel)
GdkScreen *screen;
int monitor;
+ g_return_if_fail (GDK_IS_X11_DISPLAY (gtk_widget_get_display (GTK_WIDGET (toplevel))));
+
if (!(strut = panel_struts_find_strut (toplevel)))
return;
@@ -507,6 +520,7 @@ panel_struts_update_toplevel_geometry (PanelToplevel *toplevel,
{
PanelStrut *strut;
+ g_return_val_if_fail (GDK_IS_X11_DISPLAY (gtk_widget_get_display (GTK_WIDGET (toplevel))), FALSE);
g_return_val_if_fail (x != NULL, FALSE);
g_return_val_if_fail (y != NULL, FALSE);
diff --git a/mate-panel/panel-struts.h b/mate-panel/panel-struts.h
index e7d8185f..7897f532 100644
--- a/mate-panel/panel-struts.h
+++ b/mate-panel/panel-struts.h
@@ -23,6 +23,12 @@
#ifndef __PANEL_STRUTS_H__
#define __PANEL_STRUTS_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 "panel-toplevel.h"