mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-06 05:06:28 +02:00
Qt: rework of getCapture(), setCapture() under win32, now we use native windows calls instead of buggy grabMouse() qt proc. Fixes #14779.
git-svn-id: trunk@22096 -
This commit is contained in:
parent
35755d6e3d
commit
1f47e04ef2
@ -6881,6 +6881,8 @@ begin
|
|||||||
end else
|
end else
|
||||||
SendEventToParent;
|
SendEventToParent;
|
||||||
end;
|
end;
|
||||||
|
else
|
||||||
|
QEvent_ignore(Event);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -1863,8 +1863,23 @@ function TQtWidgetSet.GetCapture: HWND;
|
|||||||
var
|
var
|
||||||
w: QWidgetH;
|
w: QWidgetH;
|
||||||
Widget: TQtWidget;
|
Widget: TQtWidget;
|
||||||
|
{$IFDEF MSWINDOWS}
|
||||||
|
AWin: HWND;
|
||||||
|
{$ENDIF}
|
||||||
begin
|
begin
|
||||||
|
{$IFDEF MSWINDOWS}
|
||||||
|
AWin := Windows.GetCapture;
|
||||||
|
if AWin <> 0 then
|
||||||
|
w := QWidget_find(AWin)
|
||||||
|
else
|
||||||
|
w := nil;
|
||||||
|
|
||||||
|
if (w = nil) and (QApplication_mouseButtons() > 0) then
|
||||||
|
w := QApplication_focusWidget();
|
||||||
|
{$ELSE}
|
||||||
w := QWidget_mouseGrabber();
|
w := QWidget_mouseGrabber();
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
if w <> nil then
|
if w <> nil then
|
||||||
begin
|
begin
|
||||||
// Capture widget can be child of complex control. In any case we should return TQtWidget as result.
|
// Capture widget can be child of complex control. In any case we should return TQtWidget as result.
|
||||||
@ -3991,7 +4006,13 @@ begin
|
|||||||
w := TQtWidget(GetCapture);
|
w := TQtWidget(GetCapture);
|
||||||
Result := w <> nil;
|
Result := w <> nil;
|
||||||
if Result then
|
if Result then
|
||||||
|
begin
|
||||||
|
{$IFDEF MSWINDOWS}
|
||||||
|
windows.ReleaseCapture;
|
||||||
|
{$ELSE}
|
||||||
w.releaseMouse();
|
w.releaseMouse();
|
||||||
|
{$ENDIF}
|
||||||
|
end;
|
||||||
{$ifdef VerboseQtWinAPI}
|
{$ifdef VerboseQtWinAPI}
|
||||||
WriteLn('[WinAPI ReleaseCapture] Capture = ', THandle(w));
|
WriteLn('[WinAPI ReleaseCapture] Capture = ', THandle(w));
|
||||||
{$endif}
|
{$endif}
|
||||||
@ -4387,7 +4408,11 @@ begin
|
|||||||
if Result <> 0 then
|
if Result <> 0 then
|
||||||
ReleaseCapture;
|
ReleaseCapture;
|
||||||
if AHandle <> 0 then
|
if AHandle <> 0 then
|
||||||
|
{$IFDEF MSWINDOWS}
|
||||||
|
Windows.SetCapture(AHandle);
|
||||||
|
{$ELSE}
|
||||||
TQtWidget(AHandle).grabMouse();
|
TQtWidget(AHandle).grabMouse();
|
||||||
|
{$ENDIF}
|
||||||
{$ifdef VerboseQtWinAPI}
|
{$ifdef VerboseQtWinAPI}
|
||||||
WriteLn('[WinAPI SetCapture] Capture = ', Result, ' New capture = ', AHandle);
|
WriteLn('[WinAPI SetCapture] Capture = ', Result, ' New capture = ', AHandle);
|
||||||
{$endif}
|
{$endif}
|
||||||
|
Loading…
Reference in New Issue
Block a user