forked from aniani/vim
patch 8.2.4175: MS-Windows: runtime check for multi-line balloon is obsolete
Problem: MS-Windows: runtime check for multi-line balloon is obsolete. Solution: Remove the obsolete code. (Ken Takata, closes #9592)
This commit is contained in:
@@ -5104,8 +5104,7 @@ f_has(typval_T *argvars, typval_T *rettv)
|
|||||||
#endif
|
#endif
|
||||||
},
|
},
|
||||||
{"balloon_multiline",
|
{"balloon_multiline",
|
||||||
#if defined(FEAT_BEVAL_GUI) && !defined(FEAT_GUI_MSWIN)
|
#ifdef FEAT_BEVAL_GUI
|
||||||
// MS-Windows requires runtime check, see below
|
|
||||||
1
|
1
|
||||||
#else
|
#else
|
||||||
0
|
0
|
||||||
@@ -6079,10 +6078,6 @@ f_has(typval_T *argvars, typval_T *rettv)
|
|||||||
{
|
{
|
||||||
// intentionally empty
|
// intentionally empty
|
||||||
}
|
}
|
||||||
#if defined(FEAT_BEVAL) && defined(FEAT_GUI_MSWIN)
|
|
||||||
else if (STRICMP(name, "balloon_multiline") == 0)
|
|
||||||
n = multiline_balloon_available();
|
|
||||||
#endif
|
|
||||||
#ifdef VIMDLL
|
#ifdef VIMDLL
|
||||||
else if (STRICMP(name, "filterpipe") == 0)
|
else if (STRICMP(name, "filterpipe") == 0)
|
||||||
n = gui.in_use || gui.starting;
|
n = gui.in_use || gui.starting;
|
||||||
@@ -6261,9 +6256,6 @@ f_has(typval_T *argvars, typval_T *rettv)
|
|||||||
dynamic_feature(char_u *feature)
|
dynamic_feature(char_u *feature)
|
||||||
{
|
{
|
||||||
return (feature == NULL
|
return (feature == NULL
|
||||||
#if defined(FEAT_BEVAL) && defined(FEAT_GUI_MSWIN)
|
|
||||||
|| STRICMP(feature, "balloon_multiline") == 0
|
|
||||||
#endif
|
|
||||||
#if defined(FEAT_GUI) && defined(FEAT_BROWSE)
|
#if defined(FEAT_GUI) && defined(FEAT_BROWSE)
|
||||||
|| (STRICMP(feature, "browse") == 0 && !gui.in_use)
|
|| (STRICMP(feature, "browse") == 0 && !gui.in_use)
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
134
src/gui_w32.c
134
src/gui_w32.c
@@ -4035,42 +4035,6 @@ static UINT_PTR BevalTimerId = 0;
|
|||||||
static DWORD LastActivity = 0;
|
static DWORD LastActivity = 0;
|
||||||
|
|
||||||
|
|
||||||
// cproto fails on missing include files
|
|
||||||
# ifndef PROTO
|
|
||||||
|
|
||||||
/*
|
|
||||||
* excerpts from headers since this may not be presented
|
|
||||||
* in the extremely old compilers
|
|
||||||
*/
|
|
||||||
# include <pshpack1.h>
|
|
||||||
|
|
||||||
# endif
|
|
||||||
|
|
||||||
typedef struct _DllVersionInfo
|
|
||||||
{
|
|
||||||
DWORD cbSize;
|
|
||||||
DWORD dwMajorVersion;
|
|
||||||
DWORD dwMinorVersion;
|
|
||||||
DWORD dwBuildNumber;
|
|
||||||
DWORD dwPlatformID;
|
|
||||||
} DLLVERSIONINFO;
|
|
||||||
|
|
||||||
# ifndef PROTO
|
|
||||||
# include <poppack.h>
|
|
||||||
# endif
|
|
||||||
|
|
||||||
typedef struct tagTOOLINFOA_NEW
|
|
||||||
{
|
|
||||||
UINT cbSize;
|
|
||||||
UINT uFlags;
|
|
||||||
HWND hwnd;
|
|
||||||
UINT_PTR uId;
|
|
||||||
RECT rect;
|
|
||||||
HINSTANCE hinst;
|
|
||||||
LPSTR lpszText;
|
|
||||||
LPARAM lParam;
|
|
||||||
} TOOLINFO_NEW;
|
|
||||||
|
|
||||||
typedef struct tagNMTTDISPINFO_NEW
|
typedef struct tagNMTTDISPINFO_NEW
|
||||||
{
|
{
|
||||||
NMHDR hdr;
|
NMHDR hdr;
|
||||||
@@ -4105,7 +4069,6 @@ typedef struct tagNMTTDISPINFOW_NEW
|
|||||||
} NMTTDISPINFOW_NEW;
|
} NMTTDISPINFOW_NEW;
|
||||||
|
|
||||||
|
|
||||||
typedef HRESULT (WINAPI* DLLGETVERSIONPROC)(DLLVERSIONINFO *);
|
|
||||||
# ifndef TTM_SETMAXTIPWIDTH
|
# ifndef TTM_SETMAXTIPWIDTH
|
||||||
# define TTM_SETMAXTIPWIDTH (WM_USER+24)
|
# define TTM_SETMAXTIPWIDTH (WM_USER+24)
|
||||||
# endif
|
# endif
|
||||||
@@ -8497,89 +8460,13 @@ gui_mch_destroy_sign(void *sign)
|
|||||||
* 5) WM_NOTIFY:TTN_POP destroys created tooltip
|
* 5) WM_NOTIFY:TTN_POP destroys created tooltip
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
* determine whether installed Common Controls support multiline tooltips
|
|
||||||
* (i.e. their version is >= 4.70
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
multiline_balloon_available(void)
|
|
||||||
{
|
|
||||||
HINSTANCE hDll;
|
|
||||||
static char comctl_dll[] = "comctl32.dll";
|
|
||||||
static int multiline_tip = MAYBE;
|
|
||||||
|
|
||||||
if (multiline_tip != MAYBE)
|
|
||||||
return multiline_tip;
|
|
||||||
|
|
||||||
hDll = GetModuleHandle(comctl_dll);
|
|
||||||
if (hDll != NULL)
|
|
||||||
{
|
|
||||||
DLLGETVERSIONPROC pGetVer;
|
|
||||||
pGetVer = (DLLGETVERSIONPROC)GetProcAddress(hDll, "DllGetVersion");
|
|
||||||
|
|
||||||
if (pGetVer != NULL)
|
|
||||||
{
|
|
||||||
DLLVERSIONINFO dvi;
|
|
||||||
HRESULT hr;
|
|
||||||
|
|
||||||
ZeroMemory(&dvi, sizeof(dvi));
|
|
||||||
dvi.cbSize = sizeof(dvi);
|
|
||||||
|
|
||||||
hr = (*pGetVer)(&dvi);
|
|
||||||
|
|
||||||
if (SUCCEEDED(hr)
|
|
||||||
&& (dvi.dwMajorVersion > 4
|
|
||||||
|| (dvi.dwMajorVersion == 4
|
|
||||||
&& dvi.dwMinorVersion >= 70)))
|
|
||||||
{
|
|
||||||
multiline_tip = TRUE;
|
|
||||||
return multiline_tip;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// there is chance we have ancient CommCtl 4.70
|
|
||||||
// which doesn't export DllGetVersion
|
|
||||||
DWORD dwHandle = 0;
|
|
||||||
DWORD len = GetFileVersionInfoSize(comctl_dll, &dwHandle);
|
|
||||||
if (len > 0)
|
|
||||||
{
|
|
||||||
VS_FIXEDFILEINFO *ver;
|
|
||||||
UINT vlen = 0;
|
|
||||||
void *data = alloc(len);
|
|
||||||
|
|
||||||
if ((data != NULL
|
|
||||||
&& GetFileVersionInfo(comctl_dll, 0, len, data)
|
|
||||||
&& VerQueryValue(data, "\\", (void **)&ver, &vlen)
|
|
||||||
&& vlen
|
|
||||||
&& HIWORD(ver->dwFileVersionMS) > 4)
|
|
||||||
|| ((HIWORD(ver->dwFileVersionMS) == 4
|
|
||||||
&& LOWORD(ver->dwFileVersionMS) >= 70)))
|
|
||||||
{
|
|
||||||
vim_free(data);
|
|
||||||
multiline_tip = TRUE;
|
|
||||||
return multiline_tip;
|
|
||||||
}
|
|
||||||
vim_free(data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
multiline_tip = FALSE;
|
|
||||||
return multiline_tip;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
make_tooltip(BalloonEval *beval, char *text, POINT pt)
|
make_tooltip(BalloonEval *beval, char *text, POINT pt)
|
||||||
{
|
{
|
||||||
TOOLINFOW *pti;
|
TOOLINFOW_NEW *pti;
|
||||||
int ToolInfoSize;
|
RECT rect;
|
||||||
|
|
||||||
if (multiline_balloon_available())
|
pti = alloc(sizeof(TOOLINFOW_NEW));
|
||||||
ToolInfoSize = sizeof(TOOLINFOW_NEW);
|
|
||||||
else
|
|
||||||
ToolInfoSize = sizeof(TOOLINFOW);
|
|
||||||
|
|
||||||
pti = alloc(ToolInfoSize);
|
|
||||||
if (pti == NULL)
|
if (pti == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -8591,30 +8478,19 @@ make_tooltip(BalloonEval *beval, char *text, POINT pt)
|
|||||||
SetWindowPos(beval->balloon, HWND_TOPMOST, 0, 0, 0, 0,
|
SetWindowPos(beval->balloon, HWND_TOPMOST, 0, 0, 0, 0,
|
||||||
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
|
SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
|
||||||
|
|
||||||
pti->cbSize = ToolInfoSize;
|
pti->cbSize = sizeof(TOOLINFOW_NEW);
|
||||||
pti->uFlags = TTF_SUBCLASS;
|
pti->uFlags = TTF_SUBCLASS;
|
||||||
pti->hwnd = beval->target;
|
pti->hwnd = beval->target;
|
||||||
pti->hinst = 0; // Don't use string resources
|
pti->hinst = 0; // Don't use string resources
|
||||||
pti->uId = ID_BEVAL_TOOLTIP;
|
pti->uId = ID_BEVAL_TOOLTIP;
|
||||||
|
|
||||||
if (multiline_balloon_available())
|
|
||||||
{
|
|
||||||
RECT rect;
|
|
||||||
TOOLINFOW_NEW *ptin = (TOOLINFOW_NEW *)pti;
|
|
||||||
pti->lpszText = LPSTR_TEXTCALLBACKW;
|
pti->lpszText = LPSTR_TEXTCALLBACKW;
|
||||||
beval->tofree = enc_to_utf16((char_u*)text, NULL);
|
beval->tofree = enc_to_utf16((char_u*)text, NULL);
|
||||||
ptin->lParam = (LPARAM)beval->tofree;
|
pti->lParam = (LPARAM)beval->tofree;
|
||||||
// switch multiline tooltips on
|
// switch multiline tooltips on
|
||||||
if (GetClientRect(s_textArea, &rect))
|
if (GetClientRect(s_textArea, &rect))
|
||||||
SendMessageW(beval->balloon, TTM_SETMAXTIPWIDTH, 0,
|
SendMessageW(beval->balloon, TTM_SETMAXTIPWIDTH, 0,
|
||||||
(LPARAM)rect.right);
|
(LPARAM)rect.right);
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// do this old way
|
|
||||||
beval->tofree = enc_to_utf16((char_u*)text, NULL);
|
|
||||||
pti->lpszText = (LPWSTR)beval->tofree;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Limit ballooneval bounding rect to CursorPos neighbourhood.
|
// Limit ballooneval bounding rect to CursorPos neighbourhood.
|
||||||
pti->rect.left = pt.x - 3;
|
pti->rect.left = pt.x - 3;
|
||||||
|
|||||||
@@ -90,7 +90,6 @@ void gui_mch_set_foreground(void);
|
|||||||
void gui_mch_drawsign(int row, int col, int typenr);
|
void gui_mch_drawsign(int row, int col, int typenr);
|
||||||
void *gui_mch_register_sign(char_u *signfile);
|
void *gui_mch_register_sign(char_u *signfile);
|
||||||
void gui_mch_destroy_sign(void *sign);
|
void gui_mch_destroy_sign(void *sign);
|
||||||
int multiline_balloon_available(void);
|
|
||||||
void gui_mch_disable_beval_area(BalloonEval *beval);
|
void gui_mch_disable_beval_area(BalloonEval *beval);
|
||||||
void gui_mch_enable_beval_area(BalloonEval *beval);
|
void gui_mch_enable_beval_area(BalloonEval *beval);
|
||||||
void gui_mch_post_balloon(BalloonEval *beval, char_u *mesg);
|
void gui_mch_post_balloon(BalloonEval *beval, char_u *mesg);
|
||||||
|
|||||||
@@ -750,6 +750,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
4175,
|
||||||
/**/
|
/**/
|
||||||
4174,
|
4174,
|
||||||
/**/
|
/**/
|
||||||
|
|||||||
Reference in New Issue
Block a user