<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
On 23.01.2013 11:44, Michael Schnell wrote:
<blockquote cite="mid:50FFA2F3.3050905@lumino.de" type="cite">
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<div class="moz-cite-prefix">On 01/22/2013 06:52 PM, Anton
Kavalenka wrote:<br>
</div>
<blockquote cite="mid:50FED1DF.2060101@tut.by" type="cite">
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<font face="Liberation Sans"><br>
<br>
But GTK Widgetset uses pure Xlib calls for determining
keyboard states. <br>
Xlib thread-safety is not initialized in GTK2 widgetset.</font><br>
</blockquote>
<br>
<font face="Liberation Sans">AFAIK: As the GUI and Event-queue
related LCL classes (i.e. TApplication)</font> are not thread
save themselves (e.g. using global variables). It does not make
sense to attach to the System's Widget set in a thread safe way. <br>
<br>
To allow for multiple GUI threads a major update of the
appropriate LCL functions would be necessary, so that multiple
threads can create their own dedicated TApplication instances. <br>
<br>
-Michael<br>
<br>
</blockquote>
Dear Michael!<br>
<br>
The problem is in LCL implementation itself, not in event queuing.<br>
<br>
Real life example:<br>
<br>
Off-screen composing is made into TBitmap. <br>
Screen update is made via Synchronize() call or sending a message to
the control (it does not matter).<br>
This approach works both in Win32/64 and Carbon.<br>
<br>
But in LCL-GTK:<br>
Getting and setting bitmap data invoke GTK and Xlib calls.<br>
If it were pure GTK - all would be OK. <br>
GTK is thread-safe and uses mutexes internally.<br>
<br>
X is also thread-safe (as soon XInitThreads called).<br>
But currently LCL-GTK is a mix of Xlib and GTK calls, and threading
for XLib is NOT initialized.<br>
<br>
The described example works until i click the form. <br>
This beaks X-message flow. <br>
GTK does not block Xlib and vice versa.<br>
<br>
As I have already written, I'll try to provide the "example" of
problem,<br>
which works in Win32,Carbon but fails in GTK.<br>
<br>
regards,<br>
Anton<br>
<br>
<br>
<br>
<br>
<br>
</body>
</html>