Revision d4d4df69
Von admin vor mehr als 4 Jahren hinzugefügt
src/gui/gui_utils.c | ||
---|---|---|
int GWEN_Gui_ReadString(const char *text, GWEN_BUFFER *tbuf)
|
||
{
|
||
#ifdef HAVE_ICONV
|
||
if (gwenhywfar_gui) {
|
||
GWEN_GUI *gui;
|
||
|
||
gui=GWEN_Gui_GetGui();
|
||
if (gui) {
|
||
const char *fromCs;
|
||
|
||
if (gwenhywfar_gui->charSet)
|
||
fromCs=gwenhywfar_gui->charSet;
|
||
if (gui->charSet)
|
||
fromCs=gui->charSet;
|
||
else
|
||
/* UTF-8 to UTF-8 conversion does not seem to make much sense, but
|
||
* it is a convenient way to check whether the input text actually
|
||
... | ... | |
GWEN_Buffer_AppendBytes(tbuf, text, len);
|
||
}
|
||
|
||
|
||
|
Auch abrufbar als: Unified diff
No longer directly use global variable gwenhywfar_gui.
We now use a thread-local variable, so a thread can set its own GUI
implementation.
The reason is that most X11 GUIs down allow any thread of a process other
than the main thread to access the graphical interface. If a thread function
uses other GWEN functions which might call GUI functions this would be a
problem.
With thread-local variables each thread can have its own GUI, side-threads
might want to use e.g. the GUI implementation from GWEN_NoGui_new().