X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=sizetip.c;h=8a37b4787cf85bdc0bbc52da38555d34acf03a5e;hb=9b15a8010102fc83dcd7eef78014a65f11619d63;hp=b34b4f114fd36a390ccd1b2ddbb48792290020af;hpb=8446532e4ad4e8e68eb82bf86a36ba1f5a38d78f;p=PuTTY.git diff --git a/sizetip.c b/sizetip.c index b34b4f11..8a37b478 100644 --- a/sizetip.c +++ b/sizetip.c @@ -5,14 +5,16 @@ #include #include "putty.h" +#include "winstuff.h" -ATOM tip_class = 0; +static ATOM tip_class = 0; -HFONT tip_font; -COLORREF tip_bg; -COLORREF tip_text; +static HFONT tip_font; +static COLORREF tip_bg; +static COLORREF tip_text; -LRESULT CALLBACK SizeTipWndProc(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam) +static LRESULT CALLBACK SizeTipWndProc(HWND hWnd, UINT nMsg, + WPARAM wParam, LPARAM lParam) { switch (nMsg) { @@ -41,7 +43,7 @@ LRESULT CALLBACK SizeTipWndProc(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lPar Rectangle(hdc, cr.left, cr.top, cr.right, cr.bottom); wtlen = GetWindowTextLength(hWnd); - wt = (LPTSTR)malloc((wtlen+1)*sizeof(TCHAR)); + wt = (LPTSTR)smalloc((wtlen+1)*sizeof(TCHAR)); GetWindowText(hWnd, wt, wtlen+1); SetTextColor(hdc, tip_text); @@ -49,7 +51,7 @@ LRESULT CALLBACK SizeTipWndProc(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lPar TextOut(hdc, cr.left+3, cr.top+3, wt, wtlen); - free(wt); + sfree(wt); SelectObject(hdc, holdbr); DeleteObject(hbr); @@ -86,8 +88,8 @@ LRESULT CALLBACK SizeTipWndProc(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lPar return DefWindowProc(hWnd, nMsg, wParam, lParam); } -HWND tip_wnd = NULL; -int tip_enabled = 0; +static HWND tip_wnd = NULL; +static int tip_enabled = 0; void UpdateSizeTip(HWND src, int cx, int cy) { @@ -106,7 +108,7 @@ void UpdateSizeTip(HWND src, int cx, int cy) wc.lpfnWndProc = SizeTipWndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; - wc.hInstance = putty_inst; + wc.hInstance = hinst; wc.hIcon = NULL; wc.hCursor = NULL; wc.hbrBackground = NULL; @@ -163,7 +165,7 @@ void UpdateSizeTip(HWND src, int cx, int cy) tip_wnd = CreateWindowEx(WS_EX_TOOLWINDOW|WS_EX_TOPMOST, MAKEINTRESOURCE(tip_class), str, WS_POPUP, ix, iy, sz.cx, sz.cy, - NULL, NULL, putty_inst, NULL); + NULL, NULL, hinst, NULL); ShowWindow(tip_wnd, SW_SHOWNOACTIVATE);