1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-27 22:49:25 +02:00

Fix SDL_Hints location

This commit is contained in:
Ivan Savenko
2023-05-19 18:56:20 +03:00
parent bb36336aed
commit e23dfec6c5
6 changed files with 19 additions and 15 deletions

View File

@@ -313,19 +313,6 @@ int main(int argc, char * argv[])
logGlobal->info("Initializing screen and sound handling: %d ms", pomtime.getDiff()); logGlobal->info("Initializing screen and sound handling: %d ms", pomtime.getDiff());
} }
#ifdef VCMI_MAC
// Ctrl+click should be treated as a right click on Mac OS X
SDL_SetHint(SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK, "1");
#endif
#ifdef SDL_HINT_MOUSE_TOUCH_EVENTS
if(settings["general"]["userRelativePointer"].Bool())
{
SDL_SetHint(SDL_HINT_MOUSE_TOUCH_EVENTS, "0");
SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0");
}
#endif
#ifndef VCMI_NO_THREADED_LOAD #ifndef VCMI_NO_THREADED_LOAD
//we can properly play intro only in the main thread, so we have to move loading to the separate thread //we can properly play intro only in the main thread, so we have to move loading to the separate thread
boost::thread loading(init); boost::thread loading(init);

View File

@@ -29,7 +29,7 @@
#include "../../lib/CConfigHandler.h" #include "../../lib/CConfigHandler.h"
#include <SDL_events.h> #include <SDL_events.h>
#include <SDL_hints.h>
InputHandler::InputHandler() InputHandler::InputHandler()
: mouseHandler(std::make_unique<InputSourceMouse>()) : mouseHandler(std::make_unique<InputSourceMouse>())

View File

@@ -18,6 +18,15 @@
#include "../gui/ShortcutHandler.h" #include "../gui/ShortcutHandler.h"
#include <SDL_events.h> #include <SDL_events.h>
#include <SDL_hints.h>
InputSourceKeyboard::InputSourceKeyboard()
{
#ifdef VCMI_MAC
// Ctrl+click should be treated as a right click on Mac OS X
SDL_SetHint(SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK, "1");
#endif
}
void InputSourceKeyboard::handleEventKeyDown(const SDL_KeyboardEvent & key) void InputSourceKeyboard::handleEventKeyDown(const SDL_KeyboardEvent & key)
{ {

View File

@@ -15,6 +15,8 @@ struct SDL_KeyboardEvent;
class InputSourceKeyboard class InputSourceKeyboard
{ {
public: public:
InputSourceKeyboard();
void handleEventKeyDown(const SDL_KeyboardEvent & current); void handleEventKeyDown(const SDL_KeyboardEvent & current);
void handleEventKeyUp(const SDL_KeyboardEvent & current); void handleEventKeyUp(const SDL_KeyboardEvent & current);
}; };

View File

@@ -21,11 +21,17 @@
#include <SDL_events.h> #include <SDL_events.h>
#include <SDL_render.h> #include <SDL_render.h>
#include <SDL_hints.h>
InputSourceTouch::InputSourceTouch() InputSourceTouch::InputSourceTouch()
: multifinger(false) : multifinger(false)
, isPointerRelativeMode(settings["general"]["userRelativePointer"].Bool()) , isPointerRelativeMode(settings["general"]["userRelativePointer"].Bool())
{ {
if(isPointerRelativeMode)
{
SDL_SetHint(SDL_HINT_MOUSE_TOUCH_EVENTS, "0");
SDL_SetHint(SDL_HINT_TOUCH_MOUSE_EVENTS, "0");
}
} }
void InputSourceTouch::handleEventFingerMotion(const SDL_TouchFingerEvent & tfinger) void InputSourceTouch::handleEventFingerMotion(const SDL_TouchFingerEvent & tfinger)

View File

@@ -277,7 +277,7 @@ void SelectionTab::clickLeft(tribool down, bool previousState)
} }
#ifdef VCMI_IOS #ifdef VCMI_IOS
// focus input field if clicked inside it // focus input field if clicked inside it
else if(inputName && inputName->active && inputNameRect.isInside(GH.getCursorPosition())) else if(inputName && inputName->isActive() && inputNameRect.isInside(GH.getCursorPosition()))
inputName->giveFocus(); inputName->giveFocus();
#endif #endif
} }