Move shell-utils to its own directory

shell-utils contains a number of helpers which are currently in use by
both desktop-shell and kiosk-shell. In order to extend this use to
fullscreen-shell as well (which can benefit from reusing the
weston_curtain infrastructure to be able to create solid-colour views
which may or may not be opaque, as well as one function within
fullscreen-shell which was copied wholesale to shell-utils), we need to
create a separate Meson dependency object, and avoid the existing
pattern of including the source from shared/ within the source list for
each shell.

This requires creating a new top-level directory for these shared helper
functions which are required by each shell, but are not part of
libweston in and of itself.

shell-utils depends on libweston-desktop; libweston-desktop depends on
libweston; libweston depends on shared.

Thus it is not possible to expose a dependency object from the shared/
directory which declares a dependency on the libweston-desktop
dependency, as Meson processes directories in order and resolves
variable references as they are parsed.

In order to break this deadlock, this commit creates a new top-level
directory called 'shell-utils' containing only this file, which can be
parsed by Meson after libweston-desktop (making the libweston-desktop
Meson dependency variable available to the build file to declare a
dependency on that), but before the shells (making the new Meson
depenendency object available to each shell which wishes to use it).

This commit contains no functional changes to any observable code.

Signed-off-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
Daniel Stone 2022-02-23 13:24:49 +00:00
parent 15a553053a
commit 6cb2526b67
10 changed files with 13 additions and 8 deletions

View File

@ -5,7 +5,6 @@ if get_option('shell-desktop')
'shell.c',
'exposay.c',
'input-panel.c',
'../shared/shell-utils.c',
weston_desktop_shell_server_protocol_h,
weston_desktop_shell_protocol_c,
input_method_unstable_v1_server_protocol_h,
@ -17,6 +16,7 @@ if get_option('shell-desktop')
dep_libshared,
dep_lib_desktop,
dep_libweston_public,
dep_shell_utils,
]
plugin_shell_desktop = shared_library(
'desktop-shell',

View File

@ -41,8 +41,8 @@
#include "weston-desktop-shell-server-protocol.h"
#include <libweston/config-parser.h>
#include "shared/helpers.h"
#include "shared/shell-utils.h"
#include "shared/timespec-util.h"
#include "shell-utils.h"
#include <libweston-desktop/libweston-desktop.h>
#define DEFAULT_NUM_WORKSPACES 1

View File

@ -33,7 +33,7 @@
#include "kiosk-shell-grab.h"
#include "compositor/weston.h"
#include "shared/helpers.h"
#include "shared/shell-utils.h"
#include "shell-utils.h"
#include <libweston/xwayland-api.h>

View File

@ -2,7 +2,6 @@ if get_option('shell-kiosk')
srcs_shell_kiosk = [
'kiosk-shell.c',
'kiosk-shell-grab.c',
'../shared/shell-utils.c',
weston_desktop_shell_server_protocol_h,
weston_desktop_shell_protocol_c,
input_method_unstable_v1_server_protocol_h,
@ -14,6 +13,7 @@ if get_option('shell-kiosk')
dep_libshared,
dep_lib_desktop,
dep_libweston_public,
dep_shell_utils,
]
plugin_shell_kiosk = shared_library(
'kiosk-shell',

View File

@ -171,6 +171,7 @@ subdir('libweston')
subdir('libweston-desktop')
subdir('xwayland')
subdir('compositor')
subdir('shell-utils')
subdir('desktop-shell')
subdir('fullscreen-shell')
subdir('ivi-shell')

5
shell-utils/meson.build Normal file
View File

@ -0,0 +1,5 @@
dep_shell_utils = declare_dependency(
sources: 'shell-utils.c',
include_directories: include_directories('.'),
dependencies: dep_lib_desktop
)

View File

@ -25,7 +25,7 @@
*/
#include "config.h"
#include "shared/shell-utils.h"
#include "shell-utils.h"
#include <libweston-desktop/libweston-desktop.h>
struct weston_output *

View File

@ -217,9 +217,8 @@ tests = [
{ 'name': 'safe-signal-output-removal',
'sources': [
'safe-signal-output-removal-test.c',
'../shared/shell-utils.c',
],
'dep_objs': [ dep_lib_desktop ]
'dep_objs': [ dep_lib_desktop, dep_shell_utils ]
},
]

View File

@ -30,7 +30,7 @@
#include <stdio.h>
#include "../shared/signal.h"
#include "../shared/shell-utils.h"
#include "shell-utils.h"
#include "weston-test-client-helper.h"
#include "weston-test-fixture-compositor.h"