diff options
Diffstat (limited to 'backends/taskbar/unity')
| -rw-r--r-- | backends/taskbar/unity/unity-taskbar.cpp | 35 | ||||
| -rw-r--r-- | backends/taskbar/unity/unity-taskbar.h | 7 | 
2 files changed, 34 insertions, 8 deletions
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 diff --git a/backends/taskbar/unity/unity-taskbar.h b/backends/taskbar/unity/unity-taskbar.h index 0d0484c02e..d8a68a4101 100644 --- a/backends/taskbar/unity/unity-taskbar.h +++ b/backends/taskbar/unity/unity-taskbar.h @@ -28,12 +28,13 @@  #if defined(UNIX) && defined(USE_TASKBAR) +#include "common/events.h"  #include "common/str.h"  #include "common/taskbar.h"  #include <unity.h> -class UnityTaskbarManager : public Common::TaskbarManager { +class UnityTaskbarManager : public Common::TaskbarManager, public Common::EventSource {  public:  	UnityTaskbarManager();  	virtual ~UnityTaskbarManager(); @@ -43,7 +44,11 @@ public:  	virtual void setProgressState(TaskbarProgressState state);  	virtual void addRecent(const Common::String &name, const Common::String &description); +	// Implementation of the EventSource interface +        virtual bool pollEvent(Common::Event &event); +  private: +	GMainLoop          *_loop;  	UnityLauncherEntry *_launcher;  };  | 
