aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorNeil <nyamatongwe@gmail.com>2017-03-09 18:10:09 +1100
committerNeil <nyamatongwe@gmail.com>2017-03-09 18:10:09 +1100
commit050a6e3efd23b01a86e1c14a9b87e6ba5394db21 (patch)
treeaa1851a0c46016045ec17d52b7674e9b38a804ee
parent43cd19e34362bb637d4deb7677c835f00d82766b (diff)
downloadscintilla-mirror-050a6e3efd23b01a86e1c14a9b87e6ba5394db21.tar.gz
Drop support for Windows NT 4 by statically linking to system APIs that are
only available from Windows 2000 and later.
-rw-r--r--doc/ScintillaHistory.html3
-rw-r--r--win32/PlatWin.cxx75
-rw-r--r--win32/SciLexer.vcxproj2
-rw-r--r--win32/ScintillaWin.cxx24
-rw-r--r--win32/makefile2
-rw-r--r--win32/scintilla.mak2
6 files changed, 20 insertions, 88 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index e32880fcd..ac3eda073 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -527,6 +527,9 @@
Released 19 February 2017.
</li>
<li>
+ Support dropped for Windows NT 4.
+ </li>
+ <li>
Accessibility support may be queried with SCI_GETACCESSIBILITY.
On GTK+, accessibility may be disabled by calling SCI_SETACCESSIBILITY.
</li>
diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx
index c79db58a3..363ae42fd 100644
--- a/win32/PlatWin.cxx
+++ b/win32/PlatWin.cxx
@@ -42,10 +42,6 @@
#include "UniConversion.h"
#include "FontQuality.h"
-#ifndef IDC_HAND
-#define IDC_HAND MAKEINTRESOURCE(32649)
-#endif
-
#ifndef SPI_GETFONTSMOOTHINGCONTRAST
#define SPI_GETFONTSMOOTHINGCONTRAST 0x200C
#endif
@@ -60,22 +56,10 @@ static void SetWindowPointer(HWND hWnd, void *ptr) {
extern UINT CodePageFromCharSet(DWORD characterSet, UINT documentCodePage);
-// Declarations needed for functions dynamically loaded as not available on all Windows versions.
-typedef BOOL (WINAPI *AlphaBlendSig)(HDC, int, int, int, int, HDC, int, int, int, int, BLENDFUNCTION);
-typedef HMONITOR (WINAPI *MonitorFromPointSig)(POINT, DWORD);
-typedef HMONITOR (WINAPI *MonitorFromRectSig)(LPCRECT, DWORD);
-typedef BOOL (WINAPI *GetMonitorInfoSig)(HMONITOR, LPMONITORINFO);
-
static CRITICAL_SECTION crPlatformLock;
static HINSTANCE hinstPlatformRes = 0;
-static HMODULE hDLLImage = 0;
-static AlphaBlendSig AlphaBlendFn = 0;
-
static HMODULE hDLLUser32 = 0;
-static HMONITOR (WINAPI *MonitorFromPointFn)(POINT, DWORD) = 0;
-static HMONITOR (WINAPI *MonitorFromRectFn)(LPCRECT, DWORD) = 0;
-static BOOL (WINAPI *GetMonitorInfoFn)(HMONITOR, LPMONITORINFO) = 0;
static HCURSOR reverseArrowCursor = NULL;
@@ -753,13 +737,6 @@ static void AllFour(DWORD *pixels, int width, int height, int x, int y, DWORD va
pixels[(height-1-y)*width+width-1-x] = val;
}
-#ifndef AC_SRC_OVER
-#define AC_SRC_OVER 0x00
-#endif
-#ifndef AC_SRC_ALPHA
-#define AC_SRC_ALPHA 0x01
-#endif
-
static DWORD dwordFromBGRA(byte b, byte g, byte r, byte a) {
union {
byte pixVal[4];
@@ -775,7 +752,7 @@ static DWORD dwordFromBGRA(byte b, byte g, byte r, byte a) {
void SurfaceGDI::AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fill, int alphaFill,
ColourDesired outline, int alphaOutline, int /* flags*/ ) {
const RECT rcw = RectFromPRectangle(rc);
- if (AlphaBlendFn && rc.Width() > 0) {
+ if (rc.Width() > 0) {
HDC hMemDC = ::CreateCompatibleDC(hdc);
int width = static_cast<int>(rc.Width());
int height = static_cast<int>(rc.Height());
@@ -821,7 +798,7 @@ void SurfaceGDI::AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fil
BLENDFUNCTION merge = { AC_SRC_OVER, 0, 255, AC_SRC_ALPHA };
- AlphaBlendFn(hdc, rcw.left, rcw.top, width, height, hMemDC, 0, 0, width, height, merge);
+ AlphaBlend(hdc, rcw.left, rcw.top, width, height, hMemDC, 0, 0, width, height, merge);
SelectBitmap(hMemDC, hbmOld);
::DeleteObject(hbmMem);
@@ -834,7 +811,7 @@ void SurfaceGDI::AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fil
}
void SurfaceGDI::DrawRGBAImage(PRectangle rc, int width, int height, const unsigned char *pixelsImage) {
- if (AlphaBlendFn && rc.Width() > 0) {
+ if (rc.Width() > 0) {
HDC hMemDC = ::CreateCompatibleDC(hdc);
if (rc.Width() > width)
rc.left += static_cast<int>((rc.Width() - width) / 2);
@@ -864,7 +841,7 @@ void SurfaceGDI::DrawRGBAImage(PRectangle rc, int width, int height, const unsig
BLENDFUNCTION merge = { AC_SRC_OVER, 0, 255, AC_SRC_ALPHA };
- AlphaBlendFn(hdc, static_cast<int>(rc.left), static_cast<int>(rc.top),
+ AlphaBlend(hdc, static_cast<int>(rc.left), static_cast<int>(rc.top),
static_cast<int>(rc.Width()), static_cast<int>(rc.Height()), hMemDC, 0, 0, width, height, merge);
SelectBitmap(hMemDC, hbmOld);
@@ -1806,12 +1783,10 @@ void Window::SetPosition(PRectangle rc) {
}
static RECT RectFromMonitor(HMONITOR hMonitor) {
- if (GetMonitorInfoFn) {
- MONITORINFO mi = {0};
- mi.cbSize = sizeof(mi);
- if (GetMonitorInfoFn(hMonitor, &mi)) {
- return mi.rcWork;
- }
+ MONITORINFO mi = {0};
+ mi.cbSize = sizeof(mi);
+ if (GetMonitorInfo(hMonitor, &mi)) {
+ return mi.rcWork;
}
RECT rc = {0, 0, 0, 0};
if (::SystemParametersInfoA(SPI_GETWORKAREA, 0, &rc, 0) == 0) {
@@ -1832,11 +1807,8 @@ void Window::SetPositionRelative(PRectangle rc, Window w) {
RECT rcMonitor = RectFromPRectangle(rc);
- HMONITOR hMonitor = NULL;
- if (MonitorFromRectFn)
- hMonitor = MonitorFromRectFn(&rcMonitor, MONITOR_DEFAULTTONEAREST);
+ HMONITOR hMonitor = MonitorFromRect(&rcMonitor, MONITOR_DEFAULTTONEAREST);
// If hMonitor is NULL, that's just the main screen anyways.
- //::GetMonitorInfo(hMonitor, &mi);
RECT rcWork = RectFromMonitor(hMonitor);
if (rcWork.left < rcWork.right) {
@@ -1967,13 +1939,10 @@ void Window::SetTitle(const char *s) {
/* Returns rectangle of monitor pt is on, both rect and pt are in Window's
coordinates */
PRectangle Window::GetMonitorRect(Point pt) {
- // MonitorFromPoint and GetMonitorInfo are not available on Windows 95 and NT 4.
PRectangle rcPosition = GetPosition();
POINT ptDesktop = {static_cast<LONG>(pt.x + rcPosition.left),
static_cast<LONG>(pt.y + rcPosition.top)};
- HMONITOR hMonitor = NULL;
- if (MonitorFromPointFn)
- hMonitor = MonitorFromPointFn(ptDesktop, MONITOR_DEFAULTTONEAREST);
+ HMONITOR hMonitor = MonitorFromPoint(ptDesktop, MONITOR_DEFAULTTONEAREST);
RECT rcWork = RectFromMonitor(hMonitor);
if (rcWork.left < rcWork.right) {
@@ -3166,22 +3135,6 @@ int Platform::Clamp(int val, int minVal, int maxVal) {
void Platform_Initialise(void *hInstance) {
::InitializeCriticalSection(&crPlatformLock);
hinstPlatformRes = static_cast<HINSTANCE>(hInstance);
- // This may be called from DllMain, in which case the call to LoadLibrary
- // is bad because it can upset the DLL load order.
- if (!hDLLImage) {
- hDLLImage = ::LoadLibrary(TEXT("Msimg32"));
- }
- if (hDLLImage) {
- AlphaBlendFn = (AlphaBlendSig)::GetProcAddress(hDLLImage, "AlphaBlend");
- }
- if (!hDLLUser32) {
- hDLLUser32 = ::LoadLibrary(TEXT("User32"));
- }
- if (hDLLUser32) {
- MonitorFromPointFn = (MonitorFromPointSig)::GetProcAddress(hDLLUser32, "MonitorFromPoint");
- MonitorFromRectFn = (MonitorFromRectSig)::GetProcAddress(hDLLUser32, "MonitorFromRect");
- GetMonitorInfoFn = (GetMonitorInfoSig)::GetProcAddress(hDLLUser32, "GetMonitorInfoA");
- }
ListBoxX_Register();
}
@@ -3219,14 +3172,6 @@ void Platform_Finalise(bool fromDllMain) {
::DestroyCursor(reverseArrowCursor);
ListBoxX_Unregister();
::DeleteCriticalSection(&crPlatformLock);
- if (hDLLUser32) {
- FreeLibrary(hDLLUser32);
- hDLLUser32 = NULL;
- }
- if (hDLLImage) {
- FreeLibrary(hDLLImage);
- hDLLImage = NULL;
- }
}
#ifdef SCI_NAMESPACE
diff --git a/win32/SciLexer.vcxproj b/win32/SciLexer.vcxproj
index 68a9e8fcd..f64ae1af0 100644
--- a/win32/SciLexer.vcxproj
+++ b/win32/SciLexer.vcxproj
@@ -66,7 +66,7 @@
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
- <AdditionalDependencies>imm32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+ <AdditionalDependencies>imm32.lib;msimg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx
index 0907d7a14..574232697 100644
--- a/win32/ScintillaWin.cxx
+++ b/win32/ScintillaWin.cxx
@@ -158,7 +158,6 @@ class ScintillaWin; // Forward declaration for COM interface subobjects
typedef void VFunction(void);
-static HMODULE commctrl32 = 0;
/**
*/
@@ -243,7 +242,6 @@ class ScintillaWin :
bool capturedMouse;
bool trackedMouseLeave;
- TrackMouseEventSig TrackMouseEventFn;
SetCoalescableTimerSig SetCoalescableTimerFn;
unsigned int linesPerScroll; ///< Intellimouse support
@@ -418,7 +416,6 @@ ScintillaWin::ScintillaWin(HWND hwnd) {
capturedMouse = false;
trackedMouseLeave = false;
- TrackMouseEventFn = 0;
SetCoalescableTimerFn = 0;
linesPerScroll = 0;
@@ -472,21 +469,12 @@ void ScintillaWin::Initialise() {
// it just so this internal feature works.
hrOle = ::OleInitialize(NULL);
- // Find TrackMouseEvent which is available on Windows > 95
+ // Find SetCoalescableTimer which is only available from Windows 8+
HMODULE user32 = ::GetModuleHandle(TEXT("user32.dll"));
if (user32) {
- TrackMouseEventFn = (TrackMouseEventSig)::GetProcAddress(user32, "TrackMouseEvent");
SetCoalescableTimerFn = (SetCoalescableTimerSig)::GetProcAddress(user32, "SetCoalescableTimer");
}
- if (TrackMouseEventFn == NULL) {
- // Windows 95 has an emulation in comctl32.dll:_TrackMouseEvent
- if (!commctrl32)
- commctrl32 = ::LoadLibrary(TEXT("comctl32.dll"));
- if (commctrl32 != NULL) {
- TrackMouseEventFn = (TrackMouseEventSig)
- ::GetProcAddress(commctrl32, "_TrackMouseEvent");
- }
- }
+
for (TickReason tr = tickCaret; tr <= tickDwell; tr = static_cast<TickReason>(tr + 1)) {
timers[tr] = 0;
}
@@ -1844,13 +1832,13 @@ bool ScintillaWin::HaveMouseCapture() {
}
void ScintillaWin::SetTrackMouseLeaveEvent(bool on) {
- if (on && TrackMouseEventFn && !trackedMouseLeave) {
+ if (on && !trackedMouseLeave) {
TRACKMOUSEEVENT tme;
tme.cbSize = sizeof(tme);
tme.dwFlags = TME_LEAVE;
tme.hwndTrack = MainHWND();
tme.dwHoverTime = HOVER_DEFAULT; // Unused but triggers Dr. Memory if not initialized
- TrackMouseEventFn(&tme);
+ TrackMouseEvent(&tme);
}
trackedMouseLeave = on;
}
@@ -3441,10 +3429,6 @@ int Scintilla_RegisterClasses(void *hInstance) {
static int ResourcesRelease(bool fromDllMain) {
bool result = ScintillaWin::Unregister();
- if (commctrl32) {
- FreeLibrary(commctrl32);
- commctrl32 = NULL;
- }
Platform_Finalise(fromDllMain);
return result;
}
diff --git a/win32/makefile b/win32/makefile
index 216feae3b..22819c4f0 100644
--- a/win32/makefile
+++ b/win32/makefile
@@ -33,7 +33,7 @@ vpath %.h ../src ../include ../lexlib
vpath %.cxx ../src ../lexlib ../lexers
LDFLAGS=-shared -static -mwindows $(LDMINGW)
-LIBS=-lgdi32 -luser32 -limm32 -lole32 -luuid -loleaut32 $(LIBSMINGW)
+LIBS=-lgdi32 -luser32 -limm32 -lole32 -luuid -loleaut32 -lmsimg32 $(LIBSMINGW)
# Add -MMD to get dependencies
INCLUDEDIRS=-I ../include -I ../src -I../lexlib
diff --git a/win32/scintilla.mak b/win32/scintilla.mak
index a44b99ea4..227578f81 100644
--- a/win32/scintilla.mak
+++ b/win32/scintilla.mak
@@ -31,7 +31,7 @@ CXXNDEBUG=-O1 -MT -DNDEBUG -GL
NAME=-Fo
LDFLAGS=-OPT:REF -LTCG -IGNORE:4197 -DEBUG $(XP_LINK)
LDDEBUG=
-LIBS=KERNEL32.lib USER32.lib GDI32.lib IMM32.lib OLE32.LIB OLEAUT32.LIB
+LIBS=KERNEL32.lib USER32.lib GDI32.lib IMM32.lib OLE32.lib OLEAUT32.lib MSIMG32.lib
NOLOGO=-nologo
!IFDEF QUIET