From a523ade3329a36a50c75161279ced7c0d754906f Mon Sep 17 00:00:00 2001 From: Littleboy Date: Fri, 1 Apr 2011 01:04:46 -0400 Subject: BACKENDS: Add stubs for unity taskbar class --- backends/taskbar/unity/unity-taskbar.cpp | 56 ++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 backends/taskbar/unity/unity-taskbar.cpp (limited to 'backends/taskbar/unity/unity-taskbar.cpp') diff --git a/backends/taskbar/unity/unity-taskbar.cpp b/backends/taskbar/unity/unity-taskbar.cpp new file mode 100644 index 0000000000..98616a7587 --- /dev/null +++ b/backends/taskbar/unity/unity-taskbar.cpp @@ -0,0 +1,56 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#if defined(UNIX) + +#include "backends/taskbar/unity/unity-taskbar.h" + +#include "common/config-manager.h" +#include "common/textconsole.h" +#include "common/file.h" + +UnityTaskbarManager::UnityTaskbarManager() { +} + +UnityTaskbarManager::~UnityTaskbarManager() { +} + +void UnityTaskbarManager::setOverlayIcon(Common::String name, Common::String description) { + warning("[UnityTaskbarManager::setOverlayIcon] Not implemented"); +} + +void UnityTaskbarManager::setProgressValue(int completed, int total) { + warning("[UnityTaskbarManager::setProgressValue] Not implemented"); +} + +void UnityTaskbarManager::setProgressState(TaskbarProgressState state) { + warning("[UnityTaskbarManager::setProgressState] Not implemented"); +} + +void UnityTaskbarManager::addRecent(Common::String name, Common::String description) { + warning("[UnityTaskbarManager::addRecent] Not implemented"); +} + +#endif -- cgit v1.2.3 From c3d9c6afa57055705849359deaac7c5748d66fe1 Mon Sep 17 00:00:00 2001 From: Littleboy Date: Fri, 1 Apr 2011 01:30:12 -0400 Subject: BACKENDS: Add use flag for taskbar integration --- backends/taskbar/unity/unity-taskbar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'backends/taskbar/unity/unity-taskbar.cpp') diff --git a/backends/taskbar/unity/unity-taskbar.cpp b/backends/taskbar/unity/unity-taskbar.cpp index 98616a7587..4a074abca2 100644 --- a/backends/taskbar/unity/unity-taskbar.cpp +++ b/backends/taskbar/unity/unity-taskbar.cpp @@ -23,7 +23,7 @@ * */ -#if defined(UNIX) +#if defined(UNIX) && defined(USE_TASKBAR) #include "backends/taskbar/unity/unity-taskbar.h" -- cgit v1.2.3 From 984e1968bce3b4a23833719653a5d5751e5c8a04 Mon Sep 17 00:00:00 2001 From: Littleboy Date: Fri, 1 Apr 2011 08:01:53 -0400 Subject: BACKENDS: Add WIP Unity support --- backends/taskbar/unity/unity-taskbar.cpp | 43 +++++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 6 deletions(-) (limited to 'backends/taskbar/unity/unity-taskbar.cpp') 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"); } -- cgit v1.2.3 From 6c14d8a95052b68c9f076d32e520c6befac3d959 Mon Sep 17 00:00:00 2001 From: Littleboy Date: Mon, 4 Apr 2011 12:35:19 -0400 Subject: BACKENDS: Integrate glib main event loop - Unity needs a glib event loop to dispatch events. - Cleanup whitespace and indentation --- backends/taskbar/unity/unity-taskbar.cpp | 35 +++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) (limited to 'backends/taskbar/unity/unity-taskbar.cpp') diff --git a/backends/taskbar/unity/unity-taskbar.cpp b/backends/taskbar/unity/unity-taskbar.cpp index 6c18f0940c..24347e382f 100644 --- a/backends/taskbar/unity/unity-taskbar.cpp +++ b/backends/taskbar/unity/unity-taskbar.cpp @@ -32,27 +32,31 @@ #include "common/textconsole.h" UnityTaskbarManager::UnityTaskbarManager() { - g_type_init(); + g_type_init(); - _launcher = unity_launcher_entry_get_for_desktop_id("scummvm.desktop"); + _loop = g_main_loop_new(NULL, FALSE); + + _launcher = unity_launcher_entry_get_for_desktop_id("scummvm.desktop"); } UnityTaskbarManager::~UnityTaskbarManager() { + g_main_loop_unref(_loop); + _loop = NULL; } void UnityTaskbarManager::setOverlayIcon(const Common::String &name, const Common::String &description) { if (_launcher == NULL) - return; + return; warning("[UnityTaskbarManager::setOverlayIcon] Not implemented"); } void UnityTaskbarManager::setProgressValue(int completed, int total) { - if (_launcher == NULL) - return; + if (_launcher == NULL) + return; - double percentage = (double)completed / (double)total; - unity_launcher_entry_set_progress(_launcher, percentage); + double percentage = (double)completed / (double)total; + unity_launcher_entry_set_progress(_launcher, percentage); unity_launcher_entry_set_progress_visible(_launcher, TRUE); } @@ -84,4 +88,21 @@ void UnityTaskbarManager::addRecent(const Common::String &name, const Common::St warning("[UnityTaskbarManager::addRecent] Not implemented"); } +// Unity requires the glib event loop to the run to function properly +// as events are sent asynchronously +bool UnityTaskbarManager::pollEvent(Common::Event &event) { + if (!_loop) + return false; + + // Get context + GMainContext *context = g_main_loop_get_context(_loop); + if (!context) + return false; + + // Dispatch events + g_main_context_iteration(context, FALSE); + + return false; +} + #endif -- cgit v1.2.3 From e1dc9cdc0b89609753d3558f9603bef1cc12f1d8 Mon Sep 17 00:00:00 2001 From: Littleboy Date: Mon, 4 Apr 2011 12:49:49 -0400 Subject: BACKENDS: Add support for count status to TaskbarManager - Show the number of found games when using the massadd dialog --- backends/taskbar/unity/unity-taskbar.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'backends/taskbar/unity/unity-taskbar.cpp') diff --git a/backends/taskbar/unity/unity-taskbar.cpp b/backends/taskbar/unity/unity-taskbar.cpp index 24347e382f..0de2167a83 100644 --- a/backends/taskbar/unity/unity-taskbar.cpp +++ b/backends/taskbar/unity/unity-taskbar.cpp @@ -88,6 +88,15 @@ void UnityTaskbarManager::addRecent(const Common::String &name, const Common::St warning("[UnityTaskbarManager::addRecent] Not implemented"); } +void UnityTaskbarManager::setCount(int count) { + if (_launcher == NULL) + return; + + unity_launcher_entry_set_count(_launcher, count); + + unity_launcher_entry_set_count_visible(_launcher, (count == 0) ? FALSE : TRUE); +} + // Unity requires the glib event loop to the run to function properly // as events are sent asynchronously bool UnityTaskbarManager::pollEvent(Common::Event &event) { -- cgit v1.2.3 From fdada1dbffb57e12f5683f54e5bbaf7cc5eafdce Mon Sep 17 00:00:00 2001 From: Littleboy Date: Wed, 6 Apr 2011 19:51:25 -0400 Subject: BACKENDS: Remove UnityTaskbarManager::setOverlayIcon() Unity is not going to provide a way to set a custom overlay icon (the emblem API is being replaced by a simple urgent state) --- backends/taskbar/unity/unity-taskbar.cpp | 7 ------- 1 file changed, 7 deletions(-) (limited to 'backends/taskbar/unity/unity-taskbar.cpp') diff --git a/backends/taskbar/unity/unity-taskbar.cpp b/backends/taskbar/unity/unity-taskbar.cpp index 0de2167a83..0045a6fdbd 100644 --- a/backends/taskbar/unity/unity-taskbar.cpp +++ b/backends/taskbar/unity/unity-taskbar.cpp @@ -44,13 +44,6 @@ UnityTaskbarManager::~UnityTaskbarManager() { _loop = NULL; } -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) { if (_launcher == NULL) return; -- cgit v1.2.3 From 1e3603b9371204c88a60983cbfb61a4adcef0b94 Mon Sep 17 00:00:00 2001 From: Littleboy Date: Tue, 26 Apr 2011 16:19:20 -0400 Subject: BACKENDS: Add define for Unity-specific taskbar code --- backends/taskbar/unity/unity-taskbar.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'backends/taskbar/unity/unity-taskbar.cpp') diff --git a/backends/taskbar/unity/unity-taskbar.cpp b/backends/taskbar/unity/unity-taskbar.cpp index 0045a6fdbd..49c56b746d 100644 --- a/backends/taskbar/unity/unity-taskbar.cpp +++ b/backends/taskbar/unity/unity-taskbar.cpp @@ -25,7 +25,7 @@ #include "common/scummsys.h" -#if defined(UNIX) && defined(USE_TASKBAR) +#if defined(UNIX) && defined(USE_TASKBAR) && defined(USE_TASKBAR_UNITY) #include "backends/taskbar/unity/unity-taskbar.h" -- cgit v1.2.3 From 2b01778e58db8f843d3cd29756f8f710a02d7306 Mon Sep 17 00:00:00 2001 From: Littleboy Date: Wed, 22 Jun 2011 20:52:59 -0400 Subject: BACKENDS: Fix compilation with Unity - Replace UNIX by POSIX - Move unity include to cpp file - Add exception for unistd.h and time.h headers --- backends/taskbar/unity/unity-taskbar.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'backends/taskbar/unity/unity-taskbar.cpp') diff --git a/backends/taskbar/unity/unity-taskbar.cpp b/backends/taskbar/unity/unity-taskbar.cpp index 49c56b746d..da053734d2 100644 --- a/backends/taskbar/unity/unity-taskbar.cpp +++ b/backends/taskbar/unity/unity-taskbar.cpp @@ -23,14 +23,18 @@ * */ +#define FORBIDDEN_SYMBOL_EXCEPTION_unistd_h +#define FORBIDDEN_SYMBOL_EXCEPTION_time_h #include "common/scummsys.h" -#if defined(UNIX) && defined(USE_TASKBAR) && defined(USE_TASKBAR_UNITY) +#if defined(POSIX) && defined(USE_TASKBAR) && defined(USE_TASKBAR_UNITY) #include "backends/taskbar/unity/unity-taskbar.h" #include "common/textconsole.h" +#include + UnityTaskbarManager::UnityTaskbarManager() { g_type_init(); -- cgit v1.2.3