mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-14 05:19:15 +02:00
qt:
- init screeninfo - thread support (issue #0010675) git-svn-id: trunk@13841 -
This commit is contained in:
parent
da0aac9b69
commit
c380a23969
@ -79,6 +79,7 @@ type
|
||||
|
||||
function CreateThemeServices: TThemeServices; override;
|
||||
function EventFilter(Sender: QObjectH; Event: QEventH): Boolean; cdecl;
|
||||
procedure OnWakeMainThread(Sender: TObject);
|
||||
public
|
||||
function LCLPlatform: TLCLPlatform; override;
|
||||
// Application
|
||||
@ -134,9 +135,9 @@ type
|
||||
Name : String[25];
|
||||
CallBack : Procedure(Data : TObject);
|
||||
Data : Pointer;
|
||||
End;
|
||||
end;
|
||||
|
||||
CallbackProcedure = Procedure (Data : Pointer);
|
||||
CallbackProcedure = procedure (Data : Pointer);
|
||||
|
||||
pTRect = ^TRect;
|
||||
|
||||
@ -146,7 +147,8 @@ type
|
||||
const
|
||||
TargetEntrys = 3;
|
||||
QEventLCLMessage = QEventUser;
|
||||
|
||||
LCLQt_CheckSynchronize = QEventType(Ord(QEventUser) + $1001);
|
||||
|
||||
var
|
||||
QtWidgetSet: TQtWidgetSet;
|
||||
|
||||
|
@ -99,9 +99,11 @@ procedure TQtWidgetSet.AppInit(var ScreenInfo: TScreenInfo);
|
||||
var
|
||||
Method: TMethod;
|
||||
FHook: QObject_hookH;
|
||||
ScreenDC: HDC;
|
||||
begin
|
||||
App := QApplication_Create(@argc, argv);
|
||||
|
||||
WakeMainThread := @OnWakeMainThread;
|
||||
|
||||
FOldFocusWidget := nil;
|
||||
|
||||
{
|
||||
@ -112,6 +114,15 @@ begin
|
||||
FHook := QObject_hook_create(App);
|
||||
TEventFilterMethod(Method) := @EventFilter;
|
||||
QObject_hook_hook_events(FHook, Method);
|
||||
|
||||
ScreenDC := GetDC(0);
|
||||
try
|
||||
ScreenInfo.PixelsPerInchX := GetDeviceCaps(ScreenDC, LOGPIXELSX);
|
||||
ScreenInfo.PixelsPerInchY := GetDeviceCaps(ScreenDC, LOGPIXELSY);
|
||||
ScreenInfo.ColorDepth := GetDeviceCaps(ScreenDC, BITSPIXEL);
|
||||
finally
|
||||
ReleaseDC(0, ScreenDC);
|
||||
end;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
@ -270,9 +281,22 @@ begin
|
||||
Result := True;
|
||||
QEvent_Accept(Event);
|
||||
end;
|
||||
LCLQt_CheckSynchronize:
|
||||
begin
|
||||
// a thread is waiting -> synchronize
|
||||
CheckSynchronize;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TQtWidgetSet.OnWakeMainThread(Sender: TObject);
|
||||
var
|
||||
Event: QEventH;
|
||||
begin
|
||||
Event := QEvent_create(LCLQt_CheckSynchronize);
|
||||
QCoreApplication_postEvent(QCoreApplication_instance(), Event);
|
||||
end;
|
||||
|
||||
function TQtWidgetSet.LCLPlatform: TLCLPlatform;
|
||||
begin
|
||||
Result:= lpQT;
|
||||
|
Loading…
Reference in New Issue
Block a user