summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Ross-Gowan <rossymiles@gmail.com>2014-12-08 17:06:14 +1100
committerJames Ross-Gowan <rossymiles@gmail.com>2014-12-08 22:07:20 +1100
commit2e1daaff83a4fe7a213d18fba3adb31bb173dedb (patch)
tree13b3ddb04126065eabc0d816d748423f895821db
parent39be59706388c93ff910302c328762e855d9a005 (diff)
downloadmpv-2e1daaff83a4fe7a213d18fba3adb31bb173dedb.tar.bz2
mpv-2e1daaff83a4fe7a213d18fba3adb31bb173dedb.tar.xz
w32_common: ensure taskbar is hidden when fullscreen
Windows uses a heuristic to determine if a window should appear fullscreen. If the active window's client area covers the whole screen, the taskbar should move to the bottom of the Z-order, allowing the window to show through. Unfortunately, sometimes it doesn't work and the taskbar stays on top of the "fullscreen" window. ITaskbarList2->MarkFullscreenWindow explicitly tells the shell that a window wants to be fullscreen, so the taskbar is always at the bottom of the Z-order while the marked window is active. This might help with #999. Firefox also uses this interface to fix fullscreen issues.
-rw-r--r--video/out/w32_common.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/video/out/w32_common.c b/video/out/w32_common.c
index 9f0180b49e..6c3359a7c3 100644
--- a/video/out/w32_common.c
+++ b/video/out/w32_common.c
@@ -16,6 +16,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+#define COBJMACROS
#include <stdio.h>
#include <limits.h>
#include <pthread.h>
@@ -23,6 +24,7 @@
#include <windows.h>
#include <windowsx.h>
#include <ole2.h>
+#include <shobjidl.h>
#include "options/options.h"
#include "input/keycodes.h"
@@ -99,6 +101,8 @@ struct vo_w32_state {
// UTF-16 decoding state for WM_CHAR and VK_PACKET
int high_surrogate;
+
+ ITaskbarList2 *taskbar_list;
};
typedef struct tagDropTarget {
@@ -835,6 +839,11 @@ static int reinit_window_state(struct vo_w32_state *w32)
bool toggle_fs = w32->current_fs != w32->opts->fullscreen;
w32->current_fs = w32->opts->fullscreen;
+ if (w32->taskbar_list) {
+ ITaskbarList2_MarkFullscreenWindow(w32->taskbar_list,
+ w32->window, w32->opts->fullscreen);
+ }
+
DWORD style = update_style(w32, GetWindowLong(w32->window, GWL_STYLE));
if (w32->opts->ontop)
@@ -1044,12 +1053,27 @@ static void *gui_thread(void *ptr)
goto done;
}
- if (OleInitialize(NULL) == S_OK) {
+ if (SUCCEEDED(OleInitialize(NULL))) {
+ ole_ok = true;
+
fmtetc_url.cfFormat = (CLIPFORMAT)RegisterClipboardFormat(TEXT("UniformResourceLocator"));
DropTarget* dropTarget = talloc(NULL, DropTarget);
DropTarget_Init(dropTarget, w32);
RegisterDragDrop(w32->window, &dropTarget->iface);
- ole_ok = true;
+
+ // ITaskbarList2 has the MarkFullscreenWindow method, which is used to
+ // make sure the taskbar is hidden when mpv goes fullscreen
+ if (SUCCEEDED(CoCreateInstance(&CLSID_TaskbarList, NULL,
+ CLSCTX_INPROC_SERVER, &IID_ITaskbarList2,
+ (void**)&w32->taskbar_list)))
+ {
+ if (FAILED(ITaskbarList2_HrInit(w32->taskbar_list))) {
+ ITaskbarList2_Release(w32->taskbar_list);
+ w32->taskbar_list = NULL;
+ }
+ }
+ } else {
+ MP_ERR(w32, "Failed to initialize OLE/COM\n");
}
w32->tracking = FALSE;
@@ -1083,6 +1107,8 @@ done:
RevokeDragDrop(w32->window);
DestroyWindow(w32->window);
}
+ if (w32->taskbar_list)
+ ITaskbarList2_Release(w32->taskbar_list);
if (ole_ok)
OleUninitialize();
SetThreadExecutionState(ES_CONTINUOUS);