diff options
-rw-r--r-- | backends/platform/sdl/posix/posix.cpp | 6 | ||||
-rw-r--r-- | backends/taskbar/unity/unity-taskbar.cpp | 43 | ||||
-rw-r--r-- | backends/taskbar/unity/unity-taskbar.h | 7 | ||||
-rwxr-xr-x | configure | 23 |
4 files changed, 61 insertions, 18 deletions
diff --git a/backends/platform/sdl/posix/posix.cpp b/backends/platform/sdl/posix/posix.cpp index d757186134..f124a3af7d 100644 --- a/backends/platform/sdl/posix/posix.cpp +++ b/backends/platform/sdl/posix/posix.cpp @@ -33,6 +33,7 @@ #include "backends/platform/sdl/posix/posix.h" #include "backends/saves/posix/posix-saves.h" #include "backends/fs/posix/posix-fs-factory.h" +#include "backends/taskbar/unity/unity-taskbar.h" #include <errno.h> #include <sys/stat.h> @@ -49,6 +50,11 @@ void OSystem_POSIX::init() { // Initialze File System Factory _fsFactory = new POSIXFilesystemFactory(); +#if defined(USE_TASKBAR) + // Initialize taskbar manager + _taskbarManager = new UnityTaskbarManager(); +#endif + // Invoke parent implementation of this method OSystem_SDL::init(); } diff --git a/backends/taskbar/unity/unity-taskbar.cpp b/backends/taskbar/unity/unity-taskbar.cpp index 4a074abca2..6c18f0940c 100644 --- a/backends/taskbar/unity/unity-taskbar.cpp +++ b/backends/taskbar/unity/unity-taskbar.cpp @@ -23,33 +23,64 @@ * */ +#include "common/scummsys.h" + #if defined(UNIX) && defined(USE_TASKBAR) #include "backends/taskbar/unity/unity-taskbar.h" -#include "common/config-manager.h" #include "common/textconsole.h" -#include "common/file.h" UnityTaskbarManager::UnityTaskbarManager() { + g_type_init(); + + _launcher = unity_launcher_entry_get_for_desktop_id("scummvm.desktop"); } UnityTaskbarManager::~UnityTaskbarManager() { } -void UnityTaskbarManager::setOverlayIcon(Common::String name, Common::String description) { +void UnityTaskbarManager::setOverlayIcon(const Common::String &name, const Common::String &description) { + if (_launcher == NULL) + return; + warning("[UnityTaskbarManager::setOverlayIcon] Not implemented"); } void UnityTaskbarManager::setProgressValue(int completed, int total) { - warning("[UnityTaskbarManager::setProgressValue] Not implemented"); + if (_launcher == NULL) + return; + + double percentage = (double)completed / (double)total; + unity_launcher_entry_set_progress(_launcher, percentage); + unity_launcher_entry_set_progress_visible(_launcher, TRUE); } void UnityTaskbarManager::setProgressState(TaskbarProgressState state) { - warning("[UnityTaskbarManager::setProgressState] Not implemented"); + if (_launcher == NULL) + return; + + switch (state) { + default: + warning("[UnityTaskbarManager::setProgressState] Unknown state / Not implemented (%d)", state); + // fallback to noprogress state + + case kTaskbarNoProgress: + unity_launcher_entry_set_progress_visible(_launcher, FALSE); + break; + + // Unity only support two progress states as of 3.0: visible or not visible + // We show progress in all of those states + case kTaskbarIndeterminate: + case kTaskbarNormal: + case kTaskbarError: + case kTaskbarPaused: + unity_launcher_entry_set_progress_visible(_launcher, TRUE); + break; + } } -void UnityTaskbarManager::addRecent(Common::String name, Common::String description) { +void UnityTaskbarManager::addRecent(const Common::String &name, const Common::String &description) { warning("[UnityTaskbarManager::addRecent] Not implemented"); } diff --git a/backends/taskbar/unity/unity-taskbar.h b/backends/taskbar/unity/unity-taskbar.h index cd8efdaf2a..0d0484c02e 100644 --- a/backends/taskbar/unity/unity-taskbar.h +++ b/backends/taskbar/unity/unity-taskbar.h @@ -31,17 +31,20 @@ #include "common/str.h" #include "common/taskbar.h" +#include <unity.h> + class UnityTaskbarManager : public Common::TaskbarManager { public: UnityTaskbarManager(); virtual ~UnityTaskbarManager(); - virtual void setOverlayIcon(Common::String name, Common::String description); + virtual void setOverlayIcon(const Common::String &name, const Common::String &description); virtual void setProgressValue(int completed, int total); virtual void setProgressState(TaskbarProgressState state); - virtual void addRecent(Common::String name, Common::String description); + virtual void addRecent(const Common::String &name, const Common::String &description); private: + UnityLauncherEntry *_launcher; }; #endif @@ -138,7 +138,7 @@ _fluidsynth=auto _opengl=auto _opengles=auto _readline=auto -_taskbar=auto +_unity=auto # Default option behaviour yes/no _debug_build=auto _release_build=auto @@ -822,8 +822,8 @@ for ac_option in $@; do --disable-fluidsynth) _fluidsynth=no ;; --enable-readline) _readline=yes ;; --disable-readline) _readline=no ;; - --enable-taskbar) _taskbar=yes ;; - --disable-taskbar) _taskbar=no ;; + --enable-unity) _unity=yes ;; + --disable-unity) _unity=no ;; --enable-opengl) _opengl=yes ;; --disable-opengl) _opengl=no ;; --enable-verbose-build) _verbose_build=yes ;; @@ -2934,21 +2934,24 @@ define_in_config_h_if_yes "$_text_console" 'USE_TEXT_CONSOLE_FOR_DEBUGGER' # # Check for Unity if taskbar integration is enabled # -echocheck "taskbar" -if test "$_taskbar" = auto ; then - _taskbar=no +echocheck "unity" +# Unity has a lots of dependency, update the libs and cflags var with them +UNITY_LIBS="$UNITY_LIBS $(pkg-config --libs unity)" +UNITY_CFLAGS="$UNITY_CFLAGS $(pkg-config --cflags unity)" +if test "$_unity" = auto ; then + _unity=no cat > $TMPC << EOF #include <unity.h> int main(void) { return 0; } EOF - cc_check $UNITY_CFLAGS $UNITY_LIBS -lunity && _taskbar=yes + cc_check $UNITY_CFLAGS $UNITY_LIBS -lunity && _unity=yes fi -if test "$_taskbar" = yes ; then +if test "$_unity" = yes ; then LIBS="$LIBS $UNITY_LIBS -lunity" INCLUDES="$INCLUDES $UNITY_CFLAGS" fi -define_in_config_h_if_yes "$_taskbar" 'USE_TASKBAR' -echo "$_taskbar" +define_in_config_h_if_yes "$_unity" 'USE_TASKBAR' +echo "$_unity" # # Check for OpenGL (ES) |