Compare commits
24 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
10ecf60848 | ||
|
d30683341c | ||
|
1ee1b93bac | ||
|
fe35be5013 | ||
|
a3fd8f3c97 | ||
|
8fdc55c03f | ||
|
16dc3b2b7f | ||
|
80e47a7161 | ||
|
8b5bb588df | ||
|
a501acd291 | ||
|
9a536962a5 | ||
|
486d96a162 | ||
|
217fb30847 | ||
|
04f27f1be2 | ||
|
68bbc4cf51 | ||
|
f86ff8c07d | ||
|
fe64eee3ae | ||
|
312c8bea66 | ||
|
067e977fe1 | ||
|
0e451e8dc3 | ||
|
2e51def212 | ||
|
a266c5fff5 | ||
|
53419eb991 | ||
|
e026fd6540 |
@ -43,7 +43,7 @@
|
||||
variables:
|
||||
FDO_UPSTREAM_REPO: wayland/weston
|
||||
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:
|
||||
|
@ -134,10 +134,11 @@ rm -rf wayland-protocols
|
||||
# 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
|
||||
# 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
|
||||
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
|
||||
cd ..
|
||||
rm -rf drm
|
||||
|
578
clients/color.c
Normal file
578
clients/color.c
Normal 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;
|
||||
}
|
@ -269,6 +269,15 @@ demo_clients = [
|
||||
'basename': 'cliptest',
|
||||
'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',
|
||||
'add_sources': [
|
||||
|
@ -1474,15 +1474,10 @@ main(int argc, char **argv)
|
||||
create_surface(&window);
|
||||
|
||||
/* 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);
|
||||
|
||||
/* wait until xdg_surface::configure acks the new dimensions */
|
||||
if (window.wait_for_configure)
|
||||
continue;
|
||||
|
||||
init_gl(&window);
|
||||
}
|
||||
init_gl(&window);
|
||||
|
||||
display.cursor_surface =
|
||||
wl_compositor_create_surface(display.compositor);
|
||||
|
@ -4372,8 +4372,8 @@ undo_resize(struct window *window)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
window_schedule_resize(struct window *window, int width, int height)
|
||||
static void
|
||||
window_configure_resize(struct window *window, int width, int height)
|
||||
{
|
||||
/* We should probably get these numbers from the theme. */
|
||||
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->resize_needed = 1;
|
||||
}
|
||||
|
||||
void
|
||||
window_schedule_resize(struct window *window, int width, int height)
|
||||
{
|
||||
window_configure_resize(window, width, height);
|
||||
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. */
|
||||
int margin = window_get_shadow_margin(window);
|
||||
|
||||
window_schedule_resize(window,
|
||||
width + margin * 2,
|
||||
height + margin * 2);
|
||||
window_configure_resize(window,
|
||||
width + margin * 2,
|
||||
height + margin * 2);
|
||||
} else if (window->saved_allocation.width > 0 &&
|
||||
window->saved_allocation.height > 0) {
|
||||
window_schedule_resize(window,
|
||||
window->saved_allocation.width,
|
||||
window->saved_allocation.height);
|
||||
window_configure_resize(window,
|
||||
window->saved_allocation.width,
|
||||
window->saved_allocation.height);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4937,6 +4943,20 @@ window_set_locked_pointer_motion_handler(struct window *window,
|
||||
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
|
||||
window_set_title(struct window *window, const char *title)
|
||||
{
|
||||
|
@ -530,6 +530,12 @@ void
|
||||
window_set_locked_pointer_motion_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
|
||||
window_set_title(struct window *window, const char *title);
|
||||
|
||||
|
@ -2777,7 +2777,13 @@ background_committed(struct weston_surface *es,
|
||||
struct weston_coord_surface new_origin)
|
||||
{
|
||||
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))
|
||||
return;
|
||||
@ -2866,9 +2872,17 @@ panel_committed(struct weston_surface *es,
|
||||
struct weston_coord_surface new_origin)
|
||||
{
|
||||
struct shell_output *sh_output = es->committed_private;
|
||||
struct weston_output *output = sh_output->output;
|
||||
struct weston_coord_global pos = output->pos;
|
||||
struct desktop_shell *shell = sh_output->shell;
|
||||
struct weston_output *output;
|
||||
struct weston_coord_global pos;
|
||||
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))
|
||||
return;
|
||||
@ -2895,13 +2909,14 @@ panel_committed(struct weston_surface *es,
|
||||
weston_surface_map(es);
|
||||
assert(wl_list_empty(&es->views));
|
||||
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);
|
||||
pos = weston_coord_global_add(output->pos, sh_output->panel_offset);
|
||||
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
|
||||
@ -4466,6 +4481,12 @@ shell_reposition_view_on_output_change(struct weston_view *view)
|
||||
struct shell_surface *shsurf;
|
||||
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))
|
||||
return;
|
||||
|
||||
@ -4543,10 +4564,14 @@ shell_output_destroy(struct shell_output *shell_output)
|
||||
|
||||
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);
|
||||
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);
|
||||
shell_output->background_surface->committed_private = NULL;
|
||||
}
|
||||
wl_list_remove(&shell_output->destroy_listener.link);
|
||||
wl_list_remove(&shell_output->link);
|
||||
free(shell_output);
|
||||
|
@ -2217,8 +2217,6 @@ void
|
||||
weston_output_schedule_repaint_reset(struct weston_output *output);
|
||||
void
|
||||
weston_output_schedule_repaint_restart(struct weston_output *output);
|
||||
enum weston_compositor_backend
|
||||
weston_get_backend_type(struct weston_backend *backend);
|
||||
void
|
||||
weston_compositor_schedule_repaint(struct weston_compositor *compositor);
|
||||
void
|
||||
@ -2475,6 +2473,8 @@ struct weston_backend *
|
||||
weston_compositor_load_backend(struct weston_compositor *compositor,
|
||||
enum weston_compositor_backend backend,
|
||||
struct weston_backend_config *config_base);
|
||||
enum weston_compositor_backend
|
||||
weston_get_backend_type(struct weston_backend *backend);
|
||||
void
|
||||
weston_compositor_exit(struct weston_compositor *ec);
|
||||
void *
|
||||
|
@ -209,7 +209,7 @@ weston_coord_surface_sub(struct weston_coord_surface a,
|
||||
static inline struct weston_coord __attribute__ ((warn_unused_result))
|
||||
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))
|
||||
|
@ -349,9 +349,9 @@ validate_icc_profile(struct lcmsProfilePtr profile, char **errmsg)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (class_sig != cmsSigDisplayClass) {
|
||||
str_printf(errmsg, "ICC profile is required to be of Display device class, "
|
||||
"but it is %s class (0x%08x)",
|
||||
if (class_sig != cmsSigDisplayClass && class_sig != cmsSigColorSpaceClass) {
|
||||
str_printf(errmsg, "ICC profile is required to be of Display or "
|
||||
"ColorSpace device class, but it is %s class (0x%08x)",
|
||||
icc_profile_class_name(class_sig), (unsigned)class_sig);
|
||||
return false;
|
||||
}
|
||||
|
@ -781,8 +781,16 @@ weston_desktop_xdg_toplevel_resource_destroy(struct wl_resource *resource)
|
||||
struct weston_desktop_surface *dsurface =
|
||||
wl_resource_get_user_data(resource);
|
||||
|
||||
if (dsurface != NULL)
|
||||
weston_desktop_surface_resource_destroy(resource);
|
||||
if (dsurface) {
|
||||
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 = {
|
||||
@ -1072,12 +1080,20 @@ weston_desktop_xdg_surface_protocol_get_toplevel(struct wl_client *wl_client,
|
||||
struct wl_resource *resource,
|
||||
uint32_t id)
|
||||
{
|
||||
struct weston_desktop_surface *dsurface =
|
||||
wl_resource_get_user_data(resource);
|
||||
struct weston_surface *wsurface =
|
||||
weston_desktop_surface_get_surface(dsurface);
|
||||
struct weston_desktop_xdg_toplevel *toplevel =
|
||||
weston_desktop_surface_get_implementation_data(dsurface);
|
||||
struct weston_desktop_surface *dsurface = NULL;
|
||||
struct weston_surface *wsurface = NULL;
|
||||
struct weston_desktop_xdg_toplevel *toplevel = NULL;
|
||||
|
||||
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);
|
||||
toplevel = weston_desktop_surface_get_implementation_data(dsurface);
|
||||
|
||||
if (weston_surface_set_role(wsurface, weston_desktop_xdg_toplevel_role,
|
||||
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 *positioner_resource)
|
||||
{
|
||||
struct weston_desktop_surface *dsurface =
|
||||
wl_resource_get_user_data(resource);
|
||||
struct weston_surface *wsurface =
|
||||
weston_desktop_surface_get_surface(dsurface);
|
||||
struct weston_desktop_xdg_popup *popup =
|
||||
weston_desktop_surface_get_implementation_data(dsurface);
|
||||
struct weston_desktop_surface *dsurface = NULL;
|
||||
struct weston_surface *wsurface = NULL;
|
||||
struct weston_desktop_xdg_popup *popup = NULL;
|
||||
struct weston_desktop_surface *parent_surface =
|
||||
wl_resource_get_user_data(parent_resource);
|
||||
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);
|
||||
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
|
||||
* is enough to verify both have been correctly set */
|
||||
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 =
|
||||
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 =
|
||||
weston_desktop_surface_get_implementation_data(dsurface);
|
||||
struct weston_desktop_xdg_surface_configure *configure, *temp;
|
||||
|
@ -887,8 +887,17 @@ weston_desktop_xdg_toplevel_resource_destroy(struct wl_resource *resource)
|
||||
struct weston_desktop_surface *dsurface =
|
||||
wl_resource_get_user_data(resource);
|
||||
|
||||
if (dsurface != NULL)
|
||||
weston_desktop_surface_resource_destroy(resource);
|
||||
if (dsurface) {
|
||||
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 = {
|
||||
@ -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_desktop_seat *seat = weston_desktop_seat_from_seat(wseat);
|
||||
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 */
|
||||
if (wseat != NULL && seat == NULL) {
|
||||
@ -937,18 +944,8 @@ weston_desktop_xdg_popup_protocol_grab(struct wl_client *wl_client,
|
||||
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);
|
||||
if ((topmost == NULL && !parent_is_toplevel) ||
|
||||
(topmost != NULL && topmost != popup->parent->desktop_surface)) {
|
||||
if (topmost != NULL && topmost != popup->parent->desktop_surface) {
|
||||
struct weston_desktop_client *client =
|
||||
weston_desktop_surface_get_client(dsurface);
|
||||
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,
|
||||
uint32_t id)
|
||||
{
|
||||
struct weston_desktop_surface *dsurface =
|
||||
wl_resource_get_user_data(resource);
|
||||
struct weston_surface *wsurface =
|
||||
weston_desktop_surface_get_surface(dsurface);
|
||||
struct weston_desktop_xdg_toplevel *toplevel =
|
||||
weston_desktop_surface_get_implementation_data(dsurface);
|
||||
struct weston_desktop *desktop = toplevel->base.desktop;
|
||||
struct weston_desktop_surface *dsurface = NULL;
|
||||
struct weston_surface *wsurface = NULL;
|
||||
struct weston_desktop_xdg_toplevel *toplevel = NULL;
|
||||
struct weston_desktop *desktop = NULL;
|
||||
|
||||
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);
|
||||
toplevel = weston_desktop_surface_get_implementation_data(dsurface);
|
||||
desktop = toplevel->base.desktop;
|
||||
|
||||
if (weston_surface_set_role(wsurface, weston_desktop_xdg_toplevel_role,
|
||||
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 *positioner_resource)
|
||||
{
|
||||
struct weston_desktop_surface *dsurface =
|
||||
wl_resource_get_user_data(resource);
|
||||
struct weston_surface *wsurface =
|
||||
weston_desktop_surface_get_surface(dsurface);
|
||||
struct weston_desktop_xdg_popup *popup =
|
||||
weston_desktop_surface_get_implementation_data(dsurface);
|
||||
struct weston_desktop_surface *dsurface = NULL;
|
||||
struct weston_surface *wsurface = NULL;
|
||||
struct weston_desktop_xdg_popup *popup = NULL;
|
||||
struct weston_desktop_surface *parent_surface;
|
||||
struct weston_desktop_xdg_surface *parent;
|
||||
struct weston_desktop_xdg_positioner *positioner =
|
||||
wl_resource_get_user_data(positioner_resource);
|
||||
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
|
||||
* specified 'using some other protocol' before committing. Since we
|
||||
* 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 =
|
||||
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 =
|
||||
weston_desktop_surface_get_implementation_data(dsurface);
|
||||
struct weston_desktop_xdg_surface_configure *configure, *temp;
|
||||
|
@ -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,
|
||||
unbind_resource);
|
||||
|
||||
if (version >= WL_SEAT_NAME_SINCE_VERSION)
|
||||
wl_seat_send_name(resource, seat->seat_name);
|
||||
|
||||
if (weston_seat_get_pointer(seat))
|
||||
caps |= WL_SEAT_CAPABILITY_POINTER;
|
||||
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;
|
||||
|
||||
wl_seat_send_capabilities(resource, caps);
|
||||
if (version >= WL_SEAT_NAME_SINCE_VERSION)
|
||||
wl_seat_send_name(resource, seat->seat_name);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -94,6 +94,12 @@ noop_renderer_attach(struct weston_paint_node *pnode)
|
||||
}
|
||||
|
||||
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);
|
||||
stride = buffer->stride;
|
||||
height = buffer->height;
|
||||
|
@ -495,6 +495,27 @@ static const struct pixel_format_info pixel_format_table[] = {
|
||||
.hsub = 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),
|
||||
SAMPLER_TYPE(EGL_TEXTURE_Y_UV_WL),
|
||||
|
@ -265,7 +265,7 @@ output_run(uint32_t *p, uint32_t delta, int run)
|
||||
#if defined(HAVE_BUILTIN_CLZ)
|
||||
i = 24 - __builtin_clz(run);
|
||||
#else
|
||||
for (i = 0, tmp = u >> 8; tmp; i++, tmp >>= 1);
|
||||
for (i = 0, tmp = run >> 8; tmp; i++, tmp >>= 1);
|
||||
#endif
|
||||
*p++ = delta | ((i + 0xe0) << 24);
|
||||
run -= 1 << (7 + i);
|
||||
|
@ -1,6 +1,6 @@
|
||||
project('weston',
|
||||
'c',
|
||||
version: '14.0.0',
|
||||
version: '14.0.90',
|
||||
default_options: [
|
||||
'warning_level=3',
|
||||
'c_std=gnu99',
|
||||
|
@ -556,6 +556,8 @@ theme_render_frame(struct theme *t,
|
||||
|
||||
if (flags & THEME_FRAME_MAXIMIZED)
|
||||
margin = 0;
|
||||
else if (flags & THEME_FRAME_NO_SHADOW)
|
||||
margin = t->margin;
|
||||
else {
|
||||
render_shadow(cr, t->shadow,
|
||||
2, 2, width + 8, height + 8,
|
||||
|
@ -76,7 +76,8 @@ theme_destroy(struct theme *t);
|
||||
enum {
|
||||
THEME_FRAME_ACTIVE = 1,
|
||||
THEME_FRAME_MAXIMIZED = 2,
|
||||
THEME_FRAME_NO_TITLE = 4
|
||||
THEME_FRAME_NO_TITLE = 4,
|
||||
THEME_FRAME_NO_SHADOW = 8
|
||||
};
|
||||
|
||||
void
|
||||
@ -122,7 +123,8 @@ enum frame_status {
|
||||
|
||||
enum frame_flag {
|
||||
FRAME_FLAG_ACTIVE = 0x1,
|
||||
FRAME_FLAG_MAXIMIZED = 0x2
|
||||
FRAME_FLAG_MAXIMIZED = 0x2,
|
||||
FRAME_FLAG_NO_SHADOW = 0x4
|
||||
};
|
||||
|
||||
enum {
|
||||
|
@ -1067,6 +1067,9 @@ frame_repaint(struct frame *frame, cairo_t *cr)
|
||||
if (frame->flags & FRAME_FLAG_ACTIVE)
|
||||
flags |= THEME_FRAME_ACTIVE;
|
||||
|
||||
if (frame->flags & FRAME_FLAG_NO_SHADOW)
|
||||
flags |= THEME_FRAME_NO_SHADOW;
|
||||
|
||||
cairo_save(cr);
|
||||
theme_render_frame(frame->theme, cr, frame->width, frame->height,
|
||||
frame->title, &frame->title_rect,
|
||||
|
@ -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 */
|
||||
#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
|
||||
|
@ -1,5 +1,5 @@
|
||||
[wrap-git]
|
||||
directory = display-info
|
||||
url = https://gitlab.freedesktop.org/emersion/libdisplay-info.git
|
||||
revision = 0.1.1
|
||||
revision = 0.2.0
|
||||
|
||||
|
@ -74,7 +74,7 @@ lib_lcms_util = static_library(
|
||||
[ 'lcms_util.c' ],
|
||||
include_directories: common_inc,
|
||||
dependencies: [
|
||||
dep_lcms2, dep_libm
|
||||
dep_lcms2, dep_libm, dep_wayland_server
|
||||
],
|
||||
build_by_default: false,
|
||||
install: false,
|
||||
@ -170,7 +170,6 @@ tests = [
|
||||
{ 'name': 'drm-smoke', 'run_exclusive': true },
|
||||
{ 'name': 'drm-writeback-screenshot', 'run_exclusive': true },
|
||||
{ 'name': 'event', },
|
||||
{ 'name': 'internal-screenshot', },
|
||||
{
|
||||
'name': 'keyboard',
|
||||
'sources': [
|
||||
@ -180,14 +179,6 @@ tests = [
|
||||
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',
|
||||
'sources': [
|
||||
@ -257,14 +248,6 @@ tests = [
|
||||
{ 'name': 'subsurface-shot', },
|
||||
{ 'name': 'surface', },
|
||||
{ 'name': 'surface-global', },
|
||||
{
|
||||
'name': 'text',
|
||||
'sources': [
|
||||
'text-test.c',
|
||||
text_input_unstable_v1_client_protocol_h,
|
||||
text_input_unstable_v1_protocol_c,
|
||||
],
|
||||
},
|
||||
{
|
||||
'name': 'touch',
|
||||
'sources': [
|
||||
@ -390,6 +373,20 @@ surface_screenshot_test = shared_library(
|
||||
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')
|
||||
ivi_layout_test_plugin = shared_library(
|
||||
'test-ivi-layout',
|
||||
@ -427,6 +424,19 @@ if get_option('shell-ivi')
|
||||
]
|
||||
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.set_quoted('WESTON_TEST_REFERENCE_PATH', meson.current_source_dir() + '/reference')
|
||||
test_config_h.set_quoted('WESTON_MODULE_MAP', env_modmap)
|
||||
|
Loading…
Reference in New Issue
Block a user