@@ -34,26 +34,24 @@ elseif(${BACKEND_TYPE} STREQUAL "X11")
3434    src/flutter/shell/platform/linux_embedded/window/linuxes_window_x11.cc
3535    src/flutter/shell/platform/linux_embedded/window/native_window_x11.cc)
3636else ()
37-   find_program (WaylandScannerExec NAMES  wayland-scanner)
38-   get_filename_component (_infile $ENV{PKG_CONFIG_SYSROOT_DIR} /usr/share/wayland-protocols/stable/xdg-shell/xdg-shell.xml ABSOLUTE )
39-   set (_client_header ${CMAKE_CURRENT_SOURCE_DIR} /src/wayland/protocol/xdg-shell-client-protocol.h)
40-   set (_code ${CMAKE_CURRENT_SOURCE_DIR} /src/wayland/protocol/xdg-shell-protocol.c)
41-   set_source_files_properties (${_client_header}  GENERATED )
42-   set_source_files_properties (${_code}  GENERATED )
43-   add_custom_command (
44-     OUTPUT  ${_client_header} 
45-     COMMAND  ${WaylandScannerExec}  client-header ${_infile}  ${_client_header} 
46-     DEPENDS  ${_infile}  VERBATIM 
47-   )
48-   add_custom_command (
49-     OUTPUT  ${_code} 
50-     COMMAND  ${WaylandScannerExec}  private -code ${_infile}  ${_code} 
51-     DEPENDS  ${_infile}  ${_client_header}  VERBATIM 
52-   )
37+   include (cmake/generate_wayland_protocols.cmake)
38+   set (_wayland_protocols_xml_dir $ENV{PKG_CONFIG_SYSROOT_DIR} /usr/share/wayland-protocols)
39+   set (_wayland_protocols_src_dir ${CMAKE_CURRENT_SOURCE_DIR} /src/wayland/protocol)
40+ 
41+   generate_wayland_client_protocol(
42+     PROTOCOL_FILE ${_wayland_protocols_xml_dir} /stable/xdg-shell/xdg-shell.xml
43+     CODE_FILE ${_wayland_protocols_src_dir} /xdg-shell-protocol.c
44+     HEADER_FILE ${_wayland_protocols_src_dir} /xdg-shell-client-protocol.h)
45+ 
46+   generate_wayland_client_protocol(
47+     PROTOCOL_FILE ${_wayland_protocols_xml_dir} /unstable/text-input /text-input -unstable-v1.xml
48+     CODE_FILE ${_wayland_protocols_src_dir} /text-input -unstable-v1-protocol.c
49+     HEADER_FILE ${_wayland_protocols_src_dir} /text-input -unstable-v1-client-protocol.h)
5350
5451  add_definitions (-DDISPLAY_BACKEND_TYPE_WAYLAND)
5552  set (DISPLAY_BACKEND_SRC
56-     ${_code} 
53+     ${_wayland_protocols_src_dir} /xdg-shell-protocol.c
54+     ${_wayland_protocols_src_dir} /text-input -unstable-v1-protocol.c
5755    src/flutter/shell/platform/linux_embedded/window/linuxes_window_wayland.cc
5856    src/flutter/shell/platform/linux_embedded/window/native_window_wayland.cc)
5957endif ()
@@ -63,15 +61,15 @@ if((${BACKEND_TYPE} STREQUAL "WAYLAND") AND DESKTOP_SHELL)
6361  add_definitions (-DDESKTOP_SHELL)
6462endif ()
6563
66- # wayland &  weston protocols. 
64+ # weston private  protocols. 
6765set (WAYLAND_PROTOCOL_SRC "" )
6866if ((${BACKEND_TYPE}  STREQUAL  "WAYLAND" ) AND  DESKTOP_SHELL)
6967  set (WAYLAND_PROTOCOL_SRC ${WAYLAND_PROTOCOL_SRC}  src/wayland/protocol/weston-desktop-shell-protocol.c)  
68+ endif ()
7069
71-   if (USE_VIRTUAL_KEYBOARD)
72-     add_definitions (-DUSE_VIRTUAL_KEYBOARD)
73-     set (WAYLAND_PROTOCOL_SRC ${WAYLAND_PROTOCOL_SRC}  src/wayland/protocol/text-input -unstable-v1-protocol.c)
74-   endif ()
70+ # Use virtual keybard(on-screen keyboard). 
71+ if (USE_VIRTUAL_KEYBOARD)
72+   add_definitions (-DUSE_VIRTUAL_KEYBOARD)
7573endif ()
7674
7775# OpenGL ES version. 
0 commit comments