mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-13 10:59:06 +02:00
Qt: fixed regressions introduced by r31087 #4b57ac797b.
git-svn-id: trunk@31119 -
This commit is contained in:
parent
be73e8a304
commit
e3970c3176
@ -204,7 +204,7 @@ type
|
||||
{$IFDEF HASX11}
|
||||
function IsCurrentDesktop(AWidget: QWidgetH): Boolean;
|
||||
function X11Raise(AHandle: HWND): boolean;
|
||||
function X11GetActiveWindow: HWND;
|
||||
function X11GetActiveWindow: QWidgetH;
|
||||
function GetWindowManager: String;
|
||||
procedure SetSkipX11Taskbar(Widget: QWidgetH; const ASkipTaskBar: Boolean);
|
||||
{check if we are running under kde3 installation}
|
||||
|
@ -4959,7 +4959,7 @@ begin
|
||||
inherited Activate;
|
||||
{$IFDEF HASX11}
|
||||
if not QWidget_isModal(Widget) then
|
||||
X11Raise(QWidget_winId(Widget));
|
||||
X11Raise(QWidget_winId(Widget));
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
|
@ -4973,11 +4973,15 @@ begin
|
||||
end;
|
||||
|
||||
function TQtWidgetSet.GetForegroundWindow: HWND;
|
||||
var
|
||||
W: QWidgetH;
|
||||
begin
|
||||
Result:=0;
|
||||
{$IFDEF HASX11}
|
||||
Result:=X11GetActivewindow;
|
||||
W := X11GetActivewindow;
|
||||
{$ELSE}
|
||||
W := QApplication_activeWindow();
|
||||
{$ENDIF}
|
||||
Result := HwndFromWidgetH(W);
|
||||
end;
|
||||
|
||||
function TQtWidgetSet.SetForegroundWindow(HWnd: HWND): boolean;
|
||||
@ -4985,14 +4989,8 @@ begin
|
||||
Result := False;
|
||||
if HWND <> 0 then
|
||||
begin
|
||||
try
|
||||
Result := TQtWidget(HWND).IsActiveWindow;
|
||||
TQtWidget(HWnd).Activate;
|
||||
except
|
||||
{$IFDEF HASX11}
|
||||
Result:=X11Raise(HWnd);
|
||||
{$ENDIF}
|
||||
end;
|
||||
Result := TQtWidget(HWND).IsActiveWindow;
|
||||
TQtWidget(HWnd).Activate;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -110,7 +110,7 @@ begin
|
||||
@XClient)<>0;
|
||||
end;
|
||||
|
||||
function X11GetActivewindow: HWND;
|
||||
function X11GetActivewindow: QWidgetH;
|
||||
var
|
||||
Display: PDisplay;
|
||||
RootWin: TWindow;
|
||||
@ -119,29 +119,34 @@ var
|
||||
ActualTypeReturn: TAtom;
|
||||
ActualFormatReturn: LongInt;
|
||||
NItemsReturn, BytesAfterReturn: Cardinal;
|
||||
Ptr: PByte;
|
||||
Ptr: Pointer;
|
||||
Valid: Boolean;
|
||||
begin
|
||||
Result := nil;
|
||||
Display := QX11Info_display();
|
||||
|
||||
if Display = nil then
|
||||
exit;
|
||||
Ptr := nil;
|
||||
ScreenNum := QX11Info_appScreen();
|
||||
RootWin := XRootWindow(Display, ScreenNum);
|
||||
WMAtom := XInternAtom(Display,'_NET_ACTIVE_WINDOW', False);
|
||||
Valid:=XGetWindowProperty(Display, RootWin, WMAtom, 0, 1, False,
|
||||
Valid := XGetWindowProperty(Display, RootWin, WMAtom, 0, 1, False,
|
||||
AnyPropertyType, @ActualTypeReturn,
|
||||
@ActualFormatReturn, @NItemsReturn,
|
||||
@BytesAfterReturn, @Ptr)=0;
|
||||
if Valid then
|
||||
try
|
||||
if (ActualTypeReturn = None) or (ActualFormatReturn <> 32) or not Assigned(Ptr) then
|
||||
Valid := False;
|
||||
if Valid then Result := PCardinal(Ptr)^;
|
||||
finally
|
||||
if Assigned(Ptr) then
|
||||
@BytesAfterReturn, @Ptr) = Success;
|
||||
if Valid and (Ptr <> nil) and (ActualTypeReturn = XA_WINDOW) and
|
||||
(ActualFormatReturn = 32) then
|
||||
begin
|
||||
RootWin := TWindow(Ptr^);
|
||||
try
|
||||
Result := QWidget_find(RootWin);
|
||||
finally
|
||||
XFree(Ptr);
|
||||
end;
|
||||
end else
|
||||
if Assigned(Ptr) then
|
||||
XFree(Ptr);
|
||||
end;
|
||||
end;
|
||||
|
||||
function GetWindowManager: String;
|
||||
|
Loading…
Reference in New Issue
Block a user