Skip to content

Commit

Permalink
SDL_bool -> bool (tray)
Browse files Browse the repository at this point in the history
  • Loading branch information
Semphris committed Sep 23, 2024
1 parent f3196e2 commit 05236ad
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 32 deletions.
8 changes: 4 additions & 4 deletions include/SDL3/SDL_tray.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_AppendTraySeparator(SDL_TrayMenu *menu);
* \sa SDL_GetTrayEntryEnabled
* \sa SDL_SetTrayEntryCallback
*/
extern SDL_DECLSPEC void SDLCALL SDL_SetTrayEntryChecked(SDL_TrayEntry *entry, SDL_bool checked);
extern SDL_DECLSPEC void SDLCALL SDL_SetTrayEntryChecked(SDL_TrayEntry *entry, bool checked);

/**
* Gets whether or not an entry is checked.
Expand All @@ -240,7 +240,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayEntryChecked(SDL_TrayEntry *entry, S
* \sa SDL_GetTrayEntryEnabled
* \sa SDL_SetTrayEntryCallback
*/
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetTrayEntryChecked(SDL_TrayEntry *entry);
extern SDL_DECLSPEC bool SDLCALL SDL_GetTrayEntryChecked(SDL_TrayEntry *entry);

/**
* Sets whether or not an entry is enabled.
Expand All @@ -256,7 +256,7 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetTrayEntryChecked(SDL_TrayEntry *entr
* \sa SDL_GetTrayEntryEnabled
* \sa SDL_SetTrayEntryCallback
*/
extern SDL_DECLSPEC void SDLCALL SDL_SetTrayEntryEnabled(SDL_TrayEntry *entry, SDL_bool enabled);
extern SDL_DECLSPEC void SDLCALL SDL_SetTrayEntryEnabled(SDL_TrayEntry *entry, bool enabled);

/**
* Gets whether or not an entry is enabled.
Expand All @@ -272,7 +272,7 @@ extern SDL_DECLSPEC void SDLCALL SDL_SetTrayEntryEnabled(SDL_TrayEntry *entry, S
* \sa SDL_SetTrayEntryEnabled
* \sa SDL_SetTrayEntryCallback
*/
extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GetTrayEntryEnabled(SDL_TrayEntry *entry);
extern SDL_DECLSPEC bool SDLCALL SDL_GetTrayEntryEnabled(SDL_TrayEntry *entry);

/**
* Sets a callback to be invoked when the entry is selected.
Expand Down
8 changes: 4 additions & 4 deletions src/dynapi/SDL_dynapi_procs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1207,10 +1207,10 @@ SDL_DYNAPI_PROC(SDL_TrayMenu*,SDL_CreateTrayMenu,(SDL_Tray *a),(a),return)
SDL_DYNAPI_PROC(SDL_TrayMenu*,SDL_CreateTraySubmenu,(SDL_TrayEntry *a),(a),return)
SDL_DYNAPI_PROC(SDL_TrayEntry*,SDL_AppendTrayEntry,(SDL_TrayMenu *a, const char *b, SDL_TrayEntryFlags c),(a,b,c),return)
SDL_DYNAPI_PROC(void,SDL_AppendTraySeparator,(SDL_TrayMenu *a),(a),)
SDL_DYNAPI_PROC(void,SDL_SetTrayEntryChecked,(SDL_TrayEntry *a, SDL_bool b),(a,b),)
SDL_DYNAPI_PROC(SDL_bool,SDL_GetTrayEntryChecked,(SDL_TrayEntry *a),(a),return)
SDL_DYNAPI_PROC(void,SDL_SetTrayEntryEnabled,(SDL_TrayEntry *a, SDL_bool b),(a,b),)
SDL_DYNAPI_PROC(SDL_bool,SDL_GetTrayEntryEnabled,(SDL_TrayEntry *a),(a),return)
SDL_DYNAPI_PROC(void,SDL_SetTrayEntryChecked,(SDL_TrayEntry *a, bool b),(a,b),)
SDL_DYNAPI_PROC(bool,SDL_GetTrayEntryChecked,(SDL_TrayEntry *a),(a),return)
SDL_DYNAPI_PROC(void,SDL_SetTrayEntryEnabled,(SDL_TrayEntry *a, bool b),(a,b),)
SDL_DYNAPI_PROC(bool,SDL_GetTrayEntryEnabled,(SDL_TrayEntry *a),(a),return)
SDL_DYNAPI_PROC(void,SDL_SetTrayEntryCallback,(SDL_TrayEntry *a, SDL_TrayCallback b, void *c),(a,b,c),)
SDL_DYNAPI_PROC(void,SDL_DestroyTray,(SDL_Tray *a),(a),)
SDL_DYNAPI_PROC(void,SDL_SetTrayIcon,(SDL_Tray *a, SDL_Surface *b),(a,b),)
Expand Down
8 changes: 4 additions & 4 deletions src/tray/cocoa/SDL_tray.m
Original file line number Diff line number Diff line change
Expand Up @@ -237,22 +237,22 @@ void SDL_AppendTraySeparator(SDL_TrayMenu *menu)
[menu->menu addItem:[NSMenuItem separatorItem]];
}

void SDL_SetTrayEntryChecked(SDL_TrayEntry *entry, SDL_bool checked)
void SDL_SetTrayEntryChecked(SDL_TrayEntry *entry, bool checked)
{
[entry->item setState:(checked ? NSControlStateValueOn : NSControlStateValueOff)];
}

SDL_bool SDL_GetTrayEntryChecked(SDL_TrayEntry *entry)
bool SDL_GetTrayEntryChecked(SDL_TrayEntry *entry)
{
return entry->item.state == NSControlStateValueOn;
}

void SDL_SetTrayEntryEnabled(SDL_TrayEntry *entry, SDL_bool enabled)
void SDL_SetTrayEntryEnabled(SDL_TrayEntry *entry, bool enabled)
{
[entry->item setState:(enabled ? YES : NO)];
}

SDL_bool SDL_GetTrayEntryEnabled(SDL_TrayEntry *entry)
bool SDL_GetTrayEntryEnabled(SDL_TrayEntry *entry)
{
return entry->item.enabled;
}
Expand Down
8 changes: 4 additions & 4 deletions src/tray/dummy/SDL_tray.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,23 @@ void SDL_AppendTraySeparator(SDL_TrayMenu *menu)
SDL_Unsupported();
}

void SDL_SetTrayEntryChecked(SDL_TrayEntry *entry, SDL_bool checked)
void SDL_SetTrayEntryChecked(SDL_TrayEntry *entry, bool checked)
{
SDL_Unsupported();
}

SDL_bool SDL_GetTrayEntryChecked(SDL_TrayEntry *entry)
bool SDL_GetTrayEntryChecked(SDL_TrayEntry *entry)
{
SDL_Unsupported();
return false;
}

void SDL_SetTrayEntryEnabled(SDL_TrayEntry *entry, SDL_bool enabled)
void SDL_SetTrayEntryEnabled(SDL_TrayEntry *entry, bool enabled)
{
SDL_Unsupported();
}

SDL_bool SDL_GetTrayEntryEnabled(SDL_TrayEntry *entry)
bool SDL_GetTrayEntryEnabled(SDL_TrayEntry *entry)
{
SDL_Unsupported();
return false;
Expand Down
24 changes: 12 additions & 12 deletions src/tray/unix/SDL_tray.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ void (*app_indicator_set_menu)(AppIndicator *self, GtkMenu *menu);
/* ------------------------------------------------------------------------- */
#endif

static SDL_bool gtk_is_init = SDL_FALSE;
static bool gtk_is_init = false;

static int main_gtk_thread(void *data)
{
Expand Down Expand Up @@ -143,13 +143,13 @@ static void quit_gtk(void)
libgdk = NULL;
}

gtk_is_init = SDL_FALSE;
gtk_is_init = false;
}

static SDL_bool init_gtk(void)
static bool init_gtk(void)
{
if (gtk_is_init) {
return SDL_TRUE;
return true;
}

libappindicator = dlopen("libayatana-appindicator3.so", RTLD_LAZY);
Expand Down Expand Up @@ -205,11 +205,11 @@ static SDL_bool init_gtk(void)
return SDL_SetError("Could not init GTK");
}

gtk_is_init = SDL_TRUE;
gtk_is_init = true;

SDL_DetachThread(SDL_CreateThread(main_gtk_thread, "tray gtk", NULL));

return SDL_TRUE;
return true;
}

struct SDL_TrayMenu {
Expand Down Expand Up @@ -245,7 +245,7 @@ static void call_callback(GtkMenuItem *item, gpointer ptr)
}

/* TODO: Replace this with a safer alternative */
static SDL_bool get_tmp_filename(char *buffer, size_t size)
static bool get_tmp_filename(char *buffer, size_t size)
{
static int count = 0;

Expand All @@ -260,7 +260,7 @@ static SDL_bool get_tmp_filename(char *buffer, size_t size)

SDL_Tray *SDL_CreateTray(SDL_Surface *icon, const char *tooltip)
{
if (init_gtk() != SDL_TRUE) {
if (init_gtk() != true) {
return NULL;
}

Expand Down Expand Up @@ -362,23 +362,23 @@ void SDL_AppendTraySeparator(SDL_TrayMenu *menu)
gtk_menu_shell_append(menu->menu, item);
}

void SDL_SetTrayEntryChecked(SDL_TrayEntry *entry, SDL_bool checked)
void SDL_SetTrayEntryChecked(SDL_TrayEntry *entry, bool checked)
{
SDL_Unsupported();
}

SDL_bool SDL_GetTrayEntryChecked(SDL_TrayEntry *entry)
bool SDL_GetTrayEntryChecked(SDL_TrayEntry *entry)
{
SDL_Unsupported();
return false;
}

void SDL_SetTrayEntryEnabled(SDL_TrayEntry *entry, SDL_bool enabled)
void SDL_SetTrayEntryEnabled(SDL_TrayEntry *entry, bool enabled)
{
SDL_Unsupported();
}

SDL_bool SDL_GetTrayEntryEnabled(SDL_TrayEntry *entry)
bool SDL_GetTrayEntryEnabled(SDL_TrayEntry *entry)
{
SDL_Unsupported();
return false;
Expand Down
8 changes: 4 additions & 4 deletions src/tray/windows/SDL_tray.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,12 +318,12 @@ void SDL_AppendTraySeparator(SDL_TrayMenu *menu)
AppendMenu(menu->hMenu, MF_SEPARATOR, 0, NULL);
}

void SDL_SetTrayEntryChecked(SDL_TrayEntry *entry, SDL_bool checked)
void SDL_SetTrayEntryChecked(SDL_TrayEntry *entry, bool checked)
{
CheckMenuItem(entry->menu->hMenu, (UINT) entry->id, checked ? MF_CHECKED : MF_UNCHECKED);
}

SDL_bool SDL_GetTrayEntryChecked(SDL_TrayEntry *entry)
bool SDL_GetTrayEntryChecked(SDL_TrayEntry *entry)
{
MENUITEMINFO mii;
mii.cbSize = sizeof(MENUITEMINFO);
Expand All @@ -334,12 +334,12 @@ SDL_bool SDL_GetTrayEntryChecked(SDL_TrayEntry *entry)
return !!(mii.fState & MFS_CHECKED);
}

void SDL_SetTrayEntryEnabled(SDL_TrayEntry *entry, SDL_bool enabled)
void SDL_SetTrayEntryEnabled(SDL_TrayEntry *entry, bool enabled)
{
EnableMenuItem(entry->menu->hMenu, (UINT) entry->id, MF_BYCOMMAND | (enabled ? MF_ENABLED : (MF_DISABLED | MF_GRAYED)));
}

SDL_bool SDL_GetTrayEntryEnabled(SDL_TrayEntry *entry)
bool SDL_GetTrayEntryEnabled(SDL_TrayEntry *entry)
{
MENUITEMINFO mii;
mii.cbSize = sizeof(MENUITEMINFO);
Expand Down

0 comments on commit 05236ad

Please sign in to comment.