aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--win32/PlatWin.cxx8
-rw-r--r--win32/PlatWin.h3
-rw-r--r--win32/ScintillaWin.cxx12
3 files changed, 9 insertions, 14 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:
diff --git a/win32/PlatWin.h b/win32/PlatWin.h
index f4f804b2e..3f1152522 100644
--- a/win32/PlatWin.h
+++ b/win32/PlatWin.h
@@ -31,6 +31,9 @@ inline HWND HwndFromWindow(const Window &w) noexcept {
return HwndFromWindowID(w.GetID());
}
+void *PointerFromWindow(HWND hWnd) noexcept;
+void SetWindowPointer(HWND hWnd, void *ptr) noexcept;
+
#if defined(USE_D2D)
extern bool LoadD2D();
extern ID2D1Factory *pD2DFactory;
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx
index b34e0d96c..8c5e2bc0d 100644
--- a/win32/ScintillaWin.cxx
+++ b/win32/ScintillaWin.cxx
@@ -143,14 +143,6 @@ namespace {
const TCHAR callClassName[] = TEXT("CallTip");
-void *PointerFromWindow(HWND hWnd) noexcept {
- return reinterpret_cast<void *>(::GetWindowLongPtr(hWnd, 0));
-}
-
-void SetWindowPointer(HWND hWnd, void *ptr) noexcept {
- ::SetWindowLongPtr(hWnd, 0, reinterpret_cast<LONG_PTR>(ptr));
-}
-
void SetWindowID(HWND hWnd, int identifier) noexcept {
::SetWindowLongPtr(hWnd, GWLP_ID, identifier);
}
@@ -3435,7 +3427,7 @@ LRESULT PASCAL ScintillaWin::CTWndProc(
}
} else {
if (iMessage == WM_NCDESTROY) {
- ::SetWindowLong(hWnd, 0, 0);
+ SetWindowPointer(hWnd, nullptr);
return ::DefWindowProc(hWnd, iMessage, wParam, lParam);
} else if (iMessage == WM_PAINT) {
PAINTSTRUCT ps;
@@ -3557,7 +3549,7 @@ LRESULT PASCAL ScintillaWin::SWndProc(
delete sci;
} catch (...) {
}
- ::SetWindowLong(hWnd, 0, 0);
+ SetWindowPointer(hWnd, nullptr);
return ::DefWindowProc(hWnd, iMessage, wParam, lParam);
} else {
return sci->WndProc(iMessage, wParam, lParam);