aboutsummaryrefslogtreecommitdiffhomepage
path: root/win32/PlatWin.cxx
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2020-04-05 08:43:27 +1000
committerNeil <nyamatongwe@gmail.com>2020-04-05 08:43:27 +1000
commitbf9adaf7f82732929f00336421536812805cdf8c (patch)
tree7f11a4a9808538d3bfe48b9b443b00de64756d98 /win32/PlatWin.cxx
parentf2878cb7710c1b5efda08cb0d5ca77acc0877339 (diff)
downloadscintilla-mirror-bf9adaf7f82732929f00336421536812805cdf8c.tar.gz
Backport: Feature [feature-requests:1345] Use more typesafe code to clear window pointers,
share implementation of window pointers between files, use GetWindowStyle. Backport of changeset 8110:33f16ac2c3ca.
Diffstat (limited to 'win32/PlatWin.cxx')
-rw-r--r--win32/PlatWin.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index 53c6ec13c..1df56e58c 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -244,8 +244,6 @@ HFONT FormatAndMetrics::HFont() {
#define CLEARTYPE_QUALITY 5
#endif
-namespace {
-
void *PointerFromWindow(HWND hWnd) noexcept {
return reinterpret_cast<void *>(::GetWindowLongPtr(hWnd, 0));
}
@@ -254,6 +252,8 @@ void SetWindowPointer(HWND hWnd, void *ptr) noexcept {
::SetWindowLongPtr(hWnd, 0, reinterpret_cast<LONG_PTR>(ptr));
}
+namespace {
+
HINSTANCE hinstPlatformRes {};
HCURSOR reverseArrowCursor {};
@@ -1752,7 +1752,7 @@ static RECT RectFromMonitor(HMONITOR hMonitor) noexcept {
}
void Window::SetPositionRelative(PRectangle rc, const Window *relativeTo) {
- const LONG style = ::GetWindowLong(HwndFromWindowID(wid), GWL_STYLE);
+ const DWORD style = GetWindowStyle(HwndFromWindowID(wid));
if (style & WS_POPUP) {
POINT ptOther = {0, 0};
::ClientToScreen(HwndFromWindow(*relativeTo), &ptOther);
@@ -2671,7 +2671,7 @@ LRESULT ListBoxX::WndProc(HWND hWnd, UINT iMessage, WPARAM wParam, LPARAM lParam
case WM_DESTROY:
lb = 0;
- ::SetWindowLong(hWnd, 0, 0);
+ SetWindowPointer(hWnd, nullptr);
return ::DefWindowProc(hWnd, iMessage, wParam, lParam);
case WM_ERASEBKGND: