Petar Popovic
68dabd48c4
SDL_GetTrayEntries(): Rename parameter size to count
2025-02-05 07:44:46 -08:00
Petar Popovic
6f098a920e
Avoid a crash when a tray without a menu is clicked on Windows.
2025-01-26 23:27:28 -08:00
Sam Lantinga
5f2dd5f04e
tray: fixed multi-threading issues with GTk implementation
...
GTK+ documentation states that all GDK and GTK+ calls should be made from the main thread.
Fixes https://github.com/libsdl-org/SDL/issues/11984
2025-01-19 18:53:55 -08:00
Sam Lantinga
dfdc120268
tray: document thread-safety
2025-01-19 18:53:55 -08:00
Sam Lantinga
7570ab106d
tray: improved error checking
...
Also clean up any existing trays when the program quits
Fixes https://github.com/libsdl-org/SDL/issues/11893
2025-01-19 18:53:55 -08:00
Sam Lantinga
049a8f0e52
Use SDL_calloc() instead of SDL_malloc()
...
This automatically initializes memory to zero so you don't have uninitialized memory bugs
2025-01-18 13:41:23 -08:00
Semphris
354d2c390c
Initialize invalid parent_{tray,entry} to NULL
...
The API states that the related functions must return NULL if the function
called (get the parent tray, or get the parent entry) is invalid for this
menu. Initialising the fields to NULL makes that API correct for Windows.
2025-01-18 16:17:16 -05:00
Semphris
b79ada6aa5
Windows trays: Fix ParentEntry & Enabling
...
The test/testtray program would crash on Windows when adding any item and then removing it, because a submenu's parent_entry field was not set.
Additionally, I noticed that some extraneous code copied from the {G,S}etTrayEntryChecked made {G,S}etTrayEntryEnabled work only for checkboxes, which is not the desired behavior.
Both issues were fixed in this commit.
2025-01-18 16:17:16 -05:00
Sam Lantinga
656c519cca
Fixed warning C6313: Incorrect operator. Use an equality test to check for zero-valued flags.
2025-01-17 12:08:58 -08:00
Scrooge86x
0aa319e4f9
Added support for custom tray icon on Windows via SDL hints.
...
SDL_CreateTray now respects SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL
and SDL_HINT_WINDOWS_INTRESOURCE_ICON hints and uses the specified icon
as the tray icon.
2025-01-13 18:35:49 -08:00
Sam Lantinga
042898995c
Added SDL_ClickTrayEntry()
...
Also removed the app delegate from the tray code on Cocoa and folded that into SDL3AppDelegate.
Fixes https://github.com/libsdl-org/SDL/issues/11906
2025-01-10 12:55:50 -08:00
Ozkan Sezer
8ec576ddab
tray, windows: fix logic error from commit 1167cf54e1
2025-01-07 10:15:40 +03:00
Sam Lantinga
8d8649b33f
Fixed error: returning 'SDL_TrayEntry **' from a function with incompatible return type 'const SDL_TrayEntry **'
2025-01-06 11:35:54 -08:00
Sam Lantinga
1167cf54e1
Fixed warning C4706: assignment within conditional expression
2025-01-06 11:30:28 -08:00
Sam Lantinga
8a9b7ae8d1
Switched nEntries to int, to avoid signed/unsigned comparison warnings
...
Also standardized memory allocation calls to match SDL style
2025-01-06 11:29:28 -08:00
Semphris
b6dc44b133
Support dark theme for tray menus on Windows
2025-01-04 11:04:21 -08:00
Semphris
7673b84f52
Make SDL_GetTrayEntires() NULL-terminated
2025-01-04 10:56:19 -08:00
Sam Lantinga
f2074d7af3
Updated copyright for 2025
2025-01-01 07:45:52 -08:00
Semphris
2d91f096ca
Remove libc function from Windows tray
2024-12-30 01:20:12 +03:00
Semphris
0461180e25
SDL_EVENT_QUIT when no window nor tray
...
SDL_HINT_QUIT_ON_LAST_WINDOW_CLOSE will not fire if there are active tray icons. This impacts only applications that create tray icons, and that at least one icon outlives the last visible top-level window. SDL_EVENT_QUIT will fire when the last active tray is destroyed if there are no active windows.
2024-12-27 09:22:27 -08:00
Ozkan Sezer
578509c326
windows/SDL_tray.c, video/windows/SDL_surface_utils.h: use SDL_windows.h
2024-12-27 12:28:02 +03:00
Ozkan Sezer
05932e05da
tray, windows: replace ZeroMemory() with SDL_zero()
2024-12-27 12:05:00 +03:00
Ozkan Sezer
50fbae9302
tray, windows: define NOTIFYICON_VERSION_4 and NIF_SHOWTIP, if missing.
2024-12-27 05:30:50 +03:00
expikr
f40a530fd9
subclass the builtin system message class instead
2024-12-24 12:06:47 -08:00
Semphriss
01b9b0edb7
Add system tray support ( #10873 )
2024-12-24 10:36:39 -08:00