diff options
author | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2008-07-23 13:14:58 +0000 |
---|---|---|
committer | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2008-07-23 13:14:58 +0000 |
commit | cd145b199b820f0676bc9ee9edf7502d5ddc38c9 (patch) | |
tree | 932bb7d3a4048dfae77f13a389f59ab2b3e81dd6 /src | |
parent | 798eec0a0b98c58ddbd9ace0e9554a21a12f22e0 (diff) | |
download | fpGUI-cd145b199b820f0676bc9ee9edf7502d5ddc38c9.tar.xz |
Applied patch from Valdimir fixing app crash when mouse wheel is scrolled in application console window.
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/gdi/gfx_gdi.pas | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/corelib/gdi/gfx_gdi.pas b/src/corelib/gdi/gfx_gdi.pas index 2dc6dd1d..313e154e 100644 --- a/src/corelib/gdi/gfx_gdi.pas +++ b/src/corelib/gdi/gfx_gdi.pas @@ -267,9 +267,14 @@ begin end; function GetMyWidgetFromHandle(wh: TfpgWinHandle): TfpgWidget; +var + wg: TfpgWidget; begin - if (wh <> 0) and (MainInstance = longword(GetWindowLong(wh, GWL_HINSTANCE))) then - Result := TfpgWidget(Windows.GetWindowLong(wh, GWL_USERDATA)) + wg := TfpgWidget(Windows.GetWindowLong(wh, GWL_USERDATA)); + if (wh <> 0) and (MainInstance = longword(GetWindowLong(wh, GWL_HINSTANCE))) + and (wg is TfpgWidget) + then + Result := wg else Result := nil; end; @@ -555,7 +560,7 @@ begin w := TfpgWindowImpl(Windows.GetWindowLong(hwnd, GWL_USERDATA)); Result := 0; - if not Assigned(w) then + if not (w is TfpgWindowImpl) then begin {$IFDEF DEBUG} writeln('fpGFX/GDI: Unable to detect Window - using DefWindowProc'); {$ENDIF} Result := Windows.DefWindowProc(hwnd, uMsg, wParam, lParam); @@ -812,14 +817,14 @@ begin write(w.ClassName + ': '); writeln('WM_MOUSEWHEEL: wp=',IntToHex(wparam,8), ' lp=',IntToHex(lparam,8)); {$ENDIF} - pt.x := LoWord(lparam); - pt.y := HiWord(lparam); + pt.x := GET_X_LPARAM(lParam); + pt.y := GET_Y_LPARAM(lParam); mw := nil; h := WindowFromPoint(pt); if h > 0 then // get window mouse is hovering over mw := TfpgWindowImpl(Windows.GetWindowLong(h, GWL_USERDATA)); - if mw <> nil then + if (mw is TfpgWindowImpl) then begin msgp.mouse.x := pt.x; msgp.mouse.y := pt.y; |