shell-utils: Integrate shell-utils into libweston
These shell utils functions are potentially useful to other shells as well, so make them widely available. Renamed all functions to weston_shell_utils namespace. No functional change, copied ad litteram. Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This commit is contained in:
parent
68cad4db42
commit
19d32da742
|
@ -76,7 +76,6 @@ if get_option('screenshare')
|
|||
deps_screenshare = [
|
||||
dep_libexec_weston,
|
||||
dep_libshared,
|
||||
dep_shell_utils,
|
||||
dep_libweston_public,
|
||||
dep_libweston_private_h, # XXX: https://gitlab.freedesktop.org/wayland/weston/issues/292
|
||||
dep_wayland_client,
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
#include "shared/helpers.h"
|
||||
#include "shared/os-compatibility.h"
|
||||
#include "shared/timespec-util.h"
|
||||
#include "shell-utils/shell-utils.h"
|
||||
#include <libweston/shell-utils.h>
|
||||
#include "fullscreen-shell-unstable-v1-client-protocol.h"
|
||||
|
||||
struct shared_output {
|
||||
|
@ -1165,9 +1165,9 @@ share_output_binding(struct weston_keyboard *keyboard,
|
|||
wl_fixed_to_int(pointer->x),
|
||||
wl_fixed_to_int(pointer->y));
|
||||
} else {
|
||||
output = get_focused_output(keyboard->seat->compositor);
|
||||
output = weston_shell_utils_get_focused_output(keyboard->seat->compositor);
|
||||
if (!output)
|
||||
output = get_default_output(keyboard->seat->compositor);
|
||||
output = weston_shell_utils_get_default_output(keyboard->seat->compositor);
|
||||
}
|
||||
|
||||
if (!output) {
|
||||
|
|
|
@ -14,7 +14,6 @@ if get_option('shell-desktop')
|
|||
dep_libexec_weston,
|
||||
dep_libshared,
|
||||
dep_libweston_public,
|
||||
dep_shell_utils,
|
||||
]
|
||||
plugin_shell_desktop = shared_library(
|
||||
'desktop-shell',
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#include <libweston/config-parser.h>
|
||||
#include "shared/helpers.h"
|
||||
#include "shared/timespec-util.h"
|
||||
#include "shell-utils.h"
|
||||
#include <libweston/shell-utils.h>
|
||||
#include <libweston/desktop.h>
|
||||
|
||||
#define DEFAULT_NUM_WORKSPACES 1
|
||||
|
@ -262,7 +262,7 @@ desktop_shell_destroy_surface(struct shell_surface *shsurf)
|
|||
struct shell_surface *shsurf_child, *tmp;
|
||||
|
||||
if (shsurf->fullscreen.black_view)
|
||||
weston_curtain_destroy(shsurf->fullscreen.black_view);
|
||||
weston_shell_utils_curtain_destroy(shsurf->fullscreen.black_view);
|
||||
|
||||
wl_list_for_each_safe(shsurf_child, tmp, &shsurf->children_list, children_link) {
|
||||
wl_list_remove(&shsurf_child->children_link);
|
||||
|
@ -535,7 +535,7 @@ create_focus_surface(struct weston_compositor *ec,
|
|||
|
||||
curtain_params.surface_private = fsurf;
|
||||
|
||||
fsurf->curtain = weston_curtain_create(ec, &curtain_params);
|
||||
fsurf->curtain = weston_shell_utils_curtain_create(ec, &curtain_params);
|
||||
weston_view_set_output(fsurf->curtain->view, output);
|
||||
fsurf->curtain->view->is_mapped = true;
|
||||
|
||||
|
@ -545,7 +545,7 @@ create_focus_surface(struct weston_compositor *ec,
|
|||
static void
|
||||
focus_surface_destroy(struct focus_surface *fsurf)
|
||||
{
|
||||
weston_curtain_destroy(fsurf->curtain);
|
||||
weston_shell_utils_curtain_destroy(fsurf->curtain);
|
||||
free(fsurf);
|
||||
}
|
||||
|
||||
|
@ -753,7 +753,7 @@ animate_focus_change(struct desktop_shell *shell, struct workspace *ws,
|
|||
if (from == to || shell->focus_animation_type != ANIMATION_DIM_LAYER)
|
||||
return;
|
||||
|
||||
output = get_default_output(shell->compositor);
|
||||
output = weston_shell_utils_get_default_output(shell->compositor);
|
||||
if (ws->fsurf_front == NULL && (from || to)) {
|
||||
ws->fsurf_front = create_focus_surface(shell->compositor, output);
|
||||
if (ws->fsurf_front == NULL)
|
||||
|
@ -1468,7 +1468,7 @@ shell_surface_set_output(struct shell_surface *shsurf,
|
|||
else if (es->output)
|
||||
shsurf->output = es->output;
|
||||
else
|
||||
shsurf->output = get_default_output(es->compositor);
|
||||
shsurf->output = weston_shell_utils_get_default_output(es->compositor);
|
||||
|
||||
if (shsurf->output_destroy_listener.notify) {
|
||||
wl_list_remove(&shsurf->output_destroy_listener.link);
|
||||
|
@ -1495,7 +1495,7 @@ unset_fullscreen(struct shell_surface *shsurf)
|
|||
wl_list_init(&shsurf->fullscreen.transform.link);
|
||||
|
||||
if (shsurf->fullscreen.black_view)
|
||||
weston_curtain_destroy(shsurf->fullscreen.black_view);
|
||||
weston_shell_utils_curtain_destroy(shsurf->fullscreen.black_view);
|
||||
shsurf->fullscreen.black_view = NULL;
|
||||
|
||||
if (shsurf->saved_position_valid)
|
||||
|
@ -1522,7 +1522,8 @@ unset_maximized(struct shell_surface *shsurf)
|
|||
weston_desktop_surface_get_surface(shsurf->desktop_surface);
|
||||
|
||||
/* undo all maximized things here */
|
||||
shell_surface_set_output(shsurf, get_default_output(surface->compositor));
|
||||
shell_surface_set_output(shsurf,
|
||||
weston_shell_utils_get_default_output(surface->compositor));
|
||||
|
||||
if (shsurf->saved_position_valid)
|
||||
weston_view_set_position(shsurf->view,
|
||||
|
@ -1648,7 +1649,7 @@ shell_ensure_fullscreen_black_view(struct shell_surface *shsurf)
|
|||
|
||||
if (!shsurf->fullscreen.black_view) {
|
||||
shsurf->fullscreen.black_view =
|
||||
weston_curtain_create(ec, &curtain_params);
|
||||
weston_shell_utils_curtain_create(ec, &curtain_params);
|
||||
}
|
||||
view = shsurf->fullscreen.black_view->view;
|
||||
|
||||
|
@ -1686,11 +1687,11 @@ shell_configure_fullscreen(struct shell_surface *shsurf)
|
|||
|
||||
shell_ensure_fullscreen_black_view(shsurf);
|
||||
|
||||
surface_subsurfaces_boundingbox(surface, &surf_x, &surf_y,
|
||||
weston_shell_utils_subsurfaces_boundingbox(surface, &surf_x, &surf_y,
|
||||
&surf_width, &surf_height);
|
||||
|
||||
if (weston_surface_has_content(surface))
|
||||
center_on_output(shsurf->view, shsurf->fullscreen_output);
|
||||
weston_shell_utils_center_on_output(shsurf->view, shsurf->fullscreen_output);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1851,7 +1852,7 @@ desktop_surface_added(struct weston_desktop_surface *desktop_surface,
|
|||
return;
|
||||
}
|
||||
|
||||
weston_surface_set_label_func(surface, surface_get_label);
|
||||
weston_surface_set_label_func(surface, weston_shell_utils_surface_get_label);
|
||||
|
||||
shsurf->shell = (struct desktop_shell *) shell;
|
||||
shsurf->unresponsive = 0;
|
||||
|
@ -1863,7 +1864,7 @@ desktop_surface_added(struct weston_desktop_surface *desktop_surface,
|
|||
wl_list_init(&shsurf->fullscreen.transform.link);
|
||||
|
||||
shell_surface_set_output(
|
||||
shsurf, get_default_output(shsurf->shell->compositor));
|
||||
shsurf, weston_shell_utils_get_default_output(shsurf->shell->compositor));
|
||||
|
||||
wl_signal_init(&shsurf->destroy_signal);
|
||||
|
||||
|
@ -1907,7 +1908,7 @@ desktop_surface_removed(struct weston_desktop_surface *desktop_surface,
|
|||
}
|
||||
|
||||
if (shsurf->fullscreen.black_view) {
|
||||
weston_curtain_destroy(shsurf->fullscreen.black_view);
|
||||
weston_shell_utils_curtain_destroy(shsurf->fullscreen.black_view);
|
||||
shsurf->fullscreen.black_view = NULL;
|
||||
}
|
||||
|
||||
|
@ -1996,7 +1997,8 @@ map(struct desktop_shell *shell, struct shell_surface *shsurf)
|
|||
|
||||
/* initial positioning, see also configure() */
|
||||
if (shsurf->state.fullscreen) {
|
||||
center_on_output(shsurf->view, shsurf->fullscreen_output);
|
||||
weston_shell_utils_center_on_output(shsurf->view,
|
||||
shsurf->fullscreen_output);
|
||||
shell_map_fullscreen(shsurf);
|
||||
} else if (shsurf->state.maximized) {
|
||||
set_maximized_position(shell, shsurf);
|
||||
|
@ -2169,7 +2171,7 @@ set_fullscreen(struct shell_surface *shsurf, bool fullscreen,
|
|||
/* handle clients launching in fullscreen */
|
||||
if (output == NULL && !weston_surface_is_mapped(surface)) {
|
||||
/* Set the output to the one that has focus currently. */
|
||||
output = get_focused_output(surface->compositor);
|
||||
output = weston_shell_utils_get_focused_output(surface->compositor);
|
||||
}
|
||||
|
||||
shell_surface_set_output(shsurf, output);
|
||||
|
@ -2294,7 +2296,7 @@ set_maximized(struct shell_surface *shsurf, bool maximized)
|
|||
struct weston_output *output;
|
||||
|
||||
if (!weston_surface_is_mapped(surface))
|
||||
output = get_focused_output(surface->compositor);
|
||||
output = weston_shell_utils_get_focused_output(surface->compositor);
|
||||
else
|
||||
output = surface->output;
|
||||
|
||||
|
@ -2719,7 +2721,8 @@ lock_surface_committed(struct weston_surface *surface, int32_t sx, int32_t sy)
|
|||
if (surface->width == 0)
|
||||
return;
|
||||
|
||||
center_on_output(view, get_default_output(shell->compositor));
|
||||
weston_shell_utils_center_on_output(view,
|
||||
weston_shell_utils_get_default_output(shell->compositor));
|
||||
|
||||
if (!weston_surface_is_mapped(surface)) {
|
||||
weston_layer_entry_insert(&shell->lock_layer.view_list,
|
||||
|
@ -3548,7 +3551,7 @@ shell_fade_done_for_output(struct weston_view_animation *animation, void *data)
|
|||
shell_output->fade.animation = NULL;
|
||||
switch (shell_output->fade.type) {
|
||||
case FADE_IN:
|
||||
weston_curtain_destroy(shell_output->fade.curtain);
|
||||
weston_shell_utils_curtain_destroy(shell_output->fade.curtain);
|
||||
shell_output->fade.curtain = NULL;
|
||||
break;
|
||||
case FADE_OUT:
|
||||
|
@ -3586,7 +3589,7 @@ shell_fade_create_view_for_output(struct desktop_shell *shell,
|
|||
};
|
||||
struct weston_curtain *curtain;
|
||||
|
||||
curtain = weston_curtain_create(compositor, &curtain_params);
|
||||
curtain = weston_shell_utils_curtain_create(compositor, &curtain_params);
|
||||
assert(curtain);
|
||||
|
||||
weston_view_set_output(curtain->view, output);
|
||||
|
@ -3611,7 +3614,7 @@ shell_fade_create_fade_out_view(struct shell_surface *shsurf,
|
|||
if (!view)
|
||||
return NULL;
|
||||
|
||||
woutput = get_focused_output(surface->compositor);
|
||||
woutput = weston_shell_utils_get_focused_output(surface->compositor);
|
||||
/* set the initial position and output just in case we happen to not
|
||||
* move it around and just destroy it */
|
||||
weston_view_set_output(view, woutput);
|
||||
|
@ -3661,7 +3664,7 @@ shell_fade(struct desktop_shell *shell, enum fade_type type)
|
|||
* happens when you close the last window under the
|
||||
* X11 or Wayland backends. */
|
||||
shell->locked = false;
|
||||
weston_curtain_destroy(shell_output->fade.curtain);
|
||||
weston_shell_utils_curtain_destroy(shell_output->fade.curtain);
|
||||
shell_output->fade.curtain = NULL;
|
||||
} else if (shell_output->fade.animation) {
|
||||
weston_fade_update(shell_output->fade.animation, tint);
|
||||
|
@ -3687,7 +3690,7 @@ do_shell_fade_startup(void *data)
|
|||
"unexpected fade-in animation type %d\n",
|
||||
shell->startup_animation_type);
|
||||
wl_list_for_each(shell_output, &shell->output_list, link) {
|
||||
weston_curtain_destroy(shell_output->fade.curtain);
|
||||
weston_shell_utils_curtain_destroy(shell_output->fade.curtain);
|
||||
shell_output->fade.curtain = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -4190,7 +4193,7 @@ backlight_binding(struct weston_keyboard *keyboard, const struct timespec *time,
|
|||
* control on the primary display. We'd have to extend later if we
|
||||
* ever get support for setting backlights on random desktop LCD
|
||||
* panels though */
|
||||
output = get_default_output(compositor);
|
||||
output = weston_shell_utils_get_default_output(compositor);
|
||||
if (!output)
|
||||
return;
|
||||
|
||||
|
@ -4323,7 +4326,7 @@ shell_output_destroy(struct shell_output *shell_output)
|
|||
}
|
||||
|
||||
if (shell_output->fade.curtain)
|
||||
weston_curtain_destroy(shell_output->fade.curtain);
|
||||
weston_shell_utils_curtain_destroy(shell_output->fade.curtain);
|
||||
|
||||
if (shell_output->fade.startup_timer)
|
||||
wl_event_source_remove(shell_output->fade.startup_timer);
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
#include "compositor/weston.h"
|
||||
#include "fullscreen-shell-unstable-v1-server-protocol.h"
|
||||
#include "shared/helpers.h"
|
||||
#include "shell-utils.h"
|
||||
#include <libweston/shell-utils.h>
|
||||
|
||||
struct fullscreen_shell {
|
||||
struct wl_client *client;
|
||||
|
@ -241,7 +241,7 @@ create_curtain(struct weston_compositor *ec, struct fs_output *fsout,
|
|||
};
|
||||
struct weston_curtain *curtain;
|
||||
|
||||
curtain = weston_curtain_create(ec, &curtain_params);
|
||||
curtain = weston_shell_utils_curtain_create(ec, &curtain_params);
|
||||
if (!curtain) {
|
||||
weston_log("no memory\n");
|
||||
return NULL;
|
||||
|
@ -371,7 +371,7 @@ fs_output_scale_view(struct fs_output *fsout, float width, float height)
|
|||
struct weston_view *view = fsout->view;
|
||||
struct weston_output *output = fsout->output;
|
||||
|
||||
surface_subsurfaces_boundingbox(view->surface, &surf_x, &surf_y,
|
||||
weston_shell_utils_subsurfaces_boundingbox(view->surface, &surf_x, &surf_y,
|
||||
&surf_width, &surf_height);
|
||||
|
||||
if (output->width == surf_width && output->height == surf_height) {
|
||||
|
@ -416,7 +416,7 @@ fs_output_configure_simple(struct fs_output *fsout,
|
|||
wl_list_remove(&fsout->transform.link);
|
||||
wl_list_init(&fsout->transform.link);
|
||||
|
||||
surface_subsurfaces_boundingbox(fsout->view->surface,
|
||||
weston_shell_utils_subsurfaces_boundingbox(fsout->view->surface,
|
||||
&surf_x, &surf_y,
|
||||
&surf_width, &surf_height);
|
||||
|
||||
|
@ -426,7 +426,7 @@ fs_output_configure_simple(struct fs_output *fsout,
|
|||
switch (fsout->method) {
|
||||
case ZWP_FULLSCREEN_SHELL_V1_PRESENT_METHOD_DEFAULT:
|
||||
case ZWP_FULLSCREEN_SHELL_V1_PRESENT_METHOD_CENTER:
|
||||
center_on_output(fsout->view, fsout->output);
|
||||
weston_shell_utils_center_on_output(fsout->view, fsout->output);
|
||||
break;
|
||||
|
||||
case ZWP_FULLSCREEN_SHELL_V1_PRESENT_METHOD_ZOOM:
|
||||
|
@ -477,12 +477,12 @@ fs_output_configure_for_mode(struct fs_output *fsout,
|
|||
if (fsout->pending.surface != configured_surface) {
|
||||
/* Nothing to really reconfigure. We'll just recenter the
|
||||
* view in case they played with subsurfaces */
|
||||
center_on_output(fsout->view, fsout->output);
|
||||
weston_shell_utils_center_on_output(fsout->view, fsout->output);
|
||||
return;
|
||||
}
|
||||
|
||||
/* We have a pending surface */
|
||||
surface_subsurfaces_boundingbox(fsout->pending.surface,
|
||||
weston_shell_utils_subsurfaces_boundingbox(fsout->pending.surface,
|
||||
&surf_x, &surf_y,
|
||||
&surf_width, &surf_height);
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ if get_option('shell-fullscreen')
|
|||
deps_shell_fullscreen = [
|
||||
dep_libweston_public,
|
||||
dep_libexec_weston,
|
||||
dep_shell_utils,
|
||||
]
|
||||
shared_library(
|
||||
'fullscreen-shell',
|
||||
|
|
|
@ -45,27 +45,30 @@ struct weston_curtain {
|
|||
};
|
||||
|
||||
struct weston_output *
|
||||
get_default_output(struct weston_compositor *compositor);
|
||||
weston_shell_utils_get_default_output(struct weston_compositor *compositor);
|
||||
|
||||
struct weston_output *
|
||||
get_focused_output(struct weston_compositor *compositor);
|
||||
weston_shell_utils_get_focused_output(struct weston_compositor *compositor);
|
||||
|
||||
void
|
||||
center_on_output(struct weston_view *view, struct weston_output *output);
|
||||
weston_shell_utils_center_on_output(struct weston_view *view,
|
||||
struct weston_output *output);
|
||||
|
||||
void
|
||||
surface_subsurfaces_boundingbox(struct weston_surface *surface, int32_t *x,
|
||||
int32_t *y, int32_t *w, int32_t *h);
|
||||
weston_shell_utils_subsurfaces_boundingbox(struct weston_surface *surface,
|
||||
int32_t *x, int32_t *y,
|
||||
int32_t *w, int32_t *h);
|
||||
|
||||
int
|
||||
surface_get_label(struct weston_surface *surface, char *buf, size_t len);
|
||||
weston_shell_utils_surface_get_label(struct weston_surface *surface,
|
||||
char *buf, size_t len);
|
||||
|
||||
/* helper to create a view w/ a color */
|
||||
struct weston_curtain *
|
||||
weston_curtain_create(struct weston_compositor *compositor,
|
||||
weston_shell_utils_curtain_create(struct weston_compositor *compositor,
|
||||
struct weston_curtain_params *params);
|
||||
void
|
||||
weston_curtain_destroy(struct weston_curtain *curtain);
|
||||
weston_shell_utils_curtain_destroy(struct weston_curtain *curtain);
|
||||
|
||||
uint32_t
|
||||
weston_shell_get_binding_modifier(struct weston_config *config, uint32_t default_mod);
|
|
@ -33,7 +33,7 @@
|
|||
#include "kiosk-shell-grab.h"
|
||||
#include "compositor/weston.h"
|
||||
#include "shared/helpers.h"
|
||||
#include "shell-utils.h"
|
||||
#include <libweston/shell-utils.h>
|
||||
|
||||
#include <libweston/xwayland-api.h>
|
||||
|
||||
|
@ -185,11 +185,11 @@ kiosk_shell_surface_find_best_output(struct kiosk_shell_surface *shsurf)
|
|||
if (root->output)
|
||||
return root->output;
|
||||
|
||||
output = get_focused_output(shsurf->shell->compositor);
|
||||
output = weston_shell_utils_get_focused_output(shsurf->shell->compositor);
|
||||
if (output)
|
||||
return output;
|
||||
|
||||
output = get_default_output(shsurf->shell->compositor);
|
||||
output = weston_shell_utils_get_default_output(shsurf->shell->compositor);
|
||||
if (output)
|
||||
return output;
|
||||
|
||||
|
@ -299,7 +299,7 @@ kiosk_shell_surface_reconfigure_for_output(struct kiosk_shell_surface *shsurf)
|
|||
shsurf->output->height);
|
||||
}
|
||||
|
||||
center_on_output(shsurf->view, shsurf->output);
|
||||
weston_shell_utils_center_on_output(shsurf->view, shsurf->output);
|
||||
weston_view_update_transform(shsurf->view);
|
||||
}
|
||||
|
||||
|
@ -488,7 +488,7 @@ kiosk_shell_output_recreate_background(struct kiosk_shell_output *shoutput)
|
|||
struct weston_curtain_params curtain_params = {};
|
||||
|
||||
if (shoutput->curtain)
|
||||
weston_curtain_destroy(shoutput->curtain);
|
||||
weston_shell_utils_curtain_destroy(shoutput->curtain);
|
||||
|
||||
if (!output)
|
||||
return;
|
||||
|
@ -515,7 +515,7 @@ kiosk_shell_output_recreate_background(struct kiosk_shell_output *shoutput)
|
|||
curtain_params.surface_committed = NULL;
|
||||
curtain_params.surface_private = NULL;
|
||||
|
||||
shoutput->curtain = weston_curtain_create(ec, &curtain_params);
|
||||
shoutput->curtain = weston_shell_utils_curtain_create(ec, &curtain_params);
|
||||
|
||||
weston_surface_set_role(shoutput->curtain->view->surface,
|
||||
"kiosk-shell-background", NULL, 0);
|
||||
|
@ -535,7 +535,7 @@ kiosk_shell_output_destroy(struct kiosk_shell_output *shoutput)
|
|||
shoutput->output_destroy_listener.notify = NULL;
|
||||
|
||||
if (shoutput->curtain)
|
||||
weston_curtain_destroy(shoutput->curtain);
|
||||
weston_shell_utils_curtain_destroy(shoutput->curtain);
|
||||
|
||||
wl_list_remove(&shoutput->output_destroy_listener.link);
|
||||
wl_list_remove(&shoutput->link);
|
||||
|
@ -636,7 +636,7 @@ desktop_surface_added(struct weston_desktop_surface *desktop_surface,
|
|||
if (!shsurf)
|
||||
return;
|
||||
|
||||
weston_surface_set_label_func(surface, surface_get_label);
|
||||
weston_surface_set_label_func(surface, weston_shell_utils_surface_get_label);
|
||||
kiosk_shell_surface_set_fullscreen(shsurf, NULL);
|
||||
}
|
||||
|
||||
|
@ -780,7 +780,8 @@ desktop_surface_committed(struct weston_desktop_surface *desktop_surface,
|
|||
|
||||
if (!weston_surface_is_mapped(surface) || (is_resized && is_fullscreen)) {
|
||||
if (is_fullscreen || !shsurf->xwayland.is_set) {
|
||||
center_on_output(shsurf->view, shsurf->output);
|
||||
weston_shell_utils_center_on_output(shsurf->view,
|
||||
shsurf->output);
|
||||
} else {
|
||||
struct weston_geometry geometry =
|
||||
weston_desktop_surface_get_geometry(desktop_surface);
|
||||
|
|
|
@ -10,7 +10,6 @@ if get_option('shell-kiosk')
|
|||
dep_libexec_weston,
|
||||
dep_libshared,
|
||||
dep_libweston_public,
|
||||
dep_shell_utils,
|
||||
]
|
||||
plugin_shell_kiosk = shared_library(
|
||||
'kiosk-shell',
|
||||
|
|
|
@ -74,6 +74,7 @@ srcs_libweston = [
|
|||
]
|
||||
|
||||
subdir('desktop')
|
||||
subdir('shell-utils')
|
||||
|
||||
if get_option('renderer-gl')
|
||||
dep_egl = dependency('egl', required: false)
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
srcs_libweston += files([
|
||||
'shell-utils.c',
|
||||
])
|
|
@ -25,11 +25,11 @@
|
|||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "shell-utils.h"
|
||||
#include <libweston/shell-utils.h>
|
||||
#include <libweston/desktop.h>
|
||||
|
||||
struct weston_output *
|
||||
get_default_output(struct weston_compositor *compositor)
|
||||
WL_EXPORT struct weston_output *
|
||||
weston_shell_utils_get_default_output(struct weston_compositor *compositor)
|
||||
{
|
||||
if (wl_list_empty(&compositor->output_list))
|
||||
return NULL;
|
||||
|
@ -38,8 +38,8 @@ get_default_output(struct weston_compositor *compositor)
|
|||
struct weston_output, link);
|
||||
}
|
||||
|
||||
struct weston_output *
|
||||
get_focused_output(struct weston_compositor *compositor)
|
||||
WL_EXPORT struct weston_output *
|
||||
weston_shell_utils_get_focused_output(struct weston_compositor *compositor)
|
||||
{
|
||||
struct weston_seat *seat;
|
||||
struct weston_output *output = NULL;
|
||||
|
@ -70,9 +70,10 @@ get_focused_output(struct weston_compositor *compositor)
|
|||
}
|
||||
|
||||
/* TODO: Fix this function to take into account nested subsurfaces. */
|
||||
void
|
||||
surface_subsurfaces_boundingbox(struct weston_surface *surface, int32_t *x,
|
||||
int32_t *y, int32_t *w, int32_t *h)
|
||||
WL_EXPORT void
|
||||
weston_shell_utils_subsurfaces_boundingbox(struct weston_surface *surface,
|
||||
int32_t *x, int32_t *y,
|
||||
int32_t *w, int32_t *h)
|
||||
{
|
||||
pixman_region32_t region;
|
||||
pixman_box32_t *box;
|
||||
|
@ -103,8 +104,9 @@ surface_subsurfaces_boundingbox(struct weston_surface *surface, int32_t *x,
|
|||
pixman_region32_fini(®ion);
|
||||
}
|
||||
|
||||
void
|
||||
center_on_output(struct weston_view *view, struct weston_output *output)
|
||||
WL_EXPORT void
|
||||
weston_shell_utils_center_on_output(struct weston_view *view,
|
||||
struct weston_output *output)
|
||||
{
|
||||
int32_t surf_x, surf_y, width, height;
|
||||
float x, y;
|
||||
|
@ -114,7 +116,8 @@ center_on_output(struct weston_view *view, struct weston_output *output)
|
|||
return;
|
||||
}
|
||||
|
||||
surface_subsurfaces_boundingbox(view->surface, &surf_x, &surf_y, &width, &height);
|
||||
weston_shell_utils_subsurfaces_boundingbox(view->surface, &surf_x,
|
||||
&surf_y, &width, &height);
|
||||
|
||||
x = output->x + (output->width - width) / 2 - surf_x / 2;
|
||||
y = output->y + (output->height - height) / 2 - surf_y / 2;
|
||||
|
@ -122,8 +125,9 @@ center_on_output(struct weston_view *view, struct weston_output *output)
|
|||
weston_view_set_position(view, x, y);
|
||||
}
|
||||
|
||||
int
|
||||
surface_get_label(struct weston_surface *surface, char *buf, size_t len)
|
||||
WL_EXPORT int
|
||||
weston_shell_utils_surface_get_label(struct weston_surface *surface,
|
||||
char *buf, size_t len)
|
||||
{
|
||||
const char *t, *c;
|
||||
struct weston_desktop_surface *desktop_surface =
|
||||
|
@ -138,8 +142,8 @@ surface_get_label(struct weston_surface *surface, char *buf, size_t len)
|
|||
c ? " of " : "", c ?: "");
|
||||
}
|
||||
|
||||
struct weston_curtain *
|
||||
weston_curtain_create(struct weston_compositor *compositor,
|
||||
WL_EXPORT struct weston_curtain *
|
||||
weston_shell_utils_curtain_create(struct weston_compositor *compositor,
|
||||
struct weston_curtain_params *params)
|
||||
{
|
||||
struct weston_curtain *curtain;
|
||||
|
@ -202,8 +206,8 @@ err:
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
weston_curtain_destroy(struct weston_curtain *curtain)
|
||||
WL_EXPORT void
|
||||
weston_shell_utils_curtain_destroy(struct weston_curtain *curtain)
|
||||
{
|
||||
struct weston_surface *surface = curtain->view->surface;
|
||||
|
||||
|
@ -213,7 +217,7 @@ weston_curtain_destroy(struct weston_curtain *curtain)
|
|||
free(curtain);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
WL_EXPORT uint32_t
|
||||
weston_shell_get_binding_modifier(struct weston_config *config,
|
||||
uint32_t default_mod)
|
||||
{
|
|
@ -157,7 +157,6 @@ subdir('protocol')
|
|||
subdir('shared')
|
||||
subdir('libweston')
|
||||
subdir('xwayland')
|
||||
subdir('shell-utils')
|
||||
subdir('compositor')
|
||||
subdir('desktop-shell')
|
||||
subdir('fullscreen-shell')
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
dep_shell_utils = declare_dependency(
|
||||
sources: 'shell-utils.c',
|
||||
include_directories: include_directories('.'),
|
||||
dependencies: dep_libweston_public,
|
||||
)
|
|
@ -2,7 +2,7 @@ plugin_test_shell_desktop = shared_library(
|
|||
'weston-test-desktop-shell',
|
||||
'weston-test-desktop-shell.c',
|
||||
include_directories: common_inc,
|
||||
dependencies: [ dep_libweston_public, dep_libexec_weston, dep_shell_utils ],
|
||||
dependencies: [ dep_libweston_public, dep_libexec_weston ],
|
||||
name_prefix: '',
|
||||
install: false
|
||||
)
|
||||
|
@ -266,7 +266,7 @@ tests = [
|
|||
'sources': [
|
||||
'safe-signal-output-removal-test.c',
|
||||
],
|
||||
'dep_objs': [ dep_shell_utils ]
|
||||
'dep_objs': [ dep_libweston_public ]
|
||||
},
|
||||
]
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
#include <stdio.h>
|
||||
|
||||
#include "../shared/signal.h"
|
||||
#include "shell-utils.h"
|
||||
#include <libweston/shell-utils.h>
|
||||
#include "weston-test-client-helper.h"
|
||||
#include "weston-test-fixture-compositor.h"
|
||||
|
||||
|
@ -61,7 +61,7 @@ output_destroy(struct test_output *t_output)
|
|||
t_output->output_destroy_listener.notify = NULL;
|
||||
|
||||
if (t_output->curtain)
|
||||
weston_curtain_destroy(t_output->curtain);
|
||||
weston_shell_utils_curtain_destroy(t_output->curtain);
|
||||
|
||||
wl_list_remove(&t_output->output_destroy_listener.link);
|
||||
free(t_output);
|
||||
|
@ -88,7 +88,7 @@ output_create_view(struct test_output *t_output)
|
|||
.surface_private = NULL,
|
||||
};
|
||||
|
||||
t_output->curtain = weston_curtain_create(t_output->compositor,
|
||||
t_output->curtain = weston_shell_utils_curtain_create(t_output->compositor,
|
||||
&curtain_params);
|
||||
weston_view_set_output(t_output->curtain->view, t_output->output);
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#include "compositor/weston.h"
|
||||
#include <libweston/config-parser.h>
|
||||
#include "shared/helpers.h"
|
||||
#include "shell-utils.h"
|
||||
#include <libweston/shell-utils.h>
|
||||
#include <libweston/desktop.h>
|
||||
|
||||
struct desktest_shell {
|
||||
|
@ -174,7 +174,7 @@ shell_destroy(struct wl_listener *listener, void *data)
|
|||
wl_list_remove(&dts->compositor_destroy_listener.link);
|
||||
|
||||
weston_desktop_destroy(dts->desktop);
|
||||
weston_curtain_destroy(dts->background);
|
||||
weston_shell_utils_curtain_destroy(dts->background);
|
||||
|
||||
weston_layer_fini(&dts->layer);
|
||||
weston_layer_fini(&dts->background_layer);
|
||||
|
@ -215,7 +215,7 @@ wet_shell_init(struct weston_compositor *ec,
|
|||
weston_layer_set_position(&dts->background_layer,
|
||||
WESTON_LAYER_POSITION_BACKGROUND);
|
||||
|
||||
dts->background = weston_curtain_create(ec, &background_params);
|
||||
dts->background = weston_shell_utils_curtain_create(ec, &background_params);
|
||||
if (dts->background == NULL)
|
||||
goto out_free;
|
||||
weston_surface_set_role(dts->background->view->surface,
|
||||
|
@ -236,7 +236,7 @@ wet_shell_init(struct weston_compositor *ec,
|
|||
return 0;
|
||||
|
||||
out_view:
|
||||
weston_curtain_destroy(dts->background);
|
||||
weston_shell_utils_curtain_destroy(dts->background);
|
||||
|
||||
out_free:
|
||||
wl_list_remove(&dts->compositor_destroy_listener.link);
|
||||
|
|
Loading…
Reference in New Issue