Skip to content

Commit 427f408

Browse files
committed
Bug fix for changes to "always on top" behavior
1 parent a239d6b commit 427f408

4 files changed

Lines changed: 14 additions & 11 deletions

File tree

autoload/xolox/shell.vim

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
" Vim auto-load script
22
" Author: Peter Odding <peter@peterodding.com>
3-
" Last Change: May 2, 2013
3+
" Last Change: May 3, 2013
44
" URL: http://peterodding.com/code/vim/shell/
55

6-
let g:xolox#shell#version = '0.11'
6+
let g:xolox#shell#version = '0.11.2'
77

88
call xolox#misc#compat#check('shell', 2)
99

@@ -348,7 +348,7 @@ if xolox#misc#os#is_win()
348348

349349
function! s:has_dll() " {{{2
350350
try
351-
return s:library_call('libversion', '') == '0.4'
351+
return s:library_call('libversion', '') == '0.5'
352352
catch
353353
return 0
354354
endtry

misc/shell/shell-x64.dll

512 Bytes
Binary file not shown.

misc/shell/shell-x86.dll

0 Bytes
Binary file not shown.

misc/shell/shell.c

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ __declspec(dllexport)
101101
const char *libversion(const char *ignored) /* {{{1 */
102102
{
103103
(void)ignored;
104-
return Success("0.4");
104+
return Success("0.5");
105105
}
106106

107107
__declspec(dllexport)
@@ -115,11 +115,13 @@ __declspec(dllexport)
115115
const char *fullscreen(const char *options) /* {{{1 */
116116
{
117117
HWND window;
118-
LONG styles;
119-
LONG exStyle;
118+
LONG styles, exStyle, enable, always_on_top;
120119
HMONITOR monitor;
121120
MONITORINFO info = { sizeof info };
122121

122+
enable = (strstr(options, "enable") != NULL);
123+
always_on_top = (strstr(options, "always on top") != NULL);
124+
123125
window = GetForegroundWindow();
124126
if (!window)
125127
return Failure("Could not get handle to foreground window!");
@@ -132,13 +134,13 @@ const char *fullscreen(const char *options) /* {{{1 */
132134
if (!exStyle)
133135
return Failure("Could not query window ex style!");
134136

135-
if (strstr(options, "enable")) {
137+
if (enable) {
136138
styles ^= WS_CAPTION | WS_THICKFRAME;
137-
if (strstr(options, "always on top"))
139+
if (always_on_top)
138140
exStyle |= WS_EX_TOPMOST;
139141
} else {
140142
styles |= WS_CAPTION | WS_THICKFRAME;
141-
if (strstr(options, "always on top"))
143+
if (always_on_top)
142144
exStyle &= ~WS_EX_TOPMOST;
143145
}
144146

@@ -148,13 +150,14 @@ const char *fullscreen(const char *options) /* {{{1 */
148150
if (!SetWindowLong(window, GWL_EXSTYLE, exStyle))
149151
return Failure("Could not apply window ex style!");
150152

151-
if (strstr(options, "enable")) {
153+
if (enable) {
152154
monitor = MonitorFromWindow(window, MONITOR_DEFAULTTONEAREST);
153155
if (!monitor)
154156
return Failure("Could not get handle to monitor!");
155157
if (!GetMonitorInfo(monitor, &info))
156158
return Failure("Could not get monitor information!");
157-
if (!SetWindowPos(window, HWND_TOPMOST,
159+
if (!SetWindowPos(window,
160+
always_on_top ? HWND_TOPMOST : HWND_TOP,
158161
info.rcMonitor.left,
159162
info.rcMonitor.top,
160163
info.rcMonitor.right - info.rcMonitor.left,

0 commit comments

Comments
 (0)