Skip to content

Commit a00451d

Browse files
committed
maybe fix input not working for one click after assigning devices
1 parent 080909a commit a00451d

File tree

5 files changed

+15
-0
lines changed

5 files changed

+15
-0
lines changed

Source/GUI/GUIControlManager.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ namespace RTE {
137137
/// @return Pointer to the GUIScreen that this GUIControlManager is drawing itself to.
138138
GUIScreen* GetScreen() const { return m_Screen; }
139139

140+
GUIInput* GetInput() const { return m_Input; }
141+
140142
private:
141143
GUIScreen* m_Screen; // Not owned.
142144
GUIInput* m_Input; // Not owned.

Source/GUI/GUIInput.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ void GUIInput::GetMouseButtons(int* Buttons, int* States) const {
8787
}
8888
}
8989

90+
void GUIInput::ClearMouseState() {
91+
memset(m_MouseButtonsEvents, 0, sizeof(int) * 3);
92+
memset(m_MouseButtonsStates, 0, sizeof(int) * 3);
93+
}
94+
9095
void GUIInput::SetNetworkMouseButton(int whichPlayer, int state1, int state2, int state3) {
9196
if (whichPlayer >= 0 && whichPlayer < 4) {
9297
m_OverrideInput = true;

Source/GUI/GUIInput.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ namespace RTE {
9999
/// @param Events State array.
100100
void GetMouseButtons(int* Events, int* States) const;
101101

102+
void ClearMouseState();
103+
102104
static void SetNetworkMouseButton(int whichPlayer, int state1, int state2, int state3);
103105

104106
/// Gets the mouse position

Source/Managers/WindowMan.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,10 @@ void WindowMan::SetVSyncEnabled(bool enable) {
248248
SDL_GL_SetSwapInterval(sdlEnableVSync);
249249
}
250250

251+
void WindowMan::RefocusWindow() const {
252+
SDL_RaiseWindow(m_PrimaryWindow.get());
253+
}
254+
251255
void WindowMan::UpdatePrimaryDisplayInfo() {
252256
m_PrimaryWindowDisplayIndex = SDL_GetDisplayForWindow(m_PrimaryWindow.get());
253257

Source/Managers/WindowMan.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ namespace RTE {
132132
/// Get the screen buffer texture.
133133
/// @return The screen buffer texture.
134134
std::shared_ptr<RenderTarget> GetScreenBuffer() const { return m_ScreenBuffer; }
135+
136+
void RefocusWindow() const;
135137
#pragma endregion
136138

137139
#pragma region Resolution Change Handling

0 commit comments

Comments
 (0)