Compare commits

...

24 Commits
14.0 ... main

Author SHA1 Message Date
Jonas Ådahl
10ecf60848 xdg-shell: Allow poup grab on non-grabbing popup
Grabbing requires a single chain of grabbing popups, but it doesn't require
grabbing to start with a toplevel, it could just as well start with a
non-grabbing popup.

Avoid seding an error when a client attempts to do this.

Signed-off-by: Jonas Ådahl <jadahl@gmail.com>
2024-11-06 10:43:27 +02:00
Alexey Yerin
d30683341c clients: don't redraw on xdg_toplevel.configure
Signed-off-by: Alexey Yerin <yyp@disroot.org>
Signed-off-by: Kirill Primak <vyivel@eclair.cafe>
2024-11-06 10:12:51 +02:00
Derek Foreman
1ee1b93bac desktop-shell: Don't crash if the output is removed in startup
If the output is destroyed between setting the panel and committing the
panel, or between setting the background and committing the background,
we have a use after free crash.

Handle this by clearing the surface private pointers on output destroy
so we can skip the useless commits.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-11-05 11:29:39 -06:00
Marius Vlad
fe35be5013 gitlab-ci: Bump libdrm to 2.4.118 to add NV{15,20,30} fmts
And add ifndef guards for cases were do have support for it.

While at it I need to change how we build it due to:

'meson.build:21:0: ERROR: Value "false" (of type "string") for combo
option "Enable support for vc4's KMS API." is not one of the choices.
Possible choices are (as string): "enabled", "disabled", "auto".'

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-11-04 16:40:46 +02:00
Leandro Ribeiro
a3fd8f3c97 color-lcms: accept ICC profiles of device class ColorSpace
From "color: update color-management protocol to xx-v4" onwards, we
should accept ICC profiles of device class ColorSpace, as the CM&HDR
protocol says. So do that.

Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
2024-11-04 13:13:22 +00:00
Daniel Stone
8fdc55c03f pixel-formats: Add NV15/20/30 YUV 10bpc formats
NV15/20/30 are a family of 10bpc YUV formats which have 4
horizontally-adjacent samples packed into a 40-bit cluster. The
difference between 15/20/30 is in the subsampling.

No fallbacks are provided, as there is no format pairing which would
allow us to sensibly unpack the clusters.

Signed-off-by: Daniel Stone <daniels@collabora.com>
2024-11-01 15:05:28 +00:00
Derek Foreman
16dc3b2b7f clients/simple-egl: simplify wait for configure loop
Just move the init function outside of the loop and we can drop the
if/continue.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-10-21 10:46:27 +00:00
Marius Vlad
80e47a7161 libweston/desktop: Avoid a potential crash on invalid resource
This checks for a valid resource when getting a xdg_popup. Similar to
the check in get_toplevel.

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-10-21 11:14:48 +03:00
Marius Vlad
8b5bb588df libweston/desktop: Don't destroy the xdg_surface
Upon xdg_toplevel::destroy we seem to be calling xdg_surface::destroy
destroy handler. Protocol states that we should umap the surface with
client having the posibility to getting another toplevel role for the
same xdg_surface and re-map the window.

This also adds a guard for an unlikely invalid resource.

Fixes: #774

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-10-21 11:14:46 +03:00
Marius Vlad
a501acd291 libweston/matrix: Fix narrow conversion with C++
Fixes the following C++ narrow conversion:

/include/libweston-14/libweston/matrix.h: In function ‘weston_coord
weston_coord_truncate(weston_coord)’:
/include/libweston-14/libweston/matrix.h:212:39: error: narrowing
conversion of ‘(int)in.weston_coord::x’ from ‘int’ to ‘double’
[-Werror=narrowing] 212 |         return (struct weston_coord){
	(int)in.x, (int)in.y };
      |                                       ^~~~~~~~~
/home/mvlad/install-new/include/libweston-14/libweston/matrix.h:212:50:
error: narrowing conversion of ‘(int)in.weston_coord::y’ from ‘int’ to
‘double’ [-Werror=narrowing] 212 |         return (struct weston_coord){
	(int)in.x, (int)in.y };

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-10-18 20:40:56 +03:00
James Le Cuirot
9a536962a5
tests: Make some tests dependent on the shell-desktop option
The internal-screenshot and text tests are dependent on the feature and
fail with it disabled.

Signed-off-by: James Le Cuirot <chewi@gentoo.org>
2024-10-14 22:47:13 +01:00
James Le Cuirot
486d96a162
tests: Make the kiosk test dependent on the shell-kiosk option
The test is dependent on the feature and fails with it disabled.

Signed-off-by: James Le Cuirot <chewi@gentoo.org>
2024-10-14 22:46:34 +01:00
Marius Vlad
217fb30847 desktop-shell: Don't attempt to re-add the view to panel layer
This change fixes a side-effect of weston_view_move_to_layer helper
which would basically unmap the view because the layer entry list is no
longer visible. Only add the view to panel layer the first time.

Fixes: #956

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-10-11 11:36:03 +03:00
Jeri Li
04f27f1be2 libweston/desktop: avoid weston crash while xdg_surface ack_configure
checks the resource and sends a protocol error if the client tries to
send a request to an inert object then returns out of the request
handler

Signed-off-by: Jeri Li <jeri.li@mediatek.com>
2024-10-11 11:22:21 +03:00
Marius Vlad
68bbc4cf51 libweston: Move weston_get_backend_type after enum declaration
Fix: #951

Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-10-10 07:56:59 +00:00
Jan Engelhardt
f86ff8c07d build: insert missing wayland-server-protocol dependency
A new build error sprung up in weston-14 compared to 13.0.0.
Fix it.

FAILED: tests/liblib_lcms_util.a.p/lcms_util.c.o
cc -Itests/liblib_lcms_util.a.p -Itests -I../tests -I. -I.. -Iinclude
-I../include -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -Wall
-Winvalid-pch -Wextra -Wpedantic -std=gnu99 -Wmissing-prototypes
-Wno-unused-parameter -Wno-shift-negative-value
-Wno-missing-field-initializers -Wno-pedantic -Wundef
-fvisibility=hidden -O2 -Wall -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3
-fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables
-fstack-clash-protection -Werror=return-type -flto=auto -g -fPIC -MD
-MQ tests/liblib_lcms_util.a.p/lcms_util.c.o -MF
tests/liblib_lcms_util.a.p/lcms_util.c.o.d -o
tests/liblib_lcms_util.a.p/lcms_util.c.o -c ../tests/lcms_util.c
In file included from ../tests/lcms_util.c:35:
../include/libweston/matrix.h:33:10: fatal error:
wayland-server-protocol.h: No such file or directory

   33 | #include <wayland-server-protocol.h>

Signed-off-by: Jan Engelhardt <jengelh@inai.de>
2024-10-08 19:36:09 +02:00
David Edmundson
fe64eee3ae libweston: Send seat name before announcing devices
Clients need to know the seat name at the time they create mouse and
keyboard objects. This brings Weston in line with other compositors.

The documentation upstream currently is not super clear. It states name
is explicitly sent on bind, capabilities don't mention being sent on
bind in any way.

Signed-off-by: David Edmundson <davidedmundson@kde.org>
2024-09-26 13:28:30 +00:00
EatingSumo
312c8bea66 libweston/screenshooter: Fix build when __builtin_clz is not available
Fix compilation error when `__builtin_clz` is not available by renaming variable 'u' to 'run'

Signed-off-by: Junyu Long <877730493@qq.com>
2024-09-26 13:17:27 +00:00
Derek Foreman
067e977fe1 desktop-shell: Don't try to move parented views on output removal
These should be repositioned relative to their parents, attempting to
move them independently not only doesn't make sense, but violates
weston_coord sanity checks.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-09-18 09:13:19 -05:00
Jan Alexander Steffens (heftig)
0e451e8dc3
libweston/noop-renderer: Check shm_buffer for NULL
Copy the check from the pixman renderer.

Fixes: https://gitlab.freedesktop.org/wayland/weston/-/issues/953
Signed-off-by: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
2024-09-14 06:38:47 +02:00
Derek Foreman
2e51def212 libdisplay-info: Bump wrap version
We need libdisplay-info 0.2.0 for some features, but our wrapper
currently builds 0.1.1, leading to some surprising errors when
trying to use those features.

Bump the wrap version so if we're pulling this in from a wrap
we get the latest features.

We leave the hard dependency alone for now, as it's still not
widely deployed.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
2024-09-13 09:43:04 -05:00
Joan Torres
a266c5fff5 clients: Add color
Add a client that creates a surface with one color using single pixel buffer.

Set to that surface an image_description created with the parametric creator of
the color management protocol.

This client can get as params:
  1. Width and height
  2. Color channels R, G, B, A
  3. The name of primaries
  4. The name of a transfer function
  5. The min, max, ref luminance levels

Signed-off-by: Joan Torres <joan.torres@suse.com>
2024-09-09 13:51:51 +00:00
Joan Torres
53419eb991 clients/window: Allow rendering frame wihout shadow
Rendering the shadow currently renders some dark color near the border inside
the inner content.

Altough the content is on top of it, if the content has some transparency,
that dark color appears and this might be unwanted.

Add an option to not render the shadow to avoid that problem.

Signed-off-by: Joan Torres <joan.torres@suse.com>
2024-09-09 13:51:51 +00:00
Marius Vlad
e026fd6540 meson.build: reopen main for regular development
Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
2024-09-04 12:12:34 +03:00
24 changed files with 849 additions and 99 deletions

View File

@ -43,7 +43,7 @@
variables: variables:
FDO_UPSTREAM_REPO: wayland/weston FDO_UPSTREAM_REPO: wayland/weston
FDO_REPO_SUFFIX: "$BUILD_OS-$FDO_DISTRIBUTION_VERSION/$BUILD_ARCH" FDO_REPO_SUFFIX: "$BUILD_OS-$FDO_DISTRIBUTION_VERSION/$BUILD_ARCH"
FDO_DISTRIBUTION_TAG: '2024-08-14-00-freerdp3.x' FDO_DISTRIBUTION_TAG: '2024-11-04-00-libdrm-2.4.118'
include: include:

View File

@ -134,10 +134,11 @@ rm -rf wayland-protocols
# Build and install our own version of libdrm. Debian 11 (bullseye) provides # Build and install our own version of libdrm. Debian 11 (bullseye) provides
# libdrm 2.4.104 which doesn't have the IN_FORMATS iterator api, and Mesa # libdrm 2.4.104 which doesn't have the IN_FORMATS iterator api, and Mesa
# depends on 2.4.109 as well. # depends on 2.4.109 as well.
git clone --branch libdrm-2.4.109 --depth=1 https://gitlab.freedesktop.org/mesa/drm.git # Bump to 2.4.118 to include DRM_FORMAT_NV{15,20,30}
git clone --branch libdrm-2.4.118 --depth=1 https://gitlab.freedesktop.org/mesa/drm.git
cd drm cd drm
meson build --wrap-mode=nofallback -Dauto_features=disabled \ meson build --wrap-mode=nofallback -Dauto_features=disabled \
-Dvc4=false -Dfreedreno=false -Detnaviv=false -Dvc4=disabled -Dfreedreno=disabled -Detnaviv=disabled
ninja ${NINJAFLAGS} -C build install ninja ${NINJAFLAGS} -C build install
cd .. cd ..
rm -rf drm rm -rf drm

578
clients/color.c Normal file
View File

@ -0,0 +1,578 @@
/*
* Copyright (C) 2024 SUSE Software Solutions Germany GmbH
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#include "config.h"
#include <assert.h>
#include <errno.h>
#include "color-management-v1-client-protocol.h"
#include "shared/helpers.h"
#include "shared/xalloc.h"
#include "single-pixel-buffer-v1-client-protocol.h"
#include "viewporter-client-protocol.h"
#include "window.h"
enum image_description_status {
IMAGE_DESCRIPTION_NOT_CREATED = 0,
IMAGE_DESCRIPTION_READY,
IMAGE_DESCRIPTION_FAILED,
};
struct pixel_color {
uint32_t r;
uint32_t g;
uint32_t b;
uint32_t a;
};
struct color {
struct display *display;
struct window *window;
struct widget *parent_widget;
struct widget *widget;
struct xx_color_manager_v4 *color_manager;
struct xx_color_management_surface_v4 *color_surface;
struct wp_single_pixel_buffer_manager_v1 *single_pixel_manager;
struct wp_viewporter *viewporter;
struct wp_viewport *viewport;
struct pixel_color pixel_color;
enum xx_color_manager_v4_primaries primaries;
enum xx_color_manager_v4_transfer_function transfer_function;
float min_lum;
float max_lum;
float ref_lum;
uint32_t supported_color_features;
uint32_t supported_rendering_intents;
uint32_t supported_primaries_named;
uint32_t supported_tf_named;
};
struct valid_enum {
const char *name;
uint32_t value;
};
static bool opt_help = false;
static uint32_t opt_width = 250;
static uint32_t opt_height = 250;
static const char *opt_r = NULL;
static const char *opt_g = NULL;
static const char *opt_b = NULL;
static const char *opt_a = NULL;
static const char *opt_primaries = NULL;
static const char *opt_transfer_function = NULL;
static const char *opt_min_lum = NULL;
static const char *opt_max_lum = NULL;
static const char *opt_ref_lum = NULL;
static const struct weston_option cli_options[] = {
{ WESTON_OPTION_BOOLEAN, "help", 0, &opt_help },
{ WESTON_OPTION_UNSIGNED_INTEGER, "width", 'w', &opt_width },
{ WESTON_OPTION_UNSIGNED_INTEGER, "height", 'h', &opt_height },
{ WESTON_OPTION_STRING, 0, 'R', &opt_r },
{ WESTON_OPTION_STRING, 0, 'G', &opt_g },
{ WESTON_OPTION_STRING, 0, 'B', &opt_b },
{ WESTON_OPTION_STRING, 0, 'A', &opt_a },
{ WESTON_OPTION_STRING, "primaries", 'p', &opt_primaries },
{ WESTON_OPTION_STRING, "transfer-function", 't', &opt_transfer_function },
{ WESTON_OPTION_STRING, "min-lum", 'm', &opt_min_lum },
{ WESTON_OPTION_STRING, "max-lum", 'M', &opt_max_lum },
{ WESTON_OPTION_STRING, "ref-lum", 'r', &opt_ref_lum },
};
static const struct valid_enum valid_primaries[] = {
{ "srgb", XX_COLOR_MANAGER_V4_PRIMARIES_SRGB },
{ "bt2020", XX_COLOR_MANAGER_V4_PRIMARIES_BT2020 },
};
static const struct valid_enum valid_transfer_functions[] = {
{ "srgb", XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_SRGB },
{ "pq", XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_ST2084_PQ },
{ "linear", XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_LINEAR },
};
static bool
validate_color(const char *c, uint32_t *dest, uint32_t fallback)
{
char *end;
double value;
if (!c) {
*dest = fallback;
return true;
}
value = strtod(c, &end);
if (value < 0.0 || value > 1.0 || *end != '\0') {
fprintf(stderr, "Validating color failed, it should be between 0.0 and 1.0\n");
return false;
}
*dest = value * UINT32_MAX;
return true;
}
static bool
validate_option(const char *option, uint32_t *dest,
const struct valid_enum *valid_options,
int count, uint32_t fallback)
{
int i;
if (!option) {
*dest = fallback;
return true;
}
for (i = 0; i < count; i++) {
if (strcmp(valid_options[i].name, option) == 0) {
*dest = valid_options[i].value;
return true;
}
}
fprintf(stderr, "Validating option '%s' failed, valid options:\n", option);
for (i = 0; i < count; i++)
fprintf(stderr, "'%s' ", valid_options[i].name);
fprintf(stderr, "\n");
return false;
}
static bool
validate_luminance(const char *c, float *dest, float fallback)
{
char *end;
float value;
if (!c) {
*dest = fallback;
return true;
}
value = strtof(c, &end);
if (value < 0.f || value > 10000.f || *end != '\0') {
fprintf(stderr, "Validating luminance failed, it should be between 0 and 10,000\n");
return false;
}
*dest = value;
return true;
}
static bool
validate_options(struct color *color)
{
return validate_color(opt_r, &color->pixel_color.r, 0) &&
validate_color(opt_g, &color->pixel_color.g, 0) &&
validate_color(opt_b, &color->pixel_color.b, 0) &&
validate_color(opt_a, &color->pixel_color.a, UINT32_MAX) &&
validate_option(opt_primaries, &color->primaries,
valid_primaries,
ARRAY_LENGTH(valid_primaries),
XX_COLOR_MANAGER_V4_PRIMARIES_SRGB) &&
validate_option(opt_transfer_function, &color->transfer_function,
valid_transfer_functions,
ARRAY_LENGTH(valid_transfer_functions),
XX_COLOR_MANAGER_V4_TRANSFER_FUNCTION_SRGB) &&
validate_luminance(opt_min_lum, &color->min_lum, -1.f) &&
validate_luminance(opt_max_lum, &color->max_lum, -1.f) &&
validate_luminance(opt_ref_lum, &color->ref_lum, -1.f);
}
static void
usage(const char *program_name, int exit_code)
{
unsigned int i;
fprintf(stderr, "Usage: %s [OPTIONS]\n", program_name);
fprintf(stderr, " --help\n");
fprintf(stderr, " --width or -w\n");
fprintf(stderr, " --height or -h\n");
fprintf(stderr, " -R (0.0 to 1.0)\n");
fprintf(stderr, " -G (0.0 to 1.0)\n");
fprintf(stderr, " -B (0.0 to 1.0)\n");
fprintf(stderr, " -A (0.0 to 1.0)\n");
fprintf(stderr, " --primaries or -p:");
fprintf(stderr, "\n ");
for (i = 0; i < ARRAY_LENGTH(valid_primaries); i++)
fprintf(stderr, " '%s'", valid_primaries[i].name);
fprintf(stderr, "\n");
fprintf(stderr, " --transfer-function or -t:");
fprintf(stderr, "\n ");
for (i = 0; i < ARRAY_LENGTH(valid_transfer_functions); i++)
fprintf(stderr, " '%s'", valid_transfer_functions[i].name);
fprintf(stderr, "\n");
fprintf(stderr, " --min-lum or -m (0.0 to 10000.0)\n");
fprintf(stderr, " --max-lum or -M (0.0 to 10000.0)\n");
fprintf(stderr, " --ref-lum or -r (0.0 to 10000.0)\n");
exit(exit_code);
}
static void
supported_intent(void *data, struct xx_color_manager_v4 *xx_color_manager_v4,
uint32_t render_intent)
{
struct color *color = data;
color->supported_rendering_intents |= 1 << render_intent;
}
static void
supported_feature(void *data, struct xx_color_manager_v4 *xx_color_manager_v4,
uint32_t feature)
{
struct color *color = data;
color->supported_color_features |= 1 << feature;
}
static void
supported_tf_named(void *data, struct xx_color_manager_v4 *xx_color_manager_v4,
uint32_t tf)
{
struct color *color = data;
color->supported_tf_named |= 1 << tf;
}
static void
supported_primaries_named(void *data,
struct xx_color_manager_v4 *xx_color_manager_v4,
uint32_t primaries)
{
struct color *color = data;
color->supported_primaries_named |= 1 << primaries;
}
static const struct xx_color_manager_v4_listener color_manager_listener = {
supported_intent,
supported_feature,
supported_tf_named,
supported_primaries_named,
};
static void
global_handler(struct display *display, uint32_t name,
const char *interface, uint32_t version, void *data)
{
struct color *color = data;
struct wl_surface *surface = widget_get_wl_surface(color->widget);
if (strcmp(interface, xx_color_manager_v4_interface.name) == 0) {
color->color_manager = display_bind(display, name,
&xx_color_manager_v4_interface, 1);
color->color_surface = xx_color_manager_v4_get_surface(color->color_manager,
surface);
xx_color_manager_v4_add_listener(color->color_manager,
&color_manager_listener, color);
} else if (strcmp(interface, wp_single_pixel_buffer_manager_v1_interface.name) == 0) {
color->single_pixel_manager =
display_bind(display, name,
&wp_single_pixel_buffer_manager_v1_interface, 1);
} else if (strcmp(interface, wp_viewporter_interface.name) == 0) {
color->viewporter = display_bind(display, name,
&wp_viewporter_interface, 1);
color->viewport = wp_viewporter_get_viewport(color->viewporter, surface);
}
}
static bool
check_color_requirements(struct color *color)
{
if (!color->color_manager) {
fprintf(stderr, "The compositor doesn't expose %s\n",
xx_color_manager_v4_interface.name);
return false;
}
if (!(color->supported_color_features & (1 << XX_COLOR_MANAGER_V4_FEATURE_PARAMETRIC))) {
fprintf(stderr, "The color manager doesn't support the parametric creator\n");
return false;
}
if (!(color->supported_primaries_named & (1 << color->primaries))) {
fprintf(stderr, "The color manager doesn't support the primaries name\n");
return false;
}
if (!(color->supported_tf_named & (1 << color->transfer_function))) {
fprintf(stderr, "The color manager doesn't support the transfer function\n");
return false;
}
if (!(color->supported_rendering_intents & (1 << XX_COLOR_MANAGER_V4_RENDER_INTENT_PERCEPTUAL))) {
fprintf(stderr, "The color manager doesn't support perceptual render intent\n");
return false;
}
if (color->min_lum != -1.f || color->max_lum != -1.f || color->ref_lum != -1.f) {
if (!(color->supported_color_features & (1 << XX_COLOR_MANAGER_V4_FEATURE_SET_LUMINANCES))) {
fprintf(stderr, "The color manager doesn't support setting luminances\n");
return false;
}
if (color->min_lum == -1.f || color->max_lum == -1.f || color->ref_lum == -1.f) {
fprintf(stderr, "To set the luminances it is required min-lum, max-lum and ref-lum\n");
return false;
}
}
return true;
}
static void
color_destroy(struct color *color)
{
if (color->color_surface)
xx_color_management_surface_v4_destroy(color->color_surface);
if (color->color_manager)
xx_color_manager_v4_destroy(color->color_manager);
if (color->single_pixel_manager)
wp_single_pixel_buffer_manager_v1_destroy(color->single_pixel_manager);
if (color->viewport)
wp_viewport_destroy(color->viewport);
if (color->viewporter)
wp_viewporter_destroy(color->viewporter);
if (color->widget)
widget_destroy(color->widget);
if (color->parent_widget)
widget_destroy(color->parent_widget);
if (color->window)
window_destroy(color->window);
if (color->display)
display_destroy(color->display);
free(color);
}
static void
resize_handler(struct widget *parent_widget, int32_t width, int32_t height, void *data)
{
struct color *color = data;
struct rectangle allocation;
struct wl_surface *surface = widget_get_wl_surface(color->widget);
struct wl_subsurface *subsurface = widget_get_wl_subsurface(color->widget);
widget_get_allocation(parent_widget, &allocation);
wl_subsurface_set_position(subsurface, allocation.x, allocation.y);
wp_viewport_set_destination(color->viewport, width, height);
wl_surface_commit(surface);
}
static void
set_empty_input_region(struct color *color, struct widget *widget)
{
struct wl_region *region;
struct wl_compositor *compositor;
struct wl_surface *surface = widget_get_wl_surface(widget);
compositor = display_get_compositor(color->display);
region = wl_compositor_create_region(compositor);
wl_surface_set_input_region(surface, region);
wl_region_destroy(region);
}
static void
buffer_release(void *data, struct wl_buffer *buffer)
{
wl_buffer_destroy(buffer);
}
static const struct wl_buffer_listener buffer_listener = {
buffer_release
};
static void
set_single_pixel(struct color *color, struct widget *widget)
{
struct wl_surface *surface = widget_get_wl_surface(widget);
struct wl_buffer *buffer =
wp_single_pixel_buffer_manager_v1_create_u32_rgba_buffer(color->single_pixel_manager,
color->pixel_color.r,
color->pixel_color.g,
color->pixel_color.b,
color->pixel_color.a);
wl_buffer_add_listener(buffer, &buffer_listener, NULL);
wl_surface_attach(surface, buffer, 0, 0);
}
static void
image_description_failed(void *data,
struct xx_image_description_v4 *xx_image_description_v4,
uint32_t cause, const char *msg)
{
enum image_description_status *image_desc_status = data;
fprintf(stderr, "Failed to create image description: %u - %s\n",
cause, msg);
*image_desc_status = IMAGE_DESCRIPTION_FAILED;
}
static void
image_description_ready(void *data, struct xx_image_description_v4 *xx_image_description_v4,
uint32_t identity)
{
enum image_description_status *image_desc_status = data;
*image_desc_status = IMAGE_DESCRIPTION_READY;
}
static const struct xx_image_description_v4_listener image_description_listener = {
image_description_failed,
image_description_ready,
};
static struct xx_image_description_v4 *
create_image_description(struct color *color, uint32_t primaries_named, uint32_t tf_named)
{
struct xx_image_description_creator_params_v4 *params_creator;
struct xx_image_description_v4 *image_description;
enum image_description_status image_desc_status = IMAGE_DESCRIPTION_NOT_CREATED;
int ret = 0;
params_creator = xx_color_manager_v4_new_parametric_creator(color->color_manager);
xx_image_description_creator_params_v4_set_primaries_named(params_creator, primaries_named);
xx_image_description_creator_params_v4_set_tf_named(params_creator, tf_named);
if (color->min_lum != -1 && color->max_lum != -1 && color->ref_lum != -1)
xx_image_description_creator_params_v4_set_luminances(params_creator,
color->min_lum * 10000,
color->max_lum,
color->ref_lum);
image_description = xx_image_description_creator_params_v4_create(params_creator);
xx_image_description_v4_add_listener(image_description,
&image_description_listener,
&image_desc_status);
while (ret != -1 && image_desc_status == IMAGE_DESCRIPTION_NOT_CREATED)
ret = wl_display_dispatch(display_get_display(color->display));
if (ret == -1) {
xx_image_description_v4_destroy(image_description);
fprintf(stderr, "Error when creating the image description: %s\n", strerror(errno));
return NULL;
}
if (image_desc_status == IMAGE_DESCRIPTION_FAILED) {
xx_image_description_v4_destroy(image_description);
return NULL;
}
assert(image_desc_status == IMAGE_DESCRIPTION_READY);
return image_description;
}
static bool
set_image_description(struct color *color, struct widget *widget)
{
struct xx_image_description_v4 *image_description;
image_description =
create_image_description(color,
color->primaries,
color->transfer_function);
if (!image_description)
return false;
xx_color_management_surface_v4_set_image_description(
color->color_surface,
image_description,
XX_COLOR_MANAGER_V4_RENDER_INTENT_PERCEPTUAL);
xx_image_description_v4_destroy(image_description);
return true;
}
int
main(int argc, char *argv[])
{
struct color *color;
if (parse_options(cli_options, ARRAY_LENGTH(cli_options), &argc, argv) > 1)
usage(argv[0], EXIT_FAILURE);
if (opt_help)
usage(argv[0], EXIT_SUCCESS);
color = xzalloc(sizeof *color);
if (!validate_options(color)) {
color_destroy(color);
exit(EXIT_FAILURE);
}
color->display = display_create(&argc, argv);
if (!color->display) {
color_destroy(color);
exit(EXIT_FAILURE);
}
color->window = window_create(color->display);
color->parent_widget = window_frame_create(color->window, color);
color->widget = window_add_subsurface(color->window, color, SUBSURFACE_SYNCHRONIZED);
display_set_user_data(color->display, color);
display_set_global_handler(color->display, global_handler);
wl_display_roundtrip(display_get_display(color->display));
if (!check_color_requirements(color)) {
color_destroy(color);
exit(EXIT_SUCCESS);
}
window_unset_shadow(color->window);
window_set_title(color->window, "Color");
window_set_appid(color->window, "org.freedesktop.weston.color");
/* The first resize call sets the min size,
* setting 0, 0 sets a default size */
window_schedule_resize(color->window, 0, 0);
window_schedule_resize(color->window, opt_width, opt_height);
widget_set_resize_handler(color->parent_widget, resize_handler);
widget_set_use_cairo(color->widget, 0);
set_empty_input_region(color, color->widget);
set_single_pixel(color, color->widget);
if (set_image_description(color, color->widget))
display_run(color->display);
color_destroy(color);
return 0;
}

View File

@ -269,6 +269,15 @@ demo_clients = [
'basename': 'cliptest', 'basename': 'cliptest',
'dep_objs': [ dep_vertex_clipping, dep_matrix_c ] 'dep_objs': [ dep_vertex_clipping, dep_matrix_c ]
}, },
{
'basename': 'color',
'add_sources': [
color_management_v1_client_protocol_h,
color_management_v1_protocol_c,
single_pixel_buffer_v1_client_protocol_h,
single_pixel_buffer_v1_protocol_c,
],
},
{ {
'basename': 'constraints', 'basename': 'constraints',
'add_sources': [ 'add_sources': [

View File

@ -1474,15 +1474,10 @@ main(int argc, char **argv)
create_surface(&window); create_surface(&window);
/* we already have wait_for_configure set after create_surface() */ /* we already have wait_for_configure set after create_surface() */
while (running && ret != -1 && window.wait_for_configure) { while (running && ret != -1 && window.wait_for_configure)
ret = wl_display_dispatch(display.display); ret = wl_display_dispatch(display.display);
/* wait until xdg_surface::configure acks the new dimensions */ init_gl(&window);
if (window.wait_for_configure)
continue;
init_gl(&window);
}
display.cursor_surface = display.cursor_surface =
wl_compositor_create_surface(display.compositor); wl_compositor_create_surface(display.compositor);

View File

@ -4372,8 +4372,8 @@ undo_resize(struct window *window)
} }
} }
void static void
window_schedule_resize(struct window *window, int width, int height) window_configure_resize(struct window *window, int width, int height)
{ {
/* We should probably get these numbers from the theme. */ /* We should probably get these numbers from the theme. */
const int min_width = 200, min_height = 200; const int min_width = 200, min_height = 200;
@ -4400,6 +4400,12 @@ window_schedule_resize(struct window *window, int width, int height)
window->pending_allocation.height = window->min_allocation.height; window->pending_allocation.height = window->min_allocation.height;
window->resize_needed = 1; window->resize_needed = 1;
}
void
window_schedule_resize(struct window *window, int width, int height)
{
window_configure_resize(window, width, height);
window_schedule_redraw(window); window_schedule_redraw(window);
} }
@ -4508,14 +4514,14 @@ xdg_toplevel_handle_configure(void *data, struct xdg_toplevel *xdg_toplevel,
* on the shadow margin to get the difference. */ * on the shadow margin to get the difference. */
int margin = window_get_shadow_margin(window); int margin = window_get_shadow_margin(window);
window_schedule_resize(window, window_configure_resize(window,
width + margin * 2, width + margin * 2,
height + margin * 2); height + margin * 2);
} else if (window->saved_allocation.width > 0 && } else if (window->saved_allocation.width > 0 &&
window->saved_allocation.height > 0) { window->saved_allocation.height > 0) {
window_schedule_resize(window, window_configure_resize(window,
window->saved_allocation.width, window->saved_allocation.width,
window->saved_allocation.height); window->saved_allocation.height);
} }
} }
@ -4937,6 +4943,20 @@ window_set_locked_pointer_motion_handler(struct window *window,
window->locked_pointer_motion_handler = handler; window->locked_pointer_motion_handler = handler;
} }
void
window_set_shadow(struct window *window)
{
if (window->frame)
frame_unset_flag(window->frame->frame, FRAME_FLAG_NO_SHADOW);
}
void
window_unset_shadow(struct window *window)
{
if (window->frame)
frame_set_flag(window->frame->frame, FRAME_FLAG_NO_SHADOW);
}
void void
window_set_title(struct window *window, const char *title) window_set_title(struct window *window, const char *title)
{ {

View File

@ -530,6 +530,12 @@ void
window_set_locked_pointer_motion_handler( window_set_locked_pointer_motion_handler(
struct window *window, window_locked_pointer_motion_handler_t handler); struct window *window, window_locked_pointer_motion_handler_t handler);
void
window_set_shadow(struct window *window);
void
window_unset_shadow(struct window *window);
void void
window_set_title(struct window *window, const char *title); window_set_title(struct window *window, const char *title);

View File

@ -2777,7 +2777,13 @@ background_committed(struct weston_surface *es,
struct weston_coord_surface new_origin) struct weston_coord_surface new_origin)
{ {
struct shell_output *sh_output = es->committed_private; struct shell_output *sh_output = es->committed_private;
struct desktop_shell *shell = sh_output->shell; struct desktop_shell *shell;
/* The output was destroyed before the background was committed */
if (!sh_output)
return;
shell = sh_output->shell;
if (!weston_surface_has_content(es)) if (!weston_surface_has_content(es))
return; return;
@ -2866,9 +2872,17 @@ panel_committed(struct weston_surface *es,
struct weston_coord_surface new_origin) struct weston_coord_surface new_origin)
{ {
struct shell_output *sh_output = es->committed_private; struct shell_output *sh_output = es->committed_private;
struct weston_output *output = sh_output->output; struct weston_output *output;
struct weston_coord_global pos = output->pos; struct weston_coord_global pos;
struct desktop_shell *shell = sh_output->shell; struct desktop_shell *shell;
/* The output was destroyed before the panel was committed */
if (!sh_output)
return;
output = sh_output->output;
pos = output->pos;
shell = sh_output->shell;
if (!weston_surface_has_content(es)) if (!weston_surface_has_content(es))
return; return;
@ -2895,13 +2909,14 @@ panel_committed(struct weston_surface *es,
weston_surface_map(es); weston_surface_map(es);
assert(wl_list_empty(&es->views)); assert(wl_list_empty(&es->views));
sh_output->panel_view = weston_view_create(es); sh_output->panel_view = weston_view_create(es);
weston_view_move_to_layer(sh_output->panel_view,
&shell->panel_layer.view_list);
} }
assert(sh_output->panel_view); assert(sh_output->panel_view);
pos = weston_coord_global_add(output->pos, sh_output->panel_offset); pos = weston_coord_global_add(output->pos, sh_output->panel_offset);
weston_view_set_position(sh_output->panel_view, pos); weston_view_set_position(sh_output->panel_view, pos);
weston_view_move_to_layer(sh_output->panel_view,
&shell->panel_layer.view_list);
} }
static void static void
@ -4466,6 +4481,12 @@ shell_reposition_view_on_output_change(struct weston_view *view)
struct shell_surface *shsurf; struct shell_surface *shsurf;
int visible; int visible;
/* We can't simply reposition popups and such, they must move with
* the parent.
*/
if (view->geometry.parent)
return;
if (wl_list_empty(&ec->output_list)) if (wl_list_empty(&ec->output_list))
return; return;
@ -4543,10 +4564,14 @@ shell_output_destroy(struct shell_output *shell_output)
shell_for_each_layer(shell, shell_output_changed_move_layer, NULL); shell_for_each_layer(shell, shell_output_changed_move_layer, NULL);
if (shell_output->panel_surface) if (shell_output->panel_surface) {
wl_list_remove(&shell_output->panel_surface_listener.link); wl_list_remove(&shell_output->panel_surface_listener.link);
if (shell_output->background_surface) shell_output->panel_surface->committed_private = NULL;
}
if (shell_output->background_surface) {
wl_list_remove(&shell_output->background_surface_listener.link); wl_list_remove(&shell_output->background_surface_listener.link);
shell_output->background_surface->committed_private = NULL;
}
wl_list_remove(&shell_output->destroy_listener.link); wl_list_remove(&shell_output->destroy_listener.link);
wl_list_remove(&shell_output->link); wl_list_remove(&shell_output->link);
free(shell_output); free(shell_output);

View File

@ -2217,8 +2217,6 @@ void
weston_output_schedule_repaint_reset(struct weston_output *output); weston_output_schedule_repaint_reset(struct weston_output *output);
void void
weston_output_schedule_repaint_restart(struct weston_output *output); weston_output_schedule_repaint_restart(struct weston_output *output);
enum weston_compositor_backend
weston_get_backend_type(struct weston_backend *backend);
void void
weston_compositor_schedule_repaint(struct weston_compositor *compositor); weston_compositor_schedule_repaint(struct weston_compositor *compositor);
void void
@ -2475,6 +2473,8 @@ struct weston_backend *
weston_compositor_load_backend(struct weston_compositor *compositor, weston_compositor_load_backend(struct weston_compositor *compositor,
enum weston_compositor_backend backend, enum weston_compositor_backend backend,
struct weston_backend_config *config_base); struct weston_backend_config *config_base);
enum weston_compositor_backend
weston_get_backend_type(struct weston_backend *backend);
void void
weston_compositor_exit(struct weston_compositor *ec); weston_compositor_exit(struct weston_compositor *ec);
void * void *

View File

@ -209,7 +209,7 @@ weston_coord_surface_sub(struct weston_coord_surface a,
static inline struct weston_coord __attribute__ ((warn_unused_result)) static inline struct weston_coord __attribute__ ((warn_unused_result))
weston_coord_truncate(struct weston_coord in) weston_coord_truncate(struct weston_coord in)
{ {
return (struct weston_coord){ (int)in.x, (int)in.y }; return (struct weston_coord){ (double)(int) in.x, (double)(int) in.y };
} }
static inline struct weston_coord_surface __attribute__ ((warn_unused_result)) static inline struct weston_coord_surface __attribute__ ((warn_unused_result))

View File

@ -349,9 +349,9 @@ validate_icc_profile(struct lcmsProfilePtr profile, char **errmsg)
return false; return false;
} }
if (class_sig != cmsSigDisplayClass) { if (class_sig != cmsSigDisplayClass && class_sig != cmsSigColorSpaceClass) {
str_printf(errmsg, "ICC profile is required to be of Display device class, " str_printf(errmsg, "ICC profile is required to be of Display or "
"but it is %s class (0x%08x)", "ColorSpace device class, but it is %s class (0x%08x)",
icc_profile_class_name(class_sig), (unsigned)class_sig); icc_profile_class_name(class_sig), (unsigned)class_sig);
return false; return false;
} }

View File

@ -781,8 +781,16 @@ weston_desktop_xdg_toplevel_resource_destroy(struct wl_resource *resource)
struct weston_desktop_surface *dsurface = struct weston_desktop_surface *dsurface =
wl_resource_get_user_data(resource); wl_resource_get_user_data(resource);
if (dsurface != NULL) if (dsurface) {
weston_desktop_surface_resource_destroy(resource); struct weston_desktop_xdg_toplevel *toplevel =
weston_desktop_surface_get_implementation_data(dsurface);
struct weston_surface *wsurface =
weston_desktop_surface_get_surface(dsurface);
weston_surface_unmap(wsurface);
wl_list_remove(wl_resource_get_link(resource));
toplevel->resource = NULL;
}
} }
static const struct zxdg_toplevel_v6_interface weston_desktop_xdg_toplevel_implementation = { static const struct zxdg_toplevel_v6_interface weston_desktop_xdg_toplevel_implementation = {
@ -1072,12 +1080,20 @@ weston_desktop_xdg_surface_protocol_get_toplevel(struct wl_client *wl_client,
struct wl_resource *resource, struct wl_resource *resource,
uint32_t id) uint32_t id)
{ {
struct weston_desktop_surface *dsurface = struct weston_desktop_surface *dsurface = NULL;
wl_resource_get_user_data(resource); struct weston_surface *wsurface = NULL;
struct weston_surface *wsurface = struct weston_desktop_xdg_toplevel *toplevel = NULL;
weston_desktop_surface_get_surface(dsurface);
struct weston_desktop_xdg_toplevel *toplevel = dsurface = wl_resource_get_user_data(resource);
weston_desktop_surface_get_implementation_data(dsurface); if (!dsurface) {
wl_resource_post_error(resource,
ZXDG_SURFACE_V6_ERROR_NOT_CONSTRUCTED,
"xdg surface destroyed");
return;
}
wsurface = weston_desktop_surface_get_surface(dsurface);
toplevel = weston_desktop_surface_get_implementation_data(dsurface);
if (weston_surface_set_role(wsurface, weston_desktop_xdg_toplevel_role, if (weston_surface_set_role(wsurface, weston_desktop_xdg_toplevel_role,
resource, ZXDG_SHELL_V6_ERROR_ROLE) < 0) resource, ZXDG_SHELL_V6_ERROR_ROLE) < 0)
@ -1101,12 +1117,9 @@ weston_desktop_xdg_surface_protocol_get_popup(struct wl_client *wl_client,
struct wl_resource *parent_resource, struct wl_resource *parent_resource,
struct wl_resource *positioner_resource) struct wl_resource *positioner_resource)
{ {
struct weston_desktop_surface *dsurface = struct weston_desktop_surface *dsurface = NULL;
wl_resource_get_user_data(resource); struct weston_surface *wsurface = NULL;
struct weston_surface *wsurface = struct weston_desktop_xdg_popup *popup = NULL;
weston_desktop_surface_get_surface(dsurface);
struct weston_desktop_xdg_popup *popup =
weston_desktop_surface_get_implementation_data(dsurface);
struct weston_desktop_surface *parent_surface = struct weston_desktop_surface *parent_surface =
wl_resource_get_user_data(parent_resource); wl_resource_get_user_data(parent_resource);
struct weston_desktop_xdg_surface *parent = struct weston_desktop_xdg_surface *parent =
@ -1115,6 +1128,17 @@ weston_desktop_xdg_surface_protocol_get_popup(struct wl_client *wl_client,
wl_resource_get_user_data(positioner_resource); wl_resource_get_user_data(positioner_resource);
struct weston_coord_surface offset; struct weston_coord_surface offset;
dsurface = wl_resource_get_user_data(resource);
if (!dsurface) {
wl_resource_post_error(resource,
ZXDG_SURFACE_V6_ERROR_NOT_CONSTRUCTED,
"xdg surface destroyed");
return;
}
wsurface = weston_desktop_surface_get_surface(dsurface);
popup = weston_desktop_surface_get_implementation_data(dsurface);
/* Checking whether the size and anchor rect both have a positive size /* Checking whether the size and anchor rect both have a positive size
* is enough to verify both have been correctly set */ * is enough to verify both have been correctly set */
if (positioner->size.width == 0 || positioner->anchor_rect.width == 0) { if (positioner->size.width == 0 || positioner->anchor_rect.width == 0) {
@ -1200,6 +1224,14 @@ weston_desktop_xdg_surface_protocol_ack_configure(struct wl_client *wl_client,
{ {
struct weston_desktop_surface *dsurface = struct weston_desktop_surface *dsurface =
wl_resource_get_user_data(resource); wl_resource_get_user_data(resource);
if (dsurface == NULL) {
wl_resource_post_error(resource,
ZXDG_SURFACE_V6_ERROR_NOT_CONSTRUCTED,
"xdg surface already destroyed configure "
"serial: %u", serial);
return;
}
struct weston_desktop_xdg_surface *surface = struct weston_desktop_xdg_surface *surface =
weston_desktop_surface_get_implementation_data(dsurface); weston_desktop_surface_get_implementation_data(dsurface);
struct weston_desktop_xdg_surface_configure *configure, *temp; struct weston_desktop_xdg_surface_configure *configure, *temp;

View File

@ -887,8 +887,17 @@ weston_desktop_xdg_toplevel_resource_destroy(struct wl_resource *resource)
struct weston_desktop_surface *dsurface = struct weston_desktop_surface *dsurface =
wl_resource_get_user_data(resource); wl_resource_get_user_data(resource);
if (dsurface != NULL) if (dsurface) {
weston_desktop_surface_resource_destroy(resource); struct weston_desktop_xdg_toplevel *toplevel =
weston_desktop_surface_get_implementation_data(dsurface);
struct weston_surface *wsurface =
weston_desktop_surface_get_surface(dsurface);
weston_surface_unmap(wsurface);
wl_list_remove(wl_resource_get_link(resource));
toplevel->resource = NULL;
}
} }
static const struct xdg_toplevel_interface weston_desktop_xdg_toplevel_implementation = { static const struct xdg_toplevel_interface weston_desktop_xdg_toplevel_implementation = {
@ -921,8 +930,6 @@ weston_desktop_xdg_popup_protocol_grab(struct wl_client *wl_client,
struct weston_seat *wseat = wl_resource_get_user_data(seat_resource); struct weston_seat *wseat = wl_resource_get_user_data(seat_resource);
struct weston_desktop_seat *seat = weston_desktop_seat_from_seat(wseat); struct weston_desktop_seat *seat = weston_desktop_seat_from_seat(wseat);
struct weston_desktop_surface *topmost; struct weston_desktop_surface *topmost;
bool parent_is_toplevel =
popup->parent->role == WESTON_DESKTOP_XDG_SURFACE_ROLE_TOPLEVEL;
/* Check that if we have a valid wseat we also got a valid desktop seat */ /* Check that if we have a valid wseat we also got a valid desktop seat */
if (wseat != NULL && seat == NULL) { if (wseat != NULL && seat == NULL) {
@ -937,18 +944,8 @@ weston_desktop_xdg_popup_protocol_grab(struct wl_client *wl_client,
return; return;
} }
/* If seat is NULL then get_topmost_surface will return NULL. In
* combination with setting parent_is_toplevel to TRUE here we will
* avoid posting an error, and we will instead gracefully fail the
* grab and dismiss the surface.
* FIXME: this is a hack because currently we cannot check the topmost
* parent with a destroyed weston_seat */
if (seat == NULL)
parent_is_toplevel = true;
topmost = weston_desktop_seat_popup_grab_get_topmost_surface(seat); topmost = weston_desktop_seat_popup_grab_get_topmost_surface(seat);
if ((topmost == NULL && !parent_is_toplevel) || if (topmost != NULL && topmost != popup->parent->desktop_surface) {
(topmost != NULL && topmost != popup->parent->desktop_surface)) {
struct weston_desktop_client *client = struct weston_desktop_client *client =
weston_desktop_surface_get_client(dsurface); weston_desktop_surface_get_client(dsurface);
struct wl_resource *client_resource = struct wl_resource *client_resource =
@ -1246,13 +1243,22 @@ weston_desktop_xdg_surface_protocol_get_toplevel(struct wl_client *wl_client,
struct wl_resource *resource, struct wl_resource *resource,
uint32_t id) uint32_t id)
{ {
struct weston_desktop_surface *dsurface = struct weston_desktop_surface *dsurface = NULL;
wl_resource_get_user_data(resource); struct weston_surface *wsurface = NULL;
struct weston_surface *wsurface = struct weston_desktop_xdg_toplevel *toplevel = NULL;
weston_desktop_surface_get_surface(dsurface); struct weston_desktop *desktop = NULL;
struct weston_desktop_xdg_toplevel *toplevel =
weston_desktop_surface_get_implementation_data(dsurface); dsurface = wl_resource_get_user_data(resource);
struct weston_desktop *desktop = toplevel->base.desktop; if (!dsurface) {
wl_resource_post_error(resource,
XDG_SURFACE_ERROR_DEFUNCT_ROLE_OBJECT,
"xdg surface destroyed");
return;
}
wsurface = weston_desktop_surface_get_surface(dsurface);
toplevel = weston_desktop_surface_get_implementation_data(dsurface);
desktop = toplevel->base.desktop;
if (weston_surface_set_role(wsurface, weston_desktop_xdg_toplevel_role, if (weston_surface_set_role(wsurface, weston_desktop_xdg_toplevel_role,
resource, XDG_WM_BASE_ERROR_ROLE) < 0) resource, XDG_WM_BASE_ERROR_ROLE) < 0)
@ -1305,18 +1311,26 @@ weston_desktop_xdg_surface_protocol_get_popup(struct wl_client *wl_client,
struct wl_resource *parent_resource, struct wl_resource *parent_resource,
struct wl_resource *positioner_resource) struct wl_resource *positioner_resource)
{ {
struct weston_desktop_surface *dsurface = struct weston_desktop_surface *dsurface = NULL;
wl_resource_get_user_data(resource); struct weston_surface *wsurface = NULL;
struct weston_surface *wsurface = struct weston_desktop_xdg_popup *popup = NULL;
weston_desktop_surface_get_surface(dsurface);
struct weston_desktop_xdg_popup *popup =
weston_desktop_surface_get_implementation_data(dsurface);
struct weston_desktop_surface *parent_surface; struct weston_desktop_surface *parent_surface;
struct weston_desktop_xdg_surface *parent; struct weston_desktop_xdg_surface *parent;
struct weston_desktop_xdg_positioner *positioner = struct weston_desktop_xdg_positioner *positioner =
wl_resource_get_user_data(positioner_resource); wl_resource_get_user_data(positioner_resource);
struct weston_coord_surface offset; struct weston_coord_surface offset;
dsurface = wl_resource_get_user_data(resource);
if (!dsurface) {
wl_resource_post_error(resource,
XDG_SURFACE_ERROR_DEFUNCT_ROLE_OBJECT,
"xdg surface destroyed");
return;
}
wsurface = weston_desktop_surface_get_surface(dsurface);
popup = weston_desktop_surface_get_implementation_data(dsurface);
/* Popup parents are allowed to be non-null, but only if a parent is /* Popup parents are allowed to be non-null, but only if a parent is
* specified 'using some other protocol' before committing. Since we * specified 'using some other protocol' before committing. Since we
* don't support such a protocol yet, clients cannot legitimately * don't support such a protocol yet, clients cannot legitimately
@ -1414,6 +1428,14 @@ weston_desktop_xdg_surface_protocol_ack_configure(struct wl_client *wl_client,
{ {
struct weston_desktop_surface *dsurface = struct weston_desktop_surface *dsurface =
wl_resource_get_user_data(resource); wl_resource_get_user_data(resource);
if (dsurface == NULL) {
wl_resource_post_error(resource,
XDG_SURFACE_ERROR_DEFUNCT_ROLE_OBJECT,
"xdg surface already destroyed configure "
"serial: %u", serial);
return;
}
struct weston_desktop_xdg_surface *surface = struct weston_desktop_xdg_surface *surface =
weston_desktop_surface_get_implementation_data(dsurface); weston_desktop_surface_get_implementation_data(dsurface);
struct weston_desktop_xdg_surface_configure *configure, *temp; struct weston_desktop_xdg_surface_configure *configure, *temp;

View File

@ -3848,6 +3848,9 @@ bind_seat(struct wl_client *client, void *data, uint32_t version, uint32_t id)
wl_resource_set_implementation(resource, &seat_interface, data, wl_resource_set_implementation(resource, &seat_interface, data,
unbind_resource); unbind_resource);
if (version >= WL_SEAT_NAME_SINCE_VERSION)
wl_seat_send_name(resource, seat->seat_name);
if (weston_seat_get_pointer(seat)) if (weston_seat_get_pointer(seat))
caps |= WL_SEAT_CAPABILITY_POINTER; caps |= WL_SEAT_CAPABILITY_POINTER;
if (weston_seat_get_keyboard(seat)) if (weston_seat_get_keyboard(seat))
@ -3856,8 +3859,6 @@ bind_seat(struct wl_client *client, void *data, uint32_t version, uint32_t id)
caps |= WL_SEAT_CAPABILITY_TOUCH; caps |= WL_SEAT_CAPABILITY_TOUCH;
wl_seat_send_capabilities(resource, caps); wl_seat_send_capabilities(resource, caps);
if (version >= WL_SEAT_NAME_SINCE_VERSION)
wl_seat_send_name(resource, seat->seat_name);
} }
static void static void

View File

@ -94,6 +94,12 @@ noop_renderer_attach(struct weston_paint_node *pnode)
} }
shm_buffer = buffer->shm_buffer; shm_buffer = buffer->shm_buffer;
/* This can happen if a SHM wl_buffer gets destroyed before we attach,
* because wayland-server just nukes the wl_shm_buffer from underneath
* us. */
if (!shm_buffer)
return;
data = wl_shm_buffer_get_data(shm_buffer); data = wl_shm_buffer_get_data(shm_buffer);
stride = buffer->stride; stride = buffer->stride;
height = buffer->height; height = buffer->height;

View File

@ -495,6 +495,27 @@ static const struct pixel_format_info pixel_format_table[] = {
.hsub = 2, .hsub = 2,
.vsub = 2, .vsub = 2,
}, },
{
DRM_FORMAT(NV15),
SAMPLER_TYPE(EGL_TEXTURE_Y_UV_WL),
.num_planes = 2,
.hsub = 2,
.vsub = 2,
},
{
DRM_FORMAT(NV20),
SAMPLER_TYPE(EGL_TEXTURE_Y_UV_WL),
.num_planes = 2,
.hsub = 2,
.vsub = 1,
},
{
DRM_FORMAT(NV30),
SAMPLER_TYPE(EGL_TEXTURE_Y_UV_WL),
.num_planes = 2,
.hsub = 1,
.vsub = 1,
},
{ {
DRM_FORMAT(NV21), DRM_FORMAT(NV21),
SAMPLER_TYPE(EGL_TEXTURE_Y_UV_WL), SAMPLER_TYPE(EGL_TEXTURE_Y_UV_WL),

View File

@ -265,7 +265,7 @@ output_run(uint32_t *p, uint32_t delta, int run)
#if defined(HAVE_BUILTIN_CLZ) #if defined(HAVE_BUILTIN_CLZ)
i = 24 - __builtin_clz(run); i = 24 - __builtin_clz(run);
#else #else
for (i = 0, tmp = u >> 8; tmp; i++, tmp >>= 1); for (i = 0, tmp = run >> 8; tmp; i++, tmp >>= 1);
#endif #endif
*p++ = delta | ((i + 0xe0) << 24); *p++ = delta | ((i + 0xe0) << 24);
run -= 1 << (7 + i); run -= 1 << (7 + i);

View File

@ -1,6 +1,6 @@
project('weston', project('weston',
'c', 'c',
version: '14.0.0', version: '14.0.90',
default_options: [ default_options: [
'warning_level=3', 'warning_level=3',
'c_std=gnu99', 'c_std=gnu99',

View File

@ -556,6 +556,8 @@ theme_render_frame(struct theme *t,
if (flags & THEME_FRAME_MAXIMIZED) if (flags & THEME_FRAME_MAXIMIZED)
margin = 0; margin = 0;
else if (flags & THEME_FRAME_NO_SHADOW)
margin = t->margin;
else { else {
render_shadow(cr, t->shadow, render_shadow(cr, t->shadow,
2, 2, width + 8, height + 8, 2, 2, width + 8, height + 8,

View File

@ -76,7 +76,8 @@ theme_destroy(struct theme *t);
enum { enum {
THEME_FRAME_ACTIVE = 1, THEME_FRAME_ACTIVE = 1,
THEME_FRAME_MAXIMIZED = 2, THEME_FRAME_MAXIMIZED = 2,
THEME_FRAME_NO_TITLE = 4 THEME_FRAME_NO_TITLE = 4,
THEME_FRAME_NO_SHADOW = 8
}; };
void void
@ -122,7 +123,8 @@ enum frame_status {
enum frame_flag { enum frame_flag {
FRAME_FLAG_ACTIVE = 0x1, FRAME_FLAG_ACTIVE = 0x1,
FRAME_FLAG_MAXIMIZED = 0x2 FRAME_FLAG_MAXIMIZED = 0x2,
FRAME_FLAG_NO_SHADOW = 0x4
}; };
enum { enum {

View File

@ -1067,6 +1067,9 @@ frame_repaint(struct frame *frame, cairo_t *cr)
if (frame->flags & FRAME_FLAG_ACTIVE) if (frame->flags & FRAME_FLAG_ACTIVE)
flags |= THEME_FRAME_ACTIVE; flags |= THEME_FRAME_ACTIVE;
if (frame->flags & FRAME_FLAG_NO_SHADOW)
flags |= THEME_FRAME_NO_SHADOW;
cairo_save(cr); cairo_save(cr);
theme_render_frame(frame->theme, cr, frame->width, frame->height, theme_render_frame(frame->theme, cr, frame->width, frame->height,
frame->title, &frame->title_rect, frame->title, &frame->title_rect,

View File

@ -46,4 +46,21 @@
#define DRM_FORMAT_ABGR16161616 fourcc_code('A', 'B', '4', '8') /* [63:0] A:B:G:R 16:16:16:16 little endian */ #define DRM_FORMAT_ABGR16161616 fourcc_code('A', 'B', '4', '8') /* [63:0] A:B:G:R 16:16:16:16 little endian */
#endif #endif
/*
* 2 plane YCbCr
* index 0 = Y plane, [39:0] Y3:Y2:Y1:Y0 little endian
* index 1 = Cr:Cb plane, [39:0] Cr1:Cb1:Cr0:Cb0 little endian
*/
#ifndef DRM_FORMAT_NV15
#define DRM_FORMAT_NV15 fourcc_code('N', 'V', '1', '5') /* 2x2 subsampled Cr:Cb plane */
#endif
#ifndef DRM_FORMAT_NV20
#define DRM_FORMAT_NV20 fourcc_code('N', 'V', '2', '0') /* 2x1 subsampled Cr:Cb plane */
#endif
#ifndef DRM_FORMAT_NV30
#define DRM_FORMAT_NV30 fourcc_code('N', 'V', '3', '0') /* non-subsampled Cr:Cb plane */
#endif
#endif #endif

View File

@ -1,5 +1,5 @@
[wrap-git] [wrap-git]
directory = display-info directory = display-info
url = https://gitlab.freedesktop.org/emersion/libdisplay-info.git url = https://gitlab.freedesktop.org/emersion/libdisplay-info.git
revision = 0.1.1 revision = 0.2.0

View File

@ -74,7 +74,7 @@ lib_lcms_util = static_library(
[ 'lcms_util.c' ], [ 'lcms_util.c' ],
include_directories: common_inc, include_directories: common_inc,
dependencies: [ dependencies: [
dep_lcms2, dep_libm dep_lcms2, dep_libm, dep_wayland_server
], ],
build_by_default: false, build_by_default: false,
install: false, install: false,
@ -170,7 +170,6 @@ tests = [
{ 'name': 'drm-smoke', 'run_exclusive': true }, { 'name': 'drm-smoke', 'run_exclusive': true },
{ 'name': 'drm-writeback-screenshot', 'run_exclusive': true }, { 'name': 'drm-writeback-screenshot', 'run_exclusive': true },
{ 'name': 'event', }, { 'name': 'event', },
{ 'name': 'internal-screenshot', },
{ {
'name': 'keyboard', 'name': 'keyboard',
'sources': [ 'sources': [
@ -180,14 +179,6 @@ tests = [
input_timestamps_unstable_v1_protocol_c, input_timestamps_unstable_v1_protocol_c,
], ],
}, },
{
'name': 'kiosk-shell',
'sources': [
'kiosk-shell-test.c',
xdg_shell_client_protocol_h,
xdg_shell_protocol_c,
],
},
{ {
'name': 'linux-explicit-synchronization', 'name': 'linux-explicit-synchronization',
'sources': [ 'sources': [
@ -257,14 +248,6 @@ tests = [
{ 'name': 'subsurface-shot', }, { 'name': 'subsurface-shot', },
{ 'name': 'surface', }, { 'name': 'surface', },
{ 'name': 'surface-global', }, { 'name': 'surface-global', },
{
'name': 'text',
'sources': [
'text-test.c',
text_input_unstable_v1_client_protocol_h,
text_input_unstable_v1_protocol_c,
],
},
{ {
'name': 'touch', 'name': 'touch',
'sources': [ 'sources': [
@ -390,6 +373,20 @@ surface_screenshot_test = shared_library(
install: false, install: false,
) )
if get_option('shell-desktop')
tests += [
{ 'name': 'internal-screenshot', },
{
'name': 'text',
'sources': [
'text-test.c',
text_input_unstable_v1_client_protocol_h,
text_input_unstable_v1_protocol_c,
],
},
]
endif
if get_option('shell-ivi') if get_option('shell-ivi')
ivi_layout_test_plugin = shared_library( ivi_layout_test_plugin = shared_library(
'test-ivi-layout', 'test-ivi-layout',
@ -427,6 +424,19 @@ if get_option('shell-ivi')
] ]
endif endif
if get_option('shell-kiosk')
tests += [
{
'name': 'kiosk-shell',
'sources': [
'kiosk-shell-test.c',
xdg_shell_client_protocol_h,
xdg_shell_protocol_c,
],
},
]
endif
test_config_h = configuration_data() test_config_h = configuration_data()
test_config_h.set_quoted('WESTON_TEST_REFERENCE_PATH', meson.current_source_dir() + '/reference') test_config_h.set_quoted('WESTON_TEST_REFERENCE_PATH', meson.current_source_dir() + '/reference')
test_config_h.set_quoted('WESTON_MODULE_MAP', env_modmap) test_config_h.set_quoted('WESTON_MODULE_MAP', env_modmap)