mirror of
https://github.com/moparisthebest/Simba
synced 2025-02-16 15:20:09 -05:00
Commented os_linux (a bit)
This commit is contained in:
parent
0cd5099196
commit
f9733bd3fb
@ -69,13 +69,23 @@ interface
|
|||||||
|
|
||||||
function GetNativeWindow: TNativeWindow;
|
function GetNativeWindow: TNativeWindow;
|
||||||
private
|
private
|
||||||
|
{ display is the connection to the X server }
|
||||||
display: PDisplay;
|
display: PDisplay;
|
||||||
|
|
||||||
|
{ screen-number and selected window }
|
||||||
screennum: integer;
|
screennum: integer;
|
||||||
window: x.TWindow;
|
window: x.TWindow;
|
||||||
|
|
||||||
|
{ Reference to the XImage }
|
||||||
buffer: PXImage;
|
buffer: PXImage;
|
||||||
|
|
||||||
|
{ For memory-leak checks }
|
||||||
dirty: Boolean; //true if image loaded
|
dirty: Boolean; //true if image loaded
|
||||||
|
|
||||||
|
{ KeyInput class }
|
||||||
keyinput: TKeyInput;
|
keyinput: TKeyInput;
|
||||||
|
|
||||||
|
{ X Error Handler }
|
||||||
oldXHandler: TXErrorHandler;
|
oldXHandler: TXErrorHandler;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -101,27 +111,32 @@ implementation
|
|||||||
uses GraphType, interfacebase, lcltype;
|
uses GraphType, interfacebase, lcltype;
|
||||||
|
|
||||||
{ PROBLEM: .Create is called on the main thread. ErrorCS etc aren't
|
{ PROBLEM: .Create is called on the main thread. ErrorCS etc aren't
|
||||||
created on other threads. We will create them on the fly... }
|
created on other threads. We will create them on the fly...
|
||||||
|
More info below...}
|
||||||
threadvar
|
threadvar
|
||||||
xerror: string;
|
xerror: string;
|
||||||
threadvar
|
threadvar
|
||||||
ErrorCS: syncobjs.TCriticalSection;
|
ErrorCS: syncobjs.TCriticalSection;
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
This is extremely hacky, but also very useful.
|
||||||
|
We have to install a X error handler, because otherwise X
|
||||||
|
will terminate out entire app on error.
|
||||||
|
|
||||||
//***implementation*** TKeyInput
|
Since we want the right thread to recieve the right error, we have to
|
||||||
|
fiddle a bit with threadvars, mutexes / semaphores.
|
||||||
|
|
||||||
procedure TKeyInput.Down(Key: Word);
|
Another problem is that the script thread is initialised on the main thread.
|
||||||
begin
|
This means that all (threadvar!) semaphores initialised on the mainthread
|
||||||
DoDown(Key);
|
are NOT initialised on the script thread, which has yet to be started.
|
||||||
end;
|
Therefore, we check if it hasn't been created yet.
|
||||||
|
|
||||||
procedure TKeyInput.Up(Key: Word);
|
** Horrible solution, but WFM **
|
||||||
begin
|
|
||||||
DoUp(Key);
|
|
||||||
end;
|
|
||||||
|
|
||||||
//***implementation*** TWindow
|
This is the Handler function.
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function MufasaXErrorHandler(para1:PDisplay; para2:PXErrorEvent):cint; cdecl;
|
function MufasaXErrorHandler(para1:PDisplay; para2:PXErrorEvent):cint; cdecl;
|
||||||
|
|
||||||
@ -158,6 +173,20 @@ implementation
|
|||||||
mDebugLn('Type: ' + inttostr(para2^._type));
|
mDebugLn('Type: ' + inttostr(para2^._type));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TKeyInput }
|
||||||
|
|
||||||
|
procedure TKeyInput.Down(Key: Word);
|
||||||
|
begin
|
||||||
|
DoDown(Key);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TKeyInput.Up(Key: Word);
|
||||||
|
begin
|
||||||
|
DoUp(Key);
|
||||||
|
end;
|
||||||
|
|
||||||
|
{ TWindow }
|
||||||
|
|
||||||
function TWindow.GetError: String;
|
function TWindow.GetError: String;
|
||||||
begin
|
begin
|
||||||
exit(xerror);
|
exit(xerror);
|
||||||
@ -173,6 +202,7 @@ implementation
|
|||||||
xerror := '';
|
xerror := '';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ See if the semaphores / CS are initialised }
|
||||||
constructor TWindow.Create(display: PDisplay; screennum: integer; window: x.TWindow);
|
constructor TWindow.Create(display: PDisplay; screennum: integer; window: x.TWindow);
|
||||||
begin
|
begin
|
||||||
inherited Create;
|
inherited Create;
|
||||||
|
Loading…
Reference in New Issue
Block a user