Merge branch 'master' into cts-rework
This commit is contained in:
commit
65f4ae16ed
|
@ -23,6 +23,12 @@
|
|||
{$mode objfpc}{$H+}
|
||||
unit os_linux;
|
||||
|
||||
{
|
||||
TODO's:
|
||||
- Allow selecting a different X display
|
||||
- Fix keyboard layout / SendString
|
||||
}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
|
@ -126,7 +132,7 @@ implementation
|
|||
{
|
||||
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.
|
||||
will terminate our entire app on error.
|
||||
|
||||
Since we want the right thread to recieve the right error, we have to
|
||||
fiddle a bit with threadvars, mutexes / semaphores.
|
||||
|
@ -413,40 +419,41 @@ implementation
|
|||
result := xmask and ButtonP > 0;
|
||||
end;
|
||||
|
||||
procedure TWindow.SendString(str: string);
|
||||
var
|
||||
I, L: Integer;
|
||||
K: Byte;
|
||||
HoldShift: Boolean;
|
||||
begin
|
||||
HoldShift := False;
|
||||
L := Length(str);
|
||||
for I := 1 to L do
|
||||
{ TODO: Check if this supports multiple keyboard layouts, probably not }
|
||||
procedure TWindow.SendString(str: string);
|
||||
var
|
||||
I, L: Integer;
|
||||
K: Byte;
|
||||
HoldShift: Boolean;
|
||||
begin
|
||||
if (((str[I] >= 'A') and (str[I] <= 'Z')) or
|
||||
((str[I] >= '!') and (str[I] <= '&')) or
|
||||
((str[I] >= '(') and (str[I] <= '+')) or
|
||||
(str[I] = ':') or
|
||||
((str[I] >= '<') and (str[I] <= '@')) or
|
||||
((str[I] >= '^') and (str[I] <= '_')) or
|
||||
((str[I] >= '{') and (str[I] <= '~'))) then
|
||||
HoldShift := False;
|
||||
L := Length(str);
|
||||
for I := 1 to L do
|
||||
begin
|
||||
HoldKey(VK_SHIFT);
|
||||
HoldShift := True;
|
||||
end;
|
||||
if (((str[I] >= 'A') and (str[I] <= 'Z')) or
|
||||
((str[I] >= '!') and (str[I] <= '&')) or
|
||||
((str[I] >= '(') and (str[I] <= '+')) or
|
||||
(str[I] = ':') or
|
||||
((str[I] >= '<') and (str[I] <= '@')) or
|
||||
((str[I] >= '^') and (str[I] <= '_')) or
|
||||
((str[I] >= '{') and (str[I] <= '~'))) then
|
||||
begin
|
||||
HoldKey(VK_SHIFT);
|
||||
HoldShift := True;
|
||||
end;
|
||||
|
||||
K := GetKeyCode(str[I]);
|
||||
HoldKey(K);
|
||||
Sleep(20);
|
||||
ReleaseKey(K);
|
||||
K := GetKeyCode(str[I]);
|
||||
HoldKey(K);
|
||||
Sleep(20);
|
||||
ReleaseKey(K);
|
||||
|
||||
if (HoldShift) then
|
||||
begin
|
||||
HoldShift := False;
|
||||
ReleaseKey(VK_SHIFT);
|
||||
if (HoldShift) then
|
||||
begin
|
||||
HoldShift := False;
|
||||
ReleaseKey(VK_SHIFT);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TWindow.HoldKey(key: integer);
|
||||
begin
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 940053e16d79c3d76b6b70d6a1bf56507ad0e627
|
||||
Subproject commit b24c52b9748c6f9f3e91a7a86f727022bf2fd6ce
|
Loading…
Reference in New Issue