mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-04-21 21:52:04 +02:00
sync thread access to text input buffer
This commit is contained in:
parent
10f3d2655d
commit
69a89cf87f
3 changed files with 635 additions and 609 deletions
|
@ -20,11 +20,13 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "binding-util.h"
|
#include "binding-util.h"
|
||||||
#include "exception.h"
|
#include "util/exception.h"
|
||||||
#include "input.h"
|
#include "input/input.h"
|
||||||
#include "sharedstate.h"
|
#include "sharedstate.h"
|
||||||
#include "src/util/util.h"
|
#include "src/util/util.h"
|
||||||
|
|
||||||
|
#include "eventthread.h"
|
||||||
|
|
||||||
#include <SDL_joystick.h>
|
#include <SDL_joystick.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@ -323,10 +325,10 @@ RB_METHOD(inputSetMode) {
|
||||||
|
|
||||||
RB_METHOD(inputGets) {
|
RB_METHOD(inputGets) {
|
||||||
RB_UNUSED_PARAM;
|
RB_UNUSED_PARAM;
|
||||||
|
shState->eThread().lockText(true);
|
||||||
VALUE ret = rb_utf8_str_new_cstr(shState->input().getText());
|
VALUE ret = rb_utf8_str_new_cstr(shState->input().getText());
|
||||||
shState->input().clearText();
|
shState->input().clearText();
|
||||||
|
shState->eThread().lockText(false);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1229
src/eventthread.cpp
1229
src/eventthread.cpp
File diff suppressed because it is too large
Load diff
|
@ -77,10 +77,13 @@ public:
|
||||||
static TouchState touchState;
|
static TouchState touchState;
|
||||||
|
|
||||||
std::string textInputBuffer;
|
std::string textInputBuffer;
|
||||||
|
void lockText(bool lock);
|
||||||
|
|
||||||
|
|
||||||
static bool allocUserEvents();
|
static bool allocUserEvents();
|
||||||
|
|
||||||
EventThread();
|
EventThread();
|
||||||
|
~EventThread();
|
||||||
|
|
||||||
void process(RGSSThreadData &rtData);
|
void process(RGSSThreadData &rtData);
|
||||||
void cleanup();
|
void cleanup();
|
||||||
|
@ -128,6 +131,8 @@ private:
|
||||||
SDL_Joystick *js;
|
SDL_Joystick *js;
|
||||||
|
|
||||||
AtomicFlag msgBoxDone;
|
AtomicFlag msgBoxDone;
|
||||||
|
|
||||||
|
SDL_mutex *textInputLock;
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue