mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-04-12 19:51:33 +02:00
Clean up the tray D-Bus code
Run clang-format to clean up whitespace issues, and remove some unused struct members.
This commit is contained in:
@@ -22,6 +22,7 @@
|
|||||||
/* Special thanks to the kind Hayden Gray (thag_iceman/A1029384756) from the SDL community for his help! */
|
/* Special thanks to the kind Hayden Gray (thag_iceman/A1029384756) from the SDL community for his help! */
|
||||||
|
|
||||||
#include "SDL_internal.h"
|
#include "SDL_internal.h"
|
||||||
|
|
||||||
#include "../../core/linux/SDL_dbus.h"
|
#include "../../core/linux/SDL_dbus.h"
|
||||||
|
|
||||||
#ifdef SDL_USE_LIBDBUS
|
#ifdef SDL_USE_LIBDBUS
|
||||||
@@ -33,15 +34,11 @@
|
|||||||
|
|
||||||
typedef struct SDL_TrayDriverDBus
|
typedef struct SDL_TrayDriverDBus
|
||||||
{
|
{
|
||||||
SDL_TrayDriver _parent;
|
|
||||||
|
|
||||||
SDL_DBusContext *dbus;
|
SDL_DBusContext *dbus;
|
||||||
} SDL_TrayDriverDBus;
|
} SDL_TrayDriverDBus;
|
||||||
|
|
||||||
typedef struct SDL_TrayDBus
|
typedef struct SDL_TrayDBus
|
||||||
{
|
{
|
||||||
SDL_Tray _parent;
|
|
||||||
|
|
||||||
DBusConnection *connection;
|
DBusConnection *connection;
|
||||||
char *service_name;
|
char *service_name;
|
||||||
|
|
||||||
@@ -58,8 +55,6 @@ typedef struct SDL_TrayDBus
|
|||||||
|
|
||||||
typedef struct SDL_TrayMenuDBus
|
typedef struct SDL_TrayMenuDBus
|
||||||
{
|
{
|
||||||
SDL_TrayMenu _parent;
|
|
||||||
|
|
||||||
SDL_ListNode *menu;
|
SDL_ListNode *menu;
|
||||||
const char *menu_path;
|
const char *menu_path;
|
||||||
|
|
||||||
@@ -68,8 +63,6 @@ typedef struct SDL_TrayMenuDBus
|
|||||||
|
|
||||||
typedef struct SDL_TrayEntryDBus
|
typedef struct SDL_TrayEntryDBus
|
||||||
{
|
{
|
||||||
SDL_TrayEntry _parent;
|
|
||||||
|
|
||||||
SDL_MenuItem *item;
|
SDL_MenuItem *item;
|
||||||
SDL_TrayMenuDBus *sub_menu;
|
SDL_TrayMenuDBus *sub_menu;
|
||||||
} SDL_TrayEntryDBus;
|
} SDL_TrayEntryDBus;
|
||||||
@@ -387,18 +380,18 @@ static DBusHandlerResult TrayMessageHandler(DBusConnection *connection, DBusMess
|
|||||||
driver->dbus->message_unref(reply);
|
driver->dbus->message_unref(reply);
|
||||||
return DBUS_HANDLER_RESULT_HANDLED;
|
return DBUS_HANDLER_RESULT_HANDLED;
|
||||||
} else if (driver->dbus->message_is_method_call(msg, SNI_INTERFACE, "Scroll")) {
|
} else if (driver->dbus->message_is_method_call(msg, SNI_INTERFACE, "Scroll")) {
|
||||||
DBusError err;
|
DBusError err;
|
||||||
char *orientation;
|
char *orientation;
|
||||||
Sint32 delta;
|
Sint32 delta;
|
||||||
|
|
||||||
driver->dbus->error_init(&err);
|
driver->dbus->error_init(&err);
|
||||||
driver->dbus->message_get_args(msg, &err, DBUS_TYPE_INT32, &delta, DBUS_TYPE_STRING, &orientation, DBUS_TYPE_INVALID);
|
driver->dbus->message_get_args(msg, &err, DBUS_TYPE_INT32, &delta, DBUS_TYPE_STRING, &orientation, DBUS_TYPE_INVALID);
|
||||||
if (!driver->dbus->error_is_set(&err)) {
|
if (!driver->dbus->error_is_set(&err)) {
|
||||||
/* Scroll callback support will come later :) */
|
/* Scroll callback support will come later :) */
|
||||||
} else {
|
} else {
|
||||||
driver->dbus->error_free(&err);
|
driver->dbus->error_free(&err);
|
||||||
}
|
}
|
||||||
|
|
||||||
reply = driver->dbus->message_new_method_return(msg);
|
reply = driver->dbus->message_new_method_return(msg);
|
||||||
driver->dbus->connection_send(tray_dbus->connection, reply, NULL);
|
driver->dbus->connection_send(tray_dbus->connection, reply, NULL);
|
||||||
driver->dbus->message_unref(reply);
|
driver->dbus->message_unref(reply);
|
||||||
@@ -450,7 +443,7 @@ SDL_Tray *CreateTray(SDL_TrayDriver *driver, SDL_PropertiesID props)
|
|||||||
}
|
}
|
||||||
tray_dbus->surface = SDL_ConvertSurface(icon, SDL_PIXELFORMAT_ARGB32);
|
tray_dbus->surface = SDL_ConvertSurface(icon, SDL_PIXELFORMAT_ARGB32);
|
||||||
tray_dbus->block = false;
|
tray_dbus->block = false;
|
||||||
|
|
||||||
/* Connect */
|
/* Connect */
|
||||||
dbus_driver = (SDL_TrayDriverDBus *)driver;
|
dbus_driver = (SDL_TrayDriverDBus *)driver;
|
||||||
dbus_driver->dbus->error_init(&err);
|
dbus_driver->dbus->error_init(&err);
|
||||||
@@ -529,7 +522,7 @@ void DestroyMenu(SDL_TrayMenu *menu)
|
|||||||
if (!menu) {
|
if (!menu) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
menu_dbus = (SDL_TrayMenuDBus *)menu;
|
menu_dbus = (SDL_TrayMenuDBus *)menu;
|
||||||
|
|
||||||
if (menu_dbus->menu) {
|
if (menu_dbus->menu) {
|
||||||
@@ -601,7 +594,7 @@ void UpdateTray(SDL_Tray *tray)
|
|||||||
if (!SDL_ObjectValid(tray, SDL_OBJECT_TYPE_TRAY)) {
|
if (!SDL_ObjectValid(tray, SDL_OBJECT_TYPE_TRAY)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tray_dbus->block) {
|
if (tray_dbus->block) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -609,11 +602,11 @@ void UpdateTray(SDL_Tray *tray)
|
|||||||
driver->dbus->connection_read_write(tray_dbus->connection, 0);
|
driver->dbus->connection_read_write(tray_dbus->connection, 0);
|
||||||
while (driver->dbus->connection_dispatch(tray_dbus->connection) == DBUS_DISPATCH_DATA_REMAINS) {
|
while (driver->dbus->connection_dispatch(tray_dbus->connection) == DBUS_DISPATCH_DATA_REMAINS) {
|
||||||
if (!SDL_ObjectValid(tray, SDL_OBJECT_TYPE_TRAY)) {
|
if (!SDL_ObjectValid(tray, SDL_OBJECT_TYPE_TRAY)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tray_dbus->block) {
|
if (tray_dbus->block) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_DelayNS(SDL_US_TO_NS(10));
|
SDL_DelayNS(SDL_US_TO_NS(10));
|
||||||
@@ -727,7 +720,8 @@ bool TrayRightClickHandler(SDL_ListNode *menu, void *udata)
|
|||||||
return tray_dbus->r_cb(tray_dbus->udata, (SDL_Tray *)tray_dbus);
|
return tray_dbus->r_cb(tray_dbus->udata, (SDL_Tray *)tray_dbus);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TraySendNewMenu(SDL_Tray *tray, const char *new_path) {
|
void TraySendNewMenu(SDL_Tray *tray, const char *new_path)
|
||||||
|
{
|
||||||
SDL_TrayDriverDBus *driver;
|
SDL_TrayDriverDBus *driver;
|
||||||
SDL_TrayDBus *tray_dbus;
|
SDL_TrayDBus *tray_dbus;
|
||||||
SDL_TrayMenuDBus *menu_dbus;
|
SDL_TrayMenuDBus *menu_dbus;
|
||||||
@@ -750,10 +744,10 @@ void TraySendNewMenu(SDL_Tray *tray, const char *new_path) {
|
|||||||
iface = SNI_INTERFACE;
|
iface = SNI_INTERFACE;
|
||||||
prop = "Menu";
|
prop = "Menu";
|
||||||
if (new_path) {
|
if (new_path) {
|
||||||
path = menu_dbus->menu_path = new_path;
|
path = menu_dbus->menu_path = new_path;
|
||||||
} else {
|
} else {
|
||||||
path = menu_dbus->menu_path;
|
path = menu_dbus->menu_path;
|
||||||
}
|
}
|
||||||
bool_val = TRUE;
|
bool_val = TRUE;
|
||||||
driver->dbus->message_iter_init_append(signal, &iter);
|
driver->dbus->message_iter_init_append(signal, &iter);
|
||||||
driver->dbus->message_iter_append_basic(&iter, DBUS_TYPE_STRING, &iface);
|
driver->dbus->message_iter_append_basic(&iter, DBUS_TYPE_STRING, &iface);
|
||||||
@@ -777,21 +771,21 @@ void TraySendNewMenu(SDL_Tray *tray, const char *new_path) {
|
|||||||
driver->dbus->connection_send(tray_dbus->connection, signal, NULL);
|
driver->dbus->connection_send(tray_dbus->connection, signal, NULL);
|
||||||
driver->dbus->connection_flush(tray_dbus->connection);
|
driver->dbus->connection_flush(tray_dbus->connection);
|
||||||
driver->dbus->message_unref(signal);
|
driver->dbus->message_unref(signal);
|
||||||
}
|
}
|
||||||
|
|
||||||
signal = driver->dbus->message_new_signal(SNI_OBJECT_PATH, SNI_INTERFACE, "NewMenu");
|
signal = driver->dbus->message_new_signal(SNI_OBJECT_PATH, SNI_INTERFACE, "NewMenu");
|
||||||
if (signal) {
|
if (signal) {
|
||||||
driver->dbus->connection_send(tray_dbus->connection, signal, NULL);
|
driver->dbus->connection_send(tray_dbus->connection, signal, NULL);
|
||||||
driver->dbus->connection_flush(tray_dbus->connection);
|
driver->dbus->connection_flush(tray_dbus->connection);
|
||||||
driver->dbus->message_unref(signal);
|
driver->dbus->message_unref(signal);
|
||||||
}
|
}
|
||||||
|
|
||||||
driver->dbus->connection_flush(tray_dbus->connection);
|
driver->dbus->connection_flush(tray_dbus->connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TrayNewMenuOnMenuUpdateCallback(SDL_ListNode *menu, const char *path, void *cbdata)
|
||||||
void TrayNewMenuOnMenuUpdateCallback(SDL_ListNode *menu, const char *path, void *cbdata) {
|
{
|
||||||
TraySendNewMenu((SDL_Tray *)cbdata, path);
|
TraySendNewMenu((SDL_Tray *)cbdata, path);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_TrayEntry *InsertTrayEntryAt(SDL_TrayMenu *menu, int pos, const char *label, SDL_TrayEntryFlags flags)
|
SDL_TrayEntry *InsertTrayEntryAt(SDL_TrayMenu *menu, int pos, const char *label, SDL_TrayEntryFlags flags)
|
||||||
@@ -861,7 +855,7 @@ SDL_TrayEntry *InsertTrayEntryAt(SDL_TrayMenu *menu, int pos, const char *label,
|
|||||||
menu_dbus->menu_path = SDL_DBus_ExportMenu(driver->dbus, tray_dbus->connection, menu_dbus->menu);
|
menu_dbus->menu_path = SDL_DBus_ExportMenu(driver->dbus, tray_dbus->connection, menu_dbus->menu);
|
||||||
|
|
||||||
if (menu_dbus->menu_path) {
|
if (menu_dbus->menu_path) {
|
||||||
TraySendNewMenu(tray, NULL);
|
TraySendNewMenu(tray, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -918,7 +912,7 @@ void RemoveTrayEntry(SDL_TrayEntry *entry)
|
|||||||
SDL_TrayDBus *tray_dbus;
|
SDL_TrayDBus *tray_dbus;
|
||||||
SDL_TrayMenuDBus *main_menu_dbus;
|
SDL_TrayMenuDBus *main_menu_dbus;
|
||||||
const char *old_path;
|
const char *old_path;
|
||||||
|
|
||||||
tray = entry->parent->parent_tray;
|
tray = entry->parent->parent_tray;
|
||||||
tray_dbus = (SDL_TrayDBus *)tray;
|
tray_dbus = (SDL_TrayDBus *)tray;
|
||||||
driver = (SDL_TrayDriverDBus *)tray->driver;
|
driver = (SDL_TrayDriverDBus *)tray->driver;
|
||||||
@@ -928,20 +922,20 @@ void RemoveTrayEntry(SDL_TrayEntry *entry)
|
|||||||
|
|
||||||
tray_dbus->block = true;
|
tray_dbus->block = true;
|
||||||
if (menu_dbus->menu->entry == entry_dbus->item && menu_dbus->menu->next) {
|
if (menu_dbus->menu->entry == entry_dbus->item && menu_dbus->menu->next) {
|
||||||
SDL_DBus_TransferMenuItemProperties(entry_dbus->item, (SDL_MenuItem *)menu_dbus->menu->next->entry);
|
SDL_DBus_TransferMenuItemProperties(entry_dbus->item, (SDL_MenuItem *)menu_dbus->menu->next->entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
old_path = NULL;
|
old_path = NULL;
|
||||||
if (!main_menu_dbus->menu->next) {
|
if (!main_menu_dbus->menu->next) {
|
||||||
old_path = main_menu_dbus->menu_path;
|
old_path = main_menu_dbus->menu_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
driver->dbus->connection_flush(tray_dbus->connection);
|
driver->dbus->connection_flush(tray_dbus->connection);
|
||||||
DestroyMenu((SDL_TrayMenu *)entry_dbus->sub_menu);
|
DestroyMenu((SDL_TrayMenu *)entry_dbus->sub_menu);
|
||||||
SDL_ListRemove(&menu_dbus->menu, entry_dbus->item);
|
SDL_ListRemove(&menu_dbus->menu, entry_dbus->item);
|
||||||
SDL_free(entry_dbus->item);
|
SDL_free(entry_dbus->item);
|
||||||
SDL_free(entry);
|
SDL_free(entry);
|
||||||
|
|
||||||
if (old_path) {
|
if (old_path) {
|
||||||
SDL_DBus_RetractMenu(driver->dbus, tray_dbus->connection, &main_menu_dbus->menu_path);
|
SDL_DBus_RetractMenu(driver->dbus, tray_dbus->connection, &main_menu_dbus->menu_path);
|
||||||
}
|
}
|
||||||
@@ -965,7 +959,7 @@ void SetTrayEntryCallback(SDL_TrayEntry *entry, SDL_TrayCallback callback, void
|
|||||||
SDL_TrayDriverDBus *driver;
|
SDL_TrayDriverDBus *driver;
|
||||||
SDL_TrayDBus *tray_dbus;
|
SDL_TrayDBus *tray_dbus;
|
||||||
SDL_TrayMenuDBus *main_menu_dbus;
|
SDL_TrayMenuDBus *main_menu_dbus;
|
||||||
|
|
||||||
tray = entry->parent->parent_tray;
|
tray = entry->parent->parent_tray;
|
||||||
tray_dbus = (SDL_TrayDBus *)tray;
|
tray_dbus = (SDL_TrayDBus *)tray;
|
||||||
driver = (SDL_TrayDriverDBus *)tray->driver;
|
driver = (SDL_TrayDriverDBus *)tray->driver;
|
||||||
@@ -1066,18 +1060,18 @@ void ClickTrayEntry(SDL_TrayEntry *entry)
|
|||||||
|
|
||||||
dbus_entry = (SDL_TrayEntryDBus *)entry;
|
dbus_entry = (SDL_TrayEntryDBus *)entry;
|
||||||
if (dbus_entry->item->type == SDL_MENU_ITEM_TYPE_CHECKBOX) {
|
if (dbus_entry->item->type == SDL_MENU_ITEM_TYPE_CHECKBOX) {
|
||||||
SDL_Tray *tray;
|
SDL_Tray *tray;
|
||||||
SDL_TrayDriverDBus *driver;
|
SDL_TrayDriverDBus *driver;
|
||||||
SDL_TrayDBus *tray_dbus;
|
SDL_TrayDBus *tray_dbus;
|
||||||
SDL_TrayMenuDBus *main_menu_dbus;
|
SDL_TrayMenuDBus *main_menu_dbus;
|
||||||
|
|
||||||
tray = entry->parent->parent_tray;
|
tray = entry->parent->parent_tray;
|
||||||
tray_dbus = (SDL_TrayDBus *)tray;
|
tray_dbus = (SDL_TrayDBus *)tray;
|
||||||
driver = (SDL_TrayDriverDBus *)tray->driver;
|
driver = (SDL_TrayDriverDBus *)tray->driver;
|
||||||
main_menu_dbus = (SDL_TrayMenuDBus *)tray->menu;
|
main_menu_dbus = (SDL_TrayMenuDBus *)tray->menu;
|
||||||
|
|
||||||
dbus_entry->item->flags ^= SDL_MENU_ITEM_FLAGS_CHECKED;
|
dbus_entry->item->flags ^= SDL_MENU_ITEM_FLAGS_CHECKED;
|
||||||
SDL_DBus_UpdateMenu(driver->dbus, tray_dbus->connection, main_menu_dbus->menu, main_menu_dbus->menu_path, TrayNewMenuOnMenuUpdateCallback, tray, SDL_DBUS_UPDATE_MENU_FLAGS_NONE);
|
SDL_DBus_UpdateMenu(driver->dbus, tray_dbus->connection, main_menu_dbus->menu, main_menu_dbus->menu_path, TrayNewMenuOnMenuUpdateCallback, tray, SDL_DBUS_UPDATE_MENU_FLAGS_NONE);
|
||||||
}
|
}
|
||||||
entry_cb = dbus_entry->item->udata2;
|
entry_cb = dbus_entry->item->udata2;
|
||||||
entry_cb(dbus_entry->item->cb_data, dbus_entry->item->udata);
|
entry_cb(dbus_entry->item->cb_data, dbus_entry->item->udata);
|
||||||
@@ -1174,4 +1168,4 @@ SDL_TrayDriver *SDL_Tray_CreateDBusDriver(void)
|
|||||||
return driver;
|
return driver;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif // SDL_USE_LIBDBUS
|
||||||
|
|||||||
@@ -59,12 +59,12 @@ void SDL_UpdateTrays(void)
|
|||||||
SDL_Tray *SDL_CreateTrayWithProperties(SDL_PropertiesID props)
|
SDL_Tray *SDL_CreateTrayWithProperties(SDL_PropertiesID props)
|
||||||
{
|
{
|
||||||
SDL_Tray *tray;
|
SDL_Tray *tray;
|
||||||
|
|
||||||
if (!SDL_IsMainThread()) {
|
if (!SDL_IsMainThread()) {
|
||||||
SDL_SetError("This function should be called on the main thread");
|
SDL_SetError("This function should be called on the main thread");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!driver) {
|
if (!driver) {
|
||||||
#ifdef SDL_USE_LIBDBUS
|
#ifdef SDL_USE_LIBDBUS
|
||||||
driver = SDL_Tray_CreateDBusDriver();
|
driver = SDL_Tray_CreateDBusDriver();
|
||||||
@@ -110,8 +110,7 @@ SDL_Tray *SDL_CreateTray(SDL_Surface *icon, const char *tooltip)
|
|||||||
|
|
||||||
void SDL_SetTrayIcon(SDL_Tray *tray, SDL_Surface *icon)
|
void SDL_SetTrayIcon(SDL_Tray *tray, SDL_Surface *icon)
|
||||||
{
|
{
|
||||||
CHECK_PARAM(!SDL_ObjectValid(tray, SDL_OBJECT_TYPE_TRAY))
|
CHECK_PARAM (!SDL_ObjectValid(tray, SDL_OBJECT_TYPE_TRAY)) {
|
||||||
{
|
|
||||||
SDL_InvalidParamError("tray");
|
SDL_InvalidParamError("tray");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -121,8 +120,7 @@ void SDL_SetTrayIcon(SDL_Tray *tray, SDL_Surface *icon)
|
|||||||
|
|
||||||
void SDL_SetTrayTooltip(SDL_Tray *tray, const char *tooltip)
|
void SDL_SetTrayTooltip(SDL_Tray *tray, const char *tooltip)
|
||||||
{
|
{
|
||||||
CHECK_PARAM(!SDL_ObjectValid(tray, SDL_OBJECT_TYPE_TRAY))
|
CHECK_PARAM (!SDL_ObjectValid(tray, SDL_OBJECT_TYPE_TRAY)) {
|
||||||
{
|
|
||||||
SDL_InvalidParamError("tray");
|
SDL_InvalidParamError("tray");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -132,8 +130,7 @@ void SDL_SetTrayTooltip(SDL_Tray *tray, const char *tooltip)
|
|||||||
|
|
||||||
SDL_TrayMenu *SDL_CreateTrayMenu(SDL_Tray *tray)
|
SDL_TrayMenu *SDL_CreateTrayMenu(SDL_Tray *tray)
|
||||||
{
|
{
|
||||||
CHECK_PARAM(!SDL_ObjectValid(tray, SDL_OBJECT_TYPE_TRAY))
|
CHECK_PARAM (!SDL_ObjectValid(tray, SDL_OBJECT_TYPE_TRAY)) {
|
||||||
{
|
|
||||||
SDL_InvalidParamError("tray");
|
SDL_InvalidParamError("tray");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -143,8 +140,7 @@ SDL_TrayMenu *SDL_CreateTrayMenu(SDL_Tray *tray)
|
|||||||
|
|
||||||
SDL_TrayMenu *SDL_GetTrayMenu(SDL_Tray *tray)
|
SDL_TrayMenu *SDL_GetTrayMenu(SDL_Tray *tray)
|
||||||
{
|
{
|
||||||
CHECK_PARAM(!SDL_ObjectValid(tray, SDL_OBJECT_TYPE_TRAY))
|
CHECK_PARAM (!SDL_ObjectValid(tray, SDL_OBJECT_TYPE_TRAY)) {
|
||||||
{
|
|
||||||
SDL_InvalidParamError("tray");
|
SDL_InvalidParamError("tray");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -154,8 +150,7 @@ SDL_TrayMenu *SDL_GetTrayMenu(SDL_Tray *tray)
|
|||||||
|
|
||||||
SDL_TrayMenu *SDL_CreateTraySubmenu(SDL_TrayEntry *entry)
|
SDL_TrayMenu *SDL_CreateTraySubmenu(SDL_TrayEntry *entry)
|
||||||
{
|
{
|
||||||
CHECK_PARAM(!entry)
|
CHECK_PARAM (!entry) {
|
||||||
{
|
|
||||||
SDL_InvalidParamError("entry");
|
SDL_InvalidParamError("entry");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -165,8 +160,7 @@ SDL_TrayMenu *SDL_CreateTraySubmenu(SDL_TrayEntry *entry)
|
|||||||
|
|
||||||
SDL_TrayMenu *SDL_GetTraySubmenu(SDL_TrayEntry *entry)
|
SDL_TrayMenu *SDL_GetTraySubmenu(SDL_TrayEntry *entry)
|
||||||
{
|
{
|
||||||
CHECK_PARAM(!entry)
|
CHECK_PARAM (!entry) {
|
||||||
{
|
|
||||||
SDL_InvalidParamError("entry");
|
SDL_InvalidParamError("entry");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -176,14 +170,12 @@ SDL_TrayMenu *SDL_GetTraySubmenu(SDL_TrayEntry *entry)
|
|||||||
|
|
||||||
const SDL_TrayEntry **SDL_GetTrayEntries(SDL_TrayMenu *menu, int *count)
|
const SDL_TrayEntry **SDL_GetTrayEntries(SDL_TrayMenu *menu, int *count)
|
||||||
{
|
{
|
||||||
CHECK_PARAM(!menu)
|
CHECK_PARAM (!menu) {
|
||||||
{
|
|
||||||
SDL_InvalidParamError("menu");
|
SDL_InvalidParamError("menu");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK_PARAM(!count)
|
CHECK_PARAM (!count) {
|
||||||
{
|
|
||||||
SDL_InvalidParamError("count");
|
SDL_InvalidParamError("count");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -193,8 +185,7 @@ const SDL_TrayEntry **SDL_GetTrayEntries(SDL_TrayMenu *menu, int *count)
|
|||||||
|
|
||||||
void SDL_RemoveTrayEntry(SDL_TrayEntry *entry)
|
void SDL_RemoveTrayEntry(SDL_TrayEntry *entry)
|
||||||
{
|
{
|
||||||
CHECK_PARAM(!entry)
|
CHECK_PARAM (!entry) {
|
||||||
{
|
|
||||||
SDL_InvalidParamError("entry");
|
SDL_InvalidParamError("entry");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -204,8 +195,7 @@ void SDL_RemoveTrayEntry(SDL_TrayEntry *entry)
|
|||||||
|
|
||||||
SDL_TrayEntry *SDL_InsertTrayEntryAt(SDL_TrayMenu *menu, int pos, const char *label, SDL_TrayEntryFlags flags)
|
SDL_TrayEntry *SDL_InsertTrayEntryAt(SDL_TrayMenu *menu, int pos, const char *label, SDL_TrayEntryFlags flags)
|
||||||
{
|
{
|
||||||
CHECK_PARAM(!menu)
|
CHECK_PARAM (!menu) {
|
||||||
{
|
|
||||||
SDL_InvalidParamError("menu");
|
SDL_InvalidParamError("menu");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -215,8 +205,7 @@ SDL_TrayEntry *SDL_InsertTrayEntryAt(SDL_TrayMenu *menu, int pos, const char *la
|
|||||||
|
|
||||||
void SDL_SetTrayEntryLabel(SDL_TrayEntry *entry, const char *label)
|
void SDL_SetTrayEntryLabel(SDL_TrayEntry *entry, const char *label)
|
||||||
{
|
{
|
||||||
CHECK_PARAM(!entry)
|
CHECK_PARAM (!entry) {
|
||||||
{
|
|
||||||
SDL_InvalidParamError("entry");
|
SDL_InvalidParamError("entry");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -226,8 +215,7 @@ void SDL_SetTrayEntryLabel(SDL_TrayEntry *entry, const char *label)
|
|||||||
|
|
||||||
const char *SDL_GetTrayEntryLabel(SDL_TrayEntry *entry)
|
const char *SDL_GetTrayEntryLabel(SDL_TrayEntry *entry)
|
||||||
{
|
{
|
||||||
CHECK_PARAM(!entry)
|
CHECK_PARAM (!entry) {
|
||||||
{
|
|
||||||
SDL_InvalidParamError("entry");
|
SDL_InvalidParamError("entry");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -237,8 +225,7 @@ const char *SDL_GetTrayEntryLabel(SDL_TrayEntry *entry)
|
|||||||
|
|
||||||
void SDL_SetTrayEntryChecked(SDL_TrayEntry *entry, bool checked)
|
void SDL_SetTrayEntryChecked(SDL_TrayEntry *entry, bool checked)
|
||||||
{
|
{
|
||||||
CHECK_PARAM(!entry)
|
CHECK_PARAM (!entry) {
|
||||||
{
|
|
||||||
SDL_InvalidParamError("entry");
|
SDL_InvalidParamError("entry");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -248,8 +235,7 @@ void SDL_SetTrayEntryChecked(SDL_TrayEntry *entry, bool checked)
|
|||||||
|
|
||||||
bool SDL_GetTrayEntryChecked(SDL_TrayEntry *entry)
|
bool SDL_GetTrayEntryChecked(SDL_TrayEntry *entry)
|
||||||
{
|
{
|
||||||
CHECK_PARAM(!entry)
|
CHECK_PARAM (!entry) {
|
||||||
{
|
|
||||||
SDL_InvalidParamError("entry");
|
SDL_InvalidParamError("entry");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -259,8 +245,7 @@ bool SDL_GetTrayEntryChecked(SDL_TrayEntry *entry)
|
|||||||
|
|
||||||
void SDL_SetTrayEntryEnabled(SDL_TrayEntry *entry, bool enabled)
|
void SDL_SetTrayEntryEnabled(SDL_TrayEntry *entry, bool enabled)
|
||||||
{
|
{
|
||||||
CHECK_PARAM(!entry)
|
CHECK_PARAM (!entry) {
|
||||||
{
|
|
||||||
SDL_InvalidParamError("entry");
|
SDL_InvalidParamError("entry");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -270,8 +255,7 @@ void SDL_SetTrayEntryEnabled(SDL_TrayEntry *entry, bool enabled)
|
|||||||
|
|
||||||
bool SDL_GetTrayEntryEnabled(SDL_TrayEntry *entry)
|
bool SDL_GetTrayEntryEnabled(SDL_TrayEntry *entry)
|
||||||
{
|
{
|
||||||
CHECK_PARAM(!entry)
|
CHECK_PARAM (!entry) {
|
||||||
{
|
|
||||||
SDL_InvalidParamError("entry");
|
SDL_InvalidParamError("entry");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -281,14 +265,12 @@ bool SDL_GetTrayEntryEnabled(SDL_TrayEntry *entry)
|
|||||||
|
|
||||||
void SDL_SetTrayEntryCallback(SDL_TrayEntry *entry, SDL_TrayCallback callback, void *userdata)
|
void SDL_SetTrayEntryCallback(SDL_TrayEntry *entry, SDL_TrayCallback callback, void *userdata)
|
||||||
{
|
{
|
||||||
CHECK_PARAM(!entry)
|
CHECK_PARAM (!entry) {
|
||||||
{
|
|
||||||
SDL_InvalidParamError("entry");
|
SDL_InvalidParamError("entry");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CHECK_PARAM(!callback)
|
CHECK_PARAM (!callback) {
|
||||||
{
|
|
||||||
SDL_InvalidParamError("callback");
|
SDL_InvalidParamError("callback");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -298,8 +280,7 @@ void SDL_SetTrayEntryCallback(SDL_TrayEntry *entry, SDL_TrayCallback callback, v
|
|||||||
|
|
||||||
void SDL_ClickTrayEntry(SDL_TrayEntry *entry)
|
void SDL_ClickTrayEntry(SDL_TrayEntry *entry)
|
||||||
{
|
{
|
||||||
CHECK_PARAM(!entry)
|
CHECK_PARAM (!entry) {
|
||||||
{
|
|
||||||
SDL_InvalidParamError("entry");
|
SDL_InvalidParamError("entry");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -309,8 +290,7 @@ void SDL_ClickTrayEntry(SDL_TrayEntry *entry)
|
|||||||
|
|
||||||
SDL_TrayMenu *SDL_GetTrayEntryParent(SDL_TrayEntry *entry)
|
SDL_TrayMenu *SDL_GetTrayEntryParent(SDL_TrayEntry *entry)
|
||||||
{
|
{
|
||||||
CHECK_PARAM(!entry)
|
CHECK_PARAM (!entry) {
|
||||||
{
|
|
||||||
SDL_InvalidParamError("entry");
|
SDL_InvalidParamError("entry");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -320,8 +300,7 @@ SDL_TrayMenu *SDL_GetTrayEntryParent(SDL_TrayEntry *entry)
|
|||||||
|
|
||||||
SDL_TrayEntry *SDL_GetTrayMenuParentEntry(SDL_TrayMenu *menu)
|
SDL_TrayEntry *SDL_GetTrayMenuParentEntry(SDL_TrayMenu *menu)
|
||||||
{
|
{
|
||||||
CHECK_PARAM(!menu)
|
CHECK_PARAM (!menu) {
|
||||||
{
|
|
||||||
SDL_InvalidParamError("menu");
|
SDL_InvalidParamError("menu");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -331,8 +310,7 @@ SDL_TrayEntry *SDL_GetTrayMenuParentEntry(SDL_TrayMenu *menu)
|
|||||||
|
|
||||||
SDL_Tray *SDL_GetTrayMenuParentTray(SDL_TrayMenu *menu)
|
SDL_Tray *SDL_GetTrayMenuParentTray(SDL_TrayMenu *menu)
|
||||||
{
|
{
|
||||||
CHECK_PARAM(!menu)
|
CHECK_PARAM (!menu) {
|
||||||
{
|
|
||||||
SDL_InvalidParamError("menu");
|
SDL_InvalidParamError("menu");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user