diff --git a/gdk/wayland/genprotocolfiles.py b/gdk/wayland/genprotocolfiles.py index 187f8ff8d7..cf4faed78f 100755 --- a/gdk/wayland/genprotocolfiles.py +++ b/gdk/wayland/genprotocolfiles.py @@ -12,9 +12,7 @@ out_file = sys.argv[3] #TODO: We can infer this optinon from the name of the output file! option = sys.argv[4] - - -pc = subprocess.Popen([scanner, option , in_file , out_file], stdout=subprocess.PIPE) +pc = subprocess.Popen([scanner, option, in_file, out_file], stdout=subprocess.PIPE) (stdo, _) = pc.communicate() if pc.returncode != 0: sys.exit(pc.returncode) @@ -24,7 +22,7 @@ content = "" with open(out_file, 'r') as content_file: content = content_file.read() -content = content.replace("WL_EXPORT", "") +content = content.replace('WL_EXPORT ', '') ofile = open(out_file, 'w') ofile.write(content) ofile.close() diff --git a/gdk/wayland/meson.build b/gdk/wayland/meson.build index f5e894cea9..ff5674f0e8 100644 --- a/gdk/wayland/meson.build +++ b/gdk/wayland/meson.build @@ -37,53 +37,67 @@ gdk_wayland_deps = [ ] # wayland protocols - proto_dir = dependency('wayland-protocols').get_pkgconfig_variable('pkgdatadir') assert(proto_dir != '', 'Could not get pkgdatadir from wayland-protocols.pc') wayland_scanner = find_program('wayland-scanner') genprotocols = find_program('genprotocolfiles.py') +# Format: +# - protocol name +# - protocol stability ('stable' or 'unstable') +# - protocol version (if stability is 'unstable') proto_sources = [ - ['gtk-shell', - 'protocol/gtk-shell.xml'], - - ['gtk-primary-selection', - 'protocol/gtk-primary-selection.xml'], - - ['pointer-gestures-unstable-v1', - join_paths(proto_dir, 'unstable/pointer-gestures/pointer-gestures-unstable-v1.xml')], - - ['xdg-shell-unstable-v6', - join_paths(proto_dir, 'unstable/xdg-shell/xdg-shell-unstable-v6.xml')], - - ['xdg-foreign-unstable-v1', - join_paths(proto_dir, 'unstable/xdg-foreign/xdg-foreign-unstable-v1.xml')], - - ['tablet-unstable-v2', - join_paths(proto_dir, 'unstable/tablet/tablet-unstable-v2.xml')], + ['gtk-shell', 'stable', ], + ['gtk-primary-selection', 'stable', ], + ['pointer-gestures', 'unstable', 'v1', ], + ['xdg-shell', 'unstable', 'v6', ], + ['xdg-foreign', 'unstable', 'v1', ], + ['tablet', 'unstable', 'v2', ], ] gdk_wayland_gen_headers = [] -# FIXME: there's some protostability/protoname stuff in Makefile.am I don't grok -foreach p : proto_sources - output_base = p[0] - input = p[1] +foreach p: proto_sources + proto_name = p.get(0) + proto_stability = p.get(1) + + if proto_stability == 'stable' + output_base = proto_name + input = 'protocol/@0@.xml'.format(proto_name) + else + proto_version = p.get(2) + output_base = '@0@-@1@-@2@'.format(proto_name, proto_stability, proto_version) + input = join_paths(proto_dir, '@0@/@1@/@2@.xml'.format(proto_stability, proto_name, output_base)) + endif gdk_wayland_gen_headers += custom_target('@0@ client header'.format(output_base), - input : input, - output : '@0@-client-protocol.h'.format(output_base), - command: [genprotocols, wayland_scanner, '@INPUT@', '@OUTPUT@', 'client-header']) + input: input, + output: '@0@-client-protocol.h'.format(output_base), + command: [ + genprotocols, + wayland_scanner, + '@INPUT@', '@OUTPUT@', + 'client-header', + ]) gdk_wayland_sources += custom_target('@0@ source'.format(output_base), - input : input, - output : '@0@-protocol.c'.format(output_base), - command: [genprotocols, wayland_scanner, '@INPUT@', '@OUTPUT@', 'code']) + input: input, + output: '@0@-protocol.c'.format(output_base), + command: [ + genprotocols, + wayland_scanner, + '@INPUT@', '@OUTPUT@', + 'code', + ]) endforeach libgdk_wayland = static_library('gdk-wayland', - gdk_wayland_sources, gdk_wayland_gen_headers, gdkconfig, gdkenum_h, - include_directories: [confinc, gdkinc], - c_args: ['-DGDK_COMPILATION', '-DG_LOG_DOMAIN="Gdk"'], - dependencies: [gdk_deps, gdk_wayland_deps]) + gdk_wayland_sources, gdk_wayland_gen_headers, gdkconfig, gdkenum_h, + include_directories: [ confinc, gdkinc, ], + c_args: [ + '-DGDK_COMPILATION', + '-DG_LOG_DOMAIN="Gdk"', + '-DG_LOG_USE_STRUCTURED=1', + ], + dependencies: [ gdk_deps, gdk_wayland_deps, ])