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:
zeljko 2009-10-11 16:08:58 +00:00
parent 35755d6e3d
commit 1f47e04ef2
2 changed files with 27 additions and 0 deletions

View File

@ -6881,6 +6881,8 @@ begin
end else
SendEventToParent;
end;
else
QEvent_ignore(Event);
end;
end;
end;

View File

@ -1863,8 +1863,23 @@ function TQtWidgetSet.GetCapture: HWND;
var
w: QWidgetH;
Widget: TQtWidget;
{$IFDEF MSWINDOWS}
AWin: HWND;
{$ENDIF}
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();
{$ENDIF}
if w <> nil then
begin
// 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);
Result := w <> nil;
if Result then
begin
{$IFDEF MSWINDOWS}
windows.ReleaseCapture;
{$ELSE}
w.releaseMouse();
{$ENDIF}
end;
{$ifdef VerboseQtWinAPI}
WriteLn('[WinAPI ReleaseCapture] Capture = ', THandle(w));
{$endif}
@ -4387,7 +4408,11 @@ begin
if Result <> 0 then
ReleaseCapture;
if AHandle <> 0 then
{$IFDEF MSWINDOWS}
Windows.SetCapture(AHandle);
{$ELSE}
TQtWidget(AHandle).grabMouse();
{$ENDIF}
{$ifdef VerboseQtWinAPI}
WriteLn('[WinAPI SetCapture] Capture = ', Result, ' New capture = ', AHandle);
{$endif}