lasttime = thistime;
}
+static void show_mouseptr(int show) {
+ static int cursor_visible = 1;
+ if (!cfg.hide_mouseptr) /* override if this feature disabled */
+ show = 1;
+ if (cursor_visible && !show)
+ ShowCursor(FALSE);
+ else if (!cursor_visible && show)
+ ShowCursor(TRUE);
+ cursor_visible = show;
+}
+
static LRESULT CALLBACK WndProc (HWND hwnd, UINT message,
WPARAM wParam, LPARAM lParam) {
HDC hdc;
{
time_t now;
time(&now);
- if (now-last_movement > cfg.ping_interval * 60 - 10)
+ if (now-last_movement > cfg.ping_interval)
{
back->special(TS_PING);
last_movement = now;
case WM_CREATE:
break;
case WM_CLOSE:
+ show_mouseptr(1);
if (!cfg.warn_on_close || session_closed ||
MessageBox(hwnd, "Are you sure you want to close this session?",
"PuTTY Exit Confirmation",
DestroyWindow(hwnd);
return 0;
case WM_DESTROY:
+ show_mouseptr(1);
PostQuitMessage (0);
return 0;
case WM_SYSCOMMAND:
#define TO_CHR_Y(y) (((y)<0 ? (y)-font_height+1: (y)) / font_height)
case WM_LBUTTONDOWN:
+ show_mouseptr(1);
click (MB_SELECT, TO_CHR_X(X_POS(lParam)),
TO_CHR_Y(Y_POS(lParam)));
SetCapture(hwnd);
return 0;
case WM_LBUTTONUP:
+ show_mouseptr(1);
term_mouse (MB_SELECT, MA_RELEASE, TO_CHR_X(X_POS(lParam)),
TO_CHR_Y(Y_POS(lParam)));
ReleaseCapture();
return 0;
case WM_MBUTTONDOWN:
+ show_mouseptr(1);
SetCapture(hwnd);
click (cfg.mouse_is_xterm ? MB_PASTE : MB_EXTEND,
TO_CHR_X(X_POS(lParam)),
TO_CHR_Y(Y_POS(lParam)));
return 0;
case WM_MBUTTONUP:
+ show_mouseptr(1);
term_mouse (cfg.mouse_is_xterm ? MB_PASTE : MB_EXTEND,
MA_RELEASE, TO_CHR_X(X_POS(lParam)),
TO_CHR_Y(Y_POS(lParam)));
ReleaseCapture();
return 0;
case WM_RBUTTONDOWN:
+ show_mouseptr(1);
SetCapture(hwnd);
click (cfg.mouse_is_xterm ? MB_EXTEND : MB_PASTE,
TO_CHR_X(X_POS(lParam)),
TO_CHR_Y(Y_POS(lParam)));
return 0;
case WM_RBUTTONUP:
+ show_mouseptr(1);
term_mouse (cfg.mouse_is_xterm ? MB_EXTEND : MB_PASTE,
MA_RELEASE, TO_CHR_X(X_POS(lParam)),
TO_CHR_Y(Y_POS(lParam)));
ReleaseCapture();
return 0;
case WM_MOUSEMOVE:
+ show_mouseptr(1);
/*
* Add the mouse position and message time to the random
* number noise.
term_update();
break;
case WM_KILLFOCUS:
+ show_mouseptr(1);
has_focus = FALSE;
DestroyCaret();
term_out();
if (len == -1)
return DefWindowProc (hwnd, message, wParam, lParam);
ldisc->send (buf, len);
+
+ if (len > 0)
+ show_mouseptr(0);
}
}
return 0;
x *= fnt_width;
y *= font_height;
- if (attr & ATTR_ACTCURS) {
+ if ((attr & ATTR_ACTCURS) && cfg.cursor_type == 0) {
attr &= (bold_mode == BOLD_COLOURS ? 0x300200 : 0x300300);
attr ^= ATTR_CUR_XOR;
}
oldpen = SelectObject (hdc, oldpen);
DeleteObject (oldpen);
}
- if (attr & ATTR_PASCURS) {
+ if ((attr & ATTR_PASCURS) && cfg.cursor_type == 0) {
POINT pts[5];
HPEN oldpen;
pts[0].x = pts[1].x = pts[4].x = x;
oldpen = SelectObject (hdc, oldpen);
DeleteObject (oldpen);
}
+ if ((attr & (ATTR_ACTCURS | ATTR_PASCURS)) && cfg.cursor_type != 0) {
+ int startx, starty, dx, dy, length, i;
+ if (cfg.cursor_type == 1) {
+ startx = x; starty = y+descent;
+ dx = 1; dy = 0; length = fnt_width;
+ } else {
+ int xadjust = 0;
+ if (attr & ATTR_RIGHTCURS)
+ xadjust = fnt_width-1;
+ startx = x+xadjust; starty = y;
+ dx = 0; dy = 1; length = font_height;
+ }
+ if (attr & ATTR_ACTCURS) {
+ HPEN oldpen;
+ oldpen = SelectObject (hdc, CreatePen(PS_SOLID, 0, colours[23]));
+ MoveToEx (hdc, startx, starty, NULL);
+ LineTo (hdc, startx+dx*length, starty+dy*length);
+ oldpen = SelectObject (hdc, oldpen);
+ DeleteObject (oldpen);
+ } else {
+ for (i = 0; i < length; i++) {
+ if (i % 2 == 0) {
+ SetPixel(hdc, startx, starty, colours[23]);
+ }
+ startx += dx; starty += dy;
+ }
+ }
+ }
}
static int check_compose(int first, int second) {