@@ -101,7 +101,7 @@ __declspec(dllexport)
101101const 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)
115115const 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