tray: removed double click handling

This commit is contained in:
Jesse Chounard
2026-02-05 12:05:57 -06:00
committed by Sam Lantinga
parent bc16157c9d
commit cb0c7b01e4
4 changed files with 13 additions and 38 deletions

View File

@@ -24,6 +24,7 @@
* SDL_CreateTrayWithProperties to demonstrate click callbacks:
* - Left click: Logs a message and shows the menu (returns true)
* - Right click: Logs a message and suppresses the menu (returns false)
* - Middle click: Logs a message (menu never shows for middle click)
*
* Window behavior:
* - Closing the window (X button) hides it to the tray rather than exiting
@@ -51,6 +52,12 @@ static bool SDLCALL tray2_rightclick(void *userdata, SDL_Tray *tray)
return false;
}
static bool SDLCALL tray2_middleclick(void *userdata, SDL_Tray *tray)
{
SDL_Log("Middle click on example tray - menu doesn't show for middle click");
return false;
}
static bool trays_destroyed = false;
static SDL_Window *window = NULL;
static SDL_TrayEntry *entry_toggle = NULL;
@@ -607,6 +614,7 @@ int main(int argc, char **argv)
SDL_SetStringProperty(tray2_props, SDL_PROP_TRAY_CREATE_TOOLTIP_STRING, "SDL Tray example");
SDL_SetPointerProperty(tray2_props, SDL_PROP_TRAY_CREATE_LEFTCLICK_CALLBACK_POINTER, tray2_leftclick);
SDL_SetPointerProperty(tray2_props, SDL_PROP_TRAY_CREATE_RIGHTCLICK_CALLBACK_POINTER, tray2_rightclick);
SDL_SetPointerProperty(tray2_props, SDL_PROP_TRAY_CREATE_MIDDLECLICK_CALLBACK_POINTER, tray2_middleclick);
SDL_Tray *tray2 = SDL_CreateTrayWithProperties(tray2_props);
SDL_DestroyProperties(tray2_props);