projects
/
u
/
mdw
/
putty
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Plink documentation cribs heavily from PSCP documentation, film at 11.
[u/mdw/putty]
/
sizetip.c
diff --git
a/sizetip.c
b/sizetip.c
index
90c0573
..
8a37b47
100644
(file)
--- a/
sizetip.c
+++ b/
sizetip.c
@@
-2,16
+2,19
@@
#include <winreg.h>
#include <tchar.h>
#include <stdio.h>
#include <winreg.h>
#include <tchar.h>
#include <stdio.h>
+#include <stdlib.h>
#include "putty.h"
#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) {
{
switch (nMsg) {
@@
-40,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);
Rectangle(hdc, cr.left, cr.top, cr.right, cr.bottom);
wtlen = GetWindowTextLength(hWnd);
- wt = (LPTSTR)malloc((wtlen+1)*sizeof(TCHAR));
+ wt = (LPTSTR)
s
malloc((wtlen+1)*sizeof(TCHAR));
GetWindowText(hWnd, wt, wtlen+1);
SetTextColor(hdc, tip_text);
GetWindowText(hWnd, wt, wtlen+1);
SetTextColor(hdc, tip_text);
@@
-48,7
+51,7
@@
LRESULT CALLBACK SizeTipWndProc(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lPar
TextOut(hdc, cr.left+3, cr.top+3, wt, wtlen);
TextOut(hdc, cr.left+3, cr.top+3, wt, wtlen);
- free(wt);
+
s
free(wt);
SelectObject(hdc, holdbr);
DeleteObject(hbr);
SelectObject(hdc, holdbr);
DeleteObject(hbr);
@@
-85,12
+88,12
@@
LRESULT CALLBACK SizeTipWndProc(HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lPar
return DefWindowProc(hWnd, nMsg, wParam, lParam);
}
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)
{
void UpdateSizeTip(HWND src, int cx, int cy)
{
- TCHAR str[
16
];
+ TCHAR str[
32
];
if (!tip_enabled) return;
if (!tip_enabled) return;
@@
-105,7
+108,7
@@
void UpdateSizeTip(HWND src, int cx, int cy)
wc.lpfnWndProc = SizeTipWndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.lpfnWndProc = SizeTipWndProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
- wc.hInstance =
putty_
inst;
+ wc.hInstance =
h
inst;
wc.hIcon = NULL;
wc.hCursor = NULL;
wc.hbrBackground = NULL;
wc.hIcon = NULL;
wc.hCursor = NULL;
wc.hbrBackground = NULL;
@@
-136,8
+139,7
@@
void UpdateSizeTip(HWND src, int cx, int cy)
/* Generate the tip text */
/* Generate the tip text */
- _sntprintf(str, 16, "%dx%d", cx, cy);
-
+ sprintf(str, "%dx%d", cx, cy);
if (!tip_wnd) {
HDC hdc;
if (!tip_wnd) {
HDC hdc;
@@
-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,
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,
h
inst, NULL);
ShowWindow(tip_wnd, SW_SHOWNOACTIVATE);
ShowWindow(tip_wnd, SW_SHOWNOACTIVATE);