summaryrefslogtreecommitdiffstats
path: root/waftools
diff options
context:
space:
mode:
authorRostislav Pehlivanov <atomnuker@gmail.com>2017-10-01 21:16:49 +0100
committerRostislav Pehlivanov <atomnuker@gmail.com>2017-10-03 19:36:02 +0100
commit68f9ee7e0b3fdddfa42fa11a15d9ae84460d5e19 (patch)
tree91b3c4dd976c54a241dc17d04ccdd15e1cf70ff8 /waftools
parent980116360b0f393e16064ec3b7a4ef9efb14372e (diff)
downloadmpv-68f9ee7e0b3fdddfa42fa11a15d9ae84460d5e19.tar.bz2
mpv-68f9ee7e0b3fdddfa42fa11a15d9ae84460d5e19.tar.xz
wayland_common: rewrite from scratch
The wayland code was written more than 4 years ago when wayland wasn't even at version 1.0. This commit rewrites everything in a more modern way, switches to using the new xdg v6 shell interface which solves a lot of bugs and makes mpv tiling-friedly, adds support for drag and drop, adds support for touchscreens, adds support for KDE's server decorations protocol, and finally adds support for the new idle-inhibitor protocol. It does not yet use the frame callback as a main rendering loop driver, this will happen with a later commit.
Diffstat (limited to 'waftools')
-rw-r--r--waftools/checks/custom.py11
-rw-r--r--waftools/checks/generic.py8
-rw-r--r--waftools/generators/sources.py26
3 files changed, 40 insertions, 5 deletions
diff --git a/waftools/checks/custom.py b/waftools/checks/custom.py
index d8065a35f2..698742406f 100644
--- a/waftools/checks/custom.py
+++ b/waftools/checks/custom.py
@@ -4,7 +4,7 @@ from waflib import Utils
import os
__all__ = ["check_pthreads", "check_iconv", "check_lua",
- "check_cocoa", "check_openal"]
+ "check_cocoa", "check_openal", "check_wl_protocols"]
pthreads_program = load_fragment('pthreads.c')
@@ -83,6 +83,15 @@ def check_lua(ctx, dependency_identifier):
return True
return False
+def check_wl_protocols(ctx, dependency_identifier):
+ def fn(ctx, dependency_identifier):
+ ret = check_pkg_config_datadir("wayland-protocols")
+ ret = ret(ctx, dependency_identifier)
+ if ret != None:
+ ctx.env.WL_PROTO_DIR = ret.split()[0]
+ return ret
+ return fn(ctx, dependency_identifier)
+
def check_cocoa(ctx, dependency_identifier):
fn = check_cc(
fragment = load_fragment('cocoa.m'),
diff --git a/waftools/checks/generic.py b/waftools/checks/generic.py
index 153cf9463d..093c600f34 100644
--- a/waftools/checks/generic.py
+++ b/waftools/checks/generic.py
@@ -7,7 +7,8 @@ __all__ = [
"check_pkg_config", "check_pkg_config_mixed", "check_pkg_config_mixed_all",
"check_pkg_config_cflags", "check_cc", "check_statement", "check_libs",
"check_headers", "compose_checks", "check_true", "any_version",
- "load_fragment", "check_stub", "check_ctx_vars", "check_program"]
+ "load_fragment", "check_stub", "check_ctx_vars", "check_program",
+ "check_pkg_config_datadir"]
any_version = None
@@ -82,6 +83,9 @@ def check_pkg_config_mixed_all(*all_args, **kw_ext):
def check_pkg_config_cflags(*args, **kw_ext):
return _check_pkg_config([], ["--cflags"], *args, **kw_ext)
+def check_pkg_config_datadir(*args, **kw_ext):
+ return _check_pkg_config([], ["--variable=pkgdatadir"], *args, **kw_ext)
+
def _check_pkg_config(_dyn_libs, _pkgc_args, *args, **kw_ext):
def fn(ctx, dependency_identifier, **kw):
argsl = list(args)
@@ -113,7 +117,7 @@ def _check_pkg_config(_dyn_libs, _pkgc_args, *args, **kw_ext):
# added only at its first occurrence.
original_append_unique = ConfigSet.append_unique
ConfigSet.append_unique = ConfigSet.append_value
- result = bool(ctx.check_cfg(**opts))
+ result = ctx.check_cfg(**opts)
ConfigSet.append_unique = original_append_unique
defkey = inflector.define_key(dependency_identifier)
diff --git a/waftools/generators/sources.py b/waftools/generators/sources.py
index 96224cf839..b0b423edda 100644
--- a/waftools/generators/sources.py
+++ b/waftools/generators/sources.py
@@ -9,6 +9,9 @@ def __zshcomp_cmd__(ctx, argument):
return '"${{BIN_PERL}}" "{0}/TOOLS/zsh.pl" "{1}" > "${{TGT}}"' \
.format(ctx.srcnode.abspath(), argument)
+def __wayland_scanner_cmd__(ctx, mode, dir, src):
+ return "${{WAYSCAN}} {0} < {1}/{2} > ${{TGT}}".format(mode, dir, src)
+
def __file2string__(ctx, **kwargs):
ctx(
rule = __file2string_cmd__(ctx),
@@ -51,5 +54,24 @@ def __zshcomp__(ctx, **kwargs):
**kwargs
)
-BuildContext.file2string = __file2string__
-BuildContext.zshcomp = __zshcomp__
+def __wayland_protocol_code__(ctx, **kwargs):
+ ctx(
+ rule = __wayland_scanner_cmd__(ctx, 'code', kwargs['proto_dir'],
+ kwargs['protocol'] + '.xml'),
+ name = os.path.basename(kwargs['target']),
+ **kwargs
+ )
+
+def __wayland_protocol_header__(ctx, **kwargs):
+ ctx(
+ rule = __wayland_scanner_cmd__(ctx, 'client-header', kwargs['proto_dir'],
+ kwargs['protocol'] + '.xml'),
+ before = ('c',),
+ name = os.path.basename(kwargs['target']),
+ **kwargs
+ )
+
+BuildContext.file2string = __file2string__
+BuildContext.wayland_protocol_code = __wayland_protocol_code__
+BuildContext.wayland_protocol_header = __wayland_protocol_header__
+BuildContext.zshcomp = __zshcomp__