瀏覽代碼

Mouse click that activates a window will also trigger mouse event

Ivan Savenko 2 年之前
父節點
當前提交
07d9674828
共有 2 個文件被更改,包括 8 次插入0 次删除
  1. 6 0
      client/eventsSDL/InputSourceMouse.cpp
  2. 2 0
      client/eventsSDL/InputSourceMouse.h

+ 6 - 0
client/eventsSDL/InputSourceMouse.cpp

@@ -18,6 +18,12 @@
 #include "../gui/MouseButton.h"
 
 #include <SDL_events.h>
+#include <SDL_hints.h>
+
+InputSourceMouse::InputSourceMouse()
+{
+	SDL_SetHint(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, "1");
+}
 
 void InputSourceMouse::handleEventMouseMotion(const SDL_MouseMotionEvent & motion)
 {

+ 2 - 0
client/eventsSDL/InputSourceMouse.h

@@ -24,6 +24,8 @@ class InputSourceMouse
 	Point middleClickPosition;
 	int mouseButtonsMask = 0;
 public:
+	InputSourceMouse();
+
 	void handleEventMouseMotion(const SDL_MouseMotionEvent & current);
 	void handleEventMouseButtonDown(const SDL_MouseButtonEvent & current);
 	void handleEventMouseWheel(const SDL_MouseWheelEvent & current);