1 From 54fd93856a3b34c92d0dd9e8cc972b57a92d1a5e Mon Sep 17 00:00:00 2001
2 From: wm4 <wm4@nowhere>
3 Date: Sat, 4 Oct 2014 15:03:02 +0200
4 Subject: [PATCH] x11: stupid workaround for XMonad
6 --x11-netwm=yes now forces NetWM fullscreen, while --x11-netwm=auto
7 (detect whether NetWM fullsctreen support is available) is the old
8 behavior and still the default.
12 DOCS/man/options.rst | 18 ++++++++++++++----
13 options/options.c | 4 ++--
14 video/out/x11_common.c | 6 +++++-
15 3 files changed, 21 insertions(+), 7 deletions(-)
17 diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst
18 index b187259..69525ae 100644
19 --- a/DOCS/man/options.rst
20 +++ b/DOCS/man/options.rst
21 @@ -1708,16 +1708,26 @@ Window
23 Set the window class name for X11-based video output methods.
26 +``--x11-netwm=<yes|no|auto>``
28 - Disable use of the NetWM protocol when switching to or from fullscreen.
29 + Control the use of NetWM protocol features.
31 This may or may not help with broken window managers. This provides some
32 functionality that was implemented by the now removed ``--fstype`` option.
33 Actually, it is not known to the developers to which degree this option
34 was needed, so feedback is welcome.
36 - By default, NetWM support is autodetected, and using this option forces
37 - autodetection to fail.
38 + Specifically, ``yes`` will force use of NetWM fullscreen support, even if
39 + not advertised by the WM. This can be useful for WMs that are broken on
40 + purpose, like XMonad. (XMonad supposedly doesn't advertise fullscreen
41 + support, because Flash uses it. Apparently, applications which want to
42 + use fullscreen anyway are supposed to either ignore the NetWM support hints,
43 + or provide a workaround. Shame on XMonad for deliberately breaking X
44 + protocols (as if X isn't bad enough already).
46 + By default, NetWM support is autodetected (``auto``).
48 + This option might be removed in the future.
52 diff --git a/options/options.c b/options/options.c
53 index bc016df..1639719 100644
54 --- a/options/options.c
55 +++ b/options/options.c
56 @@ -431,7 +431,8 @@ const m_option_t mp_opts[] = {
58 OPT_INT64("wid", vo.WinID, CONF_GLOBAL),
60 - OPT_FLAG("x11-netwm", vo.x11_netwm, 0),
61 + OPT_CHOICE("x11-netwm", vo.x11_netwm, 0,
62 + ({"auto", 0}, {"no", -1}, {"yes", 1})),
64 OPT_STRING("heartbeat-cmd", heartbeat_cmd, 0),
65 OPT_FLOAT("heartbeat-interval", heartbeat_interval, CONF_MIN, 0),
66 @@ -573,7 +574,6 @@ const struct MPOpts mp_default_opts = {
73 .wintitle = "mpv - ${media-title}",
74 diff --git a/video/out/x11_common.c b/video/out/x11_common.c
75 index 140069e..aed54f9 100644
76 --- a/video/out/x11_common.c
77 +++ b/video/out/x11_common.c
78 @@ -308,7 +308,7 @@ static int vo_wm_detect(struct vo *vo)
81 MP_VERBOSE(x11, "Detected wm supports NetWM.\n");
82 - if (vo->opts->x11_netwm) {
83 + if (vo->opts->x11_netwm >= 0) {
84 for (i = 0; i < nitems; i++)
85 wm |= net_wm_support_state_test(vo->x11, args[i]);
87 @@ -319,6 +319,10 @@ static int vo_wm_detect(struct vo *vo)
90 MP_VERBOSE(x11, "Unknown wm type...\n");
91 + if (vo->opts->x11_netwm > 0 && !(wm & vo_wm_FULLSCREEN)) {
92 + MP_WARN(x11, "Forcing NetWM FULLSCREEN support.\n");
93 + wm |= vo_wm_FULLSCREEN;