mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-04-19 03:58:05 -05:00
Ability to hide the mouse pointer on a keypress a la Word
[originally from svn r883]
This commit is contained in:
parent
83066d174c
commit
beeaa85fc5
1
putty.h
1
putty.h
@ -196,6 +196,7 @@ typedef struct {
|
|||||||
int fontcharset;
|
int fontcharset;
|
||||||
char logfilename[FILENAME_MAX];
|
char logfilename[FILENAME_MAX];
|
||||||
int logtype;
|
int logtype;
|
||||||
|
int hide_mouseptr;
|
||||||
/* Colour options */
|
/* Colour options */
|
||||||
int try_palette;
|
int try_palette;
|
||||||
int bold_colour;
|
int bold_colour;
|
||||||
|
@ -95,6 +95,7 @@ void save_settings (char *section, int do_host, Config *cfg) {
|
|||||||
write_setting_i (sesskey, "ComposeKey", cfg->compose_key);
|
write_setting_i (sesskey, "ComposeKey", cfg->compose_key);
|
||||||
write_setting_i (sesskey, "LdiscTerm", cfg->ldisc_term);
|
write_setting_i (sesskey, "LdiscTerm", cfg->ldisc_term);
|
||||||
write_setting_i (sesskey, "AlwaysOnTop", cfg->alwaysontop);
|
write_setting_i (sesskey, "AlwaysOnTop", cfg->alwaysontop);
|
||||||
|
write_setting_i (sesskey, "HideMousePtr", cfg->hide_mouseptr);
|
||||||
write_setting_i (sesskey, "CurType", cfg->cursor_type);
|
write_setting_i (sesskey, "CurType", cfg->cursor_type);
|
||||||
write_setting_i (sesskey, "BlinkCur", cfg->blink_cur);
|
write_setting_i (sesskey, "BlinkCur", cfg->blink_cur);
|
||||||
write_setting_i (sesskey, "Beep", cfg->beep);
|
write_setting_i (sesskey, "Beep", cfg->beep);
|
||||||
@ -238,6 +239,7 @@ void load_settings (char *section, int do_host, Config *cfg) {
|
|||||||
gppi (sesskey, "ComposeKey", 0, &cfg->compose_key);
|
gppi (sesskey, "ComposeKey", 0, &cfg->compose_key);
|
||||||
gppi (sesskey, "LdiscTerm", 0, &cfg->ldisc_term);
|
gppi (sesskey, "LdiscTerm", 0, &cfg->ldisc_term);
|
||||||
gppi (sesskey, "AlwaysOnTop", 0, &cfg->alwaysontop);
|
gppi (sesskey, "AlwaysOnTop", 0, &cfg->alwaysontop);
|
||||||
|
gppi (sesskey, "HideMousePtr", 0, &cfg->hide_mouseptr);
|
||||||
gppi (sesskey, "CurType", 0, &cfg->cursor_type);
|
gppi (sesskey, "CurType", 0, &cfg->cursor_type);
|
||||||
gppi (sesskey, "BlinkCur", 0, &cfg->blink_cur);
|
gppi (sesskey, "BlinkCur", 0, &cfg->blink_cur);
|
||||||
gppi (sesskey, "Beep", 1, &cfg->beep);
|
gppi (sesskey, "Beep", 1, &cfg->beep);
|
||||||
|
13
windlg.c
13
windlg.c
@ -275,6 +275,7 @@ enum { IDCX_ABOUT = IDC_ABOUT, IDCX_TVSTATIC, IDCX_TREEVIEW, controlstartvalue,
|
|||||||
IDC_BOX_APPEARANCE1, IDC_BOXT_APPEARANCE1,
|
IDC_BOX_APPEARANCE1, IDC_BOXT_APPEARANCE1,
|
||||||
IDC_BOX_APPEARANCE2, IDC_BOXT_APPEARANCE2,
|
IDC_BOX_APPEARANCE2, IDC_BOXT_APPEARANCE2,
|
||||||
IDC_BOX_APPEARANCE3, IDC_BOXT_APPEARANCE3,
|
IDC_BOX_APPEARANCE3, IDC_BOXT_APPEARANCE3,
|
||||||
|
IDC_BOX_APPEARANCE4, IDC_BOXT_APPEARANCE4,
|
||||||
IDC_CURSORSTATIC,
|
IDC_CURSORSTATIC,
|
||||||
IDC_CURBLOCK,
|
IDC_CURBLOCK,
|
||||||
IDC_CURUNDER,
|
IDC_CURUNDER,
|
||||||
@ -285,6 +286,7 @@ enum { IDCX_ABOUT = IDC_ABOUT, IDCX_TVSTATIC, IDCX_TREEVIEW, controlstartvalue,
|
|||||||
IDC_WINTITLE,
|
IDC_WINTITLE,
|
||||||
IDC_WINEDIT,
|
IDC_WINEDIT,
|
||||||
IDC_WINNAME,
|
IDC_WINNAME,
|
||||||
|
IDC_HIDEMOUSE,
|
||||||
appearancepanelend,
|
appearancepanelend,
|
||||||
|
|
||||||
connectionpanelstart,
|
connectionpanelstart,
|
||||||
@ -496,6 +498,7 @@ static void init_dlg_ctrls(HWND hwnd) {
|
|||||||
|
|
||||||
SetDlgItemText (hwnd, IDC_WINEDIT, cfg.wintitle);
|
SetDlgItemText (hwnd, IDC_WINEDIT, cfg.wintitle);
|
||||||
CheckDlgButton (hwnd, IDC_WINNAME, cfg.win_name_always);
|
CheckDlgButton (hwnd, IDC_WINNAME, cfg.win_name_always);
|
||||||
|
CheckDlgButton (hwnd, IDC_HIDEMOUSE, cfg.hide_mouseptr);
|
||||||
CheckRadioButton (hwnd, IDC_CURBLOCK, IDC_CURVERT,
|
CheckRadioButton (hwnd, IDC_CURBLOCK, IDC_CURVERT,
|
||||||
cfg.cursor_type==0 ? IDC_CURBLOCK :
|
cfg.cursor_type==0 ? IDC_CURBLOCK :
|
||||||
cfg.cursor_type==1 ? IDC_CURUNDER : IDC_CURVERT);
|
cfg.cursor_type==1 ? IDC_CURUNDER : IDC_CURVERT);
|
||||||
@ -892,6 +895,11 @@ static int GenericMainDlgProc (HWND hwnd, UINT msg,
|
|||||||
IDC_WINEDIT, 100, NULL);
|
IDC_WINEDIT, 100, NULL);
|
||||||
checkbox(&cp, "Avoid ever using &icon title", IDC_WINNAME);
|
checkbox(&cp, "Avoid ever using &icon title", IDC_WINNAME);
|
||||||
endbox(&cp);
|
endbox(&cp);
|
||||||
|
beginbox(&cp, "Adjust the use of the mouse pointer",
|
||||||
|
IDC_BOX_APPEARANCE4, IDC_BOXT_APPEARANCE4);
|
||||||
|
checkbox(&cp, "Hide mouse &pointer when typing in window",
|
||||||
|
IDC_HIDEMOUSE);
|
||||||
|
endbox(&cp);
|
||||||
|
|
||||||
treeview_insert(&tvfaff, 1, "Appearance");
|
treeview_insert(&tvfaff, 1, "Appearance");
|
||||||
}
|
}
|
||||||
@ -1502,6 +1510,11 @@ static int GenericMainDlgProc (HWND hwnd, UINT msg,
|
|||||||
HIWORD(wParam) == BN_DOUBLECLICKED)
|
HIWORD(wParam) == BN_DOUBLECLICKED)
|
||||||
cfg.win_name_always = IsDlgButtonChecked (hwnd, IDC_WINNAME);
|
cfg.win_name_always = IsDlgButtonChecked (hwnd, IDC_WINNAME);
|
||||||
break;
|
break;
|
||||||
|
case IDC_HIDEMOUSE:
|
||||||
|
if (HIWORD(wParam) == BN_CLICKED ||
|
||||||
|
HIWORD(wParam) == BN_DOUBLECLICKED)
|
||||||
|
cfg.hide_mouseptr = IsDlgButtonChecked (hwnd, IDC_HIDEMOUSE);
|
||||||
|
break;
|
||||||
case IDC_CURBLOCK:
|
case IDC_CURBLOCK:
|
||||||
if (HIWORD(wParam) == BN_CLICKED ||
|
if (HIWORD(wParam) == BN_CLICKED ||
|
||||||
HIWORD(wParam) == BN_DOUBLECLICKED)
|
HIWORD(wParam) == BN_DOUBLECLICKED)
|
||||||
|
24
window.c
24
window.c
@ -1054,6 +1054,17 @@ static void click (Mouse_Button b, int x, int y) {
|
|||||||
lasttime = thistime;
|
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,
|
static LRESULT CALLBACK WndProc (HWND hwnd, UINT message,
|
||||||
WPARAM wParam, LPARAM lParam) {
|
WPARAM wParam, LPARAM lParam) {
|
||||||
HDC hdc;
|
HDC hdc;
|
||||||
@ -1087,6 +1098,7 @@ static LRESULT CALLBACK WndProc (HWND hwnd, UINT message,
|
|||||||
case WM_CREATE:
|
case WM_CREATE:
|
||||||
break;
|
break;
|
||||||
case WM_CLOSE:
|
case WM_CLOSE:
|
||||||
|
show_mouseptr(1);
|
||||||
if (!cfg.warn_on_close || session_closed ||
|
if (!cfg.warn_on_close || session_closed ||
|
||||||
MessageBox(hwnd, "Are you sure you want to close this session?",
|
MessageBox(hwnd, "Are you sure you want to close this session?",
|
||||||
"PuTTY Exit Confirmation",
|
"PuTTY Exit Confirmation",
|
||||||
@ -1094,6 +1106,7 @@ static LRESULT CALLBACK WndProc (HWND hwnd, UINT message,
|
|||||||
DestroyWindow(hwnd);
|
DestroyWindow(hwnd);
|
||||||
return 0;
|
return 0;
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
|
show_mouseptr(1);
|
||||||
PostQuitMessage (0);
|
PostQuitMessage (0);
|
||||||
return 0;
|
return 0;
|
||||||
case WM_SYSCOMMAND:
|
case WM_SYSCOMMAND:
|
||||||
@ -1329,40 +1342,47 @@ static LRESULT CALLBACK WndProc (HWND hwnd, UINT message,
|
|||||||
#define TO_CHR_Y(y) (((y)<0 ? (y)-font_height+1: (y)) / font_height)
|
#define TO_CHR_Y(y) (((y)<0 ? (y)-font_height+1: (y)) / font_height)
|
||||||
|
|
||||||
case WM_LBUTTONDOWN:
|
case WM_LBUTTONDOWN:
|
||||||
|
show_mouseptr(1);
|
||||||
click (MB_SELECT, TO_CHR_X(X_POS(lParam)),
|
click (MB_SELECT, TO_CHR_X(X_POS(lParam)),
|
||||||
TO_CHR_Y(Y_POS(lParam)));
|
TO_CHR_Y(Y_POS(lParam)));
|
||||||
SetCapture(hwnd);
|
SetCapture(hwnd);
|
||||||
return 0;
|
return 0;
|
||||||
case WM_LBUTTONUP:
|
case WM_LBUTTONUP:
|
||||||
|
show_mouseptr(1);
|
||||||
term_mouse (MB_SELECT, MA_RELEASE, TO_CHR_X(X_POS(lParam)),
|
term_mouse (MB_SELECT, MA_RELEASE, TO_CHR_X(X_POS(lParam)),
|
||||||
TO_CHR_Y(Y_POS(lParam)));
|
TO_CHR_Y(Y_POS(lParam)));
|
||||||
ReleaseCapture();
|
ReleaseCapture();
|
||||||
return 0;
|
return 0;
|
||||||
case WM_MBUTTONDOWN:
|
case WM_MBUTTONDOWN:
|
||||||
|
show_mouseptr(1);
|
||||||
SetCapture(hwnd);
|
SetCapture(hwnd);
|
||||||
click (cfg.mouse_is_xterm ? MB_PASTE : MB_EXTEND,
|
click (cfg.mouse_is_xterm ? MB_PASTE : MB_EXTEND,
|
||||||
TO_CHR_X(X_POS(lParam)),
|
TO_CHR_X(X_POS(lParam)),
|
||||||
TO_CHR_Y(Y_POS(lParam)));
|
TO_CHR_Y(Y_POS(lParam)));
|
||||||
return 0;
|
return 0;
|
||||||
case WM_MBUTTONUP:
|
case WM_MBUTTONUP:
|
||||||
|
show_mouseptr(1);
|
||||||
term_mouse (cfg.mouse_is_xterm ? MB_PASTE : MB_EXTEND,
|
term_mouse (cfg.mouse_is_xterm ? MB_PASTE : MB_EXTEND,
|
||||||
MA_RELEASE, TO_CHR_X(X_POS(lParam)),
|
MA_RELEASE, TO_CHR_X(X_POS(lParam)),
|
||||||
TO_CHR_Y(Y_POS(lParam)));
|
TO_CHR_Y(Y_POS(lParam)));
|
||||||
ReleaseCapture();
|
ReleaseCapture();
|
||||||
return 0;
|
return 0;
|
||||||
case WM_RBUTTONDOWN:
|
case WM_RBUTTONDOWN:
|
||||||
|
show_mouseptr(1);
|
||||||
SetCapture(hwnd);
|
SetCapture(hwnd);
|
||||||
click (cfg.mouse_is_xterm ? MB_EXTEND : MB_PASTE,
|
click (cfg.mouse_is_xterm ? MB_EXTEND : MB_PASTE,
|
||||||
TO_CHR_X(X_POS(lParam)),
|
TO_CHR_X(X_POS(lParam)),
|
||||||
TO_CHR_Y(Y_POS(lParam)));
|
TO_CHR_Y(Y_POS(lParam)));
|
||||||
return 0;
|
return 0;
|
||||||
case WM_RBUTTONUP:
|
case WM_RBUTTONUP:
|
||||||
|
show_mouseptr(1);
|
||||||
term_mouse (cfg.mouse_is_xterm ? MB_EXTEND : MB_PASTE,
|
term_mouse (cfg.mouse_is_xterm ? MB_EXTEND : MB_PASTE,
|
||||||
MA_RELEASE, TO_CHR_X(X_POS(lParam)),
|
MA_RELEASE, TO_CHR_X(X_POS(lParam)),
|
||||||
TO_CHR_Y(Y_POS(lParam)));
|
TO_CHR_Y(Y_POS(lParam)));
|
||||||
ReleaseCapture();
|
ReleaseCapture();
|
||||||
return 0;
|
return 0;
|
||||||
case WM_MOUSEMOVE:
|
case WM_MOUSEMOVE:
|
||||||
|
show_mouseptr(1);
|
||||||
/*
|
/*
|
||||||
* Add the mouse position and message time to the random
|
* Add the mouse position and message time to the random
|
||||||
* number noise.
|
* number noise.
|
||||||
@ -1428,6 +1448,7 @@ static LRESULT CALLBACK WndProc (HWND hwnd, UINT message,
|
|||||||
term_update();
|
term_update();
|
||||||
break;
|
break;
|
||||||
case WM_KILLFOCUS:
|
case WM_KILLFOCUS:
|
||||||
|
show_mouseptr(1);
|
||||||
has_focus = FALSE;
|
has_focus = FALSE;
|
||||||
DestroyCaret();
|
DestroyCaret();
|
||||||
term_out();
|
term_out();
|
||||||
@ -1594,6 +1615,9 @@ static LRESULT CALLBACK WndProc (HWND hwnd, UINT message,
|
|||||||
if (len == -1)
|
if (len == -1)
|
||||||
return DefWindowProc (hwnd, message, wParam, lParam);
|
return DefWindowProc (hwnd, message, wParam, lParam);
|
||||||
ldisc->send (buf, len);
|
ldisc->send (buf, len);
|
||||||
|
|
||||||
|
if (len > 0)
|
||||||
|
show_mouseptr(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user