Cleanups
This commit is contained in:
parent
98681ace4a
commit
0f5a990141
|
@ -54,27 +54,24 @@ const char* config_get_cloud_sync_driver_options(void)
|
|||
return char_list_new_special(STRING_LIST_CLOUD_SYNC_DRIVERS, NULL);
|
||||
}
|
||||
|
||||
void cloud_sync_find_driver(
|
||||
settings_t *settings,
|
||||
const char *prefix,
|
||||
bool verbosity_enabled)
|
||||
void cloud_sync_find_driver(const char *cloud_sync_driver,
|
||||
const char *prefix, bool verbosity_enabled)
|
||||
{
|
||||
cloud_sync_driver_state_t
|
||||
*cloud_sync_st = &cloud_sync_driver_st;
|
||||
int i = (int)driver_find_index(
|
||||
"cloud_sync_driver",
|
||||
settings->arrays.cloud_sync_driver);
|
||||
"cloud_sync_driver", cloud_sync_driver);
|
||||
|
||||
if (i >= 0)
|
||||
cloud_sync_st->driver = (const cloud_sync_driver_t*)
|
||||
cloud_sync_drivers[i];
|
||||
else
|
||||
{
|
||||
if (verbosity_enabled && settings->arrays.cloud_sync_driver[0])
|
||||
if (verbosity_enabled && cloud_sync_driver[0])
|
||||
{
|
||||
unsigned d;
|
||||
RARCH_ERR("Couldn't find any %s named \"%s\"\n", prefix,
|
||||
settings->arrays.cloud_sync_driver);
|
||||
cloud_sync_driver);
|
||||
|
||||
RARCH_LOG_OUTPUT("Available %ss are:\n", prefix);
|
||||
for (d = 0; cloud_sync_drivers[d]; d++)
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
#include <stddef.h>
|
||||
#include <streams/file_stream.h>
|
||||
|
||||
#include "../configuration.h"
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
||||
/*
|
||||
|
@ -66,7 +64,8 @@ extern const cloud_sync_driver_t *cloud_sync_drivers[];
|
|||
**/
|
||||
const char* config_get_cloud_sync_driver_options(void);
|
||||
|
||||
void cloud_sync_find_driver(settings_t *settings, const char *prefix, bool verbosity_enabled);
|
||||
void cloud_sync_find_driver(const char *drv, const char *prefix,
|
||||
bool verbosity_enabled);
|
||||
|
||||
bool cloud_sync_begin(cloud_sync_complete_handler_t cb, void *user_data);
|
||||
bool cloud_sync_end(cloud_sync_complete_handler_t cb, void *user_data);
|
||||
|
|
|
@ -163,8 +163,7 @@ bool recording_deinit(void)
|
|||
{
|
||||
recording_state_t *recording_st = &recording_state;
|
||||
#ifdef HAVE_FFMPEG
|
||||
settings_t *settings = config_get_ptr();
|
||||
bool history_list_enable = settings->bools.history_list_enable;
|
||||
bool history_list_enable = config_get_ptr()->bools.history_list_enable;
|
||||
#endif
|
||||
|
||||
if ( !recording_st->data
|
||||
|
|
16
retroarch.c
16
retroarch.c
|
@ -5813,6 +5813,7 @@ void main_exit(void *args)
|
|||
**/
|
||||
int rarch_main(int argc, char *argv[], void *data)
|
||||
{
|
||||
settings_t *settings;
|
||||
struct rarch_state *p_rarch = &rarch_st;
|
||||
runloop_state_t *runloop_st = runloop_state_get_ptr();
|
||||
video_driver_state_t *video_st = video_state_get_ptr();
|
||||
|
@ -5894,7 +5895,18 @@ int rarch_main(int argc, char *argv[], void *data)
|
|||
return 1;
|
||||
}
|
||||
|
||||
ui_companion_driver_init_first();
|
||||
settings = config_get_ptr();
|
||||
|
||||
ui_companion_driver_init_first(
|
||||
#ifdef HAVE_QT
|
||||
settings->bools.desktop_menu_enable,
|
||||
settings->bools.ui_companion_toggle,
|
||||
#else
|
||||
false,
|
||||
false,
|
||||
#endif
|
||||
settings->bools.ui_companion_start_on_boot
|
||||
);
|
||||
#if HAVE_CLOUDSYNC
|
||||
task_push_cloud_sync();
|
||||
#endif
|
||||
|
@ -7770,7 +7782,7 @@ bool retroarch_main_init(int argc, char *argv[])
|
|||
wifi_driver_ctl(RARCH_WIFI_CTL_FIND_DRIVER, NULL);
|
||||
#endif
|
||||
#ifdef HAVE_CLOUDSYNC
|
||||
cloud_sync_find_driver(settings,
|
||||
cloud_sync_find_driver(settings->arrays.cloud_sync_driver,
|
||||
"cloud sync driver", verbosity_enabled);
|
||||
#endif
|
||||
location_driver_find_driver(settings->arrays.location_driver,
|
||||
|
|
|
@ -1279,10 +1279,11 @@ void task_push_cloud_sync(void)
|
|||
|
||||
void task_push_cloud_sync_update_driver(void)
|
||||
{
|
||||
char manifest_path[PATH_MAX_LENGTH];
|
||||
char manifest_path[PATH_MAX_LENGTH];
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
cloud_sync_find_driver(settings, "cloud sync driver", verbosity_is_enabled());
|
||||
cloud_sync_find_driver(settings->arrays.cloud_sync_driver,
|
||||
"cloud sync driver", verbosity_is_enabled());
|
||||
|
||||
/* The sync does a three-way diff: current local <- last sync -> current server.
|
||||
* When the server changes it becomes a four way diff, which can lead to odd
|
||||
|
|
|
@ -1,259 +1,252 @@
|
|||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2021 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch 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 Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch 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 RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
#include "../list_special.h"
|
||||
#include "../retroarch.h"
|
||||
#include "../runloop.h"
|
||||
#include "../verbosity.h"
|
||||
|
||||
#include "ui_companion_driver.h"
|
||||
|
||||
static ui_companion_driver_t ui_companion_null = {
|
||||
NULL, /* init */
|
||||
NULL, /* deinit */
|
||||
NULL, /* toggle */
|
||||
NULL, /* event_command */
|
||||
NULL, /* notify_refresh */
|
||||
NULL, /* msg_queue_push */
|
||||
NULL, /* render_messagebox */
|
||||
NULL, /* get_main_window */
|
||||
NULL, /* log_msg */
|
||||
NULL, /* is_active */
|
||||
NULL, /* get_app_icons */
|
||||
NULL, /* set_app_icon */
|
||||
NULL, /* get_app_icon_texture */
|
||||
NULL, /* browser_window */
|
||||
NULL, /* msg_window */
|
||||
NULL, /* window */
|
||||
NULL, /* application */
|
||||
"null", /* ident */
|
||||
};
|
||||
|
||||
static const ui_companion_driver_t *ui_companion_drivers[] = {
|
||||
#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__)
|
||||
&ui_companion_win32,
|
||||
#endif
|
||||
#if defined(OSX)
|
||||
&ui_companion_cocoa,
|
||||
#endif
|
||||
#if defined(IOS)
|
||||
&ui_companion_cocoatouch,
|
||||
#endif
|
||||
&ui_companion_null,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
static uico_driver_state_t uico_driver_st = {0}; /* double alignment */
|
||||
|
||||
uico_driver_state_t *uico_state_get_ptr(void)
|
||||
{
|
||||
return &uico_driver_st;
|
||||
}
|
||||
|
||||
uint8_t ui_companion_get_flags(void)
|
||||
{
|
||||
uico_driver_state_t *uico_st = &uico_driver_st;
|
||||
if (!uico_st)
|
||||
return 0;
|
||||
return uico_st->flags;
|
||||
}
|
||||
|
||||
void ui_companion_event_command(enum event_command action)
|
||||
{
|
||||
uico_driver_state_t *uico_st = &uico_driver_st;
|
||||
const ui_companion_driver_t *ui = uico_st->drv;
|
||||
if (ui && ui->event_command)
|
||||
ui->event_command(uico_st->data, action);
|
||||
#ifdef HAVE_QT
|
||||
if (ui_companion_qt.toggle && (uico_st->flags & UICO_ST_FLAG_QT_IS_INITED))
|
||||
ui_companion_qt.event_command(uico_st->qt_data, action);
|
||||
#endif
|
||||
}
|
||||
|
||||
void ui_companion_driver_deinit(void)
|
||||
{
|
||||
uico_driver_state_t *uico_st = &uico_driver_st;
|
||||
const ui_companion_driver_t *ui = uico_st->drv;
|
||||
|
||||
if (!ui)
|
||||
return;
|
||||
if (ui->deinit)
|
||||
ui->deinit(uico_st->data);
|
||||
|
||||
#ifdef HAVE_QT
|
||||
if (uico_st->flags & UICO_ST_FLAG_QT_IS_INITED)
|
||||
{
|
||||
ui_companion_qt.deinit(uico_st->qt_data);
|
||||
uico_st->qt_data = NULL;
|
||||
}
|
||||
#endif
|
||||
uico_st->data = NULL;
|
||||
}
|
||||
|
||||
void ui_companion_driver_toggle(
|
||||
bool desktop_menu_enable,
|
||||
bool ui_companion_toggle,
|
||||
bool force)
|
||||
{
|
||||
uico_driver_state_t *uico_st = &uico_driver_st;
|
||||
if (uico_st && uico_st->drv && uico_st->drv->toggle)
|
||||
uico_st->drv->toggle(uico_st->data, false);
|
||||
|
||||
#ifdef HAVE_QT
|
||||
if (desktop_menu_enable)
|
||||
{
|
||||
if ((ui_companion_toggle || force) && (!(uico_st->flags & UICO_ST_FLAG_QT_IS_INITED)))
|
||||
{
|
||||
uico_st->qt_data = ui_companion_qt.init();
|
||||
uico_st->flags |= UICO_ST_FLAG_QT_IS_INITED;
|
||||
}
|
||||
|
||||
if (ui_companion_qt.toggle && (uico_st->flags & UICO_ST_FLAG_QT_IS_INITED))
|
||||
ui_companion_qt.toggle(uico_st->qt_data, force);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void ui_companion_driver_init_first(void)
|
||||
{
|
||||
uico_driver_state_t *uico_st = &uico_driver_st;
|
||||
settings_t *settings = config_get_ptr();
|
||||
#ifdef HAVE_QT
|
||||
bool desktop_menu_enable = settings->bools.desktop_menu_enable;
|
||||
bool ui_companion_toggle = settings->bools.ui_companion_toggle;
|
||||
|
||||
if (desktop_menu_enable && ui_companion_toggle)
|
||||
{
|
||||
uico_st->qt_data = ui_companion_qt.init();
|
||||
uico_st->flags |= UICO_ST_FLAG_QT_IS_INITED;
|
||||
}
|
||||
#else
|
||||
bool desktop_menu_enable = false;
|
||||
bool ui_companion_toggle = false;
|
||||
#endif
|
||||
unsigned ui_companion_start_on_boot =
|
||||
settings->bools.ui_companion_start_on_boot;
|
||||
uico_st->drv = (ui_companion_driver_t*)ui_companion_drivers[0];
|
||||
|
||||
if (!uico_st->drv)
|
||||
return;
|
||||
if (!ui_companion_start_on_boot)
|
||||
return;
|
||||
if (uico_st->drv->init)
|
||||
uico_st->data = uico_st->drv->init();
|
||||
|
||||
ui_companion_driver_toggle(desktop_menu_enable,
|
||||
ui_companion_toggle, false);
|
||||
}
|
||||
|
||||
void ui_companion_driver_notify_refresh(void)
|
||||
{
|
||||
uico_driver_state_t *uico_st = &uico_driver_st;
|
||||
const ui_companion_driver_t *ui = uico_st->drv;
|
||||
if (!ui)
|
||||
return;
|
||||
if (ui->notify_refresh)
|
||||
ui->notify_refresh(uico_st->data);
|
||||
|
||||
#ifdef HAVE_QT
|
||||
if (config_get_ptr()->bools.desktop_menu_enable)
|
||||
if (ui_companion_qt.notify_refresh && (uico_st->flags & UICO_ST_FLAG_QT_IS_INITED))
|
||||
ui_companion_qt.notify_refresh(uico_st->qt_data);
|
||||
#endif
|
||||
}
|
||||
|
||||
const ui_msg_window_t *ui_companion_driver_get_msg_window_ptr(void)
|
||||
{
|
||||
uico_driver_state_t *uico_st = &uico_driver_st;
|
||||
const ui_companion_driver_t *ui = uico_st->drv;
|
||||
if (ui)
|
||||
return ui->msg_window;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const ui_window_t *ui_companion_driver_get_window_ptr(void)
|
||||
{
|
||||
uico_driver_state_t *uico_st = &uico_driver_st;
|
||||
const ui_companion_driver_t *ui = uico_st->drv;
|
||||
if (ui)
|
||||
return ui->window;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const ui_browser_window_t *ui_companion_driver_get_browser_window_ptr(void)
|
||||
{
|
||||
uico_driver_state_t *uico_st = &uico_driver_st;
|
||||
const ui_companion_driver_t *ui = uico_st->drv;
|
||||
if (ui)
|
||||
return ui->browser_window;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void ui_companion_driver_msg_queue_push(
|
||||
const char *msg, unsigned priority,
|
||||
unsigned duration, bool flush)
|
||||
{
|
||||
uico_driver_state_t *uico_st = &uico_driver_st;
|
||||
const ui_companion_driver_t *ui = uico_st->drv;
|
||||
|
||||
if (ui && ui->msg_queue_push)
|
||||
ui->msg_queue_push(uico_st->data, msg, priority, duration, flush);
|
||||
|
||||
#ifdef HAVE_QT
|
||||
if (config_get_ptr()->bools.desktop_menu_enable)
|
||||
if (ui_companion_qt.msg_queue_push && (uico_st->flags & UICO_ST_FLAG_QT_IS_INITED))
|
||||
ui_companion_qt.msg_queue_push(
|
||||
uico_st->qt_data,
|
||||
msg, priority, duration, flush);
|
||||
#endif
|
||||
}
|
||||
|
||||
void *ui_companion_driver_get_main_window(void)
|
||||
{
|
||||
uico_driver_state_t *uico_st = &uico_driver_st;
|
||||
const ui_companion_driver_t *ui = uico_st->drv;
|
||||
if (!ui || !ui->get_main_window)
|
||||
return NULL;
|
||||
return ui->get_main_window(uico_st->data);
|
||||
}
|
||||
|
||||
const char *ui_companion_driver_get_ident(void)
|
||||
{
|
||||
uico_driver_state_t *uico_st = &uico_driver_st;
|
||||
const ui_companion_driver_t *ui = uico_st->drv;
|
||||
if (ui)
|
||||
return ui->ident;
|
||||
return "null";
|
||||
}
|
||||
|
||||
void ui_companion_driver_log_msg(const char *msg)
|
||||
{
|
||||
#ifdef HAVE_QT
|
||||
uico_driver_state_t *uico_st= &uico_driver_st;
|
||||
bool window_is_active = uico_st->qt_data && (uico_st->flags & UICO_ST_FLAG_QT_IS_INITED)
|
||||
&& ui_companion_qt.is_active(uico_st->qt_data);
|
||||
if (config_get_ptr()->bools.desktop_menu_enable)
|
||||
if (window_is_active)
|
||||
ui_companion_qt.log_msg(uico_st->qt_data, msg);
|
||||
#endif
|
||||
}
|
||||
/* RetroArch - A frontend for libretro.
|
||||
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
|
||||
* Copyright (C) 2011-2021 - Daniel De Matteis
|
||||
*
|
||||
* RetroArch 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 Found-
|
||||
* ation, either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* RetroArch 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 RetroArch.
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "../config.h"
|
||||
#endif
|
||||
|
||||
#include "../list_special.h"
|
||||
#include "../verbosity.h"
|
||||
|
||||
#include "ui_companion_driver.h"
|
||||
|
||||
static ui_companion_driver_t ui_companion_null = {
|
||||
NULL, /* init */
|
||||
NULL, /* deinit */
|
||||
NULL, /* toggle */
|
||||
NULL, /* event_command */
|
||||
NULL, /* notify_refresh */
|
||||
NULL, /* msg_queue_push */
|
||||
NULL, /* render_messagebox */
|
||||
NULL, /* get_main_window */
|
||||
NULL, /* log_msg */
|
||||
NULL, /* is_active */
|
||||
NULL, /* get_app_icons */
|
||||
NULL, /* set_app_icon */
|
||||
NULL, /* get_app_icon_texture */
|
||||
NULL, /* browser_window */
|
||||
NULL, /* msg_window */
|
||||
NULL, /* window */
|
||||
NULL, /* application */
|
||||
"null", /* ident */
|
||||
};
|
||||
|
||||
static const ui_companion_driver_t *ui_companion_drivers[] = {
|
||||
#if defined(_WIN32) && !defined(_XBOX) && !defined(__WINRT__)
|
||||
&ui_companion_win32,
|
||||
#endif
|
||||
#if defined(OSX)
|
||||
&ui_companion_cocoa,
|
||||
#endif
|
||||
#if defined(IOS)
|
||||
&ui_companion_cocoatouch,
|
||||
#endif
|
||||
&ui_companion_null,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
||||
static uico_driver_state_t uico_driver_st = {0}; /* double alignment */
|
||||
|
||||
uico_driver_state_t *uico_state_get_ptr(void)
|
||||
{
|
||||
return &uico_driver_st;
|
||||
}
|
||||
|
||||
uint8_t ui_companion_get_flags(void)
|
||||
{
|
||||
uico_driver_state_t *uico_st = &uico_driver_st;
|
||||
if (!uico_st)
|
||||
return 0;
|
||||
return uico_st->flags;
|
||||
}
|
||||
|
||||
void ui_companion_event_command(enum event_command action)
|
||||
{
|
||||
uico_driver_state_t *uico_st = &uico_driver_st;
|
||||
const ui_companion_driver_t *ui = uico_st->drv;
|
||||
if (ui && ui->event_command)
|
||||
ui->event_command(uico_st->data, action);
|
||||
#ifdef HAVE_QT
|
||||
if (ui_companion_qt.toggle && (uico_st->flags & UICO_ST_FLAG_QT_IS_INITED))
|
||||
ui_companion_qt.event_command(uico_st->qt_data, action);
|
||||
#endif
|
||||
}
|
||||
|
||||
void ui_companion_driver_deinit(void)
|
||||
{
|
||||
uico_driver_state_t *uico_st = &uico_driver_st;
|
||||
const ui_companion_driver_t *ui = uico_st->drv;
|
||||
|
||||
if (!ui)
|
||||
return;
|
||||
if (ui->deinit)
|
||||
ui->deinit(uico_st->data);
|
||||
|
||||
#ifdef HAVE_QT
|
||||
if (uico_st->flags & UICO_ST_FLAG_QT_IS_INITED)
|
||||
{
|
||||
ui_companion_qt.deinit(uico_st->qt_data);
|
||||
uico_st->qt_data = NULL;
|
||||
}
|
||||
#endif
|
||||
uico_st->data = NULL;
|
||||
}
|
||||
|
||||
void ui_companion_driver_toggle(
|
||||
bool desktop_menu_enable,
|
||||
bool ui_companion_toggle,
|
||||
bool force)
|
||||
{
|
||||
uico_driver_state_t *uico_st = &uico_driver_st;
|
||||
if (uico_st && uico_st->drv && uico_st->drv->toggle)
|
||||
uico_st->drv->toggle(uico_st->data, false);
|
||||
|
||||
#ifdef HAVE_QT
|
||||
if (desktop_menu_enable)
|
||||
{
|
||||
if ((ui_companion_toggle || force) && (!(uico_st->flags & UICO_ST_FLAG_QT_IS_INITED)))
|
||||
{
|
||||
uico_st->qt_data = ui_companion_qt.init();
|
||||
uico_st->flags |= UICO_ST_FLAG_QT_IS_INITED;
|
||||
}
|
||||
|
||||
if (ui_companion_qt.toggle && (uico_st->flags & UICO_ST_FLAG_QT_IS_INITED))
|
||||
ui_companion_qt.toggle(uico_st->qt_data, force);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void ui_companion_driver_init_first(
|
||||
bool desktop_menu_enable,
|
||||
bool ui_companion_toggle,
|
||||
unsigned ui_companion_start_on_boot
|
||||
)
|
||||
{
|
||||
uico_driver_state_t *uico_st = &uico_driver_st;
|
||||
#ifdef HAVE_QT
|
||||
if (desktop_menu_enable && ui_companion_toggle)
|
||||
{
|
||||
uico_st->qt_data = ui_companion_qt.init();
|
||||
uico_st->flags |= UICO_ST_FLAG_QT_IS_INITED;
|
||||
}
|
||||
#endif
|
||||
uico_st->drv = (ui_companion_driver_t*)ui_companion_drivers[0];
|
||||
|
||||
if (!uico_st->drv)
|
||||
return;
|
||||
if (!ui_companion_start_on_boot)
|
||||
return;
|
||||
if (uico_st->drv->init)
|
||||
uico_st->data = uico_st->drv->init();
|
||||
|
||||
ui_companion_driver_toggle(desktop_menu_enable,
|
||||
ui_companion_toggle, false);
|
||||
}
|
||||
|
||||
void ui_companion_driver_notify_refresh(void)
|
||||
{
|
||||
uico_driver_state_t *uico_st = &uico_driver_st;
|
||||
const ui_companion_driver_t *ui = uico_st->drv;
|
||||
if (!ui)
|
||||
return;
|
||||
if (ui->notify_refresh)
|
||||
ui->notify_refresh(uico_st->data);
|
||||
|
||||
#ifdef HAVE_QT
|
||||
if (config_get_ptr()->bools.desktop_menu_enable)
|
||||
if (ui_companion_qt.notify_refresh && (uico_st->flags & UICO_ST_FLAG_QT_IS_INITED))
|
||||
ui_companion_qt.notify_refresh(uico_st->qt_data);
|
||||
#endif
|
||||
}
|
||||
|
||||
const ui_msg_window_t *ui_companion_driver_get_msg_window_ptr(void)
|
||||
{
|
||||
uico_driver_state_t *uico_st = &uico_driver_st;
|
||||
const ui_companion_driver_t *ui = uico_st->drv;
|
||||
if (ui)
|
||||
return ui->msg_window;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const ui_window_t *ui_companion_driver_get_window_ptr(void)
|
||||
{
|
||||
uico_driver_state_t *uico_st = &uico_driver_st;
|
||||
const ui_companion_driver_t *ui = uico_st->drv;
|
||||
if (ui)
|
||||
return ui->window;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const ui_browser_window_t *ui_companion_driver_get_browser_window_ptr(void)
|
||||
{
|
||||
uico_driver_state_t *uico_st = &uico_driver_st;
|
||||
const ui_companion_driver_t *ui = uico_st->drv;
|
||||
if (ui)
|
||||
return ui->browser_window;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void ui_companion_driver_msg_queue_push(
|
||||
const char *msg, unsigned priority,
|
||||
unsigned duration, bool flush)
|
||||
{
|
||||
uico_driver_state_t *uico_st = &uico_driver_st;
|
||||
const ui_companion_driver_t *ui = uico_st->drv;
|
||||
|
||||
if (ui && ui->msg_queue_push)
|
||||
ui->msg_queue_push(uico_st->data, msg, priority, duration, flush);
|
||||
|
||||
#ifdef HAVE_QT
|
||||
if (config_get_ptr()->bools.desktop_menu_enable)
|
||||
if (ui_companion_qt.msg_queue_push && (uico_st->flags & UICO_ST_FLAG_QT_IS_INITED))
|
||||
ui_companion_qt.msg_queue_push(
|
||||
uico_st->qt_data,
|
||||
msg, priority, duration, flush);
|
||||
#endif
|
||||
}
|
||||
|
||||
void *ui_companion_driver_get_main_window(void)
|
||||
{
|
||||
uico_driver_state_t *uico_st = &uico_driver_st;
|
||||
const ui_companion_driver_t *ui = uico_st->drv;
|
||||
if (!ui || !ui->get_main_window)
|
||||
return NULL;
|
||||
return ui->get_main_window(uico_st->data);
|
||||
}
|
||||
|
||||
const char *ui_companion_driver_get_ident(void)
|
||||
{
|
||||
uico_driver_state_t *uico_st = &uico_driver_st;
|
||||
const ui_companion_driver_t *ui = uico_st->drv;
|
||||
if (ui)
|
||||
return ui->ident;
|
||||
return "null";
|
||||
}
|
||||
|
||||
void ui_companion_driver_log_msg(const char *msg)
|
||||
{
|
||||
#ifdef HAVE_QT
|
||||
uico_driver_state_t *uico_st= &uico_driver_st;
|
||||
bool window_is_active = uico_st->qt_data && (uico_st->flags & UICO_ST_FLAG_QT_IS_INITED)
|
||||
&& ui_companion_qt.is_active(uico_st->qt_data);
|
||||
if (config_get_ptr()->bools.desktop_menu_enable)
|
||||
if (window_is_active)
|
||||
ui_companion_qt.log_msg(uico_st->qt_data, msg);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -169,7 +169,11 @@ void *ui_companion_driver_get_main_window(void);
|
|||
|
||||
const char *ui_companion_driver_get_ident(void);
|
||||
|
||||
void ui_companion_driver_init_first(void);
|
||||
void ui_companion_driver_init_first(
|
||||
bool desktop_menu_enable,
|
||||
bool ui_companion_toggle,
|
||||
unsigned ui_companion_start_on_boot
|
||||
);
|
||||
|
||||
void ui_companion_driver_msg_queue_push(
|
||||
const char *msg, unsigned priority,
|
||||
|
|
Loading…
Reference in New Issue