不穩定的 Wayland 模組
此模組自 0.62.0 版起提供。
此模組提供輔助函式,以尋找 wayland 協定 xmls,並使用 wayland-scanner 來產生 .c 和 .h 檔案。
注意:此模組不穩定。它僅作為技術預覽提供。它的 API 可能在不同版本之間以任意方式變更,或者可能完全從 Meson 中移除。
快速使用
project('hello-wayland', 'c')
wl_dep = dependency('wayland-client')
wl_mod = import('unstable-wayland')
xml = wl_mod.find_protocol('xdg-shell')
xdg_shell = wl_mod.scan_xml(xml)
executable('hw', 'main.c', xdg_shell, dependencies : wl_dep)
方法
find_protocol
xml = wl_mod.find_protocol(
'xdg-decoration',
state : 'unstable',
version : 1,
)
此函式需要一個位置參數:協定基本名稱。
它接受以下關鍵字參數
-
state
選用參數,指定協定的目前狀態。可以是'stable'
、'staging'
或'unstable'
。預設值為'stable'
。 -
version
向後不相容的版本號碼,為整數。staging 和 unstable 必須提供,但 stable 不允許。
scan_xml
generated = wl_mod.scan_xml(
'my-protocol.xml',
client : true,
server : true,
public : false,
include_core_only : true,
)
此函式接受一個或多個字串或檔案型別的引數。
它接受以下關鍵字參數
-
public
選用參數,指定產生程式碼的範圍。預設值為 false。 -
client
選用參數,指定是否產生用戶端標頭檔。預設值為 true。 -
server
選用參數,指定是否產生伺服器端標頭檔。預設值為 false。 -
include_core_only
選用參數,指定產生的標頭僅包含wayland-<client|server>-core.h
,而不是wayland-<client|server>.h
。預設值為 true。自 0.64.0 起。
傳回:一個 custom_tgt
列表,依序為原始碼、用戶端標頭、伺服器端標頭。產生的標頭檔名稱為 <name>-<client|server>-protocol.h
。
連結
搜尋結果為