From e48051aa15d249f527774e106a8034187949ccca Mon Sep 17 00:00:00 2001 From: Stefan Wildemann Date: Wed, 25 Nov 2015 17:09:32 +0100 Subject: Sailfish needs periodic trigger for display on. --- navit/graphics/qt5/graphics_qt5.cpp | 34 ++++++++++++++++++++++++++++++---- navit/graphics/qt5/graphics_qt5.h | 9 +++++++++ 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/navit/graphics/qt5/graphics_qt5.cpp b/navit/graphics/qt5/graphics_qt5.cpp index e8793c2f9..640cba4be 100644 --- a/navit/graphics/qt5/graphics_qt5.cpp +++ b/navit/graphics/qt5/graphics_qt5.cpp @@ -47,7 +47,6 @@ #include #include - struct callback_list* callbacks; QApplication * navit_app = NULL; @@ -79,6 +78,16 @@ graphics_destroy(struct graphics_priv *gr) { g_hash_table_remove(gr->parent->overlays, gr); } +#ifdef SAILFISH_OS + if(gr->display_on_ev != NULL) + { + event_remove_timeout(gr->display_on_ev); + } + if(gr->display_on_cb != NULL) + { + g_free(gr->display_on_cb); + } +#endif /* destroy overlays hash */ g_hash_table_destroy(gr->overlays); /* destroy self */ @@ -465,15 +474,32 @@ graphics_qt5_fullscreen(struct window *w, int on) return 1; } +#ifdef SAILFISH_OS static void -graphics_qt5_disable_suspend(struct window *w) +keep_display_on(struct graphics_priv * priv) { dbg(lvl_debug,"enter\n"); QDBusConnection system = QDBusConnection::connectToBus(QDBusConnection::SystemBus, "system"); QDBusInterface interface("com.nokia.mce", "/com/nokia/mce/request", "com.nokia.mce.request", system); - interface.call(QLatin1String("req_display_blanking_pause")); -// interface.call(QLatin1String("req_display_cancel_blanking_pause")); + interface.call(QLatin1String("req_display_blanking_pause")); +} +#endif + + +static void +graphics_qt5_disable_suspend(struct window *w) +{ +// dbg(lvl_debug,"enter\n"); +#ifdef SAILFISH_OS + struct graphics_priv * gr; + gr = (struct graphics_priv *) w->priv; + keep_display_on(gr); + /* to keep display on, d-bus trigger must be called at least once per second. + * to cope with fuzz, trigger it once per 30 seconds */ + gr->display_on_cb = callback_new_1(callback_cast(keep_display_on), gr); + gr->display_on_ev = event_add_timeout(30000, 1, gr->display_on_cb); +#endif } static void * diff --git a/navit/graphics/qt5/graphics_qt5.h b/navit/graphics/qt5/graphics_qt5.h index fb3c29f8d..0f15a88fd 100644 --- a/navit/graphics/qt5/graphics_qt5.h +++ b/navit/graphics/qt5/graphics_qt5.h @@ -12,6 +12,11 @@ #define QT_QPAINTER_USE_FREETYPE 1 #endif +#ifndef SAILFISH_OS +#define SAILFISH_OS 1 +#endif + + #ifdef QT_QPAINTER_USE_FREETYPE #include "navit/font/freetype/font_freetype.h" #endif @@ -28,6 +33,10 @@ struct graphics_priv { #ifdef QT_QPAINTER_USE_FREETYPE struct font_priv * (*font_freetype_new)(void *meth); struct font_freetype_methods freetype_methods; +#endif +#ifdef SAILFISH_OS + struct callback *display_on_cb; + struct event_timeout *display_on_ev; #endif GHashTable *overlays; struct graphics_priv * parent; -- cgit v1.2.1