FreeRDP/client/SDL/sdl_utils.c

102 lines
3.0 KiB
C
Raw Normal View History

2022-12-30 13:25:28 +03:00
/**
* FreeRDP: A Remote Desktop Protocol Implementation
* SDL Client
*
* Copyright 2022 Armin Novak <armin.novak@thincast.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <assert.h>
#include "sdl_utils.h"
#include <SDL.h>
const char* sdl_event_type_str(Uint32 type)
{
#define STR(x) #x
#define EV_CASE_STR(x) \
case x: \
return STR(x)
switch (type)
{
EV_CASE_STR(SDL_FIRSTEVENT);
EV_CASE_STR(SDL_QUIT);
EV_CASE_STR(SDL_APP_TERMINATING);
EV_CASE_STR(SDL_APP_LOWMEMORY);
EV_CASE_STR(SDL_APP_WILLENTERBACKGROUND);
EV_CASE_STR(SDL_APP_DIDENTERBACKGROUND);
EV_CASE_STR(SDL_APP_WILLENTERFOREGROUND);
EV_CASE_STR(SDL_APP_DIDENTERFOREGROUND);
#if SDL_VERSION_ATLEAST(2, 0, 10)
EV_CASE_STR(SDL_DISPLAYEVENT);
#endif
EV_CASE_STR(SDL_WINDOWEVENT);
EV_CASE_STR(SDL_SYSWMEVENT);
EV_CASE_STR(SDL_KEYDOWN);
EV_CASE_STR(SDL_KEYUP);
EV_CASE_STR(SDL_TEXTEDITING);
EV_CASE_STR(SDL_TEXTINPUT);
EV_CASE_STR(SDL_KEYMAPCHANGED);
EV_CASE_STR(SDL_MOUSEMOTION);
EV_CASE_STR(SDL_MOUSEBUTTONDOWN);
EV_CASE_STR(SDL_MOUSEBUTTONUP);
EV_CASE_STR(SDL_MOUSEWHEEL);
EV_CASE_STR(SDL_JOYAXISMOTION);
EV_CASE_STR(SDL_JOYBALLMOTION);
EV_CASE_STR(SDL_JOYHATMOTION);
EV_CASE_STR(SDL_JOYBUTTONDOWN);
EV_CASE_STR(SDL_JOYBUTTONUP);
EV_CASE_STR(SDL_JOYDEVICEADDED);
EV_CASE_STR(SDL_JOYDEVICEREMOVED);
EV_CASE_STR(SDL_CONTROLLERAXISMOTION);
EV_CASE_STR(SDL_CONTROLLERBUTTONDOWN);
EV_CASE_STR(SDL_CONTROLLERBUTTONUP);
EV_CASE_STR(SDL_CONTROLLERDEVICEADDED);
EV_CASE_STR(SDL_CONTROLLERDEVICEREMOVED);
EV_CASE_STR(SDL_CONTROLLERDEVICEREMAPPED);
#if SDL_VERSION_ATLEAST(2, 0, 14)
EV_CASE_STR(SDL_LOCALECHANGED);
EV_CASE_STR(SDL_CONTROLLERTOUCHPADDOWN);
EV_CASE_STR(SDL_CONTROLLERTOUCHPADMOTION);
EV_CASE_STR(SDL_CONTROLLERTOUCHPADUP);
EV_CASE_STR(SDL_CONTROLLERSENSORUPDATE);
#endif
EV_CASE_STR(SDL_FINGERDOWN);
EV_CASE_STR(SDL_FINGERUP);
EV_CASE_STR(SDL_FINGERMOTION);
EV_CASE_STR(SDL_DOLLARGESTURE);
EV_CASE_STR(SDL_DOLLARRECORD);
EV_CASE_STR(SDL_MULTIGESTURE);
EV_CASE_STR(SDL_CLIPBOARDUPDATE);
EV_CASE_STR(SDL_DROPFILE);
EV_CASE_STR(SDL_DROPTEXT);
EV_CASE_STR(SDL_DROPBEGIN);
EV_CASE_STR(SDL_DROPCOMPLETE);
EV_CASE_STR(SDL_AUDIODEVICEADDED);
EV_CASE_STR(SDL_AUDIODEVICEREMOVED);
#if SDL_VERSION_ATLEAST(2, 0, 9)
EV_CASE_STR(SDL_SENSORUPDATE);
#endif
EV_CASE_STR(SDL_RENDER_TARGETS_RESET);
EV_CASE_STR(SDL_RENDER_DEVICE_RESET);
EV_CASE_STR(SDL_USEREVENT);
EV_CASE_STR(SDL_LASTEVENT);
default:
return "SDL_UNKNOWNEVENT";
}
#undef EV_CASE_STR
#undef STR
}