Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'intern/ghost/intern/GHOST_TaskbarX11.cpp')
-rw-r--r--intern/ghost/intern/GHOST_TaskbarX11.cpp130
1 files changed, 67 insertions, 63 deletions
diff --git a/intern/ghost/intern/GHOST_TaskbarX11.cpp b/intern/ghost/intern/GHOST_TaskbarX11.cpp
index fbf51605bf0..e33c84fe4d8 100644
--- a/intern/ghost/intern/GHOST_TaskbarX11.cpp
+++ b/intern/ghost/intern/GHOST_TaskbarX11.cpp
@@ -25,10 +25,10 @@
#include <cassert>
#include <cstdlib>
-typedef void*(*unity_get_entry_t)(const char*);
-typedef void(*unity_set_progress_t)(void*, double);
-typedef void(*unity_set_progress_visible_t)(void*, int);
-typedef int(*unity_event_loop_t)(void*, int);
+typedef void *(*unity_get_entry_t)(const char *);
+typedef void (*unity_set_progress_t)(void *, double);
+typedef void (*unity_set_progress_visible_t)(void *, int);
+typedef int (*unity_event_loop_t)(void *, int);
static unity_get_entry_t unity_get_entry;
static unity_set_progress_t unity_set_progress;
@@ -41,83 +41,87 @@ static void *libunity_handle = NULL;
void GHOST_TaskBarX11::free()
{
- if(libunity_handle) {
- dlclose(libunity_handle);
- libunity_handle = NULL;
- }
+ if (libunity_handle) {
+ dlclose(libunity_handle);
+ libunity_handle = NULL;
+ }
}
bool GHOST_TaskBarX11::init()
{
- if(libunity_initialized) {
- return libunity_available;
- }
-
- libunity_initialized = true;
-
- const char *libunity_names[] = {"libunity.so.4", "libunity.so.6", "libunity.so.9", "libunity.so", NULL};
- for(int i = 0; libunity_names[i]; i++) {
- libunity_handle = dlopen(libunity_names[i], RTLD_LAZY);
- if(libunity_handle) {
- break;
- }
- }
-
- if(!libunity_handle) {
- return false;
- }
-
- unity_get_entry = (unity_get_entry_t) dlsym(libunity_handle, "unity_launcher_entry_get_for_desktop_id");
- if(!unity_get_entry) {
- fprintf(stderr, "failed to load libunity: %s\n", dlerror());
- return false;
- }
- unity_set_progress = (unity_set_progress_t) dlsym(libunity_handle, "unity_launcher_entry_set_progress");
- if(!unity_set_progress) {
- fprintf(stderr, "failed to load libunity: %s\n", dlerror());
- return false;
- }
- unity_set_progress_visible = (unity_set_progress_visible_t) dlsym(libunity_handle, "unity_launcher_entry_set_progress_visible");
- if(!unity_set_progress_visible) {
- fprintf(stderr, "failed to load libunity: %s\n", dlerror());
- return false;
- }
- unity_event_loop = (unity_event_loop_t) dlsym(libunity_handle, "g_main_context_iteration");
- if(!unity_event_loop) {
- fprintf(stderr, "failed to load libunity: %s\n", dlerror());
- return false;
- }
-
- atexit(GHOST_TaskBarX11::free);
-
- libunity_available = true;
- return true;
+ if (libunity_initialized) {
+ return libunity_available;
+ }
+
+ libunity_initialized = true;
+
+ const char *libunity_names[] = {
+ "libunity.so.4", "libunity.so.6", "libunity.so.9", "libunity.so", NULL};
+ for (int i = 0; libunity_names[i]; i++) {
+ libunity_handle = dlopen(libunity_names[i], RTLD_LAZY);
+ if (libunity_handle) {
+ break;
+ }
+ }
+
+ if (!libunity_handle) {
+ return false;
+ }
+
+ unity_get_entry = (unity_get_entry_t)dlsym(libunity_handle,
+ "unity_launcher_entry_get_for_desktop_id");
+ if (!unity_get_entry) {
+ fprintf(stderr, "failed to load libunity: %s\n", dlerror());
+ return false;
+ }
+ unity_set_progress = (unity_set_progress_t)dlsym(libunity_handle,
+ "unity_launcher_entry_set_progress");
+ if (!unity_set_progress) {
+ fprintf(stderr, "failed to load libunity: %s\n", dlerror());
+ return false;
+ }
+ unity_set_progress_visible = (unity_set_progress_visible_t)dlsym(
+ libunity_handle, "unity_launcher_entry_set_progress_visible");
+ if (!unity_set_progress_visible) {
+ fprintf(stderr, "failed to load libunity: %s\n", dlerror());
+ return false;
+ }
+ unity_event_loop = (unity_event_loop_t)dlsym(libunity_handle, "g_main_context_iteration");
+ if (!unity_event_loop) {
+ fprintf(stderr, "failed to load libunity: %s\n", dlerror());
+ return false;
+ }
+
+ atexit(GHOST_TaskBarX11::free);
+
+ libunity_available = true;
+ return true;
}
GHOST_TaskBarX11::GHOST_TaskBarX11(const char *name)
{
- if(GHOST_TaskBarX11::init()) {
- handle = unity_get_entry(name);
- }
- else {
- handle = NULL;
- }
+ if (GHOST_TaskBarX11::init()) {
+ handle = unity_get_entry(name);
+ }
+ else {
+ handle = NULL;
+ }
}
bool GHOST_TaskBarX11::is_valid()
{
- return (handle != NULL);
+ return (handle != NULL);
}
void GHOST_TaskBarX11::set_progress(double progress)
{
- assert(is_valid());
- unity_set_progress(handle, progress);
+ assert(is_valid());
+ unity_set_progress(handle, progress);
}
void GHOST_TaskBarX11::set_progress_enabled(bool enabled)
{
- assert(is_valid());
- unity_set_progress_visible(handle, enabled ? 1 : 0);
- unity_event_loop(NULL, 0);
+ assert(is_valid());
+ unity_set_progress_visible(handle, enabled ? 1 : 0);
+ unity_event_loop(NULL, 0);
}