#include "config.h"
#include <glib/gi18n.h>
+
+#include <gdk/gdk.h>
+
+#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
+#include <X11/keysym.h>
#ifdef HAVE_XTEST
#include <X11/extensions/XTest.h>
#endif /* HAVE_XTEST */
-#include <X11/keysym.h>
+#endif /* GDK_WINDOWING_X11 */
#ifdef ENABLE_DBUS
+#include <dbus/dbus.h>
#include <dbus/dbus-glib.h>
#define GS_SERVICE "org.gnome.ScreenSaver"
/* For use with XTest */
int keycode1, keycode2;
int *keycode;
- Bool have_xtest;
+ gboolean have_xtest;
};
G_DEFINE_TYPE(TotemScrsaver, totem_scrsaver, G_TYPE_OBJECT)
#endif /* ENABLE_DBUS */
}
+#ifdef GDK_WINDOWING_X11
static void
screensaver_enable_x11 (TotemScrsaver *scr)
{
#ifdef HAVE_XTEST
- if (scr->priv->have_xtest == True)
+ if (scr->priv->have_xtest != FALSE)
{
g_source_remove_by_user_data (scr);
return;
{
#ifdef HAVE_XTEST
- if (scr->priv->have_xtest == True)
+ if (scr->priv->have_xtest != FALSE)
{
XLockDisplay (GDK_DISPLAY());
XGetScreenSaver(GDK_DISPLAY(), &scr->priv->timeout,
int a, b, c, d;
XLockDisplay (GDK_DISPLAY());
- scr->priv->have_xtest = XTestQueryExtension (GDK_DISPLAY(), &a, &b, &c, &d);
- if(scr->priv->have_xtest == True)
+ scr->priv->have_xtest = (XTestQueryExtension (GDK_DISPLAY(), &a, &b, &c, &d) == True);
+ if (scr->priv->have_xtest != FALSE)
{
scr->priv->keycode1 = XKeysymToKeycode (GDK_DISPLAY(), XK_Alt_L);
if (scr->priv->keycode1 == 0) {
{
g_source_remove_by_user_data (scr);
}
+#endif
static void
totem_scrsaver_class_init (TotemScrsaverClass *klass)
scr = TOTEM_SCRSAVER (g_object_new (TOTEM_TYPE_SCRSAVER, NULL));
screensaver_init_dbus (scr, connection);
+#ifdef GDK_WINDOWING_X11
screensaver_init_x11 (scr);
+#else
+#warning Unimplemented
+#endif
return scr;
}
TotemScrsaver * scr;
scr = TOTEM_SCRSAVER (g_object_new (TOTEM_TYPE_SCRSAVER, NULL));
+#ifdef GDK_WINDOWING_X11
screensaver_init_x11 (scr);
+#else
+#warning Unimplemented
+#endif
return scr;
}
totem_scrsaver_init (TotemScrsaver *scr)
{
scr->priv = g_new0 (TotemScrsaverPrivate, 1);
+
+
}
void
totem_scrsaver_disable (TotemScrsaver *scr)
{
+ g_return_if_fail (TOTEM_SCRSAVER (scr));
+
if (scr->priv->disabled != FALSE)
return;
if (screensaver_is_running_dbus (scr) != FALSE)
screensaver_disable_dbus (scr);
else
+#ifdef GDK_WINDOWING_X11
screensaver_disable_x11 (scr);
+#else
+#warning Unimplemented
+ {}
+#endif
}
void
totem_scrsaver_enable (TotemScrsaver *scr)
{
+ g_return_if_fail (TOTEM_SCRSAVER (scr));
+
if (scr->priv->disabled == FALSE)
return;
if (screensaver_is_running_dbus (scr) != FALSE)
screensaver_enable_dbus (scr);
else
+#ifdef GDK_WINDOWING_X11
screensaver_enable_x11 (scr);
+#else
+#warning Unimplemented
+ {}
+#endif
}
static void
TotemScrsaver *scr = TOTEM_SCRSAVER (object);
screensaver_finalize_dbus (scr);
+#ifdef GDK_WINDOWING_X11
screensaver_finalize_x11 (scr);
+#else
+#warning Unimplemented
+ {}
+#endif
g_free (scr->priv);