From a44f5b57cbc9d57991ec1c0e2517615049f2c280 Mon Sep 17 00:00:00 2001 From: Vitaly Pronkin Date: Fri, 25 May 2018 01:34:57 +1200 Subject: [PATCH] don't need this --- library/Hooks-darwin.cpp | 7 ------- library/include/Hooks.h | 1 - plugins/CMakeLists.txt | 6 +----- plugins/mousequery.cpp | 10 +--------- 4 files changed, 2 insertions(+), 22 deletions(-) diff --git a/library/Hooks-darwin.cpp b/library/Hooks-darwin.cpp index fc9985858..22e7cc2e9 100644 --- a/library/Hooks-darwin.cpp +++ b/library/Hooks-darwin.cpp @@ -127,12 +127,6 @@ DFhackCExport int SDL_PushEvent(SDL::Event* event) return _SDL_PushEvent(event); } -static unsigned char* (*_SDL_GetKeyState)(int *numkeys) = 0; -DFhackCExport unsigned char* SDL_GetKeyState(int *numkeys) -{ - return _SDL_GetKeyState(numkeys); -} - struct WINDOW; DFhackCExport int DFH_wgetch(WINDOW *win) { @@ -297,7 +291,6 @@ DFhackCExport int DFH_SDL_Init(uint32_t flags) bind(SDL_Quit); bind(SDL_PollEvent); bind(SDL_PushEvent); - bind(SDL_GetKeyState); bind(SDL_UpperBlit); bind(SDL_CreateRGBSurface); diff --git a/library/include/Hooks.h b/library/include/Hooks.h index 07939aa65..97caecfa5 100644 --- a/library/include/Hooks.h +++ b/library/include/Hooks.h @@ -58,7 +58,6 @@ DFhackCExport int SDL_NumJoysticks(void); DFhackCExport void SDL_Quit(void); DFhackCExport int SDL_PollEvent(SDL::Event* event); DFhackCExport int SDL_PushEvent(SDL::Event* event); -DFhackCExport unsigned char* SDL_GetKeyState(int *numkeys); DFhackCExport int SDL_Init(uint32_t flags); DFhackCExport int wgetch(WINDOW * win); diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index c413f21db..e8e1b6bc8 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -136,11 +136,7 @@ if (BUILD_SUPPORTED) DFHACK_PLUGIN(manipulator manipulator.cpp) DFHACK_PLUGIN(misery misery.cpp) DFHACK_PLUGIN(mode mode.cpp) - IF(UNIX AND NOT APPLE) - DFHACK_PLUGIN(mousequery mousequery.cpp LINK_LIBRARIES SDL) - ELSE() - DFHACK_PLUGIN(mousequery mousequery.cpp) - ENDIF() + DFHACK_PLUGIN(mousequery mousequery.cpp) DFHACK_PLUGIN(orders orders.cpp LINK_LIBRARIES jsoncpp) DFHACK_PLUGIN(pathable pathable.cpp LINK_LIBRARIES lua) DFHACK_PLUGIN(petcapRemover petcapRemover.cpp) diff --git a/plugins/mousequery.cpp b/plugins/mousequery.cpp index 387a03e3c..b2856b457 100644 --- a/plugins/mousequery.cpp +++ b/plugins/mousequery.cpp @@ -21,10 +21,6 @@ #include "TileTypes.h" #include "DataFuncs.h" -// For SDL_GetKeyState -#include "Hooks.h" -#include "SDL_keyboard.h" - DFHACK_PLUGIN("mousequery"); REQUIRE_GLOBAL(enabler); REQUIRE_GLOBAL(gps); @@ -302,11 +298,7 @@ struct mousequery_hook : public df::viewscreen_dwarfmodest bool handleLeft(df::coord &mpos, int32_t mx, int32_t my) { - static unsigned char *keystate = 0; - if (!keystate) - keystate = SDL_GetKeyState(NULL); - - if (!(keystate[SDL::Key::K_LSHIFT] || keystate[SDL::Key::K_RSHIFT])) + if (!(Core::getInstance().getModstate() & DFH_MOD_SHIFT)) mpos.z += Gui::getDepthAt(mx, my); bool cursor_still_here = (last_clicked_x == mpos.x && last_clicked_y == mpos.y && last_clicked_z == mpos.z);