Allow building the tray subsystem without the video subsystem

Fixes https://github.com/libsdl-org/SDL/issues/13235
This commit is contained in:
Sam Lantinga
2025-08-27 07:34:18 -07:00
parent 943d0f67ba
commit da6e9bbf7c
18 changed files with 219 additions and 263 deletions

View File

@@ -21,7 +21,7 @@
#include "SDL_internal.h"
#ifndef SDL_PLATFORM_MACOS
#ifdef SDL_TRAY_DUMMY
#include "../SDL_tray_utils.h"
@@ -140,4 +140,4 @@ void SDL_DestroyTray(SDL_Tray *tray)
{
}
#endif // !SDL_PLATFORM_MACOS
#endif // SDL_TRAY_DUMMY

View File

@@ -23,13 +23,10 @@
#include "../SDL_tray_utils.h"
#include "../../core/windows/SDL_windows.h"
#include "../../video/windows/SDL_windowswindow.h"
#include <windowsx.h>
#include <shellapi.h>
#include "../../video/windows/SDL_surface_utils.h"
#ifndef NOTIFYICON_VERSION_4
#define NOTIFYICON_VERSION_4 4
#endif
@@ -115,7 +112,7 @@ LRESULT CALLBACK TrayWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPar
case WM_TRAYICON:
if (LOWORD(lParam) == WM_CONTEXTMENU || LOWORD(lParam) == WM_LBUTTONUP) {
SetForegroundWindow(hwnd);
if (tray->menu) {
TrackPopupMenu(tray->menu->hMenu, TPM_BOTTOMALIGN | TPM_RIGHTALIGN, GET_X_LPARAM(wParam), GET_Y_LPARAM(wParam), 0, hwnd, NULL);
}
@@ -247,7 +244,7 @@ SDL_Tray *SDL_CreateTray(SDL_Surface *icon, const char *tooltip)
SDL_free(tooltipw);
if (icon) {
tray->nid.hIcon = CreateIconFromSurface(icon);
tray->nid.hIcon = WIN_CreateIconFromSurface(icon);
if (!tray->nid.hIcon) {
tray->nid.hIcon = load_default_icon();
@@ -280,7 +277,7 @@ void SDL_SetTrayIcon(SDL_Tray *tray, SDL_Surface *icon)
}
if (icon) {
tray->nid.hIcon = CreateIconFromSurface(icon);
tray->nid.hIcon = WIN_CreateIconFromSurface(icon);
if (!tray->nid.hIcon) {
tray->nid.hIcon = load_default_icon();