2016-11-24 18:54:51 +03:00
if get_option ( 'resize-pool' )
config_h . set ( 'USE_RESIZE_POOL' , '1' )
endif
srcs_toytoolkit = [
'window.c' ,
2018-11-29 00:46:37 +03:00
xdg_shell_client_protocol_h ,
xdg_shell_protocol_c ,
2016-11-24 18:54:51 +03:00
text_cursor_position_client_protocol_h ,
text_cursor_position_protocol_c ,
relative_pointer_unstable_v1_client_protocol_h ,
relative_pointer_unstable_v1_protocol_c ,
pointer_constraints_unstable_v1_client_protocol_h ,
pointer_constraints_unstable_v1_protocol_c ,
ivi_application_client_protocol_h ,
ivi_application_protocol_c ,
2018-12-11 11:15:43 +03:00
viewporter_client_protocol_h ,
viewporter_protocol_c ,
2016-11-24 18:54:51 +03:00
]
deps_toytoolkit = [
dep_wayland_client ,
dep_lib_cairo_shared ,
2022-12-21 19:21:35 +03:00
dep_matrix_c ,
2016-11-24 18:54:51 +03:00
dep_xkbcommon ,
dependency ( 'wayland-cursor' ) ,
cc . find_library ( 'util' ) ,
]
lib_toytoolkit = static_library (
'toytoolkit' ,
srcs_toytoolkit ,
2019-04-05 17:09:28 +03:00
include_directories : common_inc ,
2016-11-24 18:54:51 +03:00
dependencies : deps_toytoolkit ,
install : false ,
)
dep_toytoolkit = declare_dependency (
link_with : lib_toytoolkit ,
dependencies : deps_toytoolkit ,
)
2022-05-12 19:36:41 +03:00
dep_gbm = dependency ( 'gbm' , required : false )
if dep_gbm . found ( ) and dep_gbm . version ( ) . version_compare ( '>= 21.3' )
config_h . set ( 'HAVE_GBM_BO_CREATE_WITH_MODIFIERS2' , '1' )
endif
2016-11-24 18:54:51 +03:00
2021-12-15 01:39:59 +03:00
simple_clients_enabled = get_option ( 'simple-clients' )
simple_build_all = simple_clients_enabled . contains ( 'all' )
2016-11-24 18:54:51 +03:00
simple_clients = [
{
'name' : 'damage' ,
'sources' : [
'simple-damage.c' ,
viewporter_client_protocol_h ,
viewporter_protocol_c ,
2018-11-29 00:46:37 +03:00
xdg_shell_client_protocol_h ,
xdg_shell_protocol_c ,
2016-11-24 18:54:51 +03:00
fullscreen_shell_unstable_v1_client_protocol_h ,
fullscreen_shell_unstable_v1_protocol_c ,
] ,
'dep_objs' : [ dep_wayland_client , dep_libshared ]
} ,
2021-11-23 00:16:10 +03:00
{
'name' : 'dmabuf-feedback' ,
'sources' : [
'simple-dmabuf-feedback.c' ,
'../libweston/pixel-formats.c' ,
linux_dmabuf_unstable_v1_client_protocol_h ,
linux_dmabuf_unstable_v1_protocol_c ,
2022-01-23 11:32:47 +03:00
presentation_time_client_protocol_h ,
presentation_time_protocol_c ,
2021-11-23 00:16:10 +03:00
xdg_shell_client_protocol_h ,
xdg_shell_protocol_c ,
] ,
'dep_objs' : [
dep_wayland_client ,
dep_libshared ,
dep_pixman ,
dep_libdrm ,
dependency ( 'libudev' , version : '>= 136' ) ,
2021-12-15 01:39:59 +03:00
# gbm_bo_get_fd_for_plane() from 21.1.0
dependency ( 'gbm' , version : '>= 21.1.1' ,
required : simple_build_all or simple_clients_enabled . contains ( 'dmabuf-feedback' ) ,
not_found_message : 'dmabuf-feedback requires gbm which was not found. If you rather not build this, drop "dmabuf-feedback" from simple-clients option.' ,
disabler : true )
2021-11-23 00:16:10 +03:00
] ,
'deps' : [ 'egl' , 'glesv2' , 'gbm' ] ,
'options' : [ 'renderer-gl' ]
} ,
2018-10-25 17:32:36 +03:00
{
'name' : 'dmabuf-egl' ,
'sources' : [
'simple-dmabuf-egl.c' ,
linux_dmabuf_unstable_v1_client_protocol_h ,
linux_dmabuf_unstable_v1_protocol_c ,
2018-10-30 15:26:47 +03:00
linux_explicit_synchronization_unstable_v1_client_protocol_h ,
linux_explicit_synchronization_unstable_v1_protocol_c ,
2019-11-12 19:22:17 +03:00
xdg_shell_client_protocol_h ,
xdg_shell_protocol_c ,
2019-11-16 21:40:13 +03:00
weston_direct_display_client_protocol_h ,
weston_direct_display_protocol_c ,
2018-10-25 17:32:36 +03:00
fullscreen_shell_unstable_v1_client_protocol_h ,
fullscreen_shell_unstable_v1_protocol_c ,
] ,
'dep_objs' : [
dep_wayland_client ,
2019-01-09 14:38:16 +03:00
dep_libdrm ,
2022-10-10 11:06:45 +03:00
dep_libm ,
dep_matrix_c ,
2018-12-31 14:36:40 +03:00
] ,
2019-10-20 18:17:20 +03:00
'deps' : [ 'egl' , 'glesv2' , 'gbm' ] ,
'options' : [ 'renderer-gl' ]
2018-10-25 17:32:36 +03:00
} ,
2016-11-24 18:54:51 +03:00
{
'name' : 'dmabuf-v4l' ,
'sources' : [
'simple-dmabuf-v4l.c' ,
linux_dmabuf_unstable_v1_client_protocol_h ,
linux_dmabuf_unstable_v1_protocol_c ,
2018-11-29 00:46:37 +03:00
xdg_shell_client_protocol_h ,
xdg_shell_protocol_c ,
2019-11-21 01:28:31 +03:00
weston_direct_display_client_protocol_h ,
weston_direct_display_protocol_c ,
2016-11-24 18:54:51 +03:00
fullscreen_shell_unstable_v1_client_protocol_h ,
fullscreen_shell_unstable_v1_protocol_c ,
] ,
'dep_objs' : [ dep_wayland_client , dep_libdrm_headers ]
} ,
{
'name' : 'egl' ,
'sources' : [
'simple-egl.c' ,
2022-11-24 23:00:35 +03:00
tearing_control_v1_client_protocol_h ,
tearing_control_v1_protocol_c ,
2018-11-29 00:46:37 +03:00
xdg_shell_client_protocol_h ,
xdg_shell_protocol_c ,
2016-11-24 18:54:51 +03:00
ivi_application_client_protocol_h ,
ivi_application_protocol_c ,
] ,
2022-05-24 02:31:48 +03:00
'dep_objs' : [
dep_libm ,
dep_libshared ,
dep_matrix_c ,
dep_wayland_client ,
] ,
2019-10-20 18:17:20 +03:00
'deps' : [ 'egl' , 'wayland-egl' , 'glesv2' , 'wayland-cursor' ] ,
'options' : [ 'renderer-gl' ]
2016-11-24 18:54:51 +03:00
} ,
# weston-simple-im is handled specially separately due to install_dir and odd window.h usage
{
'name' : 'shm' ,
'sources' : [
'simple-shm.c' ,
2018-11-29 00:46:37 +03:00
xdg_shell_client_protocol_h ,
xdg_shell_protocol_c ,
2016-11-24 18:54:51 +03:00
fullscreen_shell_unstable_v1_client_protocol_h ,
fullscreen_shell_unstable_v1_protocol_c ,
ivi_application_client_protocol_h ,
ivi_application_protocol_c ,
] ,
'dep_objs' : [ dep_wayland_client , dep_libshared ]
} ,
{
'name' : 'touch' ,
'sources' : [
'simple-touch.c' ,
2021-08-13 18:18:34 +03:00
xdg_shell_client_protocol_h ,
xdg_shell_protocol_c ,
2016-11-24 18:54:51 +03:00
] ,
'dep_objs' : [ dep_wayland_client , dep_libshared ]
} ,
]
foreach t : simple_clients
if simple_build_all or simple_clients_enabled . contains ( t . get ( 'name' ) )
t_name = 'weston-simple-' + t . get ( 'name' )
t_deps = t . get ( 'dep_objs' , [ ] )
foreach depname : t . get ( 'deps' , [ ] )
dep = dependency ( depname , required : false )
if not dep . found ( )
error ( '@0@ requires @1@ which was not found. If you rather not build this, drop "@2@" from simple-clients option.' . format ( t_name , depname , t . get ( 'name' ) ) )
endif
t_deps + = dep
endforeach
2019-10-20 18:17:20 +03:00
foreach optname : t . get ( 'options' , [ ] )
if not get_option ( optname )
error ( '@0@ requires option @1@ which is not enabled. If you rather not build this, drop "@2@" from simple-clients option.' . format ( t_name , optname , t . get ( 'name' ) ) )
endif
endforeach
2016-11-24 18:54:51 +03:00
executable (
t_name , t . get ( 'sources' ) ,
2019-04-05 17:09:28 +03:00
include_directories : common_inc ,
2016-11-24 18:54:51 +03:00
dependencies : t_deps ,
install : true
)
endif
endforeach
if simple_build_all or simple_clients_enabled . contains ( 'im' )
executable (
'weston-simple-im' , [
'simple-im.c' ,
input_method_unstable_v1_client_protocol_h ,
input_method_unstable_v1_protocol_c ,
] ,
2019-04-05 17:09:28 +03:00
include_directories : common_inc ,
2016-11-24 18:54:51 +03:00
dependencies : [
dep_libshared ,
dep_wayland_client ,
dep_xkbcommon ,
dependency ( 'wayland-cursor' ) ,
dependency ( 'cairo' )
] ,
install : true ,
install_dir : dir_libexec
)
endif
tools_enabled = get_option ( 'tools' )
tools_list = [
{
'name' : 'calibrator' ,
2019-04-05 13:50:43 +03:00
'sources' : [ 'calibrator.c' ] ,
'deps' : [ dep_toytoolkit , dep_matrix_c ] ,
2016-11-24 18:54:51 +03:00
} ,
{
'name' : 'debug' ,
'sources' : [
'weston-debug.c' ,
weston_debug_client_protocol_h ,
weston_debug_protocol_c ,
] ,
'deps' : [ dep_wayland_client ]
} ,
{
'name' : 'terminal' ,
'sources' : [ 'terminal.c' ] ,
'deps' : [ dep_toytoolkit ] ,
} ,
{
'name' : 'touch-calibrator' ,
'sources' : [
'touch-calibrator.c' ,
weston_touch_calibration_client_protocol_h ,
weston_touch_calibration_protocol_c ,
] ,
2019-04-05 13:50:43 +03:00
'deps' : [ dep_toytoolkit , dep_matrix_c ] ,
2016-11-24 18:54:51 +03:00
} ,
]
foreach t : tools_list
if tools_enabled . contains ( t . get ( 'name' ) )
executable (
'weston-@0@' . format ( t . get ( 'name' ) ) ,
t . get ( 'sources' ) ,
2019-04-05 17:09:28 +03:00
include_directories : common_inc ,
2016-11-24 18:54:51 +03:00
dependencies : t . get ( 'deps' , [ ] ) ,
install : true
)
endif
endforeach
demo_clients = [
{ 'basename' : 'clickdot' } ,
{
'basename' : 'cliptest' ,
2022-02-09 20:17:42 +03:00
'dep_objs' : [ dep_vertex_clipping , dep_matrix_c ]
2016-11-24 18:54:51 +03:00
} ,
{ 'basename' : 'confine' } ,
2019-01-08 15:15:35 +03:00
{
'basename' : 'content_protection' ,
'add_sources' : [
weston_content_protection_client_protocol_h ,
weston_content_protection_protocol_c ,
]
} ,
2016-11-24 18:54:51 +03:00
{ 'basename' : 'dnd' } ,
{
'basename' : 'editor' ,
'add_sources' : [
text_input_unstable_v1_client_protocol_h ,
text_input_unstable_v1_protocol_c ,
] ,
2019-03-22 14:58:30 +03:00
'deps' : [ 'pangocairo' , 'gobject-2.0' ]
2016-11-24 18:54:51 +03:00
} ,
{ 'basename' : 'eventdemo' } ,
{ 'basename' : 'flower' } ,
{
'basename' : 'fullscreen' ,
'add_sources' : [
fullscreen_shell_unstable_v1_client_protocol_h ,
fullscreen_shell_unstable_v1_protocol_c ,
]
} ,
{ 'basename' : 'image' } ,
2021-08-13 23:12:08 +03:00
{
'basename' : 'multi-resource' ,
'add_sources' : [
xdg_shell_client_protocol_h ,
xdg_shell_protocol_c ,
]
} ,
2016-11-24 18:54:51 +03:00
{
'basename' : 'presentation-shm' ,
'add_sources' : [
presentation_time_client_protocol_h ,
presentation_time_protocol_c ,
2019-12-18 13:54:39 +03:00
xdg_shell_client_protocol_h ,
xdg_shell_protocol_c ,
2016-11-24 18:54:51 +03:00
]
} ,
{ 'basename' : 'resizor' } ,
{
'basename' : 'scaler' ,
'add_sources' : [
viewporter_client_protocol_h ,
viewporter_protocol_c ,
]
} ,
{ 'basename' : 'smoke' } ,
{ 'basename' : 'stacking' } ,
{
'basename' : 'subsurfaces' ,
2018-12-14 20:11:51 +03:00
'deps' : [ 'egl' , 'glesv2' , 'wayland-egl' ]
2016-11-24 18:54:51 +03:00
} ,
{ 'basename' : 'transformed' } ,
]
if get_option ( 'demo-clients' )
foreach t : demo_clients
t_name = 'weston-' + t . get ( 'basename' )
t_srcs = [ t . get ( 'basename' ) + '.c' ] + t . get ( 'add_sources' , [ ] )
2019-04-04 16:53:11 +03:00
t_deps = [ dep_toytoolkit , t . get ( 'dep_objs' , [ ] ) ]
2018-12-14 20:11:51 +03:00
foreach depname : t . get ( 'deps' , [ ] )
dep = dependency ( depname , required : false )
if not dep . found ( )
error ( '@0@ requires \'@1@\' which was not found. If you rather not build this, set \'-Ddemo-clients=false\'.' . format ( t_name , depname ) )
endif
t_deps + = dep
endforeach
2016-11-24 18:54:51 +03:00
executable (
t_name , t_srcs ,
2019-04-05 17:09:28 +03:00
include_directories : common_inc ,
2016-11-24 18:54:51 +03:00
dependencies : t_deps ,
install : true
)
endforeach
endif
if get_option ( 'shell-desktop' )
exe_keyboard = executable (
'weston-keyboard' ,
'keyboard.c' ,
text_input_unstable_v1_client_protocol_h ,
text_input_unstable_v1_protocol_c ,
input_method_unstable_v1_client_protocol_h ,
input_method_unstable_v1_protocol_c ,
2019-04-05 17:09:28 +03:00
include_directories : common_inc ,
2016-11-24 18:54:51 +03:00
dependencies : dep_toytoolkit ,
install_dir : get_option ( 'libexecdir' ) ,
install : true
)
env_modmap + = 'weston-keyboard=@0@;' . format ( exe_keyboard . full_path ( ) )
2022-10-21 12:36:18 +03:00
exe_shell_desktop = executable (
'weston-desktop-shell' ,
'desktop-shell.c' ,
weston_desktop_shell_client_protocol_h ,
weston_desktop_shell_protocol_c ,
include_directories : common_inc ,
dependencies : dep_toytoolkit ,
install_dir : get_option ( 'libexecdir' ) ,
install : true
)
env_modmap + = 'weston-desktop-shell=@0@;' . format ( exe_shell_desktop . full_path ( ) )
endif
2019-12-09 14:30:13 +03:00
if get_option ( 'shell-desktop' ) or get_option ( 'shell-fullscreen' ) or get_option ( 'shell-kiosk' ) or get_option ( 'shell-ivi' )
2016-11-24 18:54:51 +03:00
exe_shooter = executable (
'weston-screenshooter' ,
'screenshot.c' ,
clients: rewrite screenshot.c for new protocol
The functionality of this screenshooting helper client is kept exactly
the same as before: if you have multiple outputs, some transformed, some
scale, in any layout, this will create a "multi-image" where the
framebuffer (the physical image) of each output is pasted into a row of
images in the order the outputs were advertised thrugh wl_registry.
Output transform or scale are not accounted for. If you have a monitor
rotated sideways, the screenshot will have the image of that monitor
reverse-sideways.
Otherwise the client is almost completely re-written, so trying to read
the diff is not that useful.
The old screenshooting protocol is replaced with the new
weston-output-capture protocol. This makes it unnecessary to listen for
wl_output information (since we do not handle output transform or scale
anyway).
The buffer sizes and formats are dictated by the compositor, which also
means we cannot hardcode the format. Hence, use Pixman for the blitting,
in case it needs to do format conversion. It is good to get rid of
hand-crafted pixel data manipulation code too.
For that reason we also need a pixel format database to convert between
DRM fourcc, wl_shm and Pixman codes. We link to libweston to borrow its
database instead of inventing another partial copy of it. It's weird to
use compositor library private API in a client, but better than the
alternative.
The original code had no tear-down code at all. Now, if everything
succeeds, the program ends with no unfreed memory according to ASan. If
something fails, it still YOLO's it (doesn't free stuff). That's how far
my pedantry carried.
I also did not bother taking output transform or scale into account,
since the old code did not either. It would be nice to create a seamless
image of the desktop with shots rotated and scaled to align, in the max
scale over all outputs. Meh.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-10-04 13:31:27 +03:00
weston_output_capture_client_protocol_h ,
weston_output_capture_protocol_c ,
2019-04-05 17:09:28 +03:00
include_directories : common_inc ,
clients: rewrite screenshot.c for new protocol
The functionality of this screenshooting helper client is kept exactly
the same as before: if you have multiple outputs, some transformed, some
scale, in any layout, this will create a "multi-image" where the
framebuffer (the physical image) of each output is pasted into a row of
images in the order the outputs were advertised thrugh wl_registry.
Output transform or scale are not accounted for. If you have a monitor
rotated sideways, the screenshot will have the image of that monitor
reverse-sideways.
Otherwise the client is almost completely re-written, so trying to read
the diff is not that useful.
The old screenshooting protocol is replaced with the new
weston-output-capture protocol. This makes it unnecessary to listen for
wl_output information (since we do not handle output transform or scale
anyway).
The buffer sizes and formats are dictated by the compositor, which also
means we cannot hardcode the format. Hence, use Pixman for the blitting,
in case it needs to do format conversion. It is good to get rid of
hand-crafted pixel data manipulation code too.
For that reason we also need a pixel format database to convert between
DRM fourcc, wl_shm and Pixman codes. We link to libweston to borrow its
database instead of inventing another partial copy of it. It's weird to
use compositor library private API in a client, but better than the
alternative.
The original code had no tear-down code at all. Now, if everything
succeeds, the program ends with no unfreed memory according to ASan. If
something fails, it still YOLO's it (doesn't free stuff). That's how far
my pedantry carried.
I also did not bother taking output transform or scale into account,
since the old code did not either. It would be nice to create a seamless
image of the desktop with shots rotated and scaled to align, in the max
scale over all outputs. Meh.
Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.com>
2022-10-04 13:31:27 +03:00
dependencies : [
dep_toytoolkit ,
dep_libweston_private , # for pixel-formats.h
dep_pixman ,
] ,
2018-12-15 16:57:19 +03:00
install_dir : get_option ( 'bindir' ) ,
2016-11-24 18:54:51 +03:00
install : true
)
env_modmap + = 'weston-screenshooter=@0@;' . format ( exe_shooter . full_path ( ) )
endif
if get_option ( 'shell-ivi' )
exe_shell_ivi_ui = executable (
'weston-ivi-shell-user-interface' ,
'ivi-shell-user-interface.c' ,
ivi_hmi_controller_client_protocol_h ,
ivi_hmi_controller_protocol_c ,
ivi_application_client_protocol_h ,
ivi_application_protocol_c ,
2019-04-05 17:09:28 +03:00
include_directories : common_inc ,
2016-11-24 18:54:51 +03:00
dependencies : dep_toytoolkit ,
install : true ,
install_dir : get_option ( 'libexecdir' )
)
env_modmap + = 'weston-ivi-shell-user-interface=@0@;' . format ( exe_shell_ivi_ui . full_path ( ) )
endif