Move clipboard processing to a separate thread to avoid blocking the main thread during pastes

This commit is contained in:
Cameron Gutman
2021-02-07 17:18:35 -06:00
parent 8372717a09
commit 05e4c5b507
4 changed files with 108 additions and 19 deletions
+10 -1
View File
@@ -65,7 +65,7 @@ public:
void handleJoystickArrivalEvent(SDL_JoyDeviceEvent* event);
void sendText(const char* text);
void sendText(QString& string);
void rumble(unsigned short controllerNumber, unsigned short lowFreqMotor, unsigned short highFreqMotor);
@@ -136,6 +136,9 @@ private:
static
Uint32 dragTimerCallback(Uint32 interval, void* param);
static
int clipboardThreadProc(void *ptr);
SDL_Window* m_Window;
bool m_MultiController;
bool m_GamepadMouse;
@@ -187,5 +190,11 @@ private:
char m_DragButton;
int m_NumFingersDown;
SDL_Thread* m_ClipboardThread;
SDL_atomic_t m_ShutdownClipboardThread;
QString m_ClipboardData;
SDL_cond* m_ClipboardHasData;
SDL_mutex* m_ClipboardLock;
static const int k_ButtonMap[];
};