Skip to content

Commit

Permalink
tweak Ctrl+TAB to not put current window into the background (~ #260)
Browse files Browse the repository at this point in the history
  • Loading branch information
mintty committed Jul 22, 2015
1 parent 8603224 commit 08a24fa
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
15 changes: 12 additions & 3 deletions src/wininput.c
Original file line number Diff line number Diff line change
Expand Up @@ -679,12 +679,21 @@ win_key_down(WPARAM wp, LPARAM lp)
else
ctrl_ch(term.backspace_sends_bs ? CDEL : CTRL('_'));
when VK_TAB:
if (alt)
return 0;
if (alt) {
if (cfg.switch_shortcuts) {
// does not work as Alt+TAB is not passed here anyway;
// could try something with KeyboardHook:
// http://www.codeproject.com/Articles/14485/Low-level-Windows-API-hooks-from-C-to-stop-unwante
win_switch(shift, true);
return 1;
}
else
return 0;
}
if (!ctrl)
shift ? csi('Z') : ch('\t');
else if (cfg.switch_shortcuts) {
win_switch(shift);
win_switch(shift, false);
return 1;
}
else
Expand Down
5 changes: 3 additions & 2 deletions src/winmain.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,16 @@ wnd_enum_proc(HWND curr_wnd, LPARAM unused(lp)) {
}

void
win_switch(bool back)
win_switch(bool back, bool alternate)
{
first_wnd = 0, last_wnd = 0;
EnumWindows(wnd_enum_proc, 0);
if (first_wnd) {
if (back)
first_wnd = last_wnd;
else
SetWindowPos(wnd, last_wnd, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
SetWindowPos(wnd, last_wnd, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE
| (alternate ? SWP_NOZORDER : SWP_NOREPOSITION));
BringWindowToTop(first_wnd);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/winpriv.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ void win_init_drop_target(void);

void win_copy_title(void);

void win_switch(bool back);
void win_switch(bool back, bool alternate);

void win_set_ime_open(bool);

Expand Down
1 change: 1 addition & 0 deletions wiki/Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
* Tweaked Ctrl+TAB to not put current window into the background (~ #260).
* Ctrl+click spawning: Syncing environment to Windows to avoid dropping environment after Alt-F2 (#360).
* Trying to keep window position within monitor work area on resizing (#79).
* Tweaked to exit while background process is running (#319).
Expand Down

0 comments on commit 08a24fa

Please sign in to comment.