FauxFaux/PuTTYTray

puttytray sometimes minimises to tray even with such option disabled

Opened this issue · 3 comments

wodim commented

2015-11-01_12-46-30

Even though my sessions are configured like this, sometimes when I click the minimise button, or click the entry in the taskbar to minimise the application, or click the "show desktop" button, the application minimises to tray anyway. This happens like 5% of the time, I don't know how to reproduce it reliably.

Even when you have "Never" selected, it will still do it if you have ctrl held down. Do you think this is what you're hitting? I've never heard anything similar be reported. It's not currently possible to disable this behaviour.

wodim commented

It is possible that that is the case then. It is not documented anywhere. Or at least in no place I could find. So let's leave it here.

wodim commented

This keeps happening to me every single day. I've been looking at the implementation:

PuTTYTray/windows/window.c

Lines 3366 to 3380 in af821f0

BYTE keys[256];
int control_pressed;
if (GetKeyboardState(keys)!=0) {
control_pressed=keys[VK_CONTROL]&0x80;
}
SetWindowText(hwnd,
conf_get_int(conf, CONF_win_name_always) ?
window_name : icon_name);
if (conf_get_int(conf, CONF_tray) == TRAY_NORMAL || conf_get_int(conf, CONF_tray) == TRAY_START || control_pressed > 0) {
taskbar_addicon(conf_get_int(conf, CONF_win_name_always) ? window_name : icon_name, TRUE);
ShowWindow(hwnd, SW_HIDE);
}
windowMinimized = TRUE;

Could it be possible that GetKeyboardState is failing and returning 0 for some reason, leading to control_pressed having an uninitialised value that happens to be > 0?